UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

115 lines 2.51 kB
/** * Supplementary structure to `Graph`, holds edges and neighbour nodes for fast access * Used internally by `Graph` * @template N */ export class NodeContainer<N> { /** * Node being described * @type {N} */ node: N; /** * Attached edges * @type {Edge<N>[]} * @private */ private __edges; /** * * @type {Map<N,number>} * Maps neighbour node to number of edges to that node from this one * @private */ private __neighbors; /** * NOTE: this method allocates memory internally * @returns {N[]} */ get neighbours(): N[]; /** * * @return {number} */ getEdgeCount(): number; /** * Do not modify the returned value * @return {Edge<N>[]} */ getEdges(): Edge<N>[]; /** * NOTE: this method allocates memory internally * @returns {N[]} */ get inNodes(): N[]; /** * NOTE: this method allocates memory internally * @returns {N[]} */ get outNodes(): N[]; /** * NOTE: this method allocates memory internally * @returns {Edge<N>[]} */ get outEdges(): Edge<N>[]; /** * NOTE: this method allocates memory internally * @returns {Edge<N>[]} */ get inEdges(): Edge<N>[]; /** * * @param {Edge<N>[]} result * @returns {number} */ getIncomingEdges(result: Edge<N>[]): number; /** * * @param {Edge<N>[]} result * @returns {number} */ getOutgoingEdges(result: Edge<N>[]): number; /** * * @return {number} */ getIncomingEdgeCount(): number; /** * * @param {N} other * @returns {boolean} */ edgeWithNodeExists(other: N): boolean; /** * * @param {function(Edge<N>)} visitor * @param {*} [thisArg] * @returns {number} */ traverseEdges(visitor: (arg0: Edge<N>) => any, thisArg?: any): number; /** * * @param {N} other * @returns {Edge<N>|undefined} */ getAnyEdgeWith(other: N): Edge<N> | undefined; /** * Undirected edges don't count * @param {N} other * @returns {Edge<N>|undefined} */ getAnyDirectionEdgeTo(other: N): Edge<N> | undefined; /** * * @param {Edge} e * @returns {boolean} */ addEdge(e: Edge): boolean; /** * * @param {Edge} e * @returns {boolean} */ removeEdge(e: Edge): boolean; } //# sourceMappingURL=NodeContainer.d.ts.map