@gpa-gemstone/react-graph
Version:
Interactive UI Components for GPA products
128 lines (127 loc) • 4.96 kB
TypeScript
/**
*
* Node in a tree.
*/
export declare class PointNode {
minT: number;
maxT: number;
minV: number[];
maxV: number[];
sum: number[];
count: number;
dim: number;
maxCount: number;
private children;
private points;
constructor(data?: number[][], maxTotalPoints?: number);
static createNodeWithDesiredTreeSize(data: number[], desiredTreeSize: number): PointNode;
static CreateCopy(oldNode: PointNode): PointNode;
/**
* Initializes the node with the provided data points.
* Handles setting points or splitting into children based on the MaxPoints threshold.
* @param data An array of points to initialize the node with.
*/
private initializeNode;
/**
* Adds one set of points to the tree.
*
* @param newPoints points to add, one array of size dim
*/
AddPoint(newPoints: number[]): void;
/**
* Adds one set of points to the tree.
*
* @param newPoints points to add, one array of size dim
* @returns Success of add operation
*/
private TryAddPoints;
/**
* Splits the given data points into child nodes based on the MaxPoints threshold.
* @param data An array of sorted points to split into child nodes.
*/
private static splitPoints;
private removeLeftMostPoint;
/**
* Updates the statistical properties of the node based on its current points or children.
*/
private RecalculateStats;
/**
* Updates statistics based on the current points.
*/
private CalculatePointStats;
/**
* Updates statistics based on the current children.
*/
private AggregateChildStats;
/**
* Updates aggregated statistics for this node to include a newly added child node.
*
* @param {PointNode} newChild - The new child node whose statistics will be merged into this node.
*/
private IncrementStatsForNewChild;
/**
* Updates aggregated statistics for this node to include a newly added point.
*
* @param {number[]} newPt - The new point
*/
private IncrementStatsForNewPoint;
/**
* Retrieves data points within a specified time range.
* @param Tstart Start time of the timerange to be looked at.
* @param Tend End time of the timerange to be looked at.
* @param IncludeEdges Optional parameter to include edge points.
* @returns An array of points within the specified time range.
*/
GetData(Tstart: number, Tend: number, IncludeEdges?: boolean): number[][];
/**
* Retrieves all data points stored in the PointNode tree.
* @returns An array of all points in the tre.
*/
GetFullData(): number[][];
/**
* Retrieves the count of data points within a specified time range.
* @param Tstart Start time of the timerange to be looked at.
* @param Tend End time of the timerange to be looked at.
* @returns The number of points within the specified time range.
*/
GetCount(Tstart: number, Tend: number): number;
/**
* Get Limits for all dimensions
* @param Tstart start time of the timerange to be looked at
* @param Tend end time of the timerange to be looked at
* @returns The min and max value of the data in the given timerange
*/
GetAllLimits(Tstart: number, Tend: number): [number, number][];
/**
* Retrieves the limits of the data in the given timerange
* @param Tstart start time of the timerange to be looked at
* @param Tend end time of the timerange to be looked at
* @param dimension dimension of the data to be retrieved (x,y,z) to get y use 0
* @returns The min and max value of the data in the given timerange
*/
GetLimits(Tstart: number, Tend: number, dimension?: number): [number, number];
/**
* Retrieves a point from the PointNode tree
* @param {number} tVal - The time value of the point to retrieve from the tree.
*/
GetPoint(tVal: number): number[];
/**
* Retrieves a specified number of points from the PointNode tree, centered around a point
* @param {number} tVal - The time value of the center point of the point retrieval.
* @param {number} pointsRetrieved - The number of points to retrieve
*/
GetPoints(tVal: number, pointsRetrieved?: number): number[][];
/**
* Implements a binary search to locate points within the PointNode tree or across neighboring nodes based on the timestamp.
* @param tVal The time value to search for.
* @param pointsRetrieved The number of points to retrieve.
* @param nodeLowerNeighbor Optional lower neighboring node for spillover.
* @param nodeUpperNeighbor Optional upper neighboring node for spillover.
* @returns An array of points matching the search criteria.
*/
private PointBinarySearch;
/**
* Returns the size of the Tree below this PointNode
*/
GetTreeSize(): number;
}