From 4f3550010afe786b638ae63d433ddfa9528c955b Mon Sep 17 00:00:00 2001
From: Michal Miszczyszyn
Date: Tue, 17 Nov 2015 20:06:22 +0100
Subject: [PATCH 001/212] jquery: Fix noConflict return type. Fix #5840
---
jquery/jquery.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts
index 29b7697b2..9f75f9a9d 100644
--- a/jquery/jquery.d.ts
+++ b/jquery/jquery.d.ts
@@ -795,7 +795,7 @@ interface JQueryStatic {
*
* @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
*/
- noConflict(removeAll?: boolean): Object;
+ noConflict(removeAll?: boolean): JQueryStatic;
/**
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
From f4b4073a444a5f90c36dddcc99efdd7e23efddca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jesper=20R=C3=B8nn-Jensen?=
Date: Thu, 19 Nov 2015 00:51:06 +0100
Subject: [PATCH 002/212] Add typings to mathjs MathNode class
Furthermore removed all trailing whitespace
---
mathjs/mathjs-tests.ts | 222 ++++++----
mathjs/mathjs.d.ts | 939 ++++++++++++++++++++++-------------------
2 files changed, 644 insertions(+), 517 deletions(-)
diff --git a/mathjs/mathjs-tests.ts b/mathjs/mathjs-tests.ts
index 78c9ed941..1691e03c2 100644
--- a/mathjs/mathjs-tests.ts
+++ b/mathjs/mathjs-tests.ts
@@ -11,20 +11,20 @@ Basic usage examples
math.log(10000, 10); // 4
math.sqrt(-4); // 2i
math.pow([[-1, 2], [3, 1]], 2); // [[7, 0], [0, 7]]
-
+
// expressions
math.eval('1.2 * (2 + 4.5)'); // 7.8
math.eval('5.08 cm to inch'); // 2 inch
math.eval('sin(45 deg) ^ 2'); // 0.5
math.eval('9 / 3 + 2i'); // 3 + 2i
math.eval('det([-1, 2; 3, 1])'); // -7
-
+
// chained operations
var a = math.chain(3)
.add(4)
.multiply(2)
.done(); // 14
-
+
// mixed use of different data types in functions
console.log('mixed use of data types');
math.add(4, [5, 6]); // number + Array, [9, 10]
@@ -44,22 +44,22 @@ Bignumbers examples
// 'number' (default), 'bignumber', or 'fraction'
precision: 20 // Number of significant digits for BigNumbers
});
-
+
console.log('round-off errors with numbers');
math.add(0.1, 0.2); // number, 0.30000000000000004
math.divide(0.3, 0.2); // number, 1.4999999999999998
console.log();
-
+
console.log('no round-off errors with BigNumbers');
math.add(math.bignumber(0.1), math.bignumber(0.2)); // BigNumber, 0.3
math.divide(math.bignumber(0.3), math.bignumber(0.2)); // BigNumber, 1.5
console.log();
-
+
console.log('create BigNumbers from strings when exceeding the range of a number');
math.bignumber(1.2e+500); // BigNumber, Infinity WRONG
math.bignumber('1.2e+500'); // BigNumber, 1.2e+500
console.log();
-
+
// one can work conveniently with BigNumbers using the expression parser.
// note though that BigNumbers are only supported in arithmetic functions
console.log('use BigNumbers in the expression parser');
@@ -80,33 +80,33 @@ Chaining examples
.add(4)
.multiply(2)
.done(); // 14
-
+
// Another example, calculate square(sin(pi / 4))
var b = math.chain(math.pi)
.divide(4)
.sin()
.square()
.done(); // 0.5
-
+
// A chain has a few special methods: done, toString, valueOf, get, and set.
// these are demonstrated in the following examples
-
+
// toString will return a string representation of the chain's value
var chain = math.chain(2).divide(3);
var str = chain.toString(); // "0.6666666666666666"
-
+
// a chain has a function .valueOf(), which returns the value hold by the chain.
// This allows using it in regular operations. The function valueOf() acts the
// same as function done().
chain.valueOf(); // 0.66666666666667
-
-
+
+
// the function subset can be used to get or replace sub matrices
var array = [[1, 2], [3, 4]];
var v = math.chain(array)
.subset(math.index(1, 0))
.done(); // 3
-
+
var m = math.chain(array)
.subset(math.index(0, 0), 8)
.multiply(3)
@@ -119,38 +119,38 @@ Complex numbers examples
*/
(function(){
var a = math.complex(2, 3); // 2 + 3i
-
+
// read the real and complex parts of the complex number
a.re; // 2
a.im; // 3
-
+
// clone a complex value
var clone = a.clone(); // 2 + 3i
-
+
// adjust the complex value
a.re = 5; // 5 + 3i
-
+
// create a complex number by providing a string with real and complex parts
var b = math.complex('3 - 7i'); // 3 - 7i
console.log();
-
+
// perform operations with complex numbers
console.log('perform operations');
math.add(a, b); // 8 - 4i
math.multiply(a, b); // 36 - 26i
math.sin(a); // -9.6541254768548 + 2.8416922956064i
-
+
// some operations will return a complex number depending on the arguments
math.sqrt(4); // 2
math.sqrt(-4); // 2i
-
+
// create a complex number from polar coordinates
console.log('create complex numbers with polar coordinates');
var c = math.complex({r: math.sqrt(2), phi: math.pi / 4}); // 1 + i
-
+
// get polar coordinates of a complex number
var d = math.complex(3, 4);
- d.toPolar(); // { r: 5, phi: 0.9272952180016122 }
+ d.toPolar(); // { r: 5, phi: 0.9272952180016122 }
}());
@@ -166,14 +166,14 @@ Expressions examples
// JavaScript Object. The scope will be used to resolve symbols, and to write
// assigned variables or function.
console.log('1. USING FUNCTION MATH.EVAL');
-
+
// evaluate expressions
console.log('\nevaluate expressions');
math.eval('sqrt(3^2 + 4^2)'); // 5
math.eval('sqrt(-4)'); // 2i
math.eval('2 inch to cm'); // 5.08 cm
math.eval('cos(45 deg)'); // 0.70711
-
+
// evaluate multiple expressions at once
console.log('\nevaluate multiple expressions at once');
math.eval([
@@ -181,34 +181,34 @@ Expressions examples
'g = 4',
'f * g'
]); // [3, 4, 12]
-
+
// provide a scope (just a regular JavaScript Object)
console.log('\nevaluate expressions providing a scope with variables and functions');
var scope: any = {
a: 3,
b: 4
};
-
+
// variables can be read from the scope
math.eval('a * b', scope); // 12
-
+
// variable assignments are written to the scope
math.eval('c = 2.3 + 4.5', scope); // 6.8
scope.c; // 6.8
-
+
// scope can contain both variables and functions
scope["hello"] = function (name: string) {
return 'hello, ' + name + '!';
};
math.eval('hello("hero")', scope); // "hello, hero!"
-
+
// define a function as an expression
var f = math.eval('f(x) = x ^ a', scope);
f(2); // 8
scope.f(2); // 8
-
-
-
+
+
+
// 2. using function math.parse
//
// Function `math.parse` parses expressions into a node tree. The syntax is
@@ -219,16 +219,16 @@ Expressions examples
// scope. This scope is a regular JavaScript Object. The scope will be used
// to resolve symbols, and to write assigned variables or function.
console.log('\n2. USING FUNCTION MATH.PARSE');
-
+
// parse an expression
console.log('\nparse an expression into a node tree');
var node1 = math.parse('sqrt(3^2 + 4^2)');
node1.toString(); // "sqrt((3 ^ 2) + (4 ^ 2))"
-
+
// compile and evaluate the compiled code
// you could also do this in two steps: node1.compile().eval()
node1.eval(); // 5
-
+
// provide a scope
console.log('\nprovide a scope');
var node2 = math.parse('x^a');
@@ -239,12 +239,12 @@ Expressions examples
a: 2
};
code2.eval(scope); // 9
-
+
// change a value in the scope and re-evaluate the node
scope.a = 3;
code2.eval(scope); // 27
-
-
+
+
// 3. using function math.compile
//
// Function `math.compile` compiles expressions into a node tree. The syntax is
@@ -255,14 +255,14 @@ Expressions examples
// be provided. This scope will be used to resolve symbols, and to write
// assigned variables or function.
console.log('\n3. USING FUNCTION MATH.COMPILE');
-
+
// parse an expression
console.log('\ncompile an expression');
var code3 = math.compile('sqrt(3^2 + 4^2)');
-
+
// evaluate the compiled code
code3.eval(); // 5
-
+
// provide a scope for the variable assignment
console.log('\nprovide a scope');
var code2 = math.compile('a = a + 3');
@@ -271,8 +271,8 @@ Expressions examples
};
code2.eval(scope);
scope.a; // 10
-
-
+
+
// 4. using a parser
//
// In addition to the static functions `math.eval` and `math.parse`, math.js
@@ -281,21 +281,21 @@ Expressions examples
// some convenience methods to get, set, and remove variables from memory.
console.log('\n4. USING A PARSER');
var parser = math.parser();
-
+
// evaluate with parser
console.log('\nevaluate expressions');
parser.eval('sqrt(3^2 + 4^2)'); // 5
parser.eval('sqrt(-4)'); // 2i
parser.eval('2 inch to cm'); // 5.08 cm
parser.eval('cos(45 deg)'); // 0.70711
-
+
// define variables and functions
console.log('\ndefine variables and functions');
parser.eval('x = 7 / 2'); // 3.5
parser.eval('x + 3'); // 6.5
parser.eval('f(x, y) = x^y'); // f(x, y)
parser.eval('f(2, 3)'); // 8
-
+
// manipulate matrices
// Note that matrix indexes in the expression parser are one-based with the
// upper-bound included. On a JavaScript level however, math.js uses zero-based
@@ -308,7 +308,7 @@ Expressions examples
parser.eval('m = k * l'); // [[19, 22], [43, 50]]
parser.eval('n = m[2, 1]'); // 43
parser.eval('n = m[:, 1]'); // [[19], [43]]
-
+
// get and set variables and functions
console.log('\nget and set variables and function in the scope of the parser');
var x = parser.get('x');
@@ -317,14 +317,14 @@ Expressions examples
console.log('f =', math.format(f)); // f = f(x, y)
var g = f(3, 3);
console.log('g =', g); // g = 27
-
+
parser.set('h', 500);
parser.eval('h / 2'); // 250
parser.set('hello', function (name: string) {
return 'hello, ' + name + '!';
});
parser.eval('hello("hero")'); // "hello, hero!"
-
+
// clear defined functions and variables
parser.clear();
}());
@@ -339,7 +339,7 @@ Fractions examples
number: 'fraction' // Default type of number:
// 'number' (default), 'bignumber', or 'fraction'
});
-
+
console.log('basic usage');
math.fraction(0.125); // Fraction, 1/8
math.fraction(0.32); // Fraction, 8/25
@@ -348,23 +348,23 @@ Fractions examples
math.fraction(2, 3); // Fraction, 2/3
math.fraction('0.(285714)'); // Fraction, 2/7
console.log();
-
+
console.log('round-off errors with numbers');
math.add(0.1, 0.2); // number, 0.30000000000000004
math.divide(0.3, 0.2); // number, 1.4999999999999998
console.log();
-
+
console.log('no round-off errors with fractions :)');
math.add(math.fraction(0.1), math.fraction(0.2)); // Fraction, 3/10
math.divide(math.fraction(0.3), math.fraction(0.2)); // Fraction, 3/2
console.log();
-
+
console.log('represent an infinite number of repeating digits');
math.fraction('1/3'); // Fraction, 0.(3)
math.fraction('2/7'); // Fraction, 0.(285714)
math.fraction('23/11'); // Fraction, 2.(09)
console.log();
-
+
// one can work conveniently with fractions using the expression parser.
// note though that Fractions are only supported by basic arithmetic functions
console.log('use fractions in the expression parser');
@@ -372,7 +372,7 @@ Fractions examples
math.eval('0.3 / 0.2'); // Fraction, 3/2
math.eval('23 / 11'); // Fraction, 23/11
console.log();
-
+
// output formatting
console.log('output formatting of fractions');
var a = math.fraction('2/3');
@@ -380,7 +380,7 @@ Fractions examples
console.log(math.format(a, {fraction: 'ratio'})); // Fraction, 2/3
console.log(math.format(a, {fraction: 'decimal'})); // Fraction, 0.(6)
console.log(a.toString()); // Fraction, 0.(6)
- console.log();
+ console.log();
}());
/*
@@ -393,33 +393,33 @@ Matrices examples
var a = math.matrix([1, 4, 9, 16, 25]); // [1, 4, 9, 16, 25]
var b = math.matrix(math.ones([2, 3])); // [[1, 1, 1], [1, 1, 1]]
b.size(); // [2, 3]
-
+
// the Array data of a Matrix can be retrieved using valueOf()
var array = a.valueOf(); // [1, 4, 9, 16, 25]
-
+
// Matrices can be cloned
var clone = a.clone(); // [1, 4, 9, 16, 25]
console.log();
-
+
// perform operations with matrices
console.log('perform operations');
math.sqrt(a); // [1, 2, 3, 4, 5]
var c = [1, 2, 3, 4, 5];
math.factorial(c); // [1, 2, 6, 24, 120]
console.log();
-
+
// create and manipulate matrices. Arrays and Matrices can be used mixed.
console.log('manipulate matrices');
var d = [[1, 2], [3, 4]]; // [[1, 2], [3, 4]]
var e = math.matrix([[5, 6], [1, 1]]); // [[5, 6], [1, 1]]
-
+
// set a submatrix.
// Matrix indexes are zero-based.
e.subset(math.index(1, [0, 1]), [[7, 8]]); // [[5, 6], [7, 8]]
var f = math.multiply(d, e); // [[19, 22], [43, 50]]
var g = f.subset(math.index(1, 0)); // 43
console.log();
-
+
// get a sub matrix
// Matrix indexes are zero-based.
console.log('get a sub matrix');
@@ -428,8 +428,8 @@ Matrices examples
var i = math.range(1,6); // [1, 2, 3, 4, 5]
i.subset(math.index(math.range(1,4))); // [2, 3, 4]
console.log();
-
-
+
+
// resize a multi dimensional matrix
console.log('resizing a matrix');
var j = math.matrix();
@@ -439,20 +439,20 @@ Matrices examples
j.resize([2, 2]); // [[0, 0], [0, 0]]
j.size(); // [2, 2]
console.log();
-
+
// setting a value outside the matrices range will resize the matrix.
// new elements will be initialized with zero.
console.log('set a value outside a matrices range');
var k = math.matrix();
k.subset(math.index(2), 6); // [0, 0, 6]
console.log();
-
+
console.log('set a value outside a matrices range, leaving new entries uninitialized');
var m = math.matrix();
defaultValue = math.uninitialized;
m.subset(math.index(2), 6, defaultValue); // [undefined, undefined, 6]
console.log();
-
+
// create ranges
console.log('create ranges');
math.range(1, 6); // [1, 2, 3, 4, 5]
@@ -469,14 +469,14 @@ Sparse matrices examples
// create a sparse matrix
console.log('creating a 1000x1000 sparse matrix...');
var a = math.eye(1000, 1000, 'sparse');
-
+
// do operations with a sparse matrix
console.log('doing some operations on the sparse matrix...');
var b = math.multiply(a, a);
var c = math.multiply(b, math.complex(2, 2));
var d = math.transpose(c);
var e = math.multiply(d, a);
-
+
// we will not print the output, but doing the same operations
// with a dense matrix are very slow, try it for yourself.
console.log('already done');
@@ -493,7 +493,7 @@ Units examples
var a = math.unit(45, 'cm'); // 450 mm
var b = math.unit('0.1m'); // 100 mm
console.log();
-
+
// units can be added, subtracted, and multiplied or divided by numbers and by other units
console.log('perform operations');
math.add(a, b); // 0.55 m
@@ -501,7 +501,7 @@ Units examples
math.divide(math.unit('1 m'), math.unit('1 s')); // 1 m / s
math.pow(math.unit('12 in'), 3); // 1728 in^3
console.log();
-
+
// units can be converted to a specific type, or to a number
console.log('convert to another type or to a number');
b.to('cm'); // 10 cm Alternatively: math.to(b, 'cm')
@@ -509,25 +509,25 @@ Units examples
b.toNumber('cm'); // 10
math.number(b, 'cm'); // 10
console.log();
-
+
// the expression parser supports units too
console.log('parse expressions');
math.eval('2 inch to cm'); // 5.08 cm
math.eval('cos(45 deg)'); // 0.70711...
math.eval('90 km/h to m/s'); // 25 m / s
console.log();
-
+
// convert a unit to a number
// A second parameter with the unit for the exported number must be provided
math.eval('number(5 cm, mm)'); // number, 50
console.log();
-
+
// simplify units
console.log('simplify units');
math.eval('100000 N / m^2'); // 100 kPa
math.eval('9.81 m/s^2 * 100 kg * 40 m'); // 39.24 kJ
console.log();
-
+
// example engineering calculations
console.log('compute molar volume of ideal gas at 65 Fahrenheit, 14.7 psi in L/mol');
var Rg = math.unit('8.314 N m / (mol K)');
@@ -539,7 +539,7 @@ Units examples
console.log('T = ' + format(T));
console.log('v = Rg * T / P = ' + format(math.to(v, 'L/mol'))); // 23.910... L / mol
console.log();
-
+
console.log('compute speed of fluid flowing out of hole in a container');
var g = math.unit('9.81 m / s^2');
var h = math.unit('1 m');
@@ -548,17 +548,17 @@ Units examples
console.log('h = ' + format(h));
console.log('v = (2 g h) ^ 0.5 = ' + format(v2)); // 4.429... m / s
console.log();
-
+
console.log('electrical power consumption:');
var expr = '460 V * 20 A * 30 days to kWh';
console.log(expr + ' = ' + math.eval(expr)); // 6624 kWh
console.log();
-
+
console.log('circuit design:');
var expr = '24 V / (6 mA)';
console.log(expr + ' = ' + math.eval(expr)); // 4 kohm
console.log();
-
+
console.log('operations on arrays:');
var B = math.eval('[1, 0, 0] T');
var v3 = math.eval('[0, 1, 0] m/s');
@@ -568,7 +568,7 @@ Units examples
console.log('v (particle velocity) = ' + format(v3)); // [0 m / s, 1 m / s, 0 m / s]
console.log('q (particle charge) = ' + format(q)); // 1 C
console.log('F (force) = q (v cross B) = ' + format(F)); // [0 N, 0 N, -1 N]
-
+
/**
* Helper function to format an output a value.
* @param {*} value
@@ -578,4 +578,62 @@ Units examples
var precision = 14;
return math.format(value, precision);
}
-}());
\ No newline at end of file
+}());
+
+
+/*
+Expression tree examples
+*/
+(function(){
+
+ // Filter an expression tree
+console.log('Filter all symbol nodes "x" in the expression "x^2 + x/4 + 3*y"');
+var node = math.parse('x^2 + x/4 + 3*y');
+var filtered = node.filter(function (node) {
+ return node.isSymbolNode && node.name == 'x';
+});
+// returns an array with two entries: two SymbolNodes 'x'
+
+filtered.forEach(function (node) {
+ console.log(node.type, node.toString())
+});
+// outputs:
+// SymbolNode x
+// SymbolNode x
+
+
+// Traverse an expression tree
+console.log();
+console.log('Traverse the expression tree of expression "3 * x + 2"');
+var node1 = math.parse('3 * x + 2');
+node1.traverse(function (node, path, parent) {
+ switch (node.type) {
+ case 'OperatorNode': console.log(node.type, node.op); break;
+ case 'ConstantNode': console.log(node.type, node.value); break;
+ case 'SymbolNode': console.log(node.type, node.name); break;
+ default: console.log(node.type);
+ }
+});
+// outputs:
+// OperatorNode +
+// OperatorNode *
+// ConstantNode 3
+// SymbolNode x
+// ConstantNode 2
+
+
+// transform an expression tree
+console.log();
+console.log('Replace all symbol nodes "x" in expression "x^2 + 5*x" with a constant 3');
+var node2 = math.parse('x^2 + 5*x');
+var transformed = node2.transform(function (node, path, parent) {
+ if (node.isSymbolNode && node.name == 'x') {
+ return new math.expression.node.ConstantNode(3);
+ }
+ else {
+ return node;
+ }
+});
+console.log(transformed.toString());
+// outputs: '(3 ^ 2) + (5 * 3)'
+}());
diff --git a/mathjs/mathjs.d.ts b/mathjs/mathjs.d.ts
index e6fa6a877..01742bf67 100644
--- a/mathjs/mathjs.d.ts
+++ b/mathjs/mathjs.d.ts
@@ -6,19 +6,19 @@
declare var math: mathjs.IMathJsStatic;
declare module mathjs {
-
+
type MathArray = number[]|number[][];
type MathType = number|BigNumber|Fraction|Complex|Unit|MathArray|Matrix;
type MathExpression = string|string[]|MathArray|Matrix;
-
+
export interface IMathJsStatic {
-
+
e: number;
pi: number;
uninitialized: any;
-
+
config(options: any): void;
-
+
/**
* Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix.
* @param L A N x N matrix or array (L)
@@ -26,15 +26,15 @@ declare module mathjs {
* @returns A column vector with the linear system solution (x)
*/
lsolve(L: Matrix|MathArray, b: Matrix|MathArray): Matrix|MathArray;
-
+
/**
- * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U)
+ * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U)
* and a row permutation vector p where A[p,:] = L * U
* @param A A two dimensional matrix or array for which to get the LUP decomposition.
* @returns The lower triangular matrix, the upper triangular matrix and the permutation matrix.
*/
lup(A?: Matrix|MathArray): MathArray;
-
+
/**
* Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.
* @param A Invertible Matrix or the Matrix LU decomposition
@@ -42,22 +42,22 @@ declare module mathjs {
* @returns Column vector with the solution to the linear system A * x = b
*/
lusolve(A: Matrix|MathArray|Number, b: Matrix|MathArray): Matrix|MathArray;
-
+
/**
- * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in
+ * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in
* two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U
* @param A A two dimensional sparse matrix for which to get the LU decomposition.
- * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is
- * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic
- * ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'.
- * This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed
- * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with
+ * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is
+ * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic
+ * ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'.
+ * This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed
+ * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with
* more than 10*sqr(columns) entries.
* @param threshold Partial pivoting threshold (1 for partial pivoting)
* @returns The lower triangular matrix, the upper triangular matrix and the permutation vectors.
*/
slu(A: Matrix, order: Number, threshold: Number): any;
-
+
/**
* Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b
* @param U A N x N matrix or array (U)
@@ -65,7 +65,7 @@ declare module mathjs {
* @returns A column vector with the linear system solution (x)
*/
usolve(U: Matrix|MathArray, b:Matrix|MathArray): Matrix|MathArray;
-
+
/**
* Calculate the absolute value of a number. For matrices, the function is evaluated element wise.
* @param x A number or matrix for which to get the absolute value
@@ -78,7 +78,7 @@ declare module mathjs {
abs(x: MathArray): MathArray;
abs(x: Matrix): Matrix;
abs(x: Unit): Unit;
-
+
/**
* Add two values, x + y. For matrices, the function is evaluated element wise.
* @param x First value to add
@@ -86,7 +86,7 @@ declare module mathjs {
* @returns Sum of x and y
*/
add(x: MathType, y: MathType): MathType;
-
+
/**
* Calculate the cubic root of a value. For matrices, the function is evaluated element wise.
* @param x Value for which to calculate the cubic root.
@@ -100,7 +100,7 @@ declare module mathjs {
cbrt(x: MathArray, allRoots?: boolean): MathArray;
cbrt(x: Matrix, allRoots?: boolean): Matrix;
cbrt(x: Unit, allRoots?: boolean): Unit;
-
+
/**
* Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. For matrices, the function is evaluated element wise.
* @param x Number to be rounded
@@ -113,8 +113,8 @@ declare module mathjs {
ceil(x: MathArray): MathArray;
ceil(x: Matrix): Matrix;
ceil(x: Unit): Unit;
-
- /**
+
+ /**
* Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise.
* @param x Number for which to calculate the cube
* @returns Cube of x
@@ -126,7 +126,7 @@ declare module mathjs {
cube(x: MathArray): MathArray;
cube(x: Matrix): Matrix;
cube(x: Unit): Unit;
-
+
/**
* Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y).
* @param x Numerator
@@ -136,7 +136,7 @@ declare module mathjs {
divide(x: Unit, y: Unit): Unit;
divide(x: number, y: number): number;
divide(x:MathType, y:MathType): MathType;
-
+
/**
* Divide two matrices element wise. The function accepts both matrices and scalar values.
* @param x Numerator
@@ -144,7 +144,7 @@ declare module mathjs {
* @returns Quotient, x ./ y
*/
dotDivide(x: MathType, y: MathType): MathType;
-
+
/**
* Multiply two matrices element wise. The function accepts both matrices and scalar values.
* @param x Left hand value
@@ -152,15 +152,15 @@ declare module mathjs {
* @returns Multiplication of x and y
*/
dotMultiply(x: MathType, y: MathType): MathType;
-
- /**
+
+ /**
* Calculates the power of x to y element wise.
* @param x The base
* @param y The exponent
* @returns The value of x to the power y
*/
dotPow(x: MathType, y: MathType): MathType;
-
+
/**
* Calculate the exponent of a value. For matrices, the function is evaluated element wise.
* @param x A number or matrix to exponentiate
@@ -172,7 +172,7 @@ declare module mathjs {
exp(x: MathArray ): MathArray ;
exp(x: Matrix): Matrix;
- /**
+ /**
* Round a value towards zero. For matrices, the function is evaluated element wise.
* @param x Number to be rounded
* @returns Rounded value
@@ -183,7 +183,7 @@ declare module mathjs {
fix(x: Complex ): Complex ;
fix(x: MathArray ): MathArray ;
fix(x: Matrix): Matrix;
-
+
/**
* Round a value towards minus infinity. For matrices, the function is evaluated element wise.
* @param Number to be rounded
@@ -195,7 +195,7 @@ declare module mathjs {
floor(x: Complex ): Complex ;
floor(x: MathArray ): MathArray ;
floor(x: Matrix): Matrix;
-
+
/**
* Calculate the greatest common divisor for two or more values or arrays. For matrices, the function is evaluated element wise.
*/
@@ -204,7 +204,7 @@ declare module mathjs {
gcd(...args: Fraction[]): Fraction ;
gcd(...args: MathArray[]): MathArray ;
gcd(...args: Matrix[]): Matrix;
-
+
/**
* Calculate the hypotenusa of a list with values. The hypotenusa is defined as:
* hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...)
@@ -212,7 +212,7 @@ declare module mathjs {
*/
hypot(...args: number[]): number;
hypot(...args: BigNumber[]): BigNumber;
-
+
/**
* Calculate the least common multiple for two or more values or arrays. lcm is defined as:
* lcm(a, b) = abs(a * b) / gcd(a, b)
@@ -222,14 +222,14 @@ declare module mathjs {
lcm(a: BigNumber , b: BigNumber ): BigNumber ;
lcm(a: MathArray, b: MathArray): MathArray;
lcm(a: Matrix, b: Matrix): Matrix;
-
+
/**
* Calculate the logarithm of a value. For matrices, the function is evaluated element wise.
* @param x Value for which to calculate the logarithm.
* @param base Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e.
*/
log(x: number|BigNumber|Complex|MathArray|Matrix, base?: number|BigNumber|Complex): number|BigNumber|Complex|MathArray|Matrix;
-
+
/**
* Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise.
* @param x Value for which to calculate the logarithm.
@@ -239,7 +239,7 @@ declare module mathjs {
log10(x: Complex): Complex;
log10(x: MathArray): MathArray;
log10(x: Matrix): Matrix;
-
+
/**
* Calculates the modulus, the remainder of an integer division. For matrices, the function is evaluated element wise.
* The modulus is defined as:
@@ -249,7 +249,7 @@ declare module mathjs {
* @param y Divisor
*/
mod(x: number|BigNumber|Fraction|MathArray|Matrix, y: number|BigNumber|Fraction|MathArray|Matrix): number|BigNumber|Fraction|MathArray|Matrix;
-
+
/**
* Multiply two values, x * y. The result is squeezed. For matrices, the matrix product is calculated.
*/
@@ -258,7 +258,7 @@ declare module mathjs {
multiply(x: Unit, y: Unit): Unit;
multiply(x: number, y: number): number;
multiply(x: MathType, y: MathType): MathType;
-
+
/**
* Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2.
* @param x Value for which to calculate the norm
@@ -266,7 +266,7 @@ declare module mathjs {
* @returns the p-norm
*/
norm(x: number|BigNumber|Complex|MathArray|Matrix, p?: number|BigNumber|string): number|BigNumber;
-
+
/**
* Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation
* x^root = A
@@ -275,21 +275,21 @@ declare module mathjs {
* @param root The root. Default value: 2.
*/
nthRoot(a: number|BigNumber|MathArray|Matrix|Complex, root?: number|BigNumber): number|Complex|MathArray|Matrix;
-
+
/**
* Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y.
* @param x The base
* @param y The exponent
*/
pow(x: number|BigNumber|Complex|MathArray|Matrix, y: number|BigNumber|Complex): number|BigNumber|Complex|MathArray|Matrix;
-
+
/**
* Round a value towards the nearest integer. For matrices, the function is evaluated element wise.
* @param x Number to be rounded
* @param n Number of decimals Default value: 0.
*/
round(x: number|BigNumber|Fraction|Complex|MathArray|Matrix, n?: number|BigNumber|MathArray): number|BigNumber|Fraction|Complex|MathArray|Matrix;
-
+
/**
* Compute the sign of a value. The sign of a value x is:
* 1 when x > 1
@@ -304,7 +304,7 @@ declare module mathjs {
sign(x: MathArray): MathArray;
sign(x: Matrix): Matrix;
sign(x: Unit): Unit;
-
+
/**
* Calculate the square root of a value. For matrices, the function is evaluated element wise.
*/
@@ -314,7 +314,7 @@ declare module mathjs {
sqrt(x: MathArray): MathArray;
sqrt(x: Matrix): Matrix;
sqrt(x: Unit): Unit;
-
+
/**
* Compute the square of a value, x * x. For matrices, the function is evaluated element wise.
*/
@@ -325,12 +325,12 @@ declare module mathjs {
square(x: MathArray): MathArray;
square(x: Matrix): Matrix;
square(x: Unit): Unit;
-
+
/**
* Subtract two values, x - y. For matrices, the function is evaluated element wise.
*/
subtract(x: MathType, y: MathType): MathType;
-
+
/**
* Inverse the sign of a value, apply a unary minus operation.
* For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted.
@@ -342,7 +342,7 @@ declare module mathjs {
unaryMinus(x: MathArray): MathArray;
unaryMinus(x: Matrix): Matrix;
unaryMinus(x: Unit): Unit;
-
+
/**
* Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is.
* For matrices, the function is evaluated element wise.
@@ -355,17 +355,17 @@ declare module mathjs {
unaryPlus(x: MathArray): MathArray;
unaryPlus(x: Matrix): Matrix;
unaryPlus(x: Unit): Unit;
-
+
/**
* Calculate the extended greatest common divisor for two values. See http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm.
*/
xgcd(a: number|BigNumber, b: number|BigNumber): MathArray;
-
+
/**
* Bitwise AND two values, x & y. For matrices, the function is evaluated element wise.
*/
bitAnd(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix;
-
+
/**
* Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
*/
@@ -373,7 +373,7 @@ declare module mathjs {
bitNot(x: BigNumber ): BigNumber ;
bitNot(x: MathArray): MathArray;
bitNot(x: Matrix): Matrix;
-
+
/**
* Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base.
*/
@@ -381,47 +381,47 @@ declare module mathjs {
bitOr(x: BigNumber ): BigNumber ;
bitOr(x: MathArray): MathArray;
bitOr(x: Matrix): Matrix;
-
+
/**
* Bitwise XOR two values, x ^ y. For matrices, the function is evaluated element wise.
*/
bitXor(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix;
-
+
/**
* Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
* @param x Value to be shifted
* @param y Amount of shifts
*/
leftShift(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber): number|BigNumber|MathArray|Matrix;
-
+
/**
* Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
* @param x Value to be shifted
* @param y Amount of shifts
*/
rightArithShift(x: number|BigNumber|MathArray|Matrix, y: number|BigNumber): number|BigNumber|MathArray|Matrix;
-
+
/**
* Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
* @param x Value to be shifted
* @param y Amount of shifts
*/
rightLogShift(x: number|MathArray|Matrix, y: number): number|MathArray|Matrix;
-
+
/**
* The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. bellNumbers only takes integer arguments. The following condition must be enforced: n >= 0
* @param n Total number of objects in the set
*/
bellNumbers(n: Number): Number;
bellNumbers(n: BigNumber): BigNumber;
-
+
/**
* The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0
* @pararm n nth Catalan number
*/
catalan(n: Number): Number;
catalan(n: BigNumber): BigNumber;
-
+
/**
* The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n.
* @param n Total number of objects in the set
@@ -429,7 +429,7 @@ declare module mathjs {
* @returns Returns the composition counts of n into k parts.
*/
composition(n: Number|BigNumber, k: Number|BigNumber): Number|BigNumber
-
+
/**
* The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n.
* If n = k or k = 1, then s(n,k) = 1
@@ -437,7 +437,7 @@ declare module mathjs {
* @param k Number of objects in the subset
*/
stirlingS2(n: Number|BigNumber, k: Number|BigNumber): Number|BigNumber;
-
+
/**
* Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise.
* @param x A complex number or array with complex numbers
@@ -446,15 +446,15 @@ declare module mathjs {
arg(x: Complex): number;
arg(x: MathArray): MathArray;
arg(x: Matrix): Matrix;
-
+
/**
* Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate of x is a - bi. For matrices, the function is evaluated element wise.
* @param x A complex number or array with complex numbers
*/
conj(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|Complex|MathArray|Matrix;
-
- /**
- * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b.
+
+ /**
+ * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b.
* For matrices, the function is evaluated element wise.
*/
im(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|MathArray|Matrix;
@@ -464,17 +464,17 @@ declare module mathjs {
* For matrices, the function is evaluated element wise.
*/
re(x: number|BigNumber|Complex|MathArray|Matrix): number|BigNumber|MathArray|Matrix;
-
+
/**
* Create a BigNumber, which can store numbers with arbitrary precision. When a matrix is provided, all elements will be converted to BigNumber.
*/
bignumber(x?: number|string|MathArray|Matrix|boolean): BigNumber;
-
+
/**
* Create a boolean or convert a string or number to a boolean. In case of a number, true is returned for non-zero numbers, and false in case of zero. Strings can be 'true' or 'false', or can contain a number. When value is a matrix, all elements will be converted to boolean.
*/
boolean(x: string|number|boolean|MathArray|Matrix ): boolean|MathArray|Matrix;
-
+
/**
* Wrap any value in a chain, allowing to perform chained operations on the value.
* All methods available in the math.js library can be called upon the chain, and then will be evaluated with the value itself as first argument. The chain can be closed by executing chain.done(), which returns the final value.
@@ -484,7 +484,7 @@ declare module mathjs {
* toString() Executes math.format() onto the chain's value, returning a string representation of the value.
*/
chain(value?: any): IMathJsChain;
-
+
/**
* Create a complex value or convert a value to a complex value.
*/
@@ -494,90 +494,90 @@ declare module mathjs {
complex(arg: string): Complex;
complex(array: MathArray): Complex;
complex(obj: IPolarCoordinates): Complex;
-
+
/**
* Create a fraction convert a value to a fraction.
*/
fraction(numerator: number|string|MathArray|Matrix, denominator?: number|string|MathArray|Matrix): Fraction|MathArray|Matrix;
-
+
/**
* Create an index. An Index can store ranges having start, step, and end for multiple dimensions. Matrix.get, Matrix.set, and math.subset accept an Index as input.
*/
index(...ranges: any[]): Index;
-
+
/**
- * Create a Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility functions
- * to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix. Supported
+ * Create a Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility functions
+ * to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix. Supported
* storage formats are 'dense' and 'sparse'.
*/
matrix(format?: string): Matrix;
matrix(data: MathArray|Matrix, format?: string, dataType?:string): Matrix;
-
+
/**
* Create a number or convert a string, boolean, or unit to a number. When value is a matrix, all elements will be converted to number.
*/
number(value?: string|number|boolean|MathArray|Matrix|Unit): number|MathArray|Matrix;
number(unit: Unit, valuelessUnit: Unit|string): number|MathArray|Matrix;
-
+
/**
- * Create a Sparse Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility
+ * Create a Sparse Matrix. The function creates a new math.type.Matrix object from an Array. A Matrix has utility
* functions to manipulate the data in the matrix, like getting the size and getting or setting values in the matrix.
* @param data A two dimensional array
*/
sparse(data?: MathArray|Matrix, dataType?:string): Matrix;
-
+
/**
* Create a string or convert any object into a string. Elements of Arrays and Matrices are processed element wise.
* @param value A value to convert to a string
*/
string(value: any): string|MathArray|Matrix;
-
+
/**
- * Create a unit. Depending on the passed arguments, the function will create and return a new math.type.Unit object.
+ * Create a unit. Depending on the passed arguments, the function will create and return a new math.type.Unit object.
* When a matrix is provided, all elements will be converted to units.
*/
unit(unit: string): Unit;
unit(value: number, unit: string): Unit;
-
+
/**
* Parse and compile an expression. Returns a an object with a function eval([scope]) to evaluate the compiled expression.
*/
compile(expr: MathExpression): EvalFunction;
compile(exprs: MathExpression[]): EvalFunction[];
-
+
/**
* Evaluate an expression.
*/
eval(expr: MathExpression, scope?: any): any;
eval(exprs: MathExpression[], scope?: any): any;
-
+
/**
* Retrieve help on a function or data type. Help files are retrieved from the documentation in math.expression.docs.
*/
help(search: any): Help;
-
+
/**
* Parse an expression. Returns a node tree, which can be evaluated by invoking node.eval();
*/
parse(expr: MathExpression, options?: any): MathNode;
parse(exprs: MathExpression[], options?: any): MathNode[];
-
+
/**
* Create a parser. The function creates a new math.expression.Parser object.
*/
parser(): Parser;
-
+
/**
- * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point
- * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When
- * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric
+ * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point
+ * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When
+ * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric
* equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c)
*/
distance(x: MathArray|Matrix|any, y: MathArray|Matrix|any): Number | BigNumber;
-
+
/**
- * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in
- * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions
+ * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in
+ * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions
* return null if the lines do not meet.
* Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0.
* @param w Co-ordinates of first end-point of first line
@@ -587,50 +587,50 @@ declare module mathjs {
* @returns Returns the point of intersection of lines/lines-planes
*/
intersect(w: MathArray|Matrix, x: MathArray|Matrix, y: MathArray|Matrix, z: MathArray|Matrix): MathArray;
-
+
/**
* Logical and. Test whether two values are both defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise.
*/
and(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix;
-
+
/**
* Logical not. Flips boolean value of a given parameter. For matrices, the function is evaluated element wise.
*/
not(x: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix;
-
+
/**
* Logical or. Test if at least one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise.
*/
or(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix;
-
+
/**
* Logical xor. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise.
*/
xor(x: number|BigNumber|Complex|Unit|MathArray|Matrix, y: number|BigNumber|Complex|Unit|MathArray|Matrix): boolean|MathArray|Matrix;
-
+
/**
* Concatenate two or more matrices.
* dim: number is a zero-based dimension over which to concatenate the matrices. By default the last dimension of the matrices.
*/
concat(...args: (MathArray|Matrix|number)[]): MathArray|Matrix;
-
+
/**
- * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3]
+ * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3]
* and B =[b1, b2, b3] is defined as:
* cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ]
*/
cross(x: MathArray|Matrix, y: MathArray|Matrix): Matrix;
-
+
/**
* Calculate the determinant of a matrix.
*/
det(x: MathArray|Matrix): number;
-
+
/**
* Create a diagonal matrix or retrieve the diagonal of a matrix.
- * When x is a vector, a matrix with vector x on the diagonal will be returned. When x is a two dimensional matrix,
+ * When x is a vector, a matrix with vector x on the diagonal will be returned. When x is a two dimensional matrix,
* the matrixes kth diagonal will be returned
- * as vector. When k is positive, the values are placed on the super diagonal. When k is negative, the values are
+ * as vector. When k is positive, the values are placed on the super diagonal. When k is negative, the values are
* placed on the sub diagonal.
* @param X A two dimensional matrix or a vector
* @param k The diagonal where the vector will be filled in or retrieved. Default value: 0.
@@ -638,38 +638,38 @@ declare module mathjs {
*/
diag(X: MathArray|Matrix, format?: string): Matrix;
diag(X: MathArray|Matrix, k: number|BigNumber, format?: string): Matrix;
-
+
/**
- * Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn]
+ * Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn]
* is defined as:
* dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn
*/
dot(x: MathArray|Matrix, y: MathArray|Matrix): number;
-
+
/**
* Create a 2-dimensional identity matrix with size m x n or n x n. The matrix has ones on the diagonal and zeros elsewhere.
*/
eye(n: number, format?: string): Matrix;
eye(m: number, n: number, format?: string): Matrix;
eye(size: number[], format?: string): Matrix;
-
+
/**
* Flatten a multi dimensional matrix into a single dimensional matrix.
*/
- flatten(x: MathArray|Matrix): MathArray|Matrix;
-
+ flatten(x: MathArray|Matrix): MathArray|Matrix;
+
/**
* Calculate the inverse of a square matrix.
*/
inv(x: number|Complex|MathArray|Matrix): number|Complex|MathArray|Matrix;
-
+
/**
* Create a matrix filled with ones. The created matrix can have one or multiple dimensions.
*/
ones(n: number, format?: string): MathArray|Matrix;
ones(m: number, n: number, format?: string): MathArray|Matrix;
ones(size: number[], format?: string): MathArray|Matrix;
-
+
/**
* Create an array from a range. By default, the range end is excluded. This can be customized by providing an extra parameter includeEnd.
* @param str A string 'start:end' or 'start:step:end'
@@ -681,7 +681,7 @@ declare module mathjs {
range(str: string, includeEnd?: boolean): Matrix;
range(start: number|BigNumber, end:number|BigNumber, includeEnd?:boolean): Matrix;
range(start: number|BigNumber, end: number|BigNumber, step: number|BigNumber, includeEnd?:boolean): Matrix;
-
+
/**
* Resize a matrix
* @param x Matrix to be resized
@@ -689,17 +689,17 @@ declare module mathjs {
* @param defaultValue Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0.
*/
resize(x: MathArray|Matrix, size: MathArray|Matrix, defaultValue?: number|string): MathArray|Matrix;
-
+
/**
* Calculate the size of a matrix or scalar.
*/
size(x: boolean|number|Complex|Unit|string|MathArray|Matrix): MathArray|Matrix;
-
+
/**
* Squeeze a matrix, remove inner and outer singleton dimensions from a matrix.
*/
squeeze(x: MathArray|Matrix): Matrix|MathArray;
-
+
/**
* Get or set a subset of a matrix or string.
* @param value An array, matrix, or string
@@ -708,60 +708,60 @@ declare module mathjs {
* @param defaultValue Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined.
*/
subset(value: MathArray|Matrix|string, index: Index, replacement?: any, defaultValue?: any): MathArray|Matrix|string;
-
+
/**
* Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.
*/
trace(x: MathArray|Matrix): number;
-
+
/**
* Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported.
*/
transpose(x: MathArray|Matrix): MathArray|Matrix;
-
+
/**
* Create a matrix filled with zeros. The created matrix can have one or multiple dimensions.
*/
zeros(n: number, format?: string): MathArray|Matrix;
zeros(m: number, n: number, format?: string): MathArray|Matrix;
zeros(size: number[], format?: string): MathArray|Matrix;
-
+
/**
- * Compute the number of ways of picking k unordered outcomes from n possibilities.
+ * Compute the number of ways of picking k unordered outcomes from n possibilities.
* Combinations only takes integer arguments. The following condition must be enforced: k <= n.
*/
combinations(n: number|BigNumber, k: number|BigNumber): number|BigNumber;
-
+
/**
* Create a distribution object with a set of random functions for given random distribution.
* @param name Name of a distribution. Choose from 'uniform', 'normal'.
*/
distribution(name: string): Distribution;
-
+
/**
* Compute the factorial of a value
* Factorial only supports an integer value as argument. For matrices, the function is evaluated element wise.
*/
factorial(n: number|BigNumber|MathArray|Matrix): number|BigNumber|MathArray|Matrix;
-
+
/**
- * Compute the gamma function of a value using Lanczos approximation for small values, and an extended
+ * Compute the gamma function of a value using Lanczos approximation for small values, and an extended
* Stirling approximation for large values.
* For matrices, the function is evaluated element wise.
*/
gamma(n: number|MathArray|Matrix): number|MathArray|Matrix;
-
+
/**
* Calculate the Kullback-Leibler (KL) divergence between two distributions
*/
kldivergence(x: MathArray|Matrix, y: MathArray|Matrix): number;
-
+
/**
* Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from n possibilities.
* multinomial takes one array of integers as an argument. The following condition must be enforced: every ai <= 0
*/
multinomial(a: number[]|BigNumber[]): number|BigNumber;
-
+
/**
* Compute the number of ways of obtaining an ordered subset of k elements from a set of n elements.
* Permutations only takes integer arguments. The following condition must be enforced: k <= n.
@@ -769,12 +769,12 @@ declare module mathjs {
* @param k The number of objects in the subset
*/
permutations(n: number|BigNumber, k?:number|BigNumber): number|BigNumber;
-
+
/**
* Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution.
*/
pickRandom(array: number[]): number;
-
+
/**
* Return a random number larger or equal to min and smaller than max using a uniform distribution.
*/
@@ -783,7 +783,7 @@ declare module mathjs {
random(min: number, max: number): number;
random(size: MathArray|Matrix, max?: number): MathArray|Matrix;
random(size: MathArray|Matrix, min:number, max: number): MathArray|Matrix;
-
+
/**
* Return a random integer number larger or equal to min and smaller than max using a uniform distribution.
*/
@@ -791,166 +791,166 @@ declare module mathjs {
randomInt(min: number, max: number): number;
randomInt(size: MathArray|Matrix, max?: number): MathArray|Matrix;
randomInt(size: MathArray|Matrix, min:number, max: number): MathArray|Matrix;
-
+
/**
* Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.
- * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon.
+ * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
* For matrices, the function is evaluated element wise.
*/
compare(x: MathType, y: MathType): number|BigNumber|Fraction|MathArray|Matrix;
-
+
/**
* Test element wise whether two matrices are equal. The function accepts both matrices and scalar values.
*/
deepEqual(x: MathType, y: MathType): number|BigNumber|Fraction|Complex|Unit|MathArray|Matrix;
-
+
/**
* Test whether two values are equal.
- *
- * The function tests whether the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function tests whether the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im.
- *
+ *
* Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else.
*/
equal(x: MathType, y: MathType): boolean|MathArray|Matrix;
-
+
/**
* Test whether value x is larger than y.
- *
- * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon.
+ *
+ * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
larger(x: MathType, y: MathType): boolean|MathArray|Matrix;
-
+
/**
* Test whether value x is larger or equal to y.
- *
- * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
largerEq(x: MathType, y: MathType): boolean|MathArray|Matrix;
-
+
/**
* Test whether value x is smaller than y.
- *
- * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
smaller(x: MathType, y: MathType): boolean|MathArray|Matrix;
-
+
/**
* Test whether value x is smaller or equal to y.
- *
- * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.
*/
smallerEq(x: MathType, y: MathType): boolean|MathArray|Matrix;
-
+
/**
* Test whether two values are unequal.
- *
- * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot
+ *
+ * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot
* be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im.
- *
- * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with
+ *
+ * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with
* everying except. undefined.
*/
unequal(x: MathType, y: MathType): boolean|MathArray|Matrix;
-
+
/**
- * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened
+ * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened
* array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.
*/
max(...args: MathType[]): any;
max(A: MathArray|Matrix, dim?: number): any;
-
+
/**
- * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be
+ * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be
* calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.
*/
mean(...args: MathType[]): any;
mean(A: MathArray|Matrix, dim?: number): any;
-
+
/**
- * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an
+ * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an
* even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit
- *
+ *
* In case of a (multi dimensional) array or matrix, the median of all elements will be calculated.
*/
median(...args: MathType[]): any;
-
+
/**
- * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened
+ * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened
* array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.
*/
min(...args: MathType[]): any;
min(A: MathArray|Matrix, dim?: number): any;
-
+
/**
* Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values.
*/
mode(...args: MathType[]): any;
-
+
/**
* Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.
*/
prod(...args: MathType[]): any;
-
+
/**
- * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned.
+ * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned.
* Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber
- *
+ *
* In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.
*/
quantileSeq(A: MathArray|Matrix, prob: Number|BigNumber|MathArray, sorted?: boolean): Number|BigNumber|Unit|MathArray;
-
+
/**
- * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the
- * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will
+ * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the
+ * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will
* be calculated.
- *
- * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following
+ *
+ * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following
* values:
- *
+ *
* 'unbiased' (default) The sum of squared errors is divided by (n - 1)
* 'uncorrected' The sum of squared errors is divided by n
* 'biased' The sum of squared errors is divided by (n + 1)
*/
std(array: MathArray|Matrix, normalization?: string): number;
-
+
/**
* Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.
*/
sum(...args: (Number|BigNumber|Fraction)[]): any;
sum(array: MathArray|Matrix): any;
-
+
/**
- * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all
+ * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all
* elements will be calculated.
- *
- * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the
+ *
+ * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the
* following values:
- *
+ *
* 'unbiased' (default) The sum of squared errors is divided by (n - 1)
* 'uncorrected' The sum of squared errors is divided by n
* 'biased' The sum of squared errors is divided by (n + 1)
- * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...)
+ * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...)
* instead of math.var(...).
*/
var(...args: (Number|BigNumber|Fraction)[]): any;
var(array: MathArray|Matrix, normalization?: string): any;
-
+
/**
* Calculate the inverse cosine of a value. For matrices, the function is evaluated element wise.
*/
@@ -969,7 +969,7 @@ declare module mathjs {
acosh(x: Complex): Complex;
acosh(x: MathArray): MathArray;
acosh(x: Matrix): Matrix;
-
+
/**
* Calculate the inverse cotangent of a value. For matrices, the function is evaluated element wise.
*/
@@ -977,7 +977,7 @@ declare module mathjs {
acot(x: BigNumber): BigNumber;
acot(x: MathArray): MathArray;
acot(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2.
* For matrices, the function is evaluated element wise.
@@ -994,7 +994,7 @@ declare module mathjs {
acsc(x: BigNumber): BigNumber;
acsc(x: MathArray): MathArray;
acsc(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)).
* For matrices, the function is evaluated element wise.
@@ -1003,7 +1003,7 @@ declare module mathjs {
acsch(x: BigNumber): BigNumber;
acsch(x: MathArray): MathArray;
acsch(x: Matrix): Matrix;
-
+
/**
* Calculate the inverse secant of a value. For matrices, the function is evaluated element wise.
*/
@@ -1011,7 +1011,7 @@ declare module mathjs {
asec(x: BigNumber): BigNumber;
asec(x: MathArray): MathArray;
asec(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated element wise.
*/
@@ -1019,8 +1019,8 @@ declare module mathjs {
asech(x: BigNumber): BigNumber;
asech(x: MathArray): MathArray;
asech(x: Matrix): Matrix;
-
- /**
+
+ /**
* Calculate the inverse sine of a value. For matrices, the function is evaluated element wise.
*/
asin(x: number): number;
@@ -1028,7 +1028,7 @@ declare module mathjs {
asin(x: Complex): Complex;
asin(x: MathArray): MathArray;
asin(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated element wise.
*/
@@ -1036,7 +1036,7 @@ declare module mathjs {
asinh(x: BigNumber): BigNumber;
asinh(x: MathArray): MathArray;
asinh(x: Matrix): Matrix;
-
+
/**
* Calculate the inverse tangent of a value. For matrices, the function is evaluated element wise.
*/
@@ -1044,16 +1044,16 @@ declare module mathjs {
atan(x: BigNumber): BigNumber;
atan(x: MathArray): MathArray;
atan(x: Matrix): Matrix;
-
+
/**
- * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the
+ * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the
* computed angle can be determined.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
atan2(y: number, x: number): number;
atan2(y: MathArray|Matrix, x: MathArray|Matrix): MathArray|Matrix;
-
+
/**
* Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2.
* For matrices, the function is evaluated element wise.
@@ -1062,7 +1062,7 @@ declare module mathjs {
atanh(x: BigNumber): BigNumber;
atanh(x: MathArray): MathArray;
atanh(x: Matrix): Matrix;
-
+
/**
* Calculate the cosine of a value. For matrices, the function is evaluated element wise.
*/
@@ -1072,7 +1072,7 @@ declare module mathjs {
asin(x: Unit): number;
asin(x: MathArray): MathArray;
asin(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)). For matrices, the function is evaluated element wise.
*/
@@ -1082,7 +1082,7 @@ declare module mathjs {
cosh(x: Unit): number;
cosh(x: MathArray): MathArray;
cosh(x: Matrix): Matrix;
-
+
/**
* Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). For matrices, the function is evaluated element wise.
*/
@@ -1091,7 +1091,7 @@ declare module mathjs {
cot(x: Unit): number;
cot(x: MathArray): MathArray;
cot(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). For matrices, the function is evaluated element wise.
*/
@@ -1100,7 +1100,7 @@ declare module mathjs {
coth(x: Unit): number;
coth(x: MathArray): MathArray;
coth(x: Matrix): Matrix;
-
+
/**
* Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For matrices, the function is evaluated element wise.
*/
@@ -1109,7 +1109,7 @@ declare module mathjs {
csc(x: Unit): number;
csc(x: MathArray): MathArray;
csc(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x). For matrices, the function is evaluated element wise.
*/
@@ -1118,7 +1118,7 @@ declare module mathjs {
csch(x: Unit): number;
csch(x: MathArray): MathArray;
csch(x: Matrix): Matrix;
-
+
/**
* Calculate the secant of a value, defined as sec(x) = 1/cos(x). For matrices, the function is evaluated element wise.
*/
@@ -1127,7 +1127,7 @@ declare module mathjs {
sec(x: Unit): number;
sec(x: MathArray): MathArray;
sec(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x). For matrices, the function is evaluated element wise.
*/
@@ -1136,7 +1136,7 @@ declare module mathjs {
sech(x: Unit): number;
sech(x: MathArray): MathArray;
sech(x: Matrix): Matrix;
-
+
/**
* Calculate the sine of a value. For matrices, the function is evaluated element wise.
*/
@@ -1146,7 +1146,7 @@ declare module mathjs {
sin(x: Unit): number;
sin(x: MathArray): MathArray;
sin(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise.
*/
@@ -1156,7 +1156,7 @@ declare module mathjs {
sinh(x: Unit): number;
sinh(x: MathArray): MathArray;
sinh(x: Matrix): Matrix;
-
+
/**
* Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). For matrices, the function is evaluated element wise.
*/
@@ -1166,7 +1166,7 @@ declare module mathjs {
tan(x: Unit): number;
tan(x: MathArray): MathArray;
tan(x: Matrix): Matrix;
-
+
/**
* Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is evaluated element wise.
*/
@@ -1176,75 +1176,75 @@ declare module mathjs {
tanh(x: Unit): number;
tanh(x: MathArray): MathArray;
tanh(x: Matrix): Matrix;
-
+
/**
* Change the unit of a value. For matrices, the function is evaluated element wise.
* @param x The unit to be converted.
* @param unit New unit. Can be a string like "cm" or a unit without value.
*/
to(x: Unit|MathArray|Matrix, unit: Unit|string): Unit|MathArray|Matrix
-
+
/**
* Clone an object.
*/
clone(x: any): any;
-
+
/**
* Filter the items in an array or one dimensional matrix.
* @param x A one dimensional matrix or array to filter
- * @param test
+ * @param test
*/
filter(x: MathArray|Matrix, test: RegExp|((item: any)=>boolean)): MathArray|Matrix;
-
+
/**
* Iterate over all elements of a matrix/array, and executes the given callback function.
* @param x The matrix to iterate on.
* @param callback The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed.
*/
forEach(x: MathArray|Matrix, callback: (item: any)=>any): void;
-
+
/**
* Format a value of any type into a string.
* @param value The value to be formatted
*/
format(value: any, options?: IFormatOptions|number|((item: any)=>string)): string;
-
+
/**
- * Test whether a value is an integer number. The function supports number, BigNumber, and Fraction.
+ * Test whether a value is an integer number. The function supports number, BigNumber, and Fraction.
* The function is evaluated element-wise in case of Array or Matrix input.
*/
isInteger(x: any): boolean;
-
+
/**
* Test whether a value is negative: smaller than zero. The function supports types number, BigNumber, Fraction, and Unit.
* The function is evaluated element-wise in case of Array or Matrix input.
*/
isNegative(x: any): boolean;
-
+
/**
* Test whether a value is an numeric value. The function is evaluated element-wise in case of Array or Matrix input.
*/
isNumeric(x: any): boolean;
-
+
/**
* Test whether a value is positive: larger than zero. The function supports types number, BigNumber, Fraction, and Unit.
* The function is evaluated element-wise in case of Array or Matrix input.
*/
isPositive(x: any): boolean;
-
+
/**
* Test whether a value is zero. The function can check for zero for types number, BigNumber, Fraction, Complex, and Unit.
* The function is evaluated element-wise in case of Array or Matrix input.
*/
isZero(x: any): boolean;
-
+
/**
* Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.
* @param x The matrix to iterate on.
* @param callback The callback method is invoked with three parameters: the value of the element, the index of the element, and the matrix being traversed.
*/
map(x: MathArray|Matrix, callback: (item: any)=>any): MathArray|Matrix;
-
+
/**
* Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.
* @param x A one dimensional matrix or array to sort
@@ -1253,7 +1253,7 @@ declare module mathjs {
* @returns Returns the kth lowest value.
*/
partitionSelect(x: MathArray|Matrix, k: number, compare?: string|((a: any, b: any)=>number)): any;
-
+
/**
* Interpolate values into a string template.
* @param template A string containing variable placeholders.
@@ -1261,225 +1261,294 @@ declare module mathjs {
* @param precision Number of digits to format numbers. If not provided, the value will not be rounded.
*/
print(template:string, values: any, precision?: number): void;
-
+
/**
* Sort the items in a matrix.
* @param x A one dimensional matrix or array to sort
* @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'.
*/
sort(x: MathArray|Matrix, compare?: string|((a: any, b: any)=>number)): MathArray|Matrix;
-
+
/**
* Determine the type of a variable.
*/
typeof(x: any): string;
}
-
+
export interface Matrix {
size(): number[];
subset(index: Index, replacement?: any, defaultValue?: any): Matrix;
resize(size: MathArray|Matrix, defaultValue?: number|string): Matrix;
clone(): Matrix;
}
-
+
export interface BigNumber {
-
+
}
-
+
export interface Fraction {
-
+
}
-
+
export interface Complex {
re: number;
im: number;
toPolar(): IPolarCoordinates;
clone(): Complex;
}
-
+
export interface IPolarCoordinates {
- r: number;
+ r: number;
phi: number;
- }
-
+ }
+
export interface Unit {
to(unit: string): Unit;
toNumber(unit: string): number;
}
-
+
export interface Index {
-
+
}
-
+
export interface EvalFunction {
eval(scope?: any): any;
}
-
+
export interface MathNode {
+ isNode: boolean;
+ isSymbolNode: boolean;
+ type: string;
+ name: string;
+
compile(): EvalFunction;
eval(): any;
+ eval(expr: string): any;
+ /**
+ *
+ * Filter nodes in an expression tree. The callback function is called as callback(node: Node, path: string, parent: Node) : boolean for every node in the tree,
+ * and must return a boolean. The function filter returns an array with nodes for which the test returned true.
+ * Parameter path is a string containing a relative JSON Path.
+ *
+ * Example:
+ *
+ * ```
+ * var node = math.parse('x^2 + x/4 + 3*y');
+ * var filtered = node.filter(function (node) {
+ * return node.isSymbolNode && node.name == 'x';
+ * });
+ * // returns an array with two entries: two SymbolNodes 'x'
+ * ```
+ *
+ * @param The callback function is called as callback(node: Node, path: string, parent: Node) : boolean for every node in the tree, and must return a boolean. The function filter returns an array with nodes for which the test returned true. Parameter path is a string containing a relative JSON Path.
+ * @param {Function} callback(node [description]
+ * @return {[Mathnode]} Returns an array with nodes for which test returned true
+ */
+ filter(callback: (node: MathNode, path: string, parent: MathNode)=>any ): MathNode[];
+
+
+ /**
+ * [forEach description]
+ * @param {MathNode} callback(node [description]
+ * @return {[type]} [description]
+ */
+ forEach(callback: (node: MathNode, path: string, parent: MathNode)=>boolean): MathNode[];
+
+
+ /**
+ * `traverse(callback)`
+ *
+ * Recursively traverse all nodes in a node tree. Executes given callback for this node and each of its child nodes. Similar to Array.forEach, except recursive. The callback function is a mapping function accepting a node, and returning a replacement for the node or the original node. Function callback is called as callback(node: Node, path: string, parent: Node) for every node in the tree. Parameter path is a string containing a relative JSON Path. Example:
+ *
+ * ```
+ * var node = math.parse('3 * x + 2');
+ * node.traverse(function (node, path, parent) {
+ * switch (node.type) {
+ * case 'OperatorNode': console.log(node.type, node.op); break;
+ * case 'ConstantNode': console.log(node.type, node.value); break;
+ * case 'SymbolNode': console.log(node.type, node.name); break;
+ * default: console.log(node.type);
+ * }
+ * });
+ * // outputs:
+ * // OperatorNode +
+ * // OperatorNode *
+ * // ConstantNode 3
+ * // SymbolNode x
+ * // ConstantNode 2
+ * ```
+ *
+ * @param {MathNode} callback=(node [description]
+ * @return {[type]} [description]
+ */
+ traverse(callback: (node: MathNode, path: string, parent: MathNode)=> void): any;
+//addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any);
+
+ transform(callback: (node: MathNode, path: string, parent: MathNode)=>boolean): MathNode[];
+
}
-
+
+
export interface Parser {
eval(expr: string): any;
get(variable: string): any;
set(variable: string, value: any): void;
clear(): void;
}
-
+
export interface Distribution {
random(size: any, min?: any, max?: any): any;
randomInt(min: any, max?: any): any;
pickRandom(array: any): any;
}
-
+
export interface IFormatOptions {
/**
* Number notation. Choose from:
* 'fixed' Always use regular number notation. For example '123.40' and '14000000'
* 'exponential' Always use exponential notation. For example '1.234e+2' and '1.4e+7'
- * 'auto' (default) Regular number notation for numbers having an absolute value between lower and upper bounds, and
+ * 'auto' (default) Regular number notation for numbers having an absolute value between lower and upper bounds, and
* uses exponential notation elsewhere. Lower bound is included, upper bound is excluded. For example '123.4' and '1.4e7'.
*/
notation?: string;
-
+
/**
- * A number between 0 and 16 to round the digits of the number. In case of notations 'exponential' and 'auto',
- * precision defines the total number of significant digits returned and is undefined by default. In case of notation 'fixed',
+ * A number between 0 and 16 to round the digits of the number. In case of notations 'exponential' and 'auto',
+ * precision defines the total number of significant digits returned and is undefined by default. In case of notation 'fixed',
* precision defines the number of significant digits after the decimal point, and is 0 by default.
*/
precision?: number;
-
+
/**
- * An object containing two parameters, {number} lower and {number} upper, used by notation 'auto' to determine
+ * An object containing two parameters, {number} lower and {number} upper, used by notation 'auto' to determine
* when to return exponential notation. Default values are lower=1e-3 and upper=1e5. Only applicable for notation auto.
*/
exponential?: {lower: number; upper: number};
-
+
/**
- * Available values: 'ratio' (default) or 'decimal'. For example format(fraction(1, 3)) will output '1/3' when 'ratio'
+ * Available values: 'ratio' (default) or 'decimal'. For example format(fraction(1, 3)) will output '1/3' when 'ratio'
* is configured, and will output 0.(3) when 'decimal' is configured.
*/
fraction?: string;
-
- /**
- * A custom formatting function. Can be used to override the built-in notations. Function fn is called with
- * value as parameter and must return a string. Is useful for example to format all values inside a matrix in a particular way.
+
+ /**
+ * A custom formatting function. Can be used to override the built-in notations. Function fn is called with
+ * value as parameter and must return a string. Is useful for example to format all values inside a matrix in a particular way.
* */
fn?: (item: any)=>string;
}
-
+
export interface Help {
toString(): string;
toJSON(): string;
- }
-
- export interface IMathJsChain {
+ }
+
+ export interface IMathJsChain {
/**
* Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix.
* @param b A column vector with the b values
*/
lsolve(b: Matrix|MathArray): IMathJsChain;
-
+
/**
- * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U)
+ * Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in two matrices (L, U)
* and a row permutation vector p where A[p,:] = L * U
*/
lup(): IMathJsChain;
-
+
/**
* Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.
* @param b Column Vector
*/
lusolve(b: Matrix|MathArray): IMathJsChain;
-
+
/**
- * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in
+ * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix A is decomposed in
* two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U
- * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is
- * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic
- * ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'.
- * This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed
- * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with
+ * @param order The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is
+ * returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic
+ * ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'.
+ * This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed
+ * on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with
* more than 10*sqr(columns) entries.
* @param threshold Partial pivoting threshold (1 for partial pivoting)
* @returns The lower triangular matrix, the upper triangular matrix and the permutation vectors.
*/
slu(order: Number, threshold: Number): IMathJsChain;
-
+
/**
* Solves the linear equation system by backward substitution. Matrix must be an upper triangular matrix. U * x = b
* @param b A column vector with the b values
* @returns A column vector with the linear system solution (x)
*/
usolve(b:Matrix|MathArray): IMathJsChain;
-
+
/**
* Calculate the absolute value of a number. For matrices, the function is evaluated element wise.
*/
abs(): IMathJsChain;
-
+
/**
* Add two values, x + y. For matrices, the function is evaluated element wise.
* @param y Second value to add
*/
add(y: MathType): IMathJsChain;
-
+
/**
* Calculate the cubic root of a value. For matrices, the function is evaluated element wise.
* @param allRoots Optional, false by default. Only applicable when x is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned.
*/
cbrt(allRoots?: boolean): IMathJsChain;
-
+
/**
* Round a value towards plus infinity If x is complex, both real and imaginary part are rounded towards plus infinity. For matrices, the function is evaluated element wise.
*/
ceil(): IMathJsChain;
-
- /**
+
+ /**
* Compute the cube of a value, x * x * x. For matrices, the function is evaluated element wise.
*/
cube(): IMathJsChain;
-
+
/**
* Divide two values, x / y. To divide matrices, x is multiplied with the inverse of y: x * inv(y).
* @param y Denominator
*/
divide(y:MathType): IMathJsChain;
-
+
/**
* Divide two matrices element wise. The function accepts both matrices and scalar values.
* @param y Denominator
*/
dotDivide(y: MathType): IMathJsChain;
-
+
/**
* Multiply two matrices element wise. The function accepts both matrices and scalar values.
* @param y Right hand value
*/
dotMultiply(y: MathType): IMathJsChain;
-
- /**
+
+ /**
* Calculates the power of x to y element wise.
* @param y The exponent
*/
dotPow(y: MathType): IMathJsChain;
-
+
/**
* Calculate the exponent of a value. For matrices, the function is evaluated element wise.
*/
exp(): IMathJsChain;
- /**
+ /**
* Round a value towards zero. For matrices, the function is evaluated element wise.
*/
fix(): IMathJsChain;
-
+
/**
* Round a value towards minus infinity. For matrices, the function is evaluated element wise.
*/
floor(): IMathJsChain;
-
+
/**
* Calculate the greatest common divisor for two or more values or arrays. For matrices, the function is evaluated element wise.
*/
@@ -1488,7 +1557,7 @@ declare module mathjs {
gcd(...args: Fraction[]): IMathJsChain ;
gcd(...args: MathArray[]): IMathJsChain ;
gcd(...args: Matrix[]): IMathJsChain;
-
+
/**
* Calculate the hypotenusa of a list with values. The hypotenusa is defined as:
* hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...)
@@ -1496,7 +1565,7 @@ declare module mathjs {
*/
hypot(...args: number[]): IMathJsChain;
hypot(...args: BigNumber[]): IMathJsChain;
-
+
/**
* Calculate the least common multiple for two or more values or arrays. lcm is defined as:
* lcm(a, b) = abs(a * b) / gcd(a, b)
@@ -1506,18 +1575,18 @@ declare module mathjs {
lcm(b: BigNumber ): IMathJsChain ;
lcm(b: MathArray): IMathJsChain;
lcm(b: Matrix): IMathJsChain;
-
+
/**
* Calculate the logarithm of a value. For matrices, the function is evaluated element wise.
* @param base Optional base for the logarithm. If not provided, the natural logarithm of x is calculated. Default value: e.
*/
log(base?: number|BigNumber|Complex): IMathJsChain;
-
+
/**
* Calculate the 10-base of a value. This is the same as calculating log(x, 10). For matrices, the function is evaluated element wise.
*/
log10(): IMathJsChain;
-
+
/**
* Calculates the modulus, the remainder of an integer division. For matrices, the function is evaluated element wise.
* The modulus is defined as:
@@ -1526,18 +1595,18 @@ declare module mathjs {
* @param y Divisor
*/
mod(y: number|BigNumber|Fraction|MathArray|Matrix): IMathJsChain;
-
+
/**
* Multiply two values, x * y. The result is squeezed. For matrices, the matrix product is calculated.
*/
multiply(y: MathType): IMathJsChain;
-
+
/**
* Calculate the norm of a number, vector or matrix. The second parameter p is optional. If not provided, it defaults to 2.
* @param p Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2.
*/
norm(p?: number|BigNumber|string): IMathJsChain;
-
+
/**
* Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation
* x^root = A
@@ -1545,19 +1614,19 @@ declare module mathjs {
* @param root The root. Default value: 2.
*/
nthRoot(root?: number|BigNumber): IMathJsChain;
-
+
/**
* Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y.
* @param y The exponent
*/
pow(y: number|BigNumber|Complex): IMathJsChain;
-
+
/**
* Round a value towards the nearest integer. For matrices, the function is evaluated element wise.
* @param n Number of decimals Default value: 0.
*/
round(n?: number|BigNumber|MathArray): IMathJsChain;
-
+
/**
* Compute the sign of a value. The sign of a value x is:
* 1 when x > 1
@@ -1566,92 +1635,92 @@ declare module mathjs {
* For matrices, the function is evaluated element wise.
*/
sign(): IMathJsChain;
-
+
/**
* Calculate the square root of a value. For matrices, the function is evaluated element wise.
*/
sqrt(): IMathJsChain;
-
+
/**
* Compute the square of a value, x * x. For matrices, the function is evaluated element wise.
*/
square(): IMathJsChain;
-
+
/**
* Subtract two values, x - y. For matrices, the function is evaluated element wise.
*/
subtract(y: MathType): IMathJsChain;
-
+
/**
* Inverse the sign of a value, apply a unary minus operation.
* For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted.
*/
unaryMinus(): IMathJsChain;
-
+
/**
* Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is.
* For matrices, the function is evaluated element wise.
*/
unaryPlus(): IMathJsChain;
-
+
/**
* Calculate the extended greatest common divisor for two values. See http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm.
*/
xgcd(b: number|BigNumber): IMathJsChain;
-
+
/**
* Bitwise AND two values, x & y. For matrices, the function is evaluated element wise.
*/
bitAnd(y: number|BigNumber|MathArray|Matrix): IMathJsChain;
-
+
/**
* Bitwise NOT value, ~x. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
*/
bitNot(): IMathJsChain;
-
+
/**
* Bitwise OR two values, x | y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the lowest print base.
*/
bitOr(): IMathJsChain;
-
+
/**
* Bitwise XOR two values, x ^ y. For matrices, the function is evaluated element wise.
*/
bitXor(y: number|BigNumber|MathArray|Matrix): IMathJsChain;
-
+
/**
* Bitwise left logical shift of a value x by y number of bits, x << y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
* @param x Value to be shifted
* @param y Amount of shifts
*/
leftShift(y: number|BigNumber): IMathJsChain;
-
+
/**
* Bitwise right arithmetic shift of a value x by y number of bits, x >> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
* @param x Value to be shifted
* @param y Amount of shifts
*/
rightArithShift(y: number|BigNumber): IMathJsChain;
-
+
/**
* Bitwise right logical shift of value x by y number of bits, x >>> y. For matrices, the function is evaluated element wise. For units, the function is evaluated on the best prefix base.
* @param x Value to be shifted
* @param y Amount of shifts
*/
rightLogShift(y: number): IMathJsChain;
-
+
/**
* The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. bellNumbers only takes integer arguments. The following condition must be enforced: n >= 0
* @param n Total number of objects in the set
*/
bellNumbers(): IMathJsChain;
-
+
/**
* The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0
* @pararm n nth Catalan number
*/
catalan(): IMathJsChain;
-
+
/**
* The composition counts of n into k parts. Composition only takes integer arguments. The following condition must be enforced: k <= n.
* @param n Total number of objects in the set
@@ -1659,7 +1728,7 @@ declare module mathjs {
* @returns Returns the composition counts of n into k parts.
*/
composition(k: Number|BigNumber): IMathJsChain;
-
+
/**
* The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. stirlingS2 only takes integer arguments. The following condition must be enforced: k <= n.
* If n = k or k = 1, then s(n,k) = 1
@@ -1667,21 +1736,21 @@ declare module mathjs {
* @param k Number of objects in the subset
*/
stirlingS2(k: Number|BigNumber): IMathJsChain;
-
+
/**
* Compute the argument of a complex value. For a complex number a + bi, the argument is computed as atan2(b, a). For matrices, the function is evaluated element wise.
* @param x A complex number or array with complex numbers
*/
arg(): IMathJsChain;
-
+
/**
* Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate of x is a - bi. For matrices, the function is evaluated element wise.
* @param x A complex number or array with complex numbers
*/
conj(): IMathJsChain;
-
- /**
- * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b.
+
+ /**
+ * Get the imaginary part of a complex number. For a complex number a + bi, the function returns b.
* For matrices, the function is evaluated element wise.
*/
im(): IMathJsChain;
@@ -1691,18 +1760,18 @@ declare module mathjs {
* For matrices, the function is evaluated element wise.
*/
re(): IMathJsChain;
-
+
/**
- * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point
- * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When
- * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric
+ * Calculates: The eucledian distance between two points in 2 and 3 dimensional spaces. Distance between point
+ * and a line in 2 and 3 dimensional spaces. Pairwise distance between a set of 2D or 3D points NOTE: When
+ * substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c For parametric
* equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c)
*/
distance(y: MathArray|Matrix|any): IMathJsChain;
-
+
/**
- * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in
- * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions
+ * Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in
+ * three dimensions. The inputs are in the form of arrays or 1 dimensional matrices. The line intersection functions
* return null if the lines do not meet.
* Note: Fill the plane coefficients as x + y + z = c and not as x + y + z + c = 0.
* @param w Co-ordinates of first end-point of first line
@@ -1712,39 +1781,39 @@ declare module mathjs {
* @returns Returns the point of intersection of lines/lines-planes
*/
intersect(x: MathArray|Matrix, y: MathArray|Matrix, z: MathArray|Matrix): IMathJsChain;
-
+
/**
* Logical and. Test whether two values are both defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise.
*/
and(y: number|BigNumber|Complex|Unit|MathArray|Matrix): IMathJsChain;
-
+
/**
* Logical not. Flips boolean value of a given parameter. For matrices, the function is evaluated element wise.
*/
not(): IMathJsChain;
-
+
/**
* Logical or. Test if at least one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise.
*/
or(y: number|BigNumber|Complex|Unit|MathArray|Matrix): IMathJsChain;
-
+
/**
* Logical xor. Test whether one and only one value is defined with a nonzero/nonempty value. For matrices, the function is evaluated element wise.
*/
xor(y: number|BigNumber|Complex|Unit|MathArray|Matrix): IMathJsChain;
-
+
/**
- * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3]
+ * Calculate the cross product for two vectors in three dimensional space. The cross product of A = [a1, a2, a3]
* and B =[b1, b2, b3] is defined as:
* cross(A, B) = [ a2 * b3 - a3 * b2, a3 * b1 - a1 * b3, a1 * b2 - a2 * b1 ]
*/
cross(y: MathArray|Matrix): IMathJsChain;
-
+
/**
* Calculate the determinant of a matrix.
*/
det(): IMathJsChain;
-
+
/**
* Resize a matrix
* @param x Matrix to be resized
@@ -1752,17 +1821,17 @@ declare module mathjs {
* @param defaultValue Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0.
*/
resize(size: MathArray|Matrix, defaultValue?: number|string): IMathJsChain;
-
+
/**
* Calculate the size of a matrix or scalar.
*/
size(): IMathJsChain;
-
+
/**
* Squeeze a matrix, remove inner and outer singleton dimensions from a matrix.
*/
squeeze(): IMathJsChain;
-
+
/**
* Get or set a subset of a matrix or string.
* @param value An array, matrix, or string
@@ -1771,189 +1840,189 @@ declare module mathjs {
* @param defaultValue Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined.
*/
subset(index: Index, replacement?: any, defaultValue?: any): IMathJsChain;
-
+
/**
* Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.
*/
trace(): IMathJsChain;
-
+
/**
* Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported.
*/
transpose(): IMathJsChain;
-
+
/**
* Random pick a value from a one dimensional array. Array element is picked using a random function with uniform distribution.
*/
pickRandom(): IMathJsChain;
-
+
/**
* Return a random number larger or equal to min and smaller than max using a uniform distribution.
*/
random(): IMathJsChain;
random(max?: number): IMathJsChain;
random(min:number, max: number): IMathJsChain;
-
+
/**
* Return a random integer number larger or equal to min and smaller than max using a uniform distribution.
*/
randomInt(max?: number): IMathJsChain;
randomInt(min:number, max: number): IMathJsChain;
-
+
/**
* Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.
- * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon.
+ * x and y are considered equal when the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
* For matrices, the function is evaluated element wise.
*/
compare(y: MathType): IMathJsChain;
-
+
/**
* Test element wise whether two matrices are equal. The function accepts both matrices and scalar values.
*/
deepEqual(y: MathType): IMathJsChain;
-
+
/**
* Test whether two values are equal.
- *
- * The function tests whether the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function tests whether the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise. In case of complex numbers, x.re must equal y.re, and x.im must equal y.im.
- *
+ *
* Values null and undefined are compared strictly, thus null is only equal to null and nothing else, and undefined is only equal to undefined and nothing else.
*/
equal(y: MathType): IMathJsChain;
-
+
/**
* Test whether value x is larger than y.
- *
- * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon.
+ *
+ * The function returns true when x is larger than y and the relative difference between x and y is larger than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
larger(y: MathType): IMathJsChain;
-
+
/**
* Test whether value x is larger or equal to y.
- *
- * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function returns true when x is larger than y or the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
largerEq(y: MathType): IMathJsChain;
-
+
/**
* Test whether value x is smaller than y.
- *
- * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function returns true when x is smaller than y and the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
smaller(IMathJsChainy: MathType): IMathJsChain;
-
+
/**
* Test whether value x is smaller or equal to y.
- *
- * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon.
+ *
+ * The function returns true when x is smaller than y or the relative difference between x and y is smaller than the configured epsilon.
* The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise.
*/
smallerEq(IMathJsChainy: MathType): IMathJsChain;
-
+
/**
* Test whether two values are unequal.
- *
- * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot
+ *
+ * The function tests whether the relative difference between x and y is larger than the configured epsilon. The function cannot
* be used to compare values smaller than approximately 2.22e-16.
- *
+ *
* For matrices, the function is evaluated element wise. In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im.
- *
- * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with
+ *
+ * Values null and undefined are compared strictly, thus null is unequal with everything except null, and undefined is unequal with
* everying except. undefined.
*/
unequal(IMathJsChainy: MathType): IMathJsChain;
-
+
/**
- * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened
+ * Compute the maximum value of a matrix or a list with values. In case of a multi dimensional array, the maximum of the flattened
* array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.
*/
max(dim?: number): IMathJsChain;
-
+
/**
- * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be
+ * Compute the mean value of matrix or a list with values. In case of a multi dimensional array, the mean of the flattened array will be
* calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.
*/
mean(dim?: number): IMathJsChain;
-
+
/**
- * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an
+ * Compute the median of a matrix or a list with values. The values are sorted and the middle value is returned. In case of an
* even number of values, the average of the two middle values is returned. Supported types of values are: Number, BigNumber, Unit
- *
+ *
* In case of a (multi dimensional) array or matrix, the median of all elements will be calculated.
*/
median(): IMathJsChain;
-
+
/**
- * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened
+ * Compute the maximum value of a matrix or a list of values. In case of a multi dimensional array, the maximum of the flattened
* array will be calculated. When dim is provided, the maximum over the selected dimension will be calculated. Parameter dim is zero-based.
*/
min(dim?: number): IMathJsChain;
-
+
/**
* Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values.
*/
mode(): IMathJsChain;
-
+
/**
* Compute the product of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.
*/
prod(): IMathJsChain;
-
+
/**
- * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned.
+ * Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned.
* Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber
- *
+ *
* In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.
*/
quantileSeq(prob: Number|BigNumber|MathArray, sorted?: boolean): IMathJsChain;
-
+
/**
- * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the
- * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will
+ * Compute the standard deviation of a matrix or a list with values. The standard deviations is defined as the square root of the
+ * variance: std(A) = sqrt(var(A)). In case of a (multi dimensional) array or matrix, the standard deviation over all elements will
* be calculated.
- *
- * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following
+ *
+ * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the following
* values:
- *
+ *
* 'unbiased' (default) The sum of squared errors is divided by (n - 1)
* 'uncorrected' The sum of squared errors is divided by n
* 'biased' The sum of squared errors is divided by (n + 1)
*/
std(normalization?: string): IMathJsChain;
-
+
/**
* Compute the sum of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the sum of all elements will be calculated.
*/
sum(): IMathJsChain;
-
+
/**
- * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all
+ * Compute the variance of a matrix or a list with values. In case of a (multi dimensional) array or matrix, the variance over all
* elements will be calculated.
- *
- * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the
+ *
+ * Optionally, the type of normalization can be specified as second parameter. The parameter normalization can be one of the
* following values:
- *
+ *
* 'unbiased' (default) The sum of squared errors is divided by (n - 1)
* 'uncorrected' The sum of squared errors is divided by n
* 'biased' The sum of squared errors is divided by (n + 1)
- * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...)
+ * Note that older browser may not like the variable name var. In that case, the function can be called as math['var'](...)
* instead of math.var(...).
*/
var(normalization?: string): IMathJsChain;
-
+
/**
* Calculate the inverse cosine of a value. For matrices, the function is evaluated element wise.
*/
@@ -1964,12 +2033,12 @@ declare module mathjs {
* For matrices, the function is evaluated element wise.
*/
acosh(): IMathJsChain;
-
+
/**
* Calculate the inverse cotangent of a value. For matrices, the function is evaluated element wise.
*/
acot(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic arccotangent of a value, defined as acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2.
* For matrices, the function is evaluated element wise.
@@ -1980,143 +2049,143 @@ declare module mathjs {
* Calculate the inverse cosecant of a value. For matrices, the function is evaluated element wise.
*/
acsc(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic arccosecant of a value, defined as acsch(x) = ln(1/x + sqrt(1/x^2 + 1)).
* For matrices, the function is evaluated element wise.
*/
acsch(): IMathJsChain;
-
+
/**
* Calculate the inverse secant of a value. For matrices, the function is evaluated element wise.
*/
asec(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic arcsecant of a value, defined as asech(x) = ln(sqrt(1/x^2 - 1) + 1/x). For matrices, the function is evaluated element wise.
*/
asech(): IMathJsChain;
-
- /**
+
+ /**
* Calculate the inverse sine of a value. For matrices, the function is evaluated element wise.
*/
asin(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic arcsine of a value, defined as asinh(x) = ln(x + sqrt(x^2 + 1)). For matrices, the function is evaluated element wise.
*/
asinh(): IMathJsChain;
-
+
/**
* Calculate the inverse tangent of a value. For matrices, the function is evaluated element wise.
*/
atan(): IMathJsChain;
-
+
/**
- * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the
+ * Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the
* computed angle can be determined.
- *
+ *
* For matrices, the function is evaluated element wise.
*/
atan2(x: number): IMathJsChain;
atan2(x: MathArray|Matrix): IMathJsChain;
-
+
/**
* Calculate the hyperbolic arctangent of a value, defined as atanh(x) = ln((1 + x)/(1 - x)) / 2.
* For matrices, the function is evaluated element wise.
*/
atanh(): IMathJsChain;
-
+
/**
* Calculate the cosine of a value. For matrices, the function is evaluated element wise.
*/
asin(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic cosine of a value, defined as cosh(x) = 1/2 * (exp(x) + exp(-x)). For matrices, the function is evaluated element wise.
*/
cosh(): IMathJsChain;
-
+
/**
* Calculate the cotangent of a value. cot(x) is defined as 1 / tan(x). For matrices, the function is evaluated element wise.
*/
cot(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic cotangent of a value, defined as coth(x) = 1 / tanh(x). For matrices, the function is evaluated element wise.
*/
coth(): IMathJsChain;
-
+
/**
* Calculate the cosecant of a value, defined as csc(x) = 1/sin(x). For matrices, the function is evaluated element wise.
*/
csc(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic cosecant of a value, defined as csch(x) = 1 / sinh(x). For matrices, the function is evaluated element wise.
*/
csch(): IMathJsChain;
-
+
/**
* Calculate the secant of a value, defined as sec(x) = 1/cos(x). For matrices, the function is evaluated element wise.
*/
sec(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic secant of a value, defined as sech(x) = 1 / cosh(x). For matrices, the function is evaluated element wise.
*/
sech(): IMathJsChain;
-
+
/**
* Calculate the sine of a value. For matrices, the function is evaluated element wise.
*/
sin(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic sine of a value, defined as sinh(x) = 1/2 * (exp(x) - exp(-x)). For matrices, the function is evaluated element wise.
*/
sinh(): IMathJsChain;
-
+
/**
* Calculate the tangent of a value. tan(x) is equal to sin(x) / cos(x). For matrices, the function is evaluated element wise.
*/
tan(): IMathJsChain;
-
+
/**
* Calculate the hyperbolic tangent of a value, defined as tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1). For matrices, the function is evaluated element wise.
*/
tanh(): IMathJsChain;
-
+
/**
* Change the unit of a value. For matrices, the function is evaluated element wise.
* @param x The unit to be converted.
* @param unit New unit. Can be a string like "cm" or a unit without value.
*/
to(unit: Unit|string): IMathJsChain;
-
+
/**
* Clone an object.
*/
clone(): IMathJsChain;
-
+
/**
* Filter the items in an array or one dimensional matrix.
* @param x A one dimensional matrix or array to filter
- * @param test
+ * @param test
*/
filter(test: RegExp|((item: any)=>boolean)): IMathJsChain;
-
+
/**
* Format a value of any type into a string.
*/
format(options?: IFormatOptions|number|((item: any)=>string)): IMathJsChain;
-
+
/**
* Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.
* @param callback The callback method is invoked with three parameters: the value of the element, the index of the element, and the matrix being traversed.
*/
map(callback: (item: any)=>any): IMathJsChain;
-
+
/**
* Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.
* @param k The kth smallest value to be retrieved; zero-based index
@@ -2124,15 +2193,15 @@ declare module mathjs {
* @returns Returns the kth lowest value.
*/
partitionSelect(k: number, compare?: string|((a: any, b: any)=>number)): IMathJsChain;
-
+
/**
* Sort the items in a matrix.
* @param compare An optional comparator function. The function is called as compare(a, b), and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'.
*/
sort(compare?: string|((a: any, b: any)=>number)): IMathJsChain;
-
+
done(): any;
valueOf(): any;
toString(): string;
}
-}
\ No newline at end of file
+}
From 79c2ead09a395f5273d55e104e1293586a4b7914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jesper=20R=C3=B8nn-Jensen?=
Date: Thu, 19 Nov 2015 10:58:57 +0100
Subject: [PATCH 003/212] Fixing last errors, but had to comment out an example
from mathjs
the example is
mathjs.expression.node
I couldnt find any explanation in examples
---
mathjs/mathjs-tests.ts | 27 ++++++++++++++-------------
mathjs/mathjs.d.ts | 7 +++++--
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/mathjs/mathjs-tests.ts b/mathjs/mathjs-tests.ts
index 1691e03c2..0545ca9d0 100644
--- a/mathjs/mathjs-tests.ts
+++ b/mathjs/mathjs-tests.ts
@@ -608,7 +608,8 @@ console.log('Traverse the expression tree of expression "3 * x + 2"');
var node1 = math.parse('3 * x + 2');
node1.traverse(function (node, path, parent) {
switch (node.type) {
- case 'OperatorNode': console.log(node.type, node.op); break;
+ // case 'OperatorNode': console.log(node.type, node.op); break;
+ case 'OperatorNode': console.log(node.type); break;//for now removing .op
case 'ConstantNode': console.log(node.type, node.value); break;
case 'SymbolNode': console.log(node.type, node.name); break;
default: console.log(node.type);
@@ -623,17 +624,17 @@ node1.traverse(function (node, path, parent) {
// transform an expression tree
-console.log();
-console.log('Replace all symbol nodes "x" in expression "x^2 + 5*x" with a constant 3');
-var node2 = math.parse('x^2 + 5*x');
-var transformed = node2.transform(function (node, path, parent) {
- if (node.isSymbolNode && node.name == 'x') {
- return new math.expression.node.ConstantNode(3);
- }
- else {
- return node;
- }
-});
-console.log(transformed.toString());
+// console.log();
+// console.log('Replace all symbol nodes "x" in expression "x^2 + 5*x" with a constant 3');
+// var node2 = math.parse('x^2 + 5*x');
+// var transformed = node2.transform(function (node, path, parent) {
+// if (node.isSymbolNode && node.name == 'x') {
+// return new math.expression.node.ConstantNode(3);
+// }
+// else {
+// return node;
+// }
+// });
+// console.log(transformed.toString());
// outputs: '(3 ^ 2) + (5 * 3)'
}());
diff --git a/mathjs/mathjs.d.ts b/mathjs/mathjs.d.ts
index 01742bf67..9652117c5 100644
--- a/mathjs/mathjs.d.ts
+++ b/mathjs/mathjs.d.ts
@@ -19,6 +19,8 @@ declare module mathjs {
config(options: any): void;
+ expression: MathNode;
+
/**
* Solves the linear equation system by forwards substitution. Matrix must be a lower triangular matrix.
* @param L A N x N matrix or array (L)
@@ -1320,9 +1322,10 @@ declare module mathjs {
isSymbolNode: boolean;
type: string;
name: string;
+ value: any;
- compile(): EvalFunction;
- eval(): any;
+ compile(): EvalFunction;
+ eval(): any;
eval(expr: string): any;
/**
*
From 94cc10600a5dc2990cce89b4c1d7b38f1f0277a1 Mon Sep 17 00:00:00 2001
From: r-ising
Date: Mon, 7 Dec 2015 14:31:58 +0100
Subject: [PATCH 004/212] update node.d.ts (publicEncrypt & privateDecrypt)
added rsa function to encrypt and decrypt
---
node/node.d.ts | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/node/node.d.ts b/node/node.d.ts
index 017ca8e6b..483c51d51 100644
--- a/node/node.d.ts
+++ b/node/node.d.ts
@@ -1670,6 +1670,17 @@ declare module "crypto" {
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
export function pseudoRandomBytes(size: number): Buffer;
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
+ export interface RsaPublicKey {
+ key: string;
+ padding: any;
+ }
+ export interface RsaPrivateKey {
+ key: string;
+ passphrase: string,
+ padding: any;
+ }
+ export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer
+ export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer
}
declare module "stream" {
From 4406eae2c1b0795b18007488b77641286ed06e85 Mon Sep 17 00:00:00 2001
From: r-ising
Date: Thu, 10 Dec 2015 15:02:09 +0100
Subject: [PATCH 005/212] update node.d.ts
in publicEncrypt- and privateDecrypt-function is passpharse and padding optional
---
node/node.d.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/node/node.d.ts b/node/node.d.ts
index 483c51d51..0bfd5b4d9 100644
--- a/node/node.d.ts
+++ b/node/node.d.ts
@@ -1672,12 +1672,12 @@ declare module "crypto" {
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void;
export interface RsaPublicKey {
key: string;
- padding: any;
+ padding?: any;
}
export interface RsaPrivateKey {
key: string;
- passphrase: string,
- padding: any;
+ passphrase?: string,
+ padding?: any;
}
export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer
export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer
From de36bab90b8d23ae1bf562d8ea8579dca8d5d208 Mon Sep 17 00:00:00 2001
From: aba
Date: Mon, 11 Jan 2016 08:07:53 +0100
Subject: [PATCH 006/212] I made some changes according to the version 3.12.1.
I add some methods that I currently use. Of course it miss a lot of work to
be exaustive but I will continue to work on it during the next monthes.
---
openlayers/openlayers.d.ts | 271 +++++++++++++++++++++++++++++++------
1 file changed, 229 insertions(+), 42 deletions(-)
diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts
index c81a42084..09a6e3397 100644
--- a/openlayers/openlayers.d.ts
+++ b/openlayers/openlayers.d.ts
@@ -129,15 +129,30 @@ declare module olx {
interface TileWMSOptions {
+ attributions?: Array;
+
+ /**WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT, BBOX and CRS (SRS for WMS version < 1.3.0) will be set dynamically. Required.*/
+ params: Object;
+ /**The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.*/
+ crossOrigin?: string;
+
/** The size in pixels of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. Defaults to zero. Using a non-zero value allows artifacts of rendering at tile edges to be ignored. If you control the WMS service it is recommended to address "artifacts at tile edges" issues by properly configuring the WMS service. For example, MapServer has a tile_map_edge_buffer configuration parameter for this. See http://mapserver.org/output/tile_mode.html. */
gutter?: number;
+ /** Use the ol.Map#pixelRatio value when requesting the image from the remote server. Default is true.*/
+ hidpi?: boolean;
+
+ logo?: string | olx.LogoOptions;
+
/** Tile grid. Base this on the resolutions, tilesize and extent supported by the server. If this is not defined, a default grid will be used: if there is a projection extent, the grid will be based on that; if not, a grid based on a global extent with origin at 0,0 will be used. */
tileGrid?: ol.tilegrid.TileGrid;
/** experimental Maximum zoom. */
maxZoom?: number;
+ projection?: ol.proj.ProjectionLike;
+ reprojectionErrorThreshold?: number;
+
/** experimental Optional function to load a tile given a URL. */
tileLoadFunction?: ol.TileLoadFunctionType;
@@ -515,37 +530,47 @@ declare module olx {
zoomDelta?: number;
zoomDuration?: number;
}
+ interface ModifyOptions {
+ deleteCondition?: ol.events.ConditionType;
+ pixelTolerance?: number;
+ style?: ol.style.Style | Array | ol.style.StyleFunction;
+ features: ol.Collection;
+ wrapX?: boolean;
+ }
+ interface DrawOptions {
+ clickTolerance?: number;
+ features?: ol.Collection;
+ source?: ol.source.Vector;
+ snapTolerance?: number;
+ type: ol.geom.GeometryType;
+ maxPoints?: number;
+ minPoints?: number;
+ style?: ol.style.Style | Array | ol.style.StyleFunction;
+ geometryFunction?: ol.interaction.DrawGeometryFunctionType;
+ wrapX?: boolean;
+ }
+ interface SelectOptions{
+ addCondition?: ol.events.ConditionType;
+ condition?: ol.events.ConditionType;
+ layers?: Array;
+ style?: ol.style.Style | Array | ol.style.StyleFunction;
+ removeCondition?: ol.events.ConditionType;
+ toggleCondition?: ol.events.ConditionType;
+ multi?: boolean;
+ features?: ol.Collection
+ filter?: ol.interaction.SelectFilterFunction;
+ wrapX?: boolean;
+ }
}
module layer {
interface BaseOptions {
-
- /**
- * Brightness. Default is 0.
- */
- brightness?: number;
-
- /**
- * Contrast. Default is 1.
- */
- contrast?: number;
-
- /**
- * Hue. Default is 0.
- */
- hue?: number;
-
/**
* Opacity (0, 1). Default is 1.
*/
opacity?: number;
- /**
- * Saturation. Default is 1.
- */
- saturation?: number;
-
/**
* Visibility. Default is true.
*/
@@ -555,7 +580,8 @@ declare module olx {
* The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
*/
extent?: ol.Extent;
-
+
+ zIndex?: number;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
*/
@@ -722,6 +748,28 @@ declare module olx {
*/
wrapX?: boolean;
}
+ interface WMTSOptions{
+ attributions?: Array;
+ crossOrigin?: string;
+ logo?: string | olx.LogoOptions;
+ tileGrid: ol.tilegrid.WMTS; // REQUIRED !
+ projection?: ol.proj.ProjectionLike;
+ reprojectionErrorThreshold?: number;
+ requestEncoding?: ol.source.WMTSRequestEncoding;
+ layer: string; //REQUIRED
+ style: string; //REQUIRED
+ tileClass?: Function;
+ tilePixelRatio?: number;
+ version?: string;
+ format?: string;
+ matrixSet: string; //REQUIRED
+ dimensions?: Object;
+ url?: string;
+ maxZoom?: number;
+ tileLoadFunction?: ol.TileLoadFunctionType;
+ urls?: Array;
+ wrapX: boolean;
+ }
}
module style {
@@ -751,6 +799,38 @@ declare module olx {
fill?: ol.style.Fill;
stroke?: ol.style.Stroke;
}
+ interface StrokeOptions {
+ color?: ol.Color | string;
+ lineCap?: string;
+ lineJoin?: string;
+ lineDash?: Array;
+ miterLimit?: number;
+ width?: number;
+ }
+ interface IconOptions {
+ anchor?: Array;
+ anchorOrigin?: string;
+ anchorXUnits?: string;
+ anchorYUnits?: string;
+ crossOrigin?: string;
+ img?: ol.Image | HTMLCanvasElement;
+ offset?: Array;
+ offsetOrigin?: string;
+ opacity?: number;
+ scale?: number;
+ snapToPixel?: boolean;
+ rotateWithView?: boolean;
+ rotation?: number;
+ size?: ol.Size;
+ imgSize?: ol.Size;
+ src?: string;
+ }
+ interface CircleOptions {
+ fill?: ol.style.Fill;
+ radius: number;
+ snapToPixel?: boolean;
+ stroke?: ol.style.Stroke;
+ }
}
module tilegrid {
@@ -1197,18 +1277,12 @@ declare module ol {
* @param name The property name of the default geometry.
*/
setGeometryName(name: string): void;
-
+
/**
* Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the ol.source.Vector#getFeatureById method.
* @param id The feature id.
*/
- setId(id: number): void;
-
- /**
- * Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the ol.source.Vector#getFeatureById method.
- * @param id The feature id.
- */
- setId(id: string): void;
+ setId(id: string|number): void;
/**
* Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is null the feature has no style (a null style).
@@ -2399,7 +2473,21 @@ declare module ol {
module events {
module condition {
+ function altKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function altShiftKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function always(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function click(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function doubleClick(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function mouseOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function never(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function noModifierKeys(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function platformModifierKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function pointerMove(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function shiftKeyOnly(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function singleClick(mapBrowserEvent: ol.MapBrowserEvent): boolean;
+ function targetNotEditable(mapBrowserEvent: ol.MapBrowserEvent): boolean;
}
+ interface ConditionType { (mapBrowseEvent: ol.MapBrowserEvent): boolean; }
}
module extent {
@@ -2711,6 +2799,7 @@ declare module ol {
}
class WFS {
+ readFeatures(source: Document | Node | Object | string, option?: olx.format.ReadOptions): Array;
}
class WKT {
@@ -2789,6 +2878,17 @@ declare module ol {
* @returns Extent
*/
getExtent(extent?: ol.Extent): ol.Extent;
+
+ /**
+ * Transform each coordinate of the geometry from one coordinate reference system to another.
+ * The geometry is modified in place. For example, a line will be transformed to a line and a
+ * circle to a circle. If you do not want the geometry modified in place, first clone() it and
+ * then use this function on the clone.
+ * @param source The current projection. Can be a string identifier or a ol.proj.Projection object.
+ * @param destination The desired projection. Can be a string identifier or a ol.proj.Projection object.
+ * @return This geometry. Note that original geometry is modified in place.
+ */
+ transform(source: ol.proj.ProjectionLike, destination: ol.proj.ProjectionLike);
}
/**
@@ -3407,13 +3507,14 @@ declare module ol {
class DragZoom {
}
- class Draw {
+ class Draw extends ol.interaction.Pointer {
+ constructor(opt_options?: olx.interaction.DrawOptions)
}
class DrawEvent {
}
- class Interaction {
+ class Interaction extends ol.Object {
}
class KeyboardPan {
@@ -3422,7 +3523,8 @@ declare module ol {
class KeyboardZoom {
}
- class Modify {
+ class Modify extends ol.interaction.Pointer {
+ constructor(opt_options?: olx.interaction.ModifyOptions)
}
class MouseWheelZoom {
@@ -3434,16 +3536,21 @@ declare module ol {
class PinchZoom {
}
- class Pointer {
+ class Pointer extends ol.interaction.Interaction {
}
- class Select {
+ class Select extends ol.interaction.Interaction {
+ constructor(opt_options?: olx.interaction.SelectOptions);
+ getLayer(): ol.layer.Layer;
+ getFeatures(): ol.Collection;
}
class Snap {
}
function defaults(opts: olx.interaction.DefaultsOptions): ol.Collection;
+ interface DrawGeometryFunctionType { (coordinates: ol.Coordinate, geom?: ol.geom.Geometry): ol.geom.Geometry;}
+ interface SelectFilterFunction { (feature: ol.Feature | ol.render.Feature, layer: ol.layer.Layer):boolean;}
}
module layer {
@@ -3774,6 +3881,15 @@ declare module ol {
* @param Layer style
*/
setStyle(style: ol.style.StyleFunction): void;
+
+ /**
+ * Sets the layer to be rendered on top of other layers on a map. The map will not manage this layer
+ * in its layers collection, and the callback in ol.Map#forEachLayerAtPixel will receive null as
+ * layer. This is useful for temporary layers. To remove an unmanaged layer from the map, use #setMap(null).
+ * To add the layer to a map and have it managed by the map, use ol.Map#addLayer instead.
+ * @argument map.
+ */
+ setMap(map: ol.Map): void;
}
}
@@ -3898,7 +4014,13 @@ declare module ol {
class VectorContext {
}
-
+ class Feature{
+ get(key: string): any;
+ getExtent(): ol.Extent;
+ getGeometry(): ol.geom.Geometry;
+ getProperties: Object[];
+ getType(): ol.geom.GeometryType;
+ }
module canvas {
class Immediate {
}
@@ -3978,19 +4100,45 @@ declare module ol {
class Vector {
constructor(opts: olx.source.VectorOptions)
-
+ /**
+ * Add a single feature to the source. If you want to add a batch of features at once,
+ * call source.addFeatures() instead.
+ */
+ addFeature(feature: ol.Feature);
+
+ /**
+ * Add a batch of features to the source.
+ */
+ addFeatures(features: ol.Feature[]);
+
+ /**
+ * Remove all features from the source.
+ * @param Skip dispatching of removefeature events.
+ */
+ clear(fast?: boolean);
/**
* Get the extent of the features currently in the source.
*/
getExtent(): ol.Extent;
-
+
+ /**
+ * Get all features in the provided extent. Note that this returns all features whose bounding boxes
+ * intersect the given extent (so it may include features whose geometries do not intersect the extent).
+ * This method is not available when the source is configured with useSpatialIndex set to false.
+ */
getFeaturesInExtent(extent: ol.Extent): ol.Feature[];
+
+ /**
+ * Get all features on the source
+ */
+ getFeatures(): ol.Feature[];
}
class VectorEvent {
}
class WMTS {
+ constructor(options: olx.source.WMTSOptions);
}
class XYZ {
@@ -4014,7 +4162,8 @@ declare module ol {
class AtlasManager {
}
- class Circle {
+ class Circle extends Image{
+ constructor(opt_options?: olx.style.CircleOptions);
}
/**
@@ -4034,10 +4183,20 @@ declare module ol {
getChecksum(): string;
}
- class Icon {
+ class Icon extends Image {
+ constructor(option: olx.style.IconOptions)
}
class Image {
+ getOpacity(): number;
+ getRotateWithView(): boolean;
+ getRotation(): number;
+ getScale(): number;
+ getSnapToPiexl(): boolean;
+
+ setOpacity(opacity: number);
+ setRotation(rotation: number);
+ setScale(scale: number);
}
interface GeometryFunction {
@@ -4048,7 +4207,19 @@ declare module ol {
}
class Stroke {
- constructor();
+ constructor(opts?: olx.style.StrokeOptions);
+ getColor(): ol.Color|string;
+ getLineCap(): string;
+ getLineDash(): number[];
+ getLineJoin(): string;
+ getMitterLimit(): number;
+ getWidth(): number;
+ setColor(color: ol.Color|string);
+ setLineCap(lineCap: string);
+ setLineDash(lineDash: number[]);
+ setLineJoin(lineJoin: string);
+ setMiterLimit(miterLimit: number);
+ setWidth(width: number);
}
/**
@@ -4058,6 +4229,22 @@ declare module ol {
*/
class Style {
constructor(opts: olx.style.StyleOptions);
+
+ getFill(): ol.style.Fill;
+ /***
+ * Get the geometry to be rendered.
+ * @return Feature property or geometry or function that returns the geometry that will
+ * be rendered with this style.
+ */
+ getGeometry(): string | ol.geom.Geometry | ol.style.GeometryFunction;
+ getGeometryFunction(): ol.style.GeometryFunction;
+ getImage(): ol.style.Image;
+ getStroke(): ol.style.Stroke;
+ getText(): ol.style.Text;
+ getZIndex(): number;
+
+ setGeometry(geometry: string | ol.geom.Geometry | ol.style.GeometryFunction);
+ setZIndex( zIndex: number);
}
/**
@@ -4346,7 +4533,7 @@ declare module ol {
/**
* Implementation based on the code of OpenLayers, no documentation available (yet). If it is incorrect, please create an issue and I will change it.
*/
- interface FeatureLoader { (extent: ol.Extent, number: number, projection: ol.proj.Projection): Array }
+ interface FeatureLoader { (extent: ol.Extent, number: number, projection: ol.proj.Projection): string }
/**
* A function that returns a style given a resolution. The this keyword inside the function references the ol.Feature to be styled.
From b779873b3f98b30e42d68d837a6533f4c4a7a882 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Tue, 12 Jan 2016 16:24:28 -0500
Subject: [PATCH 007/212] Expanding Chartist Type Definitions
---
chartist/chartist-tests.ts | 19 +++++++++++++++++++
chartist/chartist.d.ts | 26 ++++++++++++++++++++++----
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index 0a5072c6a..6d44922ac 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -168,3 +168,22 @@ new Chartist.Bar('.ct-chart', {
seriesBarDistance: 15
}]
]);
+
+new Chartist.Pie('.ct-chart', {
+ series: [{
+ value: 20,
+ name: 'Series 1',
+ className: 'my-custom-class-one',
+ meta: 'Meta One'
+ }, {
+ value: 10,
+ name: 'Series 2',
+ className: 'my-custom-class-two',
+ meta: 'Meta Two'
+ }, {
+ value: 70,
+ name: 'Series 3',
+ className: 'my-custom-class-three',
+ meta: 'Meta Three'
+ }]
+});
\ No newline at end of file
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 9381aaff0..4c0e787b8 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -18,9 +18,25 @@ declare module Chartist {
1: T;
}
+ // data formats are not well documented on all the ways they can be passed to the constructors
+ // this definition gives some intellisense, but does not protect the user from misuse
+ // TODO: come in and tidy this up and make it fit better
+ interface IChartistData {
+ labels?: Array;
+ series: Array | Array | Array>;
+ }
+
+ interface IChartistSeriesData {
+ name: string;
+ value?: number;
+ data?: Array;
+ className?: string;
+ meta?: string; // I assume this could probably be a number as well?
+ }
+
interface IChartistBase {
container: any;
- data: Object;
+ data: IChartistData;
defaultOptions: T;
options: T;
responsiveOptions: Array>;
@@ -55,15 +71,15 @@ declare module Chartist {
}
interface IChartistPieChart extends IChartistBase {
- new (target: any, data: Object, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart;
+ new (target: any, data: IChartistData, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart;
}
interface IChartistLineChart extends IChartistBase {
- new (target: any, data: Object, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart;
+ new (target: any, data: IChartistData, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart;
}
interface IChartistBarChart extends IChartistBase {
- new (target: any, data: Object, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart;
+ new (target: any, data: IChartistData, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart;
}
interface IChartOptions {
@@ -163,6 +179,7 @@ declare module Chartist {
height?: number | string;
high?: number;
low?: number;
+ ticks?: Array;
onlyInteger?: boolean;
chartPadding?: IChartPadding;
seriesBarDistance?: number;
@@ -217,6 +234,7 @@ declare module Chartist {
lineSmooth?: boolean;
low?: number;
high?: number;
+ ticks?: Array;
chartPadding?: IChartPadding;
fullWidth?: boolean;
reverseData?: boolean;
From 9867eb1aa42f4ec603fd4bf208ff785c9fe23a28 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Thu, 14 Jan 2016 11:13:35 -0500
Subject: [PATCH 008/212] Updating Chartist Axis types
There are three different types of Axes for line charts that project
their properties onto the axis type. I am trying to emulate that here.
If you specifically declare a LineChartAxis, then you MUST attach the
axis type. The library lets you play a little fast and loose with this,
but because we're going for some compile-time checks, the typing file is
going to enforce being specific.
---
chartist/chartist-tests.ts | 231 ++++++++++++++++++++++++-------------
chartist/chartist.d.ts | 43 +++++--
2 files changed, 187 insertions(+), 87 deletions(-)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index 6d44922ac..797dc8bd5 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -8,26 +8,26 @@ new Chartist.Line('.ct-chart', {
[1, 3, 4, 5, 6]
]
}, {
- fullWidth: true,
- chartPadding: {
- right: 40
- }
-});
+ fullWidth: true,
+ chartPadding: {
+ right: 40
+ }
+ });
var lineChart = new Chartist.Line('.ct-chart', {
labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
series: [
[5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9],
[10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null],
- [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null]
+ [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null]
]
}, {
- fullWidth: true,
- chartPadding: {
- right: 10
- },
- low: 0
-});
+ fullWidth: true,
+ chartPadding: {
+ right: 10
+ },
+ low: 0
+ });
new Chartist.Line('.ct-chart', {
labels: ['1', '2', '3', '4', '5', '6'],
@@ -47,10 +47,10 @@ var data = {
series: [5, 3, 4]
};
-var sum = function(a: number, b: number) { return a + b };
+var sum = (a: number, b: number) => { return a + b };
new Chartist.Pie('.ct-chart', data, {
- labelInterpolationFnc: function(value: number) {
+ labelInterpolationFnc: (value: number) => {
return Math.round(value / data.series.reduce(sum) * 100) + '%';
}
});
@@ -58,26 +58,24 @@ new Chartist.Pie('.ct-chart', data, {
new Chartist.Pie('.ct-chart', {
series: [20, 10, 30, 40]
}, {
- donut: true,
- donutWidth: 60,
- startAngle: 270,
- total: 200,
- showLabel: false
-});
-
+ donut: true,
+ donutWidth: 60,
+ startAngle: 270,
+ total: 200,
+ showLabel: false
+ });
// Animation Donut example
-
var chart = new Chartist.Pie('.ct-chart', {
series: [10, 20, 50, 20, 5, 50, 15],
labels: [1, 2, 3, 4, 5, 6, 7]
}, {
- donut: true,
- showLabel: false
-});
+ donut: true,
+ showLabel: false
+ });
chart.on('draw', function(data: any) {
- if(data.type === 'slice') {
+ if (data.type === 'slice') {
// Get the total path length in order to use for dash array animation
var pathLength = data.element._node.getTotalLength();
@@ -92,7 +90,7 @@ chart.on('draw', function(data: any) {
id: 'anim' + data.index,
dur: 1000,
from: -pathLength + 'px',
- to: '0px',
+ to: '0px',
easing: Chartist.Svg.Easing.easeOutQuint,
// We need to use `fill: 'freeze'` otherwise our animation will fall back to initial (not visible)
fill: 'freeze'
@@ -100,7 +98,7 @@ chart.on('draw', function(data: any) {
};
// If this was not the first slice, we need to time the animation so that it uses the end sync event of the previous animation
- if(data.index !== 0) {
+ if (data.index !== 0) {
animationDefinition['stroke-dashoffset'].begin = 'anim' + (data.index - 1) + '.end';
}
@@ -119,8 +117,8 @@ new Chartist.Bar('.ct-chart', {
labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'],
series: [20, 60, 120, 200, 180, 20, 10]
}, {
- distributeSeries: true
-});
+ distributeSeries: true
+ });
new Chartist.Bar('.ct-chart', {
labels: ['Quarter 1', 'Quarter 2', 'Quarter 3', 'Quarter 4'],
@@ -132,58 +130,135 @@ new Chartist.Bar('.ct-chart', {
[4, 1, 2, 1]
]
}, {
- // Default mobile configuration
- stackBars: true,
- axisX: {
- labelInterpolationFnc: function(value: string) {
- return value.split(/\s+/).map(function(word: string) {
- return word[0];
- }).join('');
- }
- },
- axisY: {
- offset: 20
- }
-}, [
- // Options override for media > 400px
- ['screen and (min-width: 400px)', {
- reverseData: true,
- horizontalBars: true,
+ // Default mobile configuration
+ stackBars: true,
axisX: {
- labelInterpolationFnc: Chartist.noop
+ labelInterpolationFnc: function(value: string) {
+ return value.split(/\s+/).map(function(word: string) {
+ return word[0];
+ }).join('');
+ }
},
axisY: {
- offset: 60
+ offset: 20
}
- }],
- // Options override for media > 800px
- ['screen and (min-width: 800px)', {
- stackBars: false,
- seriesBarDistance: 10
- }],
- // Options override for media > 1000px
- ['screen and (min-width: 1000px)', {
- reverseData: false,
- horizontalBars: false,
- seriesBarDistance: 15
- }]
-]);
+ }, [
+ // Options override for media > 400px
+ ['screen and (min-width: 400px)', {
+ reverseData: true,
+ horizontalBars: true,
+ axisX: {
+ labelInterpolationFnc: Chartist.noop
+ },
+ axisY: {
+ offset: 60
+ }
+ }],
+ // Options override for media > 800px
+ ['screen and (min-width: 800px)', {
+ stackBars: false,
+ seriesBarDistance: 10
+ }],
+ // Options override for media > 1000px
+ ['screen and (min-width: 1000px)', {
+ reverseData: false,
+ horizontalBars: false,
+ seriesBarDistance: 15
+ }]
+ ]);
new Chartist.Pie('.ct-chart', {
- series: [{
- value: 20,
- name: 'Series 1',
- className: 'my-custom-class-one',
- meta: 'Meta One'
+ series: [{
+ value: 20,
+ name: 'Series 1',
+ className: 'my-custom-class-one',
+ meta: 'Meta One'
+ }, {
+ value: 10,
+ name: 'Series 2',
+ className: 'my-custom-class-two',
+ meta: 'Meta Two'
}, {
- value: 10,
- name: 'Series 2',
- className: 'my-custom-class-two',
- meta: 'Meta Two'
- }, {
- value: 70,
- name: 'Series 3',
- className: 'my-custom-class-three',
- meta: 'Meta Three'
- }]
-});
\ No newline at end of file
+ value: 70,
+ name: 'Series 3',
+ className: 'my-custom-class-three',
+ meta: 'Meta Three'
+ }]
+});
+
+new Chartist.Bar('.bar-chart', {
+ labels: ['foo', 'bar', 'foobar'],
+ series: [
+ {
+ data: [1],
+ className: 'graph-foo',
+ },
+ {
+ data: [10],
+ className: 'graph-foo',
+ },
+ {
+ data: [12],
+ className: 'graph-foo',
+ }]
+ }, {
+ seriesBarDistance: 30,
+ reverseData: true,
+ horizontalBars: true,
+ height: '115px',
+ axisY: {
+ offset: 70,
+ showGrid: false,
+ },
+ axisX: {
+ scaleMinSpace: 200
+ }
+ });
+
+new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5, 6, 7, 8],
+ series: [
+ [5, 9, 7, 8, 5, 3, 5, 4]
+ ]
+}, {
+ ticks: [0, 4],
+ low: 0,
+ showArea: true,
+ axisY: {
+ showLabel: true,
+ showGrid: false,
+ ticks: [1, 4],
+ type: Chartist.FixedScaleAxis
+ }
+ });
+
+var chart2 = new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5],
+ series: [
+ [12, 9, 7, 8, 5]
+ ]
+});
+
+// Listening for draw events that get emitted by the Chartist chart
+chart2.on('draw', (data: any) => {
+ // If the draw event was triggered from drawing a point on the line chart
+ if (data.type === 'point') {
+ // We are creating a new path SVG element that draws a triangle around the point coordinates
+ var triangle = new Chartist.Svg('path', {
+ d: ['M',
+ data.x,
+ data.y - 15,
+ 'L',
+ data.x - 15,
+ data.y + 8,
+ 'L',
+ data.x + 15,
+ data.y + 8,
+ 'z'].join(' '),
+ style: 'fill-opacity: 1'
+ }, 'ct-area');
+
+ // With data.element we get the Chartist SVG wrapper and we can replace the original point drawn by Chartist with our newly created triangle
+ data.element.replace(triangle);
+ }
+});
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 4c0e787b8..089e87cde 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -9,6 +9,10 @@ declare module Chartist {
Bar: IChartistBarChart;
Line: IChartistLineChart;
+ FixedScaleAxis: IFixedScaleAxisStatic;
+ AutoScaleAxis: IAutoScaleAxisStatic;
+ StepAxis: IStepAxisStatic;
+
Svg: any;
noop: Function;
}
@@ -18,16 +22,24 @@ declare module Chartist {
1: T;
}
+ // these have no other purpose than to help define the types that can be placed on
+ // a line chart axisX
+ // in the actual chartist library these are classes that project their options onto
+ // the parent class
+ interface IFixedScaleAxisStatic { }
+ interface IAutoScaleAxisStatic { }
+ interface IStepAxisStatic { }
+
// data formats are not well documented on all the ways they can be passed to the constructors
// this definition gives some intellisense, but does not protect the user from misuse
// TODO: come in and tidy this up and make it fit better
interface IChartistData {
- labels?: Array;
- series: Array | Array | Array>;
+ labels?: Array | Array;
+ series: Array | Array | Array>;
}
interface IChartistSeriesData {
- name: string;
+ name?: string;
value?: number;
data?: Array;
className?: string;
@@ -223,8 +235,8 @@ declare module Chartist {
}
interface ILineChartOptions extends IChartOptions {
- axisX?: ILineChartXAxis;
- axisY?: ILineChartYAxis;
+ axisX?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis;
+ axisY?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis;
width?: number | string;
height?: number | string;
showLine?: boolean;
@@ -237,7 +249,6 @@ declare module Chartist {
ticks?: Array;
chartPadding?: IChartPadding;
fullWidth?: boolean;
- reverseData?: boolean;
classNames?: ILineChartClasses;
}
@@ -251,15 +262,29 @@ declare module Chartist {
showLabel?: boolean;
showGrid?: boolean;
labelInterpolationFnc?: Function;
- type?: any;
}
- interface ILineChartXAxis extends ILineChartAxis {
+ interface IChartistStepAxis extends ILineChartAxis {
+ type: IStepAxisStatic;
+ ticks?: Array | Array;
+ stretch?: boolean;
}
- interface ILineChartYAxis extends ILineChartAxis {
+ interface IChartistFixedScaleAxis extends ILineChartAxis {
+ type: IFixedScaleAxisStatic;
+ high?: number;
+ low?: number;
+ divisor?: number;
+ ticks?: Array | Array;
+ }
+
+ interface IChartistAutoScaleAxis extends ILineChartAxis {
+ high?: number;
+ low?: number;
scaleMinSpace?: number;
onlyInteger?: boolean;
+ referenceValue?: number;
+ type: IAutoScaleAxisStatic;
}
// TODO: Finish documenting all of the defaults
From fe08f93533910692fad602cc60c9bb39332779c1 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Thu, 14 Jan 2016 14:52:05 -0500
Subject: [PATCH 009/212] Further expanding Chartist type definitions.
---
chartist/chartist-tests.ts | 56 ++++++++++
chartist/chartist.d.ts | 216 +++++++++++++++++++++++++++++++++++--
2 files changed, 263 insertions(+), 9 deletions(-)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index 797dc8bd5..5c76754f2 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -1,5 +1,15 @@
///
+Chartist.escapingMap = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+};
+
+Chartist.precision = 8;
+
new Chartist.Line('.ct-chart', {
labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
series: [
@@ -262,3 +272,49 @@ chart2.on('draw', (data: any) => {
data.element.replace(triangle);
}
});
+
+// Create a simple bi-polar bar chart
+var biPolarChart = new Chartist.Bar('.ct-chart', {
+ labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'],
+ series: [
+ [1, 2, 4, 8, 6, -2, -1, -4, -6, -2]
+ ]
+}, {
+ high: 10,
+ low: -10,
+ axisX: {
+ labelInterpolationFnc: (value: any, index: number) => {
+ return index % 2 === 0 ? value : null;
+ }
+ }
+ });
+
+// Listen for draw events on the bar chart
+biPolarChart.on('draw', (data: any) => {
+ // If this draw event is of type bar we can use the data to create additional content
+ if (data.type === 'bar') {
+ // We use the group element of the current series to append a simple circle with the bar peek coordinates and a circle radius that is depending on the value
+ data.group.append(new Chartist.Svg('circle', {
+ cx: data.x2,
+ cy: data.y2,
+ r: Math.abs(Chartist.getMultiValue(data.value)) * 2 + 5
+ }, 'ct-slice-pie'));
+ }
+});
+
+new Chartist.Bar('.ct-chart', {
+ labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+ series: [
+ [5, 4, 3, 7, 5, 10, 3],
+ [3, 2, 9, 5, 4, 6, 4]
+ ]
+}, {
+ axisX: {
+ // On the x-axis start means top and end means bottom
+ position: 'start'
+ },
+ axisY: {
+ // On the y-axis start means left and end means right
+ position: 'end'
+ }
+ });
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 089e87cde..a510032c2 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -4,7 +4,19 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Chartist {
+
interface ChartistStatic {
+
+ /**
+ * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number.
+ */
+ precision: number;
+
+ /**
+ * A map with characters to escape for strings to be safely used as attribute values.
+ */
+ escapingMap: IChartistEscapeMap;
+
Pie: IChartistPieChart;
Bar: IChartistBarChart;
Line: IChartistLineChart;
@@ -13,8 +25,34 @@ declare module Chartist {
AutoScaleAxis: IAutoScaleAxisStatic;
StepAxis: IStepAxisStatic;
- Svg: any;
+ Svg: ChartistSvgStatic;
noop: Function;
+
+ alphaNumerate(n: number): string;
+ extend(target: Object, sources: Object): Object;
+
+ replaceAll(str: string, subStr: string, newSubStr: string): string;
+ ensureUnit(value: number, unit: string): string;
+ quantity(input: string | number): Object;
+
+ query(query: Node | string): Node;
+ times(length: number): Array;
+ sum(previous: number, current: number): number;
+ mapMultiply(factor: number): (num: number) => number;
+ mapAdd(addend: number): (num: number) => number;
+ serialMap(arr: Array, cb: Function): Array;
+ roundWithPrecision(value: number, digits?: number): number;
+
+ getMultiValue(value: any, dimension?: any): number; // this method is not documented, but it is used in the examples
+
+ serialize(data: Object | string | number): string;
+ deserialize(data: string): Object | string | number;
+
+ createSvg(container: Node, width: string, height: string, className: string): Object; // TODO: Figure out if this is returning a ChartistSVGWrapper or an actual SVGElement
+ }
+
+ interface IChartistEscapeMap {
+ [Key: string]: string;
}
interface IResponsiveOptionTuple extends Array {
@@ -34,16 +72,16 @@ declare module Chartist {
// this definition gives some intellisense, but does not protect the user from misuse
// TODO: come in and tidy this up and make it fit better
interface IChartistData {
- labels?: Array | Array;
- series: Array | Array | Array>;
+ labels?: Array | Array;
+ series: Array | Array | Array>;
}
interface IChartistSeriesData {
- name?: string;
- value?: number;
- data?: Array;
- className?: string;
- meta?: string; // I assume this could probably be a number as well?
+ name?: string;
+ value?: number;
+ data?: Array;
+ className?: string;
+ meta?: string; // I assume this could probably be a number as well?
}
interface IChartistBase {
@@ -287,7 +325,6 @@ declare module Chartist {
type: IAutoScaleAxisStatic;
}
- // TODO: Finish documenting all of the defaults
interface ILineChartClasses {
/**
* Default is 'ct-chart-line'
@@ -306,6 +343,167 @@ declare module Chartist {
start?: string;
end?: string;
}
+
+ interface ChartistSvgStatic {
+ new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg;
+
+ Easing: ChartistEasingStatic;
+
+ /**
+ * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list.
+ */
+ isSupported(feature: string): boolean;
+ }
+
+ interface IChartistSvg {
+
+ /**
+ * Set attributes on the current SVG element of the wrapper you're currently working on.
+ */
+ attr(attributes: Object | string, ns: string): Object | string;
+
+ /**
+ * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily.
+ */
+ elem(name: string, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg;
+
+ /**
+ * Returns the parent Chartist.SVG wrapper object
+ */
+ parent(): IChartistSvg;
+
+ /**
+ * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree.
+ */
+ root(): IChartistSvg;
+
+ /**
+ * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper.
+ */
+ querySelector(selector: string): IChartistSvg;
+
+ /**
+ * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper.
+ */
+ querySelectorAll(selector: string): any; // this returns an svg wrapper list in the docs, need to see if that's just an array or a special list
+
+ /**
+ * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM.
+ */
+ foreignObject(content: any, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg;
+
+ /**
+ * This method adds a new text element to the current Chartist.Svg wrapper.
+ */
+ text(t: string): IChartistSvg;
+
+ /**
+ * This method will clear all child nodes of the current wrapper object.
+ */
+ empty(): IChartistSvg;
+
+ /**
+ * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure.
+ */
+ remove(): IChartistSvg;
+
+ /**
+ * This method will replace the element with a new element that can be created outside of the current DOM.
+ */
+ replace(): IChartistSvg;
+
+ /**
+ * This method will append an element to the current element as a child.
+ */
+ append(): IChartistSvg;
+
+ /**
+ * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further.
+ */
+ classes(): Array;
+
+ /**
+ * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once.
+ *
+ * @method addClass
+ * @param names {string} A white space separated list of class names
+ */
+ addClass(names: string): IChartistSvg;
+
+ /**
+ * Removes one or a space separated list of classes from the current element.
+ *
+ * @method removeClass
+ * @param names {string} A white space separated list of class names
+ */
+ removeClass(names: string): IChartistSvg;
+
+ /**
+ * Removes all classes from the current element.
+ */
+ removeAllClasses(): IChartistSvg;
+
+ /**
+ * Get element height with fallback to svg BoundingBox or parent container dimensions
+ */
+ height(): number;
+
+ /**
+ * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes.
+ */
+ animate(animations: IChartistAnimations, guided: boolean, eventEmitter: Object): IChartistSvg;
+
+ /**
+ * "Safe" way to get property value from svg BoundingBox. This is a workaround. Firefox throws an NS_ERROR_FAILURE error if getBBox() is called on an invisible node.
+ * THIS IS A WORKAROUND
+ */
+ getBBoxProperty(node: SVGElement, prop: string): string; // TODO: find a good example of this and add it to the tests, it might belong to static
+ }
+
+ interface IChartistAnimations {
+ [Key: string]: IChartistAnimationOptions;
+ }
+
+ interface IChartistAnimationOptions {
+ dur: String | number;
+ from: number;
+ to: number;
+ easing?: IChartistEasingDefinition | string;
+ }
+
+ interface IChartistEasingDefinition {
+ 0: number;
+ 1: number;
+ 2: number;
+ 3: number;
+ }
+
+ interface ChartistEasingStatic {
+ easeInSine: IChartistEasingDefinition;
+ easeOutSine: IChartistEasingDefinition;
+ easeInOutSine: IChartistEasingDefinition;
+ easeInQuad: IChartistEasingDefinition;
+ easeOutQuad: IChartistEasingDefinition;
+ easeInOutQuad: IChartistEasingDefinition;
+ easeInCubic: IChartistEasingDefinition;
+ easeOutCubic: IChartistEasingDefinition;
+ easeInOutCubic: IChartistEasingDefinition;
+ easeInQuart: IChartistEasingDefinition;
+ easeOutQuart: IChartistEasingDefinition;
+ easeInOutQuart: IChartistEasingDefinition;
+ easeInQuint: IChartistEasingDefinition;
+ easeOutQuint: IChartistEasingDefinition;
+ easeInOutQuint: IChartistEasingDefinition;
+ easeInExpo: IChartistEasingDefinition;
+ easeOutExpo: IChartistEasingDefinition;
+ easeInOutExpo: IChartistEasingDefinition;
+ easeInCirc: IChartistEasingDefinition;
+ easeOutCirc: IChartistEasingDefinition;
+ easeInOutCirc: IChartistEasingDefinition;
+ easeInBack: IChartistEasingDefinition;
+ easeOutBack: IChartistEasingDefinition;
+ easeInOutBack: IChartistEasingDefinition;
+ }
}
declare var Chartist: Chartist.ChartistStatic;
From 2e5f3e2db48a41a1578c15c2685dba7b5c424978 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Thu, 14 Jan 2016 15:10:55 -0500
Subject: [PATCH 010/212] Added Interpolation definitions and tests
---
chartist/chartist-tests.ts | 39 ++++++++++++++++++++++++++++++++++++++
chartist/chartist.d.ts | 27 +++++++++++++++++++++++++-
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index 5c76754f2..36e5a38e1 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -318,3 +318,42 @@ new Chartist.Bar('.ct-chart', {
position: 'end'
}
});
+
+new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5],
+ series: [[1, 2, 8, 1, 7]]
+}, {
+ lineSmooth: Chartist.Interpolation.none({
+ fillHoles: false
+ })
+ });
+
+new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5],
+ series: [[1, 2, 8, 1, 7]]
+}, {
+ lineSmooth: Chartist.Interpolation.simple({
+ divisor: 2,
+ fillHoles: false
+ })
+ });
+
+new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5],
+ series: [[1, 2, 8, 1, 7]]
+}, {
+ lineSmooth: Chartist.Interpolation.cardinal({
+ tension: 1,
+ fillHoles: false
+ })
+ });
+
+new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5],
+ series: [[1, 2, 8, 1, 7]]
+}, {
+ lineSmooth: Chartist.Interpolation.step({
+ postpone: true,
+ fillHoles: false
+ })
+ });
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index a510032c2..6c18e9c96 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -26,6 +26,8 @@ declare module Chartist {
StepAxis: IStepAxisStatic;
Svg: ChartistSvgStatic;
+ Interpolation: ChartistInterpolationStatic;
+
noop: Function;
alphaNumerate(n: number): string;
@@ -281,7 +283,7 @@ declare module Chartist {
showPoint?: boolean;
showArea?: boolean;
areaBase?: number;
- lineSmooth?: boolean;
+ lineSmooth?: Function | boolean;
low?: number;
high?: number;
ticks?: Array;
@@ -504,6 +506,29 @@ declare module Chartist {
easeOutBack: IChartistEasingDefinition;
easeInOutBack: IChartistEasingDefinition;
}
+
+ interface ChartistInterpolationStatic {
+
+ /**
+ * This interpolation function does not smooth the path and the result is only containing lines and no curves.
+ */
+ none(options?: Object): Function;
+
+ /**
+ * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing.
+ */
+ simple(options?: Object): Function;
+
+ /**
+ * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results.
+ */
+ cardinal(options?: Object): Function;
+
+ /**
+ * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the showPoint option is enabled.
+ */
+ step(options?: Object): Function;
+ }
}
declare var Chartist: Chartist.ChartistStatic;
From 8bf574716d401491d4b678f1d1a65f24663a3019 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Thu, 14 Jan 2016 15:13:26 -0500
Subject: [PATCH 011/212] Bumping chartist version to 0.9.5
---
chartist/chartist.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 6c18e9c96..9878e9f70 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Chartist v0.9.4
+// Type definitions for Chartist v0.9.5
// Project: https://github.com/gionkunz/chartist-js
// Definitions by: Matt Gibbs
// Definitions: https://github.com/borisyankov/DefinitelyTyped
From 21f5129d25ee0994b7bd0b68cb22ca30c983a9c8 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Thu, 14 Jan 2016 15:20:43 -0500
Subject: [PATCH 012/212] Adding more tests for bar charts
---
chartist/chartist-tests.ts | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index 36e5a38e1..f62f0a2c5 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -357,3 +357,28 @@ new Chartist.Line('.ct-chart', {
fillHoles: false
})
});
+
+var overlappingBarsData: Chartist.IChartistData = {
+ labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ series: [
+ [5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8],
+ [3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4]
+ ]
+};
+
+var overlappingBarsOptions: Chartist.IBarChartOptions = {
+ seriesBarDistance: 10
+};
+
+var overlappingBarsResponsiveOptions: Array> = [
+ ['screen and (max-width: 640px)', {
+ seriesBarDistance: 5,
+ axisX: {
+ labelInterpolationFnc: (value: any) => {
+ return value[0];
+ }
+ }
+ }]
+];
+
+new Chartist.Bar('.ct-chart', overlappingBarsData, overlappingBarsOptions, overlappingBarsResponsiveOptions);
From 059319a0338d744146dc91595c63aecafc228910 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Thu, 14 Jan 2016 15:46:42 -0500
Subject: [PATCH 013/212] Defining Chartist Interpolation Options
---
chartist/chartist-tests.ts | 8 ++++----
chartist/chartist.d.ts | 33 ++++++++++++++++++++++++++-------
2 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index f62f0a2c5..f4ec32f2a 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -84,7 +84,7 @@ var chart = new Chartist.Pie('.ct-chart', {
showLabel: false
});
-chart.on('draw', function(data: any) {
+chart.on('draw', (data: any) => {
if (data.type === 'slice') {
// Get the total path length in order to use for dash array animation
var pathLength = data.element._node.getTotalLength();
@@ -95,7 +95,7 @@ chart.on('draw', function(data: any) {
});
// Create animation definition while also assigning an ID to the animation for later sync usage
- var animationDefinition: any = {
+ var animationDefinition: Chartist.IChartistAnimations = {
'stroke-dashoffset': {
id: 'anim' + data.index,
dur: 1000,
@@ -143,8 +143,8 @@ new Chartist.Bar('.ct-chart', {
// Default mobile configuration
stackBars: true,
axisX: {
- labelInterpolationFnc: function(value: string) {
- return value.split(/\s+/).map(function(word: string) {
+ labelInterpolationFnc: (value: string) => {
+ return value.split(/\s+/).map((word: string) => {
return word[0];
}).join('');
}
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 9878e9f70..bb0042f4b 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -467,10 +467,13 @@ declare module Chartist {
}
interface IChartistAnimationOptions {
- dur: String | number;
- from: number;
- to: number;
+ id?: string;
+ dur: string | number;
+ from: string | number;
+ to: string | number;
easing?: IChartistEasingDefinition | string;
+ fill?: string;
+ begin?: string;
}
interface IChartistEasingDefinition {
@@ -512,22 +515,38 @@ declare module Chartist {
/**
* This interpolation function does not smooth the path and the result is only containing lines and no curves.
*/
- none(options?: Object): Function;
+ none(options?: IChartistInterpolationOptions): Function;
/**
* Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing.
*/
- simple(options?: Object): Function;
+ simple(options?: IChartistSimpleInterpolationOptions): Function;
/**
* Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results.
*/
- cardinal(options?: Object): Function;
+ cardinal(options?: IChartistCardinalInterpolationOptions): Function;
/**
* Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the showPoint option is enabled.
*/
- step(options?: Object): Function;
+ step(options?: IChartistStepInterpolationOptions): Function;
+ }
+
+ interface IChartistInterpolationOptions {
+ fillHoles?: boolean;
+ }
+
+ interface IChartistSimpleInterpolationOptions extends IChartistInterpolationOptions {
+ divisor?: number;
+ }
+
+ interface IChartistCardinalInterpolationOptions extends IChartistInterpolationOptions {
+ tension?: number;
+ }
+
+ interface IChartistStepInterpolationOptions extends IChartistInterpolationOptions {
+ postpone?: boolean;
}
}
From fab0b336b0414fac23963bde83f7d7077f6cf14c Mon Sep 17 00:00:00 2001
From: mykohsu
Date: Thu, 14 Jan 2016 15:30:05 -0800
Subject: [PATCH 014/212] Add additional off method that can accept a handler
with extra arguments
While this is not part of jQuery API for off() it is possible to attach such a handler using on(). See http://api.jquery.com/on/ and http://api.jquery.com/off/.
---
jquery/jquery.d.ts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts
index ff259e7fb..ee6c0e19d 100644
--- a/jquery/jquery.d.ts
+++ b/jquery/jquery.d.ts
@@ -2271,6 +2271,13 @@ interface JQuery {
* @param handler A handler function previously attached for the event(s), or the special value false.
*/
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
+ /**
+ * Remove an event handler.
+ *
+ * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
+ * @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on().
+ */
+ off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
/**
* Remove an event handler.
*
From 299be13624c3998ca5ca0f146202723e25eeb465 Mon Sep 17 00:00:00 2001
From: Tomas Carnecky
Date: Tue, 19 Jan 2016 14:42:42 +0100
Subject: [PATCH 015/212] redux-logger: transformer has been renamed to
stateTransformer
---
redux-logger/redux-logger-tests.ts | 2 +-
redux-logger/redux-logger.d.ts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/redux-logger/redux-logger-tests.ts b/redux-logger/redux-logger-tests.ts
index b5dd3232f..02b1b47a7 100644
--- a/redux-logger/redux-logger-tests.ts
+++ b/redux-logger/redux-logger-tests.ts
@@ -13,7 +13,7 @@ let loggerWithOpts = createLogger({
logger: console,
predicate: (getState, action) => true,
timestamp: true,
- transformer: state => state
+ stateTransformer: state => state
});
let createStoreWithMiddleware = applyMiddleware(
diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts
index 7f9cab9d7..b0459e536 100644
--- a/redux-logger/redux-logger.d.ts
+++ b/redux-logger/redux-logger.d.ts
@@ -15,7 +15,7 @@ declare module 'redux-logger' {
logger?: any;
predicate?: (getState: Function, action: any) => boolean;
timestamp?: boolean;
- transformer?: (state:any) => any;
+ stateTransformer?: (state: any) => any;
}
export default function createLogger(options?: ReduxLoggerOptions): Redux.Middleware;
From 7edc447a5f1890b2d197ca843c5603c0fec50f0b Mon Sep 17 00:00:00 2001
From: Forrest Peterson
Date: Tue, 19 Jan 2016 13:16:43 -0500
Subject: [PATCH 016/212] Change to IChartistData interface in Chartist
---
chartist/chartist.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index bb0042f4b..8d63696f6 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -74,7 +74,7 @@ declare module Chartist {
// this definition gives some intellisense, but does not protect the user from misuse
// TODO: come in and tidy this up and make it fit better
interface IChartistData {
- labels?: Array | Array;
+ labels?: Array | Array | Array;
series: Array | Array | Array>;
}
From f9b189a87343fb0e05f2d06d09f9cab11a44cf41 Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Tue, 19 Jan 2016 15:32:11 -0500
Subject: [PATCH 017/212] Made 'type' optional to avoid problems with Chartist
defaults
When forced to define the type, Chartist won't default to all of the
other options. So if you just want to do something like not show the
grid, you'll end up having to define all of the axis options because of
the strict typing that was there before.
---
chartist/chartist-tests.ts | 20 ++++++++++++++++++++
chartist/chartist.d.ts | 6 +++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/chartist/chartist-tests.ts b/chartist/chartist-tests.ts
index f4ec32f2a..22b10e8b0 100644
--- a/chartist/chartist-tests.ts
+++ b/chartist/chartist-tests.ts
@@ -242,6 +242,26 @@ new Chartist.Line('.ct-chart', {
}
});
+new Chartist.Line('.ct-chart', {
+ labels: [1, 2, 3, 4, 5, 6, 7, 8],
+ series: [
+ [5, 9, 7, 8, 5, 3, 5, 4]
+ ]
+}, {
+ ticks: [0, 4],
+ low: 0,
+ showArea: true,
+ axisX: {
+ showGrid: false
+ },
+ axisY: {
+ showLabel: true,
+ showGrid: false,
+ ticks: [1, 4],
+ type: Chartist.FixedScaleAxis
+ }
+ });
+
var chart2 = new Chartist.Line('.ct-chart', {
labels: [1, 2, 3, 4, 5],
series: [
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index 8d63696f6..a38aa4ce7 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -305,13 +305,13 @@ declare module Chartist {
}
interface IChartistStepAxis extends ILineChartAxis {
- type: IStepAxisStatic;
+ type?: IStepAxisStatic;
ticks?: Array | Array;
stretch?: boolean;
}
interface IChartistFixedScaleAxis extends ILineChartAxis {
- type: IFixedScaleAxisStatic;
+ type?: IFixedScaleAxisStatic;
high?: number;
low?: number;
divisor?: number;
@@ -324,7 +324,7 @@ declare module Chartist {
scaleMinSpace?: number;
onlyInteger?: boolean;
referenceValue?: number;
- type: IAutoScaleAxisStatic;
+ type?: IAutoScaleAxisStatic;
}
interface ILineChartClasses {
From e58251a8d3c55dfb12276efea0a3d3eb9238737d Mon Sep 17 00:00:00 2001
From: Matt Gibbs
Date: Tue, 19 Jan 2016 15:42:43 -0500
Subject: [PATCH 018/212] Added an optional member for plugins
Just set to Array for now until I have a better understanding of
all the possibilities for plugins.
---
chartist/chartist.d.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index a38aa4ce7..d89a0e3bb 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -100,6 +100,8 @@ declare module Chartist {
supportsAnimations: boolean;
resizeListener: any;
+ plugins?: Array; // all of these plugins seem to be functions with options, but keeping type any for now
+
update(data: Object, options?: T, override?: boolean): void;
detatch(): void;
From 4d99796247d33bc4f287b77f2a280f2cce2cf78c Mon Sep 17 00:00:00 2001
From: Forrest Peterson
Date: Thu, 21 Jan 2016 15:45:33 -0500
Subject: [PATCH 019/212] Change to where plugins is
---
chartist/chartist.d.ts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/chartist/chartist.d.ts b/chartist/chartist.d.ts
index d89a0e3bb..169d361db 100644
--- a/chartist/chartist.d.ts
+++ b/chartist/chartist.d.ts
@@ -51,6 +51,8 @@ declare module Chartist {
deserialize(data: string): Object | string | number;
createSvg(container: Node, width: string, height: string, className: string): Object; // TODO: Figure out if this is returning a ChartistSVGWrapper or an actual SVGElement
+
+ plugins: any;
}
interface IChartistEscapeMap {
@@ -141,6 +143,8 @@ declare module Chartist {
* If true the whole data is reversed including labels, the series order as well as the whole series data arrays.
*/
reverseData?: boolean;
+
+ plugins?: Array;
}
interface IPieChartOptions extends IChartOptions {
From 3556e7e896b57323b5d1bbd8ba3c824ea7c1fbdb Mon Sep 17 00:00:00 2001
From: Rom Grk
Date: Wed, 13 Jan 2016 03:48:28 -0500
Subject: [PATCH 020/212] Update github-electron.d.ts
BrowserWindowOptions, WebPreferences, from the doc:
https://github.com/atom/electron/blob/master/docs/api/browser-window.md
Version is now 0.36.3
Update github-electron.d.ts
fix: code style
update with:
https://github.com/atom/electron/commit/8433d94cacfe251f6351deae893250cbbf4fea9e
https://github.com/atom/electron/commit/5567baf33500b5cd7d4026553dc7b26dc1800146
---
github-electron/github-electron.d.ts | 39 ++++++++++++++++------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts
index a02a1edb6..45160fb02 100644
--- a/github-electron/github-electron.d.ts
+++ b/github-electron/github-electron.d.ts
@@ -1,11 +1,11 @@
-// Type definitions for Electron v0.35.0
+// Type definitions for Electron v0.36.3
// Project: http://electron.atom.io/
// Definitions by: jedmao , rhysd
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
-declare module Electron {
+declare module GithubElectron {
/**
* This class is used to represent an image.
*/
@@ -51,6 +51,10 @@ declare module Electron {
* Marks the image as template image.
*/
setTemplateImage(option: boolean): void;
+ /**
+ * Returns a boolean whether the image is a template image.
+ */
+ isTemplateImage(): boolean;
}
module Clipboard {
@@ -479,6 +483,7 @@ declare module Electron {
interface WebPreferences {
nodeIntegration?: boolean;
preload?: string;
+ session?: Session;
partition?: string;
zoomFactor?: number;
javascript?: boolean;
@@ -492,16 +497,11 @@ declare module Electron {
plugins?: boolean;
experimentalFeatures?: boolean;
experimentalCanvasFeatures?: boolean;
- overlayScrollbars?: boolean;
- sharedWorker?: boolean;
directWrite?: boolean;
- pageVisibility?: boolean;
+ blinkFeatures?: string;
}
- // Includes all options BrowserWindow can take as of this writing
- // http://electron.atom.io/docs/v0.29.0/api/browser-window/
interface BrowserWindowOptions extends Rectangle {
- show?: boolean;
useContentSize?: boolean;
center?: boolean;
minWidth?: number;
@@ -512,28 +512,23 @@ declare module Electron {
alwaysOnTop?: boolean;
fullscreen?: boolean;
skipTaskbar?: boolean;
- zoomFactor?: number;
kiosk?: boolean;
title?: string;
icon?: NativeImage|string;
+ show?: boolean;
frame?: boolean;
acceptFirstMouse?: boolean;
disableAutoHideCursor?: boolean;
autoHideMenuBar?: boolean;
enableLargerThanScreen?: boolean;
+ backgroundColor?: string;
darkTheme?: boolean;
preload?: string;
transparent?: boolean;
type?: string;
- standardWindow?: boolean;
- webPreferences?: WebPreferences;
- java?: boolean;
- textAreasAreResizable?: boolean;
- extraPluginDirs?: string[];
- subpixelFontScaling?: boolean;
- overlayFullscreenVideo?: boolean;
titleBarStyle?: string;
backgroundColor?: string;
+ webPreferences?: WebPreferences;
}
interface Rectangle {
@@ -1576,6 +1571,17 @@ declare module Electron {
* corrupted by active network attackers.
*/
registerURLSchemeAsSecure(scheme: string): void;
+ /**
+ * Inserts text to the focused element.
+ */
+ insertText(text: string): void;
+ /**
+ * Evaluates `code` in page.
+ * In the browser window some HTML APIs like `requestFullScreen` can only be
+ * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
+ * this limitation.
+ */
+ executeJavaScript(code: string, userGesture?: boolean): void;
}
// Type definitions for main process
@@ -1798,6 +1804,7 @@ declare module Electron {
clearCache(callback: Function): void;
clearStorageData(callback: Function): void;
clearStorageData(options: ClearStorageDataOptions, callback: Function): void;
+ flushStorageData(): void;
setProxy(config: string, callback: Function): void;
resolveProxy(url: URL, callback: (proxy: any) => any): void;
setDownloadPath(path: string): void;
From fa051132c8617f6d670c22917ad5d14204768058 Mon Sep 17 00:00:00 2001
From: Rom Grk
Date: Sat, 23 Jan 2016 17:44:51 -0500
Subject: [PATCH 021/212] Update github-electron.d.ts
module GithubElectron > Electron
remove duplicate backgroundColor
---
github-electron/github-electron.d.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts
index 45160fb02..899df7a9f 100644
--- a/github-electron/github-electron.d.ts
+++ b/github-electron/github-electron.d.ts
@@ -5,7 +5,7 @@
///
-declare module GithubElectron {
+declare module Electron {
/**
* This class is used to represent an image.
*/
@@ -527,7 +527,6 @@ declare module GithubElectron {
transparent?: boolean;
type?: string;
titleBarStyle?: string;
- backgroundColor?: string;
webPreferences?: WebPreferences;
}
From 65afd8b3fd2880ef4efd168f5079afbb7d0efee4 Mon Sep 17 00:00:00 2001
From: Lukas Hollaender
Date: Mon, 25 Jan 2016 11:43:39 +0100
Subject: [PATCH 022/212] yFiles.d.ts and yfiles-tests.ts
---
yfiles/yfiles-tests.ts | 146 +
yfiles/yfiles.d.ts | 134491 ++++++++++++++++++++++++++++++++++++++
2 files changed, 134637 insertions(+)
create mode 100644 yfiles/yfiles-tests.ts
create mode 100644 yfiles/yfiles.d.ts
diff --git a/yfiles/yfiles-tests.ts b/yfiles/yfiles-tests.ts
new file mode 100644
index 000000000..0bc89557b
--- /dev/null
+++ b/yfiles/yfiles-tests.ts
@@ -0,0 +1,146 @@
+///
+
+module yfilesTest {
+
+ export class BasicTest {
+ private graphControl:yfiles.canvas.GraphControl;
+
+ constructor() {
+ this.graphControl = new yfiles.canvas.GraphControl.ForId("graphControl");
+
+ var graphEditorInputMode = new yfiles.input.GraphEditorInputMode();
+
+ // Modify the MyHitTestable class to be usable with our class framework
+ yfiles.lang.Class.injectInterfaces(MyHitTestable.prototype, [yfiles.drawing.IHitTestable]);
+ var myHitTestable = new MyHitTestable();
+
+ if (yfiles.drawing.IHitTestable.isInstance(myHitTestable)) {
+ // If myHitTestable is recognized as instance of yfiles.drawing.IHitTestable by the yFiles class
+ // framework, set it as hit testable to prevent clicking any item.
+ // If you cannot click-select the nodes in the GraphControl, this worked correctly.
+ graphEditorInputMode.clickInputMode.validClickHitTestable = myHitTestable;
+ }
+
+ this.graphControl.inputMode = graphEditorInputMode;
+
+ this.graphControl.graph.nodeDefaults.style = new yfiles.drawing.ShinyPlateNodeStyle.WithBrush(yfiles.system.Brushes.ORANGE);
+
+ this.graphControl.graph.createNodeWithBoundsAndStyle(new yfiles.geometry.RectD(0, 0, 10, 10), new MyNodeStyle());
+
+ this.layout();
+ }
+
+ start() {
+ for (var i = 0; i < 5; i++) {
+ for (var j = 0; j < 5; j++) {
+ this.graphControl.graph.createNodeWithCenter(new yfiles.geometry.PointD(100 * i, 100 * j));
+ }
+ }
+ this.graphControl.graph.nodes.forEach((node) => this.graphControl.graph.addLabel(node, "Label"));
+ this.graphControl.fitGraphBounds();
+ }
+
+
+ /**
+ * Runs a layout algorithm and animates the transition to the new layout.
+ */
+ layout() {
+ var layouter = new yfiles.hierarchic.IncrementalHierarchicLayouter();
+ var layoutExecutor = new yfiles.graph.LayoutExecutor.FromControlAndLayouter(this.graphControl,
+ new yfiles.layout.MinNodeSizeStage(layouter));
+
+ layoutExecutor.duration = yfiles.system.TimeSpan.fromSeconds(1);
+ layoutExecutor.animateViewport = true;
+ layoutExecutor.updateContentRect = true;
+ layoutExecutor.finishHandler = function (s, args) {
+ if (args instanceof yfiles.graph.LayoutExceptionEventArgs && typeof(window.console) !== "undefined") {
+ var exception = args.exception;
+ console.log(exception.message);
+ }
+ };
+ layoutExecutor.start();
+ }
+
+ /**
+ * Runs a shortest path analysis.
+ */
+ analyze() {
+ var graph = this.graphControl.graph;
+
+ // Create the graph model adapter to get a proper analysis graph structure.
+ var graphAdapter = new yfiles.graph.YGraphAdapter(graph);
+
+ // Create an array the size of the edge set with costs for each edge.
+ var cost = new Array(graph.edges.count);
+ for (var i = 0; i < graph.edges.count; i++) {
+ cost[i] = Math.random();
+ }
+
+ var pred:yfiles.algorithms.Edge[] = null;
+
+ // Suppose the first node from the graph is the node named "Start."
+ var startNode = graphAdapter.getCopiedNode(graph.nodes.getFirstElement());
+ // Suppose the last node from the graph is the node named "Destination."
+ var destinationNode = graphAdapter.getCopiedNode(graph.nodes.getLastElement());
+
+ // Run the single-source single-sink algorithm on the graph.
+ var result = yfiles.algorithms.ShortestPaths.singleSourceSingleSinkToArray(graphAdapter.yGraph, startNode,
+ destinationNode, true, cost, pred);
+ // Transfer back the result.
+ var predIGraph = new Array(pred.length);
+ for (var i = 0; i < pred.length; i++) {
+ predIGraph[i] = graphAdapter.getOriginalEdge(pred[i]);
+ }
+ }
+
+ coreLib() {
+ new yfiles.AttributeDefinition(() => { return {} });
+ new yfiles.ClassDefinition(() => { return {} });
+ new yfiles.EnumDefinition(() => { return {} });
+ new yfiles.StructDefinition(() => { return {} });
+ }
+
+ namespacesExist() {
+ new yfiles.algorithms.AbortHandler();
+ new yfiles.binding.AdjacentEdgesGraphSource();
+ new yfiles.canvas.CanvasContainer();
+ new yfiles.circular.CircularLayouter();
+ new yfiles.collections.HashSet();
+ new yfiles.drawing.ArcEdgeStyle();
+ new yfiles.genealogy.FamilyTreeLayouter();
+ new yfiles.geometry.Matrix2D();
+ new yfiles.graph.YGraphAdapter(this.graphControl.graph);
+ var a:yfiles.graphml.ChildParseContext;
+ new yfiles.hierarchic.AsIsLayerer();
+ new yfiles.labeling.GreedyMISLabeling();
+ var b:yfiles.lang.Abstract;
+ new yfiles.layout.BendConverter();
+ new yfiles.markup.ArrayExtension();
+ new yfiles.model.BridgeManager();
+ var c:yfiles.multipage.IEdgeInfo;
+ var d:yfiles.objectcollections.ICollection;
+ new yfiles.organic.GroupedShuffleLayouter();
+ new yfiles.orthogonal.CompactOrthogonalLayouter();
+ var e = yfiles.partial.ComponentAssignmentStrategy.CLUSTERING;
+ var f = yfiles.radial.CenterNodesPolicy.CENTRALITY;
+ new yfiles.random.RandomLayouter();
+ var g:yfiles.router.BusDescriptor;
+ new yfiles.seriesparallel.SeriesParallelLayouter();
+ var h:yfiles.support.AbstractContextLookupChainLink;
+ new yfiles.system.ApplicationException();
+ new yfiles.tree.ARTreeLayouter();
+ }
+ }
+
+ class MyHitTestable implements yfiles.drawing.IHitTestable {
+ isHit(p:yfiles.geometry.PointD, ctx:yfiles.canvas.ICanvasContext):boolean {
+ return false;
+ }
+ }
+
+ class MyNodeStyle extends yfiles.drawing.SimpleAbstractNodeStyle {
+ createVisual(node:yfiles.graph.INode, renderContext:yfiles.drawing.IRenderContext):yfiles.drawing.RectVisual {
+ return new yfiles.drawing.RectVisual.FromRectangle(new yfiles.geometry.Rectangle(0, 0, 10, 10));
+ }
+ }
+}
diff --git a/yfiles/yfiles.d.ts b/yfiles/yfiles.d.ts
new file mode 100644
index 000000000..b258fc373
--- /dev/null
+++ b/yfiles/yfiles.d.ts
@@ -0,0 +1,134491 @@
+// Type definitions for yFiles for HTML 1.3+
+// Project: http://www.yworks.com/products/yfiles-for-html
+// Definitions by: yWorks GmbH
+// Definitions: https://github.com/yWorks/DefinitelyTyped
+
+/****************************************************************************
+ **
+ ** This file is part of yFiles for HTML 1.3.
+ **
+ ** yWorks proprietary/confidential. Use is subject to license terms.
+ **
+ ** Copyright (c) 2015 by yWorks GmbH, Vor dem Kreuzberg 28,
+ ** 72070 Tuebingen, Germany. All rights reserved.
+ **
+ ***************************************************************************/
+declare module system{
+}
+declare module yfiles{
+ /**
+ * A lazy interface type which delays the creation of the interface until it is used.
+ */
+ export interface InterfaceDefinition extends Object{
+ }
+ var InterfaceDefinition:{
+ $class:yfiles.lang.Class;
+ /**
+ * A lazy interface type which delays the creation of the interface until it is used.
+ * @param {function():Object} callback Returns the interface definition as required by {@link yfiles.lang.Trait}.
+ */
+ new (callback:()=>Object):yfiles.InterfaceDefinition;
+ };
+ /**
+ * A lazy class type which delays the creation of the class until it is used.
+ */
+ export interface ClassDefinition extends Object{
+ }
+ var ClassDefinition:{
+ $class:yfiles.lang.Class;
+ /**
+ * A lazy class type which delays the creation of the class until it is used.
+ * @param {function():Object} callback Returns the class definition as required by {@link yfiles.lang.Class}.
+ */
+ new (callback:()=>Object):yfiles.ClassDefinition;
+ };
+ /**
+ * A lazy struct type which delays the creation of the struct until it is used.
+ */
+ export interface StructDefinition extends Object{
+ }
+ var StructDefinition:{
+ $class:yfiles.lang.Class;
+ /**
+ * A lazy struct type which delays the creation of the struct until it is used.
+ * @param {function():Object} callback Returns the struct definition as required by {@link yfiles.lang.Struct}.
+ */
+ new (callback:()=>Object):yfiles.StructDefinition;
+ };
+ /**
+ * A lazy attribute definition which delays the creation of the attribute until it is used.
+ */
+ export interface AttributeDefinition extends Object{
+ }
+ var AttributeDefinition:{
+ $class:yfiles.lang.Class;
+ /**
+ * A lazy attribute definition which delays the creation of the attribute until it is used.
+ * @param {function():Object} callback Returns the attribute definition as required by {@link yfiles.lang.Attribute}.
+ */
+ new (callback:()=>Object):yfiles.AttributeDefinition;
+ };
+ /**
+ * A lazy enum type which delays the creation of the enum until it is used.
+ */
+ export interface EnumDefinition extends Object{
+ }
+ var EnumDefinition:{
+ $class:yfiles.lang.Class;
+ /**
+ * A lazy enum type which delays the creation of the enum until it is used.
+ * @param {function():Object} callback Returns the enum definition as required by {@link yfiles.lang.Enum}.
+ */
+ new (callback:()=>Object):yfiles.EnumDefinition;
+ };
+ export module algorithms{
+ /**
+ * Specialized list implementation for instances of type {@link yfiles.algorithms.Node}.
+ */
+ export interface NodeList extends yfiles.algorithms.YList{
+ /**
+ * Returns a node cursor for this node list.
+ * @return {yfiles.algorithms.INodeCursor} A node cursor granting access to the nodes within this list.
+ */
+ nodes():yfiles.algorithms.INodeCursor;
+ /**
+ * Returns the first node in this list, or null when the list is
+ * empty.
+ * @return {yfiles.algorithms.Node} The first node in the list.
+ */
+ firstNode():yfiles.algorithms.Node;
+ /**
+ * Returns the last node in this list, or null when the list is empty.
+ * @return {yfiles.algorithms.Node} The last node in the list.
+ */
+ lastNode():yfiles.algorithms.Node;
+ /**
+ * Removes the first node from this list and returns it.
+ * @return {yfiles.algorithms.Node} The first node from the list.
+ */
+ popNode():yfiles.algorithms.Node;
+ /**
+ * Returns a node array containing all elements of this list in the canonical
+ * order.
+ */
+ toNodeArray():yfiles.algorithms.Node[];
+ getEnumerator():yfiles.collections.IEnumerator;
+ }
+ var NodeList:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an empty node list.
+ */
+ new ():yfiles.algorithms.NodeList;
+ /**
+ * Creates a list that is initialized with the nodes provided by the given NodeCursor
+ * object.
+ */
+ WithNodes:{
+ new (c:yfiles.algorithms.INodeCursor):yfiles.algorithms.NodeList;
+ };
+ /**
+ * Creates a list that is initialized with those nodes from the given NodeCursor
+ * object for which the given data provider returns true upon
+ * calling its {@link yfiles.algorithms.IDataProvider#getBool getBool} method.
+ * @param {yfiles.algorithms.INodeCursor} nc A node cursor providing nodes that should be added to this list.
+ * @param {yfiles.algorithms.IDataProvider} predicate
+ * A data provider that acts as a inclusion predicate for each node accessible
+ * by the given node cursor.
+ */
+ WithFilteredNodes:{
+ new (nc:yfiles.algorithms.INodeCursor,predicate:yfiles.algorithms.IDataProvider):yfiles.algorithms.NodeList;
+ };
+ /**
+ * Creates a list that is initialized with the elements provided by the given
+ * Iterator object.
+ */
+ WithIterator:{
+ new (it:yfiles.algorithms.IIterator):yfiles.algorithms.NodeList;
+ };
+ /**
+ * Creates a list that is initialized with the nodes provided by the given array
+ * of nodes.
+ */
+ WithNodeArray:{
+ new (a:yfiles.algorithms.Node[]):yfiles.algorithms.NodeList;
+ };
+ /**
+ * Creates a list that is initialized with a single node provided.
+ */
+ WithNode:{
+ new (v:yfiles.algorithms.Node):yfiles.algorithms.NodeList;
+ };
+ /**
+ * Creates a list that is initialized with the entries of the given list.
+ * @param {yfiles.algorithms.NodeList} list the values are added to the new list
+ */
+ WithNodeList:{
+ new (list:yfiles.algorithms.NodeList):yfiles.algorithms.NodeList;
+ };
+ };
+ /**
+ * Provides sophisticated algorithms for solving classical network flow problems
+ * like MinCostFlow or MaxFlow.
+ */
+ export interface NetworkFlows extends Object{
+ }
+ var NetworkFlows:{
+ $class:yfiles.lang.Class;
+ /**
+ * Solves a minimum cost flow problem with a capacity scaling algorithm.
+ * (see Ahuja,Magnanti,Orlin: Network flows, Prentice Hall, 1993, pp.360-362).
+ * This algorithm is a variant of the successive shortest path algorithm.
+ * (see Ahuja,Magnanti,Orlin: Network flows, Prentice Hall, 1993, pp.320-324).
+ * It has the pseudo-polynomial running time O(m*log U*(m+n log n)) where n is the
+ * number of nodes in the network, m the number of edges and U the maximal edge
+ * capacity.
+ * Edges may have infinite capacity, which is denoted by
+ * the value Integer.MAX_VALUE.
+ * There are no restriction for the costs, especially they
+ * can be negative.
+ * Solves a min-cost flow optimization problem.
+ * @param {yfiles.algorithms.Graph} graph the network.
+ * @param {yfiles.algorithms.IDataProvider} lCapDP
+ * the lower bound on the arc flow.
+ * May be null.
+ * @param {yfiles.algorithms.IDataProvider} uCapDP
+ * the capacity of the arcs.
+ * Infinite capacity is denoted by
+ * Integer.MAX_VALUE
+ * @param {yfiles.algorithms.IDataProvider} cost0DP the costs of the arcs.
+ * @param {yfiles.algorithms.IDataProvider} supplyDP
+ * the supply/demand of the nodes.
+ * Supply is denoted by a positive value, demand by a
+ * negative value.
+ * @param {yfiles.algorithms.IEdgeMap} flowEM here the resulting flow is stored.
+ * @param {yfiles.algorithms.INodeMap} dualsNM
+ * here the resulting dual values are stored.
+ * Dual values are also referred as potentials.
+ * May be null.
+ * @return {number} the cost of the flow.
+ */
+ minCostFlowWithLowerBound(graph:yfiles.algorithms.Graph,lCapDP:yfiles.algorithms.IDataProvider,uCapDP:yfiles.algorithms.IDataProvider,cost0DP:yfiles.algorithms.IDataProvider,supplyDP:yfiles.algorithms.IDataProvider,flowEM:yfiles.algorithms.IEdgeMap,dualsNM:yfiles.algorithms.INodeMap):number;
+ /**
+ * Solves a min-cost flow optimization problem.
+ * @param {yfiles.algorithms.Graph} graph the network.
+ * @param {yfiles.algorithms.IDataProvider} uCapDP
+ * the capacity of the arcs.
+ * Infinite capacity is denoted by
+ * Integer.MAX_VALUE
+ * @param {yfiles.algorithms.IDataProvider} cost0DP the costs of the arcs.
+ * @param {yfiles.algorithms.IDataProvider} supplyDP
+ * the supply/demand of the nodes.
+ * Supply is denoted by a positive value, demand by a
+ * negative value.
+ * @param {yfiles.algorithms.IEdgeMap} flowEM here the resulting flow is stored.
+ * @param {yfiles.algorithms.INodeMap} dualsNM
+ * here the resulting dual values are stored.
+ * Dual values are also referred as potentials.
+ * @return {number} the cost of the flow.
+ */
+ minCostFlow(graph:yfiles.algorithms.Graph,uCapDP:yfiles.algorithms.IDataProvider,cost0DP:yfiles.algorithms.IDataProvider,supplyDP:yfiles.algorithms.IDataProvider,flowEM:yfiles.algorithms.IEdgeMap,dualsNM:yfiles.algorithms.INodeMap):number;
+ /**
+ * Solves a min-cost max-flow optimization problem.
+ * @param {yfiles.algorithms.Graph} graph the network.
+ * @param {yfiles.algorithms.Node} s source of the network.
+ * @param {yfiles.algorithms.Node} t sink of the network.
+ * @param {yfiles.algorithms.IDataProvider} uCapDP
+ * the capacity of the arcs.
+ * Infinite capacity is denoted by
+ * Integer.MAX_VALUE
+ * @param {yfiles.algorithms.IDataProvider} cost0DP the costs of the arcs.
+ * @param {yfiles.algorithms.IEdgeMap} flowEM here the resulting flow is stored.
+ * @param {yfiles.algorithms.INodeMap} dualsNM
+ * here the resulting dual values are stored.
+ * Dual values are also referred as potentials.
+ * @return {number} the cost of the flow.
+ */
+ minCostFlowBetweenSourceAndSink(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,uCapDP:yfiles.algorithms.IDataProvider,cost0DP:yfiles.algorithms.IDataProvider,flowEM:yfiles.algorithms.IEdgeMap,dualsNM:yfiles.algorithms.INodeMap):number;
+ /**
+ * Solves a maximum flow problem using the preflow-push method.
+ * (see Mehlhorn, Naeher: LEDA: a platform for combinatorial and geometric computing,
+ * Cambridge University Press, 2000, pp. 443-488)
+ * The worst case running time is O(mdeg * n^2 * m^(1/2)), where n is the number of
+ * nodes in the network, m the number of edges and mdeg the maximal degree of any node.
+ * Edges may have infinite capacity, which is denoted by
+ * the value Integer.MAX_VALUE.
+ * @param {yfiles.algorithms.Graph} graph the network.
+ * @param {yfiles.algorithms.Node} source the source of the network.
+ * @param {yfiles.algorithms.Node} sink the sink of the network.
+ * @param {yfiles.algorithms.IDataProvider} eCapDP
+ * the capacity of the arcs.
+ * Infinite capacity is denoted by
+ * Integer.MAX_VALUE
+ * @param {yfiles.algorithms.IEdgeMap} flowEM here the resulting flow is stored.
+ * @return {number} the maximum flow value.
+ */
+ calcMaxFlow(graph:yfiles.algorithms.Graph,source:yfiles.algorithms.Node,sink:yfiles.algorithms.Node,eCapDP:yfiles.algorithms.IDataProvider,flowEM:yfiles.algorithms.IEdgeMap):number;
+ /**
+ * Like {@link yfiles.algorithms.NetworkFlows#calcMaxFlow} this method
+ * solves a maximum flow problem.
+ * Additionally, this method marks all nodes
+ * that belong to the minimum cut set that is associated with the
+ * source of the network.
+ * @param {yfiles.algorithms.INodeMap} sourceCutNM
+ * return value. This map will provide a boolean value for each node
+ * that indicates whether or not a node belongs to the cut set associated
+ * with the source of the network.
+ * @return {number}
+ * the maximum flow value which also corresponds to the capacity
+ * of all edges that cross from the cut set associated with the network source
+ * to the cut set associated with the network sink.
+ */
+ calcMaxFlowMinCut(graph:yfiles.algorithms.Graph,source:yfiles.algorithms.Node,sink:yfiles.algorithms.Node,eCapDP:yfiles.algorithms.IDataProvider,flowEM:yfiles.algorithms.IEdgeMap,sourceCutNM:yfiles.algorithms.INodeMap):number;
+ };
+ /**
+ * Represents a so-called node in the directed graph data type {@link yfiles.algorithms.Graph}.
+ * Most notably, a node provides access to its adjacent edges (represented by instances
+ * of class {@link yfiles.algorithms.Edge}).
+ * These can be distinguished into the sets of incoming and outgoing edges.
+ * Iteration over all three sets of edges is provided by means of bidirectional
+ * cursors that present a read-only view of the respective set ({@link yfiles.algorithms.Node#getEdgeCursor},
+ * {@link yfiles.algorithms.Node#getInEdgeCursor}, {@link yfiles.algorithms.Node#getOutEdgeCursor}).
+ * Also supported is iteration over all nodes at opposite ends of either incoming
+ * edges or outgoing edges ({@link yfiles.algorithms.Node#getPredecessorCursor}, {@link yfiles.algorithms.Node#getSuccessorCursor}).
+ * The number of overall edges at a node is called its degree ({@link yfiles.algorithms.Node#degree}),
+ * which is the sum of incoming and outgoing edges ({@link yfiles.algorithms.Node#inDegree},
+ * {@link yfiles.algorithms.Node#outDegree}).
+ * Important:
+ * Class Graph is the single authority for any structural changes to the graph data
+ * type.
+ * Specifically, this means that there is no way to create or delete a node or an
+ * edge without using an actual Graph instance.
+ */
+ export interface Node extends yfiles.algorithms.GraphObject{
+ /**
+ * Creates a copy of this node that will be inserted into the given graph.
+ * @param {yfiles.algorithms.Graph} g The graph that the created node will belong to.
+ * @return {yfiles.algorithms.Node} The newly created Node object.
+ */
+ createCopy(g:yfiles.algorithms.Graph):yfiles.algorithms.Node;
+ /**
+ * The overall number of incoming and outgoing edges at this node.
+ * Note that self-loops are counted twice.
+ * @see {@link yfiles.algorithms.Edge}
+ * @see {@link yfiles.algorithms.Node#inDegree}
+ * @see {@link yfiles.algorithms.Node#outDegree}
+ */
+ degree:number;
+ /**
+ * The number of incoming edges at this node.
+ * @see {@link yfiles.algorithms.Node#degree}
+ * @see {@link yfiles.algorithms.Node#outDegree}
+ */
+ inDegree:number;
+ /**
+ * The number of outgoing edges at this node.
+ * @see {@link yfiles.algorithms.Node#degree}
+ * @see {@link yfiles.algorithms.Node#inDegree}
+ */
+ outDegree:number;
+ /**
+ * The index of this node within its graph G.
+ * Node indices represent the ordering of standard node iteration on G.
+ * The value of an index is >= 0 and < G.nodeCount().
+ * Note that indices are subject to change whenever the sequence of nodes in a
+ * graph is modified by either removing, hiding, reinserting, or unhiding a node,
+ * or by explicitly changing its position in the sequence.
+ * Precondition: This node must belong to some graph.
+ * @see {@link yfiles.algorithms.Graph#removeNode}
+ * @see {@link yfiles.algorithms.Graph#hideNode}
+ * @see {@link yfiles.algorithms.Graph#reInsertNode}
+ * @see {@link yfiles.algorithms.Graph#unhideNode}
+ * @see {@link yfiles.algorithms.Graph#moveToFirstNode}
+ * @see {@link yfiles.algorithms.Graph#moveToLastNode}
+ */
+ index:number;
+ /**
+ * The graph this node belongs to.
+ * If the node does not belong to a graph, because it was removed or hidden from
+ * it, this method returns null.
+ */
+ graph:yfiles.algorithms.Graph;
+ /**
+ * The first outgoing edge at this node, or null if it does
+ * not exist.
+ * @see {@link yfiles.algorithms.Node#firstInEdge}
+ * @see {@link yfiles.algorithms.Node#lastOutEdge}
+ */
+ firstOutEdge:yfiles.algorithms.Edge;
+ /**
+ * The first incoming edge at this node, or null if it does
+ * not exist.
+ * @see {@link yfiles.algorithms.Node#firstOutEdge}
+ * @see {@link yfiles.algorithms.Node#lastInEdge}
+ */
+ firstInEdge:yfiles.algorithms.Edge;
+ /**
+ * The last outgoing edge at this node, or null if it does
+ * not exist.
+ * @see {@link yfiles.algorithms.Node#firstOutEdge}
+ * @see {@link yfiles.algorithms.Node#lastInEdge}
+ */
+ lastOutEdge:yfiles.algorithms.Edge;
+ /**
+ * The last incoming edge at this node, or null if it does
+ * not exist.
+ * @see {@link yfiles.algorithms.Node#firstInEdge}
+ * @see {@link yfiles.algorithms.Node#lastOutEdge}
+ */
+ lastInEdge:yfiles.algorithms.Edge;
+ /**
+ * Returns an edge cursor for all incoming and outgoing edges at this node.
+ * @see {@link yfiles.algorithms.Node#getInEdgeCursor}
+ * @see {@link yfiles.algorithms.Node#getOutEdgeCursor}
+ */
+ getEdgeCursor():yfiles.algorithms.IEdgeCursor;
+ /**
+ * Returns an edge cursor for all incoming edges at this node.
+ * @see {@link yfiles.algorithms.Node#getEdgeCursor}
+ * @see {@link yfiles.algorithms.Node#getOutEdgeCursor}
+ */
+ getInEdgeCursor():yfiles.algorithms.IEdgeCursor;
+ /**
+ * Returns an edge cursor for incoming edges at this node.
+ * The cursor starts at the given edge, and the cyclic sequence order is the same
+ * as returned by {@link yfiles.algorithms.Node#getInEdgeCursor}.
+ * Precondition:startEdge is an incoming edge at this node.
+ * @param {yfiles.algorithms.Edge} startEdge The first edge being accessed by the returned cursor.
+ * @see {@link yfiles.algorithms.Node#getOutEdgeCursorFromStartEdge}
+ */
+ getInEdgeCursorFromStartEdge(startEdge:yfiles.algorithms.Edge):yfiles.algorithms.IEdgeCursor;
+ /**
+ * Returns an edge cursor for all outgoing edges at this node.
+ * @see {@link yfiles.algorithms.Node#getEdgeCursor}
+ * @see {@link yfiles.algorithms.Node#getInEdgeCursor}
+ */
+ getOutEdgeCursor():yfiles.algorithms.IEdgeCursor;
+ /**
+ * Returns an edge cursor for outgoing edges at this node.
+ * The cursor starts at the given edge, and the cyclic sequence order is the same
+ * as returned by {@link yfiles.algorithms.Node#getOutEdgeCursor}.
+ * Precondition:startEdge is an outgoing edge at this node.
+ * @param {yfiles.algorithms.Edge} startEdge The first edge being accessed by the returned cursor.
+ * @see {@link yfiles.algorithms.Node#getInEdgeCursorFromStartEdge}
+ */
+ getOutEdgeCursorFromStartEdge(startEdge:yfiles.algorithms.Edge):yfiles.algorithms.IEdgeCursor;
+ /**
+ * Returns a node cursor for all neighbor nodes of this node.
+ * Neighbor nodes are those at the opposite ends of both incoming and outgoing
+ * edges.
+ * @see {@link yfiles.algorithms.Node#getPredecessorCursor}
+ * @see {@link yfiles.algorithms.Node#getSuccessorCursor}
+ */
+ getNeighborCursor():yfiles.algorithms.INodeCursor;
+ /**
+ * Returns a node cursor for all predecessor nodes of this node.
+ * Predecessor nodes are those at the opposite ends of incoming edges.
+ * @see {@link yfiles.algorithms.Node#getSuccessorCursor}
+ */
+ getPredecessorCursor():yfiles.algorithms.INodeCursor;
+ /**
+ * Returns a node cursor for all successor nodes of this node.
+ * Successor nodes are those at the opposite ends of outgoing edges.
+ * @see {@link yfiles.algorithms.Node#getPredecessorCursor}
+ */
+ getSuccessorCursor():yfiles.algorithms.INodeCursor;
+ /**
+ * Returns an outgoing edge that connects this node with the given node, if such
+ * an edge exists.
+ * Otherwise null is returned.
+ * @see {@link yfiles.algorithms.Node#getEdge}
+ * @see {@link yfiles.algorithms.Node#getEdgeFrom}
+ */
+ getEdgeTo(target:yfiles.algorithms.Node):yfiles.algorithms.Edge;
+ /**
+ * Returns an incoming edge that connects the given node with this node, if such
+ * an edge exists.
+ * Otherwise null is returned.
+ * @see {@link yfiles.algorithms.Node#getEdge}
+ * @see {@link yfiles.algorithms.Node#getEdgeTo}
+ */
+ getEdgeFrom(source:yfiles.algorithms.Node):yfiles.algorithms.Edge;
+ /**
+ * Returns an edge that connects this node with the given node, if such an edge
+ * exists.
+ * Otherwise null is returned.
+ * Note that the first matching edge is returned, and that outgoing edges are
+ * tested prior to incoming edges.
+ * @see {@link yfiles.algorithms.Node#getEdgeFrom}
+ * @see {@link yfiles.algorithms.Node#getEdgeTo}
+ */
+ getEdge(opposite:yfiles.algorithms.Node):yfiles.algorithms.Edge;
+ /**
+ * Sorts incoming edges at this node according to the given comparator.
+ * @see {@link yfiles.algorithms.Node#sortOutEdges}
+ */
+ sortInEdges(c:yfiles.objectcollections.IComparer):void;
+ /**
+ * Sorts outgoing edges at this node according to the given comparator.
+ * @see {@link yfiles.algorithms.Node#sortInEdges}
+ */
+ sortOutEdges(c:yfiles.objectcollections.IComparer):void;
+ /**
+ * Returns a String representation of this node.
+ */
+ toString():string;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Edge}s that can be used to iterate over outgoing edges at this instance.
+ * This is a live enumerable and will thus reflect the current state of the node's adjacency.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ * Note that self-loop edges are reported, too.
+ */
+ outEdges:yfiles.collections.IEnumerable;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Edge}s that can be used to iterate over ingoing edges at this instance.
+ * This is a live enumerable and will thus reflect the current state of the node's adjacency.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ * Note that self-loop edges are reported, too.
+ */
+ inEdges:yfiles.collections.IEnumerable;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Edge}s that can be used to iterate over the adjacent edges at this instance.
+ * This is a live enumerable and will thus reflect the current state of the node's adjacency.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ * Note that self-loop edges are reported twice (as in edge and as out edge).
+ */
+ edges:yfiles.collections.IEnumerable;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Node}s that can be used to iterate over the opposite sides of adjacent outgoing edges at this instance.
+ * This is a live enumerable and will thus reflect the current state of the node's adjacency.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ * Note that for self-loop edges this node itself will be reported as a successor.
+ */
+ successors:yfiles.collections.IEnumerable;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Node}s that can be used to iterate over the opposite sides of adjacent incoming edges at this instance.
+ * This is a live enumerable and will thus reflect the current state of the node's adjacency.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ * Note that for self-loop edges this node itself will be reported as a predecessor.
+ */
+ predecessors:yfiles.collections.IEnumerable;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Node}s that can be used to iterate over the opposite sides of adjacent adjacent edges at this instance.
+ * This is a live enumerable and will thus reflect the current state of the node's adjacency.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ * Note that for self-loop edges this node itself will be reported as a neighbor, twice.
+ */
+ neighbors:yfiles.collections.IEnumerable;
+ }
+ var Node:{
+ $class:yfiles.lang.Class;
+ /**
+ * Instantiates a new Node object that will be part of the given graph.
+ * @param {yfiles.algorithms.Graph} g The graph that the created node will belong to.
+ */
+ new (g:yfiles.algorithms.Graph):yfiles.algorithms.Node;
+ };
+ /**
+ * Provides algorithms for solving the rank assignment problem.
+ * Let G=(V,E) be a directed acyclic graph. Let length(e) denote
+ * the minimal length and weight(e) the weight of an
+ * edge e.
+ * The rank assignment problem is to find values x(v) for all
+ * v in V, such that x(v) - x(w) >= length(v,w) for all (v,w) in E,
+ * and that the sum weight(v,w)*(x(v)-x(w)) over all (v,w) in E
+ * is minimal.
+ */
+ export interface RankAssignments extends Object{
+ }
+ var RankAssignments:{
+ $class:yfiles.lang.Class;
+ /**
+ * Solves the rank assignment problem using the simplex method.
+ * This method assigns a minimal rank to the nodes in a acyclic graph.
+ * Although its time complexity has not been proven polynomial, in practice
+ * it takes few iterations and runs quickly.
+ * The algorithm is based on:
+ * E.R. Gansner et al, A Technique for Drawing Directed Graphs,
+ * IEEE Transactions on Software Engineering, Vol.19, No.3,
+ * March 1993,
+ * Precondition: GraphChecker.isAcyclic(graph)
+ * Precondition: minLength.getInt(e) defined for each edge in graph.
+ * @param {yfiles.algorithms.Graph} g the graph for which the layers are determined.
+ * @param {yfiles.algorithms.INodeMap} layer here the ranking is stored.
+ * @param {yfiles.algorithms.IDataProvider} w here the weight of an edge is stored.
+ * @param {yfiles.algorithms.IDataProvider} minLength here the minimal length of an edge is stored.
+ * @return {number} the number of layers
+ */
+ simplex(g:yfiles.algorithms.Graph,layer:yfiles.algorithms.INodeMap,w:yfiles.algorithms.IDataProvider,minLength:yfiles.algorithms.IDataProvider):number;
+ /**
+ * Solves the rank assignment problem using the simplex method.
+ * This method assigns a minimal rank to the nodes in a acyclic graph.
+ * Although its time complexity has not been proven polynomial, in practice
+ * it takes few iterations and runs quickly.
+ * The algorithm is based on:
+ * E.R. Gansner et al, A Technique for Drawing Directed Graphs,
+ * IEEE Transactions on Software Engineering, Vol.19, No.3,
+ * March 1993,
+ *
+ * Note: if the algorithm exceeds the maximal duration, the result may not be optimal.
+ *
+ * Precondition: GraphChecker.isAcyclic(graph)
+ * Precondition: minLength.getInt(e) defined for each edge in graph.
+ * @param {yfiles.algorithms.Graph} g the graph for which the layers are determined.
+ * @param {yfiles.algorithms.INodeMap} layer here the ranking is stored.
+ * @param {yfiles.algorithms.IDataProvider} w here the weight of an edge is stored.
+ * @param {yfiles.algorithms.IDataProvider} minLength here the minimal length of an edge is stored.
+ * @param {number} maximalDuration a preferred time limit for the algorithm in milliseconds.
+ * @return {number} the number of layers
+ */
+ simplexWithMaximalDuration(g:yfiles.algorithms.Graph,layer:yfiles.algorithms.INodeMap,w:yfiles.algorithms.IDataProvider,minLength:yfiles.algorithms.IDataProvider,maximalDuration:number):number;
+ /**
+ * Similar to {@link yfiles.algorithms.RankAssignments#simplex}.
+ * Additionally
+ * it is possible to provide a valid initial tree solution for the problem.
+ * @param {yfiles.algorithms.Graph} g the graph for which the layers are determined.
+ * @param {yfiles.algorithms.INodeMap} layer here the ranking is stored.
+ * @param {yfiles.algorithms.IDataProvider} w here the weight of an edge is stored.
+ * @param {yfiles.algorithms.IDataProvider} minLength here the minimal length of an edge is stored.
+ * @param {boolean} validRanking
+ * if true, the argument
+ * layer contains a valid ranking.
+ * @param {yfiles.algorithms.IEdgeMap} tree may contain a valid tree solution.
+ * @param {yfiles.algorithms.Node} _root the root of the tree solution.
+ * @return {number} the number of layers
+ */
+ simplexWithRankingValidity(g:yfiles.algorithms.Graph,layer:yfiles.algorithms.INodeMap,w:yfiles.algorithms.IDataProvider,minLength:yfiles.algorithms.IDataProvider,tree:yfiles.algorithms.IEdgeMap,_root:yfiles.algorithms.Node,validRanking:boolean):number;
+ /**
+ * Similar to {@link yfiles.algorithms.RankAssignments#simplex}.
+ * Additionally
+ * it is possible to provide a valid initial tree solution for the problem.
+ *
+ * Note: if the algorithm exceeds the maximal duration, the result may not be optimal.
+ *
+ * @param {yfiles.algorithms.Graph} g the graph for which the layers are determined.
+ * @param {yfiles.algorithms.INodeMap} layer here the ranking is stored.
+ * @param {yfiles.algorithms.IDataProvider} w here the weight of an edge is stored.
+ * @param {yfiles.algorithms.IDataProvider} minLength here the minimal length of an edge is stored.
+ * @param {boolean} validRanking
+ * if true, the argument
+ * layer contains a valid ranking.
+ * @param {yfiles.algorithms.IEdgeMap} tree may contain a valid tree solution.
+ * @param {yfiles.algorithms.Node} _root the root of the tree solution.
+ * @param {number} maximalDuration a preferred time limit for the algorithm in milliseconds.
+ * @return {number} the number of layers
+ */
+ simplexWithRankingValidityAndMaximalDuration(g:yfiles.algorithms.Graph,layer:yfiles.algorithms.INodeMap,w:yfiles.algorithms.IDataProvider,minLength:yfiles.algorithms.IDataProvider,tree:yfiles.algorithms.IEdgeMap,_root:yfiles.algorithms.Node,validRanking:boolean,maximalDuration:number):number;
+ /**
+ * This method quickly calculates a tight tree
+ * using a highly optimized version of Gansner's algorithm .
+ * @param {yfiles.algorithms.Graph} g
+ * the graph, where all the edges have directions, such that
+ * rank[source] < rank[target] and rank[target] - rank[source] >= minlength[edge]
+ * @param {yfiles.algorithms.INodeMap} rank the initial ranking
+ * @param {yfiles.algorithms.IEdgeMap} minLength
+ * the minimal (tight) lengths for each edge. Values must be
+ * non-negative.
+ * @return {number} the number of layers.
+ */
+ simple(g:yfiles.algorithms.Graph,rank:yfiles.algorithms.INodeMap,minLength:yfiles.algorithms.IEdgeMap):number;
+ /**
+ * This method quickly calculates a tight tree
+ * using a highly optimized version of Gansner's algorithm .
+ *
+ * Note: if the algorithm exceeds the maximal duration, the result may be invalid (not a valid ranking).
+ *
+ * @param {yfiles.algorithms.Graph} g
+ * the graph, where all the edges have directions, such that
+ * rank[source] < rank[target] and rank[target] - rank[source] >= minlength[edge]
+ * @param {yfiles.algorithms.INodeMap} rank the initial ranking
+ * @param {yfiles.algorithms.IEdgeMap} minLength
+ * the minimal (tight) lengths for each edge. Values must be
+ * non-negative.
+ * @param {number} maximalDuration a preferred time limit for the algorithm in milliseconds.
+ * @return {number} the number of layers.
+ */
+ simpleWithMaximumDuration(g:yfiles.algorithms.Graph,rank:yfiles.algorithms.INodeMap,minLength:yfiles.algorithms.IEdgeMap,maximalDuration:number):number;
+ /**
+ * This method quickly calculates a tight tree
+ * using a highly optimized version of Gansner's algorithm .
+ * @param {yfiles.algorithms.Graph} g
+ * the graph, where all the edges have directions, such that
+ * rank[source] < rank[target] and rank[target] - rank[source] >= minlength[edge]
+ * @param {number[]} rank the initial ranking
+ * @param {number[]} minLength
+ * the minimal (tight) lengths for each edge. Values must be
+ * non-negative.
+ * @return {number} the number of layers.
+ */
+ simpleFromArray(g:yfiles.algorithms.Graph,rank:number[],minLength:number[]):number;
+ /**
+ * This method quickly calculates a tight tree
+ * using a highly optimized version of Gansner's algorithm .
+ *
+ * Note: if the algorithm exceeds the maximal duration, the result may be invalid (not a valid ranking).
+ *
+ * @param {yfiles.algorithms.Graph} g
+ * the graph, where all the edges have directions, such that
+ * rank[source] < rank[target] and rank[target] - rank[source] >= minlength[edge]
+ * @param {number[]} rank the initial ranking
+ * @param {number[]} minLength
+ * the minimal (tight) lengths for each edge. Values must be
+ * non-negative.
+ * @param {number} maximalDuration a preferred time limit for the algorithm in milliseconds.
+ * @return {number} the number of layers.
+ */
+ simpleFromArrayWithMaximalDuration(g:yfiles.algorithms.Graph,rank:number[],minLength:number[],maximalDuration:number):number;
+ };
+ /**
+ * Responsible for finding paths within a graph that have
+ * certain properties.
+ */
+ export interface Paths extends Object{
+ }
+ var Paths:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns an edge list that contains the edges of a path
+ * from the given start node to the given end node,
+ * if such a path exists.
+ * The edges are returned in the
+ * order they appear in the found path.
+ * If the returned path is empty then no path between the
+ * given nodes was found.
+ * Precondition: startNode != endNode
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.Node} startNode the first node of the path
+ * @param {yfiles.algorithms.Node} endNode the last node of the path
+ * @param {boolean} directed whether to search for a directed or undirected path
+ */
+ findPath(graph:yfiles.algorithms.Graph,startNode:yfiles.algorithms.Node,endNode:yfiles.algorithms.Node,directed:boolean):yfiles.algorithms.EdgeList;
+ /**
+ * Returns an edge list that contains the edges of a
+ * undirected simple path within the given graph.
+ * The edges are returned in the order they appear in the found path.
+ * A heuristic is used to find a path that is long.
+ * It is not guaranteed though that the returned path is
+ * actually the longest path within the given graph, since that is
+ * a well known hard to solve problem.
+ * Complexity: O(graph.N() + graph.E())
+ * Precondition: GraphChecker.isSimple(graph);
+ */
+ findLongPath(graph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Calculates the longest path from one vertex to all other vertices
+ * in a given acyclic graph.
+ * Precondition: GraphCheckers.isAcyclic(g)
+ * @param {yfiles.algorithms.Graph} g a directed acyclic graph.
+ * @param {yfiles.algorithms.Node} startNode the node, for which the distances are calculated.
+ * @param {yfiles.algorithms.IEdgeMap} dist the distances for the edges.
+ * @param {yfiles.algorithms.INodeMap} maxDist here the result will be stored.
+ * @param {yfiles.algorithms.IEdgeMap} predicate only edges for which predicate is true are considered.
+ */
+ findLongestPaths(g:yfiles.algorithms.Graph,startNode:yfiles.algorithms.Node,dist:yfiles.algorithms.IEdgeMap,maxDist:yfiles.algorithms.INodeMap,predicate:yfiles.algorithms.IEdgeMap):void;
+ /**
+ * Returns the longest directed path within the given acyclic graph.
+ * Precondition: GraphChecker.isAcyclic(g)
+ * @param {yfiles.algorithms.Graph} g a directed acyclic graph
+ * @return {yfiles.algorithms.EdgeList}
+ * an edge list representing the longest directed path within
+ * the given graph
+ */
+ findLongestPath(g:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Returns the longest directed path within a given acyclic weighted
+ * graph.
+ * All edges of the graph have an integral length associated
+ * with them. The longest path is defined as one of all
+ * directed paths within the graph for which the edge lengths
+ * of all contained edges sum up to a maximum.
+ * Precondition: GraphChecker.isAcyclic(g)
+ * Precondition: edgeLength.getInt(e) > 0 for all edges e of g
+ * @param {yfiles.algorithms.Graph} g a directed acyclic graph
+ * @param {yfiles.algorithms.IDataProvider} edgeLength
+ * a data provider that must provide the length of each
+ * edge as an int value
+ * @return {yfiles.algorithms.EdgeList}
+ * an edge list representing the longest directed path within
+ * the given graph
+ */
+ findLongestPathWithEdgeLength(g:yfiles.algorithms.Graph,edgeLength:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ /**
+ * Constructs a node path from a given edge path.
+ * The returned node path
+ * has length path.size()+1, if the given path is not empty.
+ * Otherwise the returned path will be empty. The i-th node in the
+ * returned path will be either source or target node of the i-th edge
+ * in the given path.
+ */
+ constructNodePath(path:yfiles.algorithms.EdgeList):yfiles.algorithms.NodeList;
+ /**
+ * Returns whether or not there is a directed path from one node to another node
+ * in an acyclic graph.
+ * Precondition: GraphChecker.isAcyclic(g)
+ * @param {yfiles.algorithms.Graph} g the acyclic graph which contains the two nodes.
+ * @param {yfiles.algorithms.NodeList} topSort a topological sorting of the nodes of the graph.
+ * @param {yfiles.algorithms.IEdgeMap} predicate only edges for which predicate is true are considered.
+ */
+ findPathFiltered(g:yfiles.algorithms.Graph,topSort:yfiles.algorithms.NodeList,startNode:yfiles.algorithms.Node,endNode:yfiles.algorithms.Node,predicate:yfiles.algorithms.IEdgeMap):boolean;
+ /**
+ * Marks all edges that belong to a directed path from start to end node.
+ * Complexity: O(g.N()+g.E())
+ * @param {yfiles.algorithms.Graph} g the input graph
+ * @param {yfiles.algorithms.Node} start the start node
+ * @param {yfiles.algorithms.Node} end the end node
+ * @param {yfiles.algorithms.IEdgeMap} pathEdges
+ * the result. For each edge a boolean value will indicate whether or not
+ * it belongs to a path connecting the two nodes.
+ */
+ findAllPathsToEdgeMap(g:yfiles.algorithms.Graph,start:yfiles.algorithms.Node,end:yfiles.algorithms.Node,pathEdges:yfiles.algorithms.IEdgeMap):void;
+ /**
+ * Returns all chains present in the given graph.
+ * A chain in a graph is
+ * a paths of maximal length, where each internal node on the path has degree 2.
+ * The internal nodes on directed chains all have in-degree 1 and out-degree 1.
+ * Complexity: O(g.N()+g.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @return {yfiles.algorithms.EdgeList[]}
+ * an array of EdgeList objects, each of which has at least length 2.
+ * An edge list contains the edges that make up a chain. Method
+ * {@link yfiles.algorithms.Paths#constructNodePath} can be used to convert an edge path
+ * to a node path.
+ */
+ findAllChains(graph:yfiles.algorithms.Graph,directed:boolean):yfiles.algorithms.EdgeList[];
+ /**
+ * Returns all simple directed or undirected paths that connect start with end node.
+ * One should note that the number of different paths connecting two nodes can be exponential
+ * in number of nodes and edges of a given graph. This said, even for small graphs the runtime and memory
+ * consumption of the algorithm can be excessive. To significantly lower memory consumption use
+ * {@link yfiles.algorithms.Paths#findAllPathsCursor} instead.
+ * Complexity: O(2^(g.N()+g.E()))
+ * Precondition: graph, startNode, and endNode may not be null.
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.Node} startNode the start node
+ * @param {yfiles.algorithms.Node} endNode the end node
+ * @param {boolean} directed whether or not to consider the edges in the graph to be directed or not.
+ * @return {yfiles.algorithms.EdgeList[]} an array of EdgeLists each representing a path between start and end node.
+ */
+ findAllPaths(graph:yfiles.algorithms.Graph,startNode:yfiles.algorithms.Node,endNode:yfiles.algorithms.Node,directed:boolean):yfiles.algorithms.EdgeList[];
+ /**
+ * A variant of {@link yfiles.algorithms.Paths#findAllPaths}
+ * that returns its result not as a list but as a special cursor that calculates
+ * the next path in the sequence only when needed.
+ * The returned cursor only supports the operation {@link yfiles.algorithms.ICursor#ok},
+ * {@link yfiles.algorithms.ICursor#current}, {@link yfiles.algorithms.ICursor#size} and {@link yfiles.algorithms.ICursor#next}.
+ */
+ findAllPathsCursor(graph:yfiles.algorithms.Graph,startNode:yfiles.algorithms.Node,endNode:yfiles.algorithms.Node,directed:boolean):yfiles.algorithms.ICursor;
+ /**
+ * A variant of {@link yfiles.algorithms.Paths#findAllPaths}
+ * that additionally allows to specify a filter for the paths to be returned.
+ * @param {function(yfiles.algorithms.EdgeList):boolean} filter a filter that tests for each found EdgeList if it should make it to the result list.
+ */
+ findAllPathsFiltered(graph:yfiles.algorithms.Graph,startNode:yfiles.algorithms.Node,endNode:yfiles.algorithms.Node,directed:boolean,filter:(obj:yfiles.algorithms.EdgeList)=>boolean):yfiles.algorithms.EdgeList[];
+ };
+ /**
+ * Provides graph algorithms that order the nodes of a graph
+ * by a specific criterion.
+ */
+ export interface NodeOrders extends Object{
+ }
+ var NodeOrders:{
+ $class:yfiles.lang.Class;
+ /**
+ * Assigns a topological order to the nodes of an acyclic graph.
+ * If the given graph is not acyclic then this method returns false
+ * leaving the contents of result topOrder unspecified.
+ * A topological node order of an acyclic graph has the property that for
+ * each node v all of its successors have a higher rank in the order
+ * than v itself.
+ * Precondition: order.length == graph.N()
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {number[]} order
+ * result value that holds for each node v the
+ * zero-based index within the calculated order,
+ * i.e topOrder[v.index()] == 5
+ * means that v is the 6-th node within the order.
+ */
+ topologicalWithOrder(graph:yfiles.algorithms.Graph,order:number[]):boolean;
+ /**
+ * Returns a topological node order of an acyclic graph.
+ * Precondition: GraphChecker.isAcyclic(graph)
+ * Complexity: O(graph.N()+graph.E())
+ */
+ topological(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ /**
+ * This method calculates a node order that is identical with
+ * the order of node completion events in a depth first search.
+ * This order is a reversed topological order in case the input graph
+ * is acyclic.
+ * Complexity: O(graph.N()+graph.E())
+ * @see {@link yfiles.algorithms.NodeOrders#topologicalWithOrder}
+ */
+ dfsCompletionWithOrder(graph:yfiles.algorithms.Graph,order:number[]):void;
+ /**
+ * Like {@link yfiles.algorithms.NodeOrders#dfsCompletionWithOrder} but the result is returned
+ * as a NodeList.
+ */
+ dfsCompletion(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ /**
+ * Assigns an ST-order to the nodes of a biconnected graph.
+ * An ST order (v_1,v_2,....,v_n) for a biconnected graph
+ * is a node order which guarantees that
+ *
+ *
the first node S and the last node T
+ * are connected by an edge.
+ *
For each node v_i in the order that
+ * are not S or T there are
+ * neighbors v_j and v_k with
+ * j < i and k > i.
+ *
+ * Precondition: tOrder.length == graph.N()
+ * Precondition: GraphChecker.isBiconnected(graph)
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {number[]} stOrder
+ * result value that holds for each node v the
+ * zero-based index within the calculated order,
+ * i.e stOrder[v.index()] == 5
+ * means that v is the 6-th node within the order.
+ */
+ stWithOrder(graph:yfiles.algorithms.Graph,stOrder:number[]):void;
+ /**
+ * Similar to {@link yfiles.algorithms.NodeOrders#stWithOrder}.
+ * Additionally, the edge between the first node S and
+ * the last node T of the returned ordering can be specified.
+ * @param {yfiles.algorithms.Edge} stEdge an edge that connects the first node of the ordering with the last node of the ordering.
+ */
+ stWithOrderAndEdge(graph:yfiles.algorithms.Graph,stOrder:number[],stEdge:yfiles.algorithms.Edge):void;
+ /**
+ * Like {@link yfiles.algorithms.NodeOrders#stWithOrder} but the result is returned as
+ * a NodeList.
+ */
+ st(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ /**
+ * Converts an array-based result yield by a method of this class
+ * to a NodeList that contains all nodes of the order in the
+ * correct sequence.
+ */
+ toNodeList(graph:yfiles.algorithms.Graph,order:number[]):yfiles.algorithms.NodeList;
+ /**
+ * Copies an array-based result yield by a method of this class
+ * to a NodeMap that will provide values of basic type int.
+ */
+ toNodeMapWithOrder(graph:yfiles.algorithms.Graph,order:number[],result:yfiles.algorithms.INodeMap):void;
+ /**
+ * Copies a list-based result yield by a method of this class
+ * to a NodeMap.
+ * The resulting NodeMap will provide for each node
+ * the index of the node within the given order. The index is of basic type
+ * int.
+ */
+ toNodeMap(order:yfiles.algorithms.NodeList,result:yfiles.algorithms.INodeMap):void;
+ };
+ /**
+ * An interface that describes the structural information of a graph and the data
+ * that is associated with its nodes and edges.
+ */
+ export interface IGraphInterface extends Object{
+ /**
+ * Returns an iterator that provides access to all nodes residing in the graph.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#nodeObjects}.
+ */
+ nodeObjects():yfiles.algorithms.IIterator;
+ /**
+ * Returns an iterator that provides access to all edges residing in the graph.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#edgeObjects}.
+ */
+ edgeObjects():yfiles.algorithms.IIterator;
+ /**
+ * Returns the source node associated with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#getSource}.
+ */
+ getSource(edgeObject:Object):Object;
+ /**
+ * Returns the target node associated with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#getTarget}.
+ */
+ getTarget(edgeObject:Object):Object;
+ /**
+ * Returns the data provider that is registered with the graph using the given
+ * look-up key.
+ * The look-up domain of a returned data provider normally consists of either
+ * the nodes of the graph, or its edges, or both.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#getDataProvider}.
+ */
+ getDataProvider(dataKey:Object):yfiles.algorithms.IDataProvider;
+ /**
+ * An array of all data provider look-up keys that are registered with
+ * the graph.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#dataProviderKeys}.
+ */
+ dataProviderKeys:Object[];
+ }
+ var IGraphInterface:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * The listener interface for receiving graph events.
+ * A class that is interested in processing a graph event implements this interface.
+ * The object created with that class is then registered with a graph.
+ * When the graph structure changes, the listener object's
+ * {@link yfiles.algorithms.IGraphListener#onGraphEvent onGraphEvent} method is invoked.
+ * The listener object's onGraphEvent method is also invoked on so-called PRE and
+ * POST events emitted by the graph.
+ * These events signal that a (possibly empty) sequence of graph events is about
+ * to be emitted (PRE event) or that the sequence is completed (POST event).
+ * For example, if a node is about to be removed from a graph, then the following
+ * sequence of graph events can be observed:
+ *
+ *
+ * a PRE event
+ *
+ *
+ * a (possibly empty) sequence of edge removal events
+ *
+ *
+ * the actual node removal event
+ *
+ *
+ * a POST event
+ *
+ *
+ * The POST event concludes the logically coherent sequence of structural graph
+ * changes that has been opened by the PRE event.
+ * PRE and POST events must constitute a well-formed bracket-structure, e.g.,
+ * ( ( () ) () ).
+ */
+ export interface IGraphListener extends Object{
+ /**
+ * Invoked when the structure of the graph has changed.
+ * The code written for this method performs the operations that need to occur
+ * when the graph changes.
+ * @see Specified by {@link yfiles.algorithms.IGraphListener#onGraphEvent}.
+ */
+ onGraphEvent(e:yfiles.algorithms.GraphEvent):void;
+ }
+ var IGraphListener:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * A general interface for data provision.
+ * A data provider grants access to data associated
+ * with one or more data holders. It constitutes a read-only
+ * view on particular data.
+ */
+ export interface IDataProvider extends Object{
+ /**
+ * Returns an object value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#get}.
+ */
+ get(dataHolder:Object):Object;
+ /**
+ * Returns an integer value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#getInt}.
+ */
+ getInt(dataHolder:Object):number;
+ /**
+ * Returns a double value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#getDouble}.
+ */
+ getDouble(dataHolder:Object):number;
+ /**
+ * Returns a boolean value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#getBool}.
+ */
+ getBool(dataHolder:Object):boolean;
+ }
+ var IDataProvider:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * A cursor interface for iterating over edges.
+ */
+ export interface IEdgeCursor extends Object,yfiles.algorithms.ICursor{
+ /**
+ * The edge at the current location of the cursor.
+ * This method is the typed variant of {@link yfiles.algorithms.ICursor#current}.
+ * @see Specified by {@link yfiles.algorithms.IEdgeCursor#edge}.
+ */
+ edge:yfiles.algorithms.Edge;
+ /**
+ * Moves the cursor to the cyclic next element of the underlying sequence.
+ * This is the next element if available, else it is the first element.
+ * @see Specified by {@link yfiles.algorithms.IEdgeCursor#cyclicNext}.
+ */
+ cyclicNext():void;
+ /**
+ * Moves the cursor to the cyclic previous element of the underlying sequence.
+ * This is the previous element if available, else it is the last element.
+ * @see Specified by {@link yfiles.algorithms.IEdgeCursor#cyclicPrev}.
+ */
+ cyclicPrev():void;
+ }
+ var IEdgeCursor:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * Provides access to data associated with an edge.
+ * An edge map can be considered as a map that allows
+ * only edges as keys. Edge keys of an edge map must belong
+ * to the same graph.
+ * There are data access methods defined for the most common typed
+ * values as well.
+ * The edge values are initialized with Java(TM) default values
+ * (null, 0, 0.0, false) upon initialization.
+ */
+ export interface IEdgeMap extends Object,yfiles.algorithms.IDataProvider,yfiles.algorithms.IDataAcceptor,yfiles.algorithms.IDataMap{
+ /**
+ * Associates the given value to the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#set}.
+ */
+ set(edge:Object,value:Object):void;
+ /**
+ * Returns the value bound to the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#get}.
+ */
+ get(edge:Object):Object;
+ /**
+ * Associates the given boolean value to the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#setBool}.
+ */
+ setBool(edge:Object,value:boolean):void;
+ /**
+ * Returns the boolean value bound to the given edge.
+ * Precondition:
+ * The value must have been associated to the given edge by
+ * a call to {@link yfiles.algorithms.IEdgeMap#setBool setBool}.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#getBool}.
+ */
+ getBool(edge:Object):boolean;
+ /**
+ * Associates the given double value to the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#setDouble}.
+ */
+ setDouble(edge:Object,value:number):void;
+ /**
+ * Returns the double value bound to the given edge.
+ * Precondition:
+ * The value must have been associated to the given edge by
+ * a call to {@link yfiles.algorithms.IEdgeMap#setDouble setDouble}.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#getDouble}.
+ */
+ getDouble(edge:Object):number;
+ /**
+ * Associates the given integer value to the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#setInt}.
+ */
+ setInt(edge:Object,value:number):void;
+ /**
+ * Returns the integer value bound to the given edge.
+ * Precondition:
+ * The value must have been associated to the given edge by
+ * a call to {@link yfiles.algorithms.IEdgeMap#setInt setInt}.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#getInt}.
+ */
+ getInt(edge:Object):number;
+ }
+ var IEdgeMap:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * This class provides methods for calculating independent sets.
+ */
+ export interface IndependentSets extends Object{
+ }
+ var IndependentSets:{
+ $class:yfiles.lang.Class;
+ /**
+ * Partitions the vertex set of the given conflict graph into independent sets.
+ * Precondition: The input graph is simple, i.e. it contains neither multi-edges nor selfloops.
+ * @param {yfiles.algorithms.Graph} conflictGraph the input graph.
+ * @return {yfiles.algorithms.NodeList[]} a NodeList array where each entry contains an independent set of nodes.
+ * @see {@link yfiles.algorithms.IndependentSets#getIndependentSet}
+ */
+ getIndependentSets(conflictGraph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList[];
+ /**
+ * Calculates an independent set for a given conflict graph (each pair of nodes of the independent set is non-adjacent
+ * in the conflict graph).
+ * We use a greedy heuristic which tries to find a large independent set.
+ * Precondition: The input graph is simple, i.e. it contains neither multi-edges nor selfloops.
+ * @param {yfiles.algorithms.Graph} conflictGraph the input graph.
+ * @return {yfiles.algorithms.NodeList} a NodeList containing an independent set of nodes
+ */
+ getIndependentSet(conflictGraph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ };
+ /**
+ * Exception thrown when a graph-structural precondition is violated.
+ * Some graph algorithms make only sense on specially structured graphs, like,
+ * e.g., trees, DAGs (short for directed acyclic graph), or planar graphs.
+ * Methods that detect graph-structural mismatch will throw this exception then.
+ */
+ export interface InvalidGraphStructureException extends yfiles.system.ArgumentException{
+ }
+ var InvalidGraphStructureException:{
+ $class:yfiles.lang.Class;
+ /**
+ * Constructs a WrongGraphStructure exception with the specified message.
+ */
+ new (msg:string):yfiles.algorithms.InvalidGraphStructureException;
+ };
+ /**
+ * Represents a so-called "cell" or "link" of the doubly linked list implementation
+ * {@link yfiles.algorithms.YList}.
+ * It may be used to perform fast access and remove operations on that type of list.
+ */
+ export interface ListCell extends Object{
+ /**
+ * Returns the successor cell of this cell.
+ * If there is no successor, then null is returned.
+ */
+ succ():yfiles.algorithms.ListCell;
+ /**
+ * Returns the predecessor cell of this cell.
+ * If there is no predecessor, then null is returned.
+ */
+ pred():yfiles.algorithms.ListCell;
+ /**
+ * The element stored in this cell.
+ */
+ info:Object;
+ }
+ var ListCell:{
+ $class:yfiles.lang.Class;
+ };
+ /**
+ * A cursor interface for iterating over nodes.
+ */
+ export interface INodeCursor extends Object,yfiles.algorithms.ICursor{
+ /**
+ * The node at the current location of the cursor.
+ * This method is the typed variant of {@link yfiles.algorithms.ICursor#current}.
+ * @see Specified by {@link yfiles.algorithms.INodeCursor#node}.
+ */
+ node:yfiles.algorithms.Node;
+ /**
+ * Moves the cursor to the cyclic next element of the underlying sequence.
+ * This is the next element if available, else it is the first element.
+ * @see Specified by {@link yfiles.algorithms.INodeCursor#cyclicNext}.
+ */
+ cyclicNext():void;
+ /**
+ * Moves the cursor to the cyclic previous element of the underlying sequence.
+ * This is the previous element if available, else it is the last element.
+ * @see Specified by {@link yfiles.algorithms.INodeCursor#cyclicPrev}.
+ */
+ cyclicPrev():void;
+ }
+ var INodeCursor:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * Provides access to data associated with a node.
+ * A node map can be considered as a map that allows
+ * only nodes as keys. Node keys of a node map must belong
+ * to the same graph.
+ * There are data access methods defined for the most common typed
+ * values as well.
+ * The node values are initialized with Java(TM) default values
+ * (null, 0, 0.0, false) upon initialization.
+ */
+ export interface INodeMap extends Object,yfiles.algorithms.IDataProvider,yfiles.algorithms.IDataAcceptor,yfiles.algorithms.IDataMap{
+ /**
+ * Associates the given value to the given node.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#set}.
+ */
+ set(node:Object,value:Object):void;
+ /**
+ * Returns the value bound to the given node.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#get}.
+ */
+ get(node:Object):Object;
+ /**
+ * Associates the given boolean value to the given node.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#setBool}.
+ */
+ setBool(node:Object,value:boolean):void;
+ /**
+ * Returns the boolean value bound to the given node.
+ * Precondition:
+ * The value must have been associated to the given node by
+ * a call to {@link yfiles.algorithms.INodeMap#setBool setBool}.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#getBool}.
+ */
+ getBool(key:Object):boolean;
+ /**
+ * Associates the given double value to the given node.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#setDouble}.
+ */
+ setDouble(node:Object,value:number):void;
+ /**
+ * Returns the double value bound to the given node.
+ * Precondition:
+ * The value must have been associated to the given node by
+ * a call to {@link yfiles.algorithms.INodeMap#setDouble setDouble}.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#getDouble}.
+ */
+ getDouble(node:Object):number;
+ /**
+ * Associates the given integer value to the given node.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#setInt}.
+ */
+ setInt(node:Object,value:number):void;
+ /**
+ * Returns the integer value bound to the given node.
+ * Precondition:
+ * The value must have been associated to the given node by
+ * a call to {@link yfiles.algorithms.INodeMap#setInt setInt}.
+ * @see Specified by {@link yfiles.algorithms.INodeMap#getInt}.
+ */
+ getInt(node:Object):number;
+ }
+ var INodeMap:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * Generic Interface for classes that provide an ordering
+ * for the nodes of a graph.
+ */
+ export interface INodeSequencer extends Object{
+ /**
+ * Returns a cursor that grants access to all nodes of the given
+ * graph in some order.
+ * @see Specified by {@link yfiles.algorithms.INodeSequencer#nodes}.
+ */
+ nodes(graph:yfiles.algorithms.Graph):yfiles.algorithms.INodeCursor;
+ }
+ var INodeSequencer:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * Provides diverse algorithms and helper methods for solving the shortest path problem
+ * on weighted graphs.
+ */
+ export interface ShortestPaths extends Object{
+ }
+ var ShortestPaths:{
+ $class:yfiles.lang.Class;
+ /**
+ * This method solves the single-source shortest path problem for arbitrary graphs
+ * where each edge has a uniform cost of 1.0.
+ * This method yields the shortest distance from a given node s to all other nodes.
+ * Precondition: dist.length == graph.N()
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} s the start node for the shortest path search
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {number[]} dist
+ * return value that will hold the shortest distance from node s to
+ * all other nodes. The distance from s to v is
+ * dist[v.index()]. If there is no path from s to v
+ * then dist[v.index()] == Double.POSITIVE_INFINITY.
+ */
+ uniform(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,dist:number[]):void;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#uniform} but additionally this method
+ * yields the path edges of each calculated shortest path.
+ * Precondition: pred.length == graph.N()
+ * @param {yfiles.algorithms.Edge[]} pred
+ * return value that holds for each node t the shortest
+ * path edge pred[t.index()] which is the last edge on the shortest
+ * path from s to t. If t == s or if there
+ * is no shortest path from s to t then
+ * pred[t.index()] == null.
+ * @see {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray}
+ * @see {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray}
+ */
+ uniformToArray(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,dist:number[],pred:yfiles.algorithms.Edge[]):void;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#uniformToArray} but uses NodeMaps instead of
+ * arrays.
+ * @param {yfiles.algorithms.INodeMap} dist return value. the map will provide a double value for each node.
+ * @param {yfiles.algorithms.INodeMap} pred return value. the map will provide an Edge for each node.
+ */
+ uniformToMap(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,dist:yfiles.algorithms.INodeMap,pred:yfiles.algorithms.INodeMap):void;
+ /**
+ * This method solves the single-source shortest path problem for acyclic directed graphs.
+ * Associated with each edge is an arbitrary double value that represents the cost of that edge.
+ * This method yields the shortest distance from a given node s to all other nodes.
+ * Precondition: GraphChecker.isAcyclic(graph)
+ * Precondition: cost.length == graph.E()
+ * Precondition: dist.length == graph.N()
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} s the start node for the shortest path search
+ * @param {number[]} cost
+ * holds the costs for traversing each edge. Edge e
+ * has cost cost[e.index()].
+ * @param {number[]} dist
+ * return value that will hold the shortest distance from node s to
+ * all other nodes. The distance from s to v is
+ * dist[v.index()]. If there is no path from s to v
+ * then dist[v.index()] == Double.POSITIVE_INFINITY.
+ * @return {boolean} false if the input graph was not acyclic.
+ */
+ acyclic(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,cost:number[],dist:number[]):boolean;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#acyclic} but additionally this method
+ * yields the path edges of each calculated shortest path.
+ * Precondition: pred.length == graph.N()
+ * @param {yfiles.algorithms.Edge[]} pred
+ * return value that holds for each node t the shortest
+ * path edge pred[t.index()] which is the last edge on the shortest
+ * path from s to t. If t == s or if there
+ * is no shortest path from s to t then
+ * pred[t.index()] == null.
+ * @see {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray}
+ * @see {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray}
+ */
+ acyclicToArray(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,cost:number[],dist:number[],pred:yfiles.algorithms.Edge[]):boolean;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#acyclicToArray}
+ * but uses NodeMaps and DataProviders instead of arrays.
+ * @param {yfiles.algorithms.IDataProvider} cost must provide a double value for each edge.
+ * @param {yfiles.algorithms.INodeMap} dist return value. the map will provide a double value for each node.
+ * @param {yfiles.algorithms.INodeMap} pred return value. the map will provide an Edge for each node.
+ */
+ acyclicToMap(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,cost:yfiles.algorithms.IDataProvider,dist:yfiles.algorithms.INodeMap,pred:yfiles.algorithms.INodeMap):boolean;
+ /**
+ * This method solves the single-source shortest path problem for arbitrary graphs.
+ * Associated with each edge is a non-negative double value that represents
+ * the cost of that edge.
+ * This method yields the shortest distance from a given node s to all other nodes.
+ * Precondition: For each edge e: cost[e.index()] >= 0
+ * Precondition: cost.length == graph.E()
+ * Precondition: dist.length == graph.N()
+ * Complexity: O(graph.E()+graph.N()*log(graph.N())
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} s the start node for the shortest path search
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {number[]} cost
+ * holds the costs for traversing each edge. Edge e
+ * has cost cost[e.index()].
+ * @param {number[]} dist
+ * return value that will hold the shortest distance from node s to
+ * all other nodes. The distance from s to v is
+ * dist[v.index()]. If there is no path from s to v
+ * then dist[v.index()] == Double.POSITIVE_INFINITY.
+ */
+ dijkstra(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:number[],dist:number[]):void;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#dijkstra} but additionally this method
+ * yields the path edges of each calculated shortest path.
+ * Precondition: pred.length == graph.N()
+ * @param {yfiles.algorithms.Edge[]} pred
+ * return value that holds for each node t the shortest
+ * path edge pred[t.index()] which is the last edge on the shortest
+ * path from s to t. If t == s or if there
+ * is no shortest path from s to t then
+ * pred[t.index()] == null.
+ * @see {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray}
+ * @see {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray}
+ */
+ dijkstraToArray(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:number[],dist:number[],pred:yfiles.algorithms.Edge[]):void;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#dijkstraToArray}
+ * but uses NodeMaps and DataProviders instead of arrays.
+ * @param {yfiles.algorithms.IDataProvider} cost must provide a double value for each edge.
+ * @param {yfiles.algorithms.INodeMap} dist return value. the map will provide a double value for each node.
+ * @param {yfiles.algorithms.INodeMap} pred return value. the map will provide an Edge for each node.
+ */
+ dijkstraWithCostToMap(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:yfiles.algorithms.IDataProvider,dist:yfiles.algorithms.INodeMap,pred:yfiles.algorithms.INodeMap):void;
+ /**
+ * This method solves the single-source single-sink shortest path problem
+ * for arbitrary graphs.
+ * Associated with each edge is a non-negative double value that represents
+ * the cost of that edge.
+ * This method returns the shortest distance from node s to node t.
+ * It also returns information to construct the actual path between these to nodes.
+ * Precondition: For each edge e: cost[e.index()] >= 0
+ * Precondition: cost.length == graph.E()
+ * Precondition: pred.length == graph.N()
+ * Complexity: O(graph.E()+graph.N()*log(graph.N())
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} s the source node for the shortest path search
+ * @param {yfiles.algorithms.Node} t the sink node for the shortest path search
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {number[]} cost
+ * holds the costs for traversing each edge. Edge e
+ * has cost cost[e.index()].
+ * @param {yfiles.algorithms.Edge[]} pred
+ * return value that holds for each node v on the
+ * the shortest the path from s to t an edge
+ * pred[v.index()] which is the last edge on
+ * the shortest path from s to v. If v == s or if there
+ * is no shortest path from s to v then
+ * pred[v.index()] == null.
+ * @return {number}
+ * the distance between s and t if a path between these two
+ * nodes exist and Double.POSITIVE_INFINITY otherwise.
+ * @see {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray}
+ * @see {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray}
+ */
+ singleSourceSingleSinkToArray(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,directed:boolean,cost:number[],pred:yfiles.algorithms.Edge[]):number;
+ /**
+ * Similar to {@link yfiles.algorithms.ShortestPaths#singleSourceSingleSinkToArray}
+ * but instead of returning the shortest distance between the source and sink
+ * the actual shortest edge path between these nodes will be returned.
+ * If the returned path is empty then there is no path between the nodes.
+ * @return {yfiles.algorithms.EdgeList} a shortest path between source and sink
+ */
+ singleSourceSingleSink(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,directed:boolean,cost:number[]):yfiles.algorithms.EdgeList;
+ /**
+ * Similar to {@link yfiles.algorithms.ShortestPaths#singleSourceSingleSinkToMap}
+ * but instead of returning the shortest distance between the source and sink
+ * the actual shortest edge path between these nodes will be returned.
+ * If the returned path is empty then there is no path between the nodes.
+ * @return {yfiles.algorithms.EdgeList} a shortest path between source and sink
+ */
+ singleSourceSingleSinkWithCost(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,directed:boolean,cost:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#singleSourceSingleSinkToArray}
+ * but uses NodeMaps and DataProviders instead of arrays.
+ * @param {yfiles.algorithms.IDataProvider} cost must provide a double value for each edge.
+ * @param {yfiles.algorithms.INodeMap} pred return value. the map will provide an Edge for each node.
+ */
+ singleSourceSingleSinkToMap(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,directed:boolean,cost:yfiles.algorithms.IDataProvider,pred:yfiles.algorithms.INodeMap):number;
+ /**
+ * This method solves the single-source shortest path problem for arbitrary graphs.
+ * Associated with each edge is an arbitrary double value that represents
+ * the cost of that edge. In case the given weighted graph contains no negative cost cycles
+ * this method will yield the shortest distance from a given node s to all other nodes.
+ * If, on the other hand, the given graph contains negative-cost cycles this method will yield
+ * no reasonable result which will be indicated by the return value false.
+ * Precondition: cost.length == graph.E()
+ * Precondition: dist.length == graph.N()
+ * Complexity:
+ * O(graph.E()*min(D,graph.N())) where D is the maximal
+ * number of edges in any shortest path.
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} s the start node for the shortest path search
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {number[]} cost
+ * holds the costs for traversing each edge. Edge e
+ * has cost cost[e.index()].
+ * @param {number[]} dist
+ * return value that will hold the shortest distance from node s to
+ * all other nodes. The distance from s to v is
+ * dist[v.index()]. If there is no path from s to v
+ * then dist[v.index()] == Double.POSITIVE_INFINITY.
+ * @return {boolean}
+ * false if this weighted graph contains a negative cost cycle,
+ * true otherwise.
+ */
+ bellmanFord(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:number[],dist:number[]):boolean;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#bellmanFord} but additionally this method
+ * yields the path edges of each calculated shortest path.
+ * Precondition: pred.length == graph.N()
+ * @param {yfiles.algorithms.Edge[]} pred
+ * return value that holds for each node t the shortest
+ * path edge pred[t.index()] which is the last edge on the shortest
+ * path from s to t. If t == s or if there
+ * is no shortest path from s to t then
+ * pred[t.index()] == null.
+ * @see {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray}
+ * @see {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray}
+ */
+ bellmanFordToArray(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:number[],dist:number[],pred:yfiles.algorithms.Edge[]):boolean;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#bellmanFordToArray}
+ * but uses NodeMaps and DataProviders instead of arrays.
+ * @param {yfiles.algorithms.IDataProvider} cost must provide a double value for each edge.
+ * @param {yfiles.algorithms.INodeMap} dist return value. the map will provide a double value for each node.
+ * @param {yfiles.algorithms.INodeMap} pred return value. the map will provide an Edge for each node.
+ */
+ bellmanFordToMap(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:yfiles.algorithms.IDataProvider,dist:yfiles.algorithms.INodeMap,pred:yfiles.algorithms.INodeMap):boolean;
+ /**
+ * This method solves the single-source shortest path problem for arbitrary graphs.
+ * Depending on the structure of the given graph and the values of the given edge costs it
+ * delegates its job to the algorithm with the theoretically best running time.
+ * Please note that theory does not necessarily reflect practice.
+ * Precondition: cost.length == graph.E()
+ * Precondition: dist.length == graph.N()
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} s the start node for the shortest path search
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {number[]} cost
+ * holds the costs for traversing each edge. Edge e
+ * has cost cost[e.index()].
+ * @param {number[]} dist
+ * return value that will hold the shortest distance from node s to
+ * all other nodes. The distance from s to v is
+ * dist[v.index()]. If there is no path from s to v
+ * then dist[v.index()] == Double.POSITIVE_INFINITY.
+ * @return {boolean}
+ * false if this weighted graph contains a negative cost cycle,
+ * true otherwise.
+ */
+ singleSource(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:number[],dist:number[]):boolean;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#singleSource} but additionally this method
+ * yields the path edges of each calculated shortest path.
+ * Precondition: pred.length == graph.N()
+ * @param {yfiles.algorithms.Edge[]} pred
+ * return value that holds for each node t the shortest
+ * path edge pred[t.index()] which is the last edge on the shortest
+ * path from s to t. If t == s or if there
+ * is no shortest path from s to t then
+ * pred[t.index()] == null.
+ * @see {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray}
+ * @see {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray}
+ */
+ singleSourceToArray(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:number[],dist:number[],pred:yfiles.algorithms.Edge[]):boolean;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#singleSourceToArray}
+ * but uses NodeMaps and DataProviders instead of arrays.
+ * @param {yfiles.algorithms.IDataProvider} cost must provide a double value for each edge.
+ * @param {yfiles.algorithms.INodeMap} dist return value. the map will provide a double value for each node.
+ * @param {yfiles.algorithms.INodeMap} pred return value. the map will provide an Edge for each node.
+ */
+ singleSourceToMap(graph:yfiles.algorithms.Graph,s:yfiles.algorithms.Node,directed:boolean,cost:yfiles.algorithms.IDataProvider,dist:yfiles.algorithms.INodeMap,pred:yfiles.algorithms.INodeMap):boolean;
+ /**
+ * This method solves the all-pairs shortest path problem for graphs with arbitrary
+ * edge costs.
+ * If the given graph contains a negative cost cycle, then false is
+ * returned and the values returned in dist are left unspecified.
+ * Precondition: cost.length == graph.E();
+ * Precondition: dimension of dist: [graph.N()][graph.N()]]
+ * Complexity: O(graph.N())*O(singleSource)
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {number[]} cost
+ * holds the costs for traversing each edge. Edge e
+ * has cost cost[e.index()].
+ * @param {number[][]} dist
+ * return value that will hold the shortest path distances from all pairs of
+ * nodes s and t in the graph.
+ * The distance from s to t is
+ * dist[s.index()][t.index()]. If there is no path from s to t
+ * then dist[s.index()][t.index()] == Double.POSITIVE_INFINITY.
+ * @return {boolean} whether or not the given graph contains a negative cost cycle.
+ */
+ allPairs(graph:yfiles.algorithms.Graph,directed:boolean,cost:number[],dist:number[][]):boolean;
+ /**
+ * Marks all edges that belong to a shortest path from start to end node.
+ * This method assumes that each edge of the input graph has a cost of 1.0.
+ * Complexity: O(g.N()+g.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.Node} start the start node
+ * @param {yfiles.algorithms.Node} end the end node
+ * @param {boolean} directed
+ * whether or not to consider the graph as directed. If the graph is
+ * to be considered undirected then each edge can be traversed in both directions and
+ * the returned shortest paths can thus be undirected.
+ * @param {yfiles.algorithms.IEdgeMap} pathMap
+ * the result. For each edge a boolean value will indicate whether or not
+ * it belongs to a shortest path connecting the two nodes.
+ */
+ findShortestUniformPaths(graph:yfiles.algorithms.Graph,start:yfiles.algorithms.Node,end:yfiles.algorithms.Node,directed:boolean,pathMap:yfiles.algorithms.IEdgeMap):void;
+ /**
+ * This method finds the k shortest paths
+ * connecting a pair of nodes in a directed graph with non-negative edge costs.
+ * The result will be returned as a list of EdgeList objects.
+ * Note that the returned paths are not required to be simple, i.e. they may contain
+ * a node or an edge multiple times.
+ * Precondition: For each edge e: costDP.getDouble(e) >= 0
+ * Complexity: O(graph.E() + graph.N()*log(graph.N()) + k)
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.IDataProvider} costDP
+ * a data provider that provides a double-valued cost for each edge
+ * of the input graph.
+ * @param {yfiles.algorithms.Node} start start node of the shortest paths
+ * @param {yfiles.algorithms.Node} end the end node of the shortest paths
+ * @param {number} k
+ * @return {yfiles.algorithms.YList}
+ * a list of EdgeList objects each of which representing a path from
+ * start to end node. The i-th path in the
+ * list contains the i-th shortest path between start and end
+ * node. Note that the returned list may contain less than k paths in case
+ * there are fewer directed paths between start and end node.
+ */
+ kShortestPaths(graph:yfiles.algorithms.Graph,costDP:yfiles.algorithms.IDataProvider,start:yfiles.algorithms.Node,end:yfiles.algorithms.Node,k:number):yfiles.algorithms.YList;
+ /**
+ * A variant of {@link yfiles.algorithms.ShortestPaths#kShortestPaths}
+ * that returns its result not as a list but as a special cursor that calculates
+ * the next path in the sequence only when needed.
+ * The returned cursor only supports the operation {@link yfiles.algorithms.ICursor#ok},
+ * {@link yfiles.algorithms.ICursor#current} and {@link yfiles.algorithms.ICursor#next}.
+ */
+ kShortestPathsCursor(graph:yfiles.algorithms.Graph,costDP:yfiles.algorithms.IDataProvider,start:yfiles.algorithms.Node,end:yfiles.algorithms.Node,k:number):yfiles.algorithms.ICursor;
+ /**
+ * Convenience method that returns an array containing
+ * uniform edge costs of 1.0 for each edge
+ * of the given graph.
+ * @return {number[]}
+ * an array cost[] that contains uniform
+ * edge costs of 1.0 for each edge e: cost[e.index()] == 1.0.
+ */
+ uniformCost(graph:yfiles.algorithms.Graph):number[];
+ /**
+ * Convenience method that constructs an explicit node path from the
+ * result yielded by one of the shortest paths methods defined in this class.
+ * @param {yfiles.algorithms.Node} s
+ * the start node of the shortest path. This must be the
+ * same start node that was specified when pred was calculated.
+ * @param {yfiles.algorithms.Node} t the end node of the path
+ * @param {yfiles.algorithms.Edge[]} pred
+ * the shortest path edge result array returned by one of the
+ * shortest path edge methods defined in this class.
+ * @return {yfiles.algorithms.NodeList}
+ * a node list that holds the nodes on the shortest path
+ * from s to t in the correct order. If there
+ * is no path from s to t then an empty
+ * list is returned.
+ */
+ constructNodePathFromArray(s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,pred:yfiles.algorithms.Edge[]):yfiles.algorithms.NodeList;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#constructNodePathFromArray} with the difference that
+ * the path edges are given by a DataProvider.
+ * @param {yfiles.algorithms.IDataProvider} pred
+ * the shortest path edge result DataProvider returned by one of the
+ * shortest path edge methods defined in this class.
+ */
+ constructNodePathFromMap(s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,pred:yfiles.algorithms.IDataProvider):yfiles.algorithms.NodeList;
+ /**
+ * Convenience method that constructs an explicit edge path from the
+ * result yielded by one of the shortest paths methods defined in this class.
+ * @param {yfiles.algorithms.Node} s
+ * the start node of the shortest path. This must be the
+ * same start node that was specified when pred was calculated.
+ * @param {yfiles.algorithms.Node} t the end node of the path
+ * @param {yfiles.algorithms.Edge[]} pred
+ * the shortest path edge result array returned by one of the
+ * shortest path edge methods defined in this class.
+ * @return {yfiles.algorithms.EdgeList}
+ * an edge list that holds the edges on the shortest path
+ * from s to t in the correct order. If there
+ * is no path from s to t then an empty
+ * list is returned.
+ */
+ constructEdgePathFromArray(s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,pred:yfiles.algorithms.Edge[]):yfiles.algorithms.EdgeList;
+ /**
+ * Like {@link yfiles.algorithms.ShortestPaths#constructEdgePathFromArray} with the difference that
+ * the path edges are given by a DataProvider.
+ * @param {yfiles.algorithms.IDataProvider} pred
+ * the shortest path edge result DataProvider returned by one of the
+ * shortest path edge methods defined in this class.
+ */
+ constructEdgePathToMap(s:yfiles.algorithms.Node,t:yfiles.algorithms.Node,pred:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ /**
+ * Finds all nodes and edges that belong to a shortest path from start to a set of target nodes in the graph not
+ * farther away than a given distance.
+ * This method assumes that each edge of the input graph has a cost of 1.0.
+ * Complexity: O(g.N()+g.E())
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.Node} start the start node
+ * @param {yfiles.algorithms.IDataProvider} targetMap
+ * a boolean data provider that marks the target nodes. If the data provider is null
+ * all nodes in the graph are assumed to be target nodes.
+ * @param {boolean} directed whether or not to work on directed edges
+ * @param {number} maxLength
+ * the maximum edge length of the shortest paths. Shortest paths
+ * that are longer than this value will not be considered.
+ * @param {yfiles.algorithms.EdgeList} pathEdges
+ * a return value. If this parameter is not null, this algorithm first clears the list and then adds
+ * all edges that belong to the detected shortest paths.
+ * @param {yfiles.algorithms.NodeList} pathNodes
+ * a return value. If this parameter is not null, this algorithm first clears the list and then adds
+ * all nodes that belong to the detected shortest paths.
+ */
+ findShortestUniformPathsFromMap(graph:yfiles.algorithms.Graph,start:yfiles.algorithms.Node,targetMap:yfiles.algorithms.IDataProvider,directed:boolean,maxLength:number,pathEdges:yfiles.algorithms.EdgeList,pathNodes:yfiles.algorithms.NodeList):void;
+ /**
+ * Returns two edge-disjoint paths from in a nonnegatively-weighted directed graph, so that both paths connect
+ * s and t and have minimum total length.
+ * @param {yfiles.algorithms.Graph} graph the graph being acted upon
+ * @param {yfiles.algorithms.Node} source source node of the shortest pair
+ * @param {yfiles.algorithms.Node} target end node of the shortest pair
+ * @param {boolean} directed whether or not to interpret the edges as directed or undirected
+ * @param {yfiles.algorithms.IDataProvider} costDP
+ * a data provider that provides a double-valued cost for each edge
+ * of the input graph.
+ * @return {yfiles.algorithms.EdgeList[]}
+ * a two-dimensional EdgeList array that holds the resulting edge-disjoint paths, or null if no such
+ * edge-disjoint paths exist.
+ */
+ shortestPair(graph:yfiles.algorithms.Graph,source:yfiles.algorithms.Node,target:yfiles.algorithms.Node,directed:boolean,costDP:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList[];
+ };
+ /**
+ * An abstract adapter class for providing data.
+ * The data provision methods
+ * in this class throw a {@link yfiles.system.NotSupportedException} and
+ * {@link yfiles.algorithms.DataProviderAdapter#defined} always returns false.
+ *
+ * This class exists as a convenience for creating data provider objects.
+ *
+ * Extend this class to provide either typed or untyped data for a
+ * certain lookup domain.
+ *
+ */
+ export interface DataProviderAdapter extends Object,yfiles.algorithms.IDataProvider{
+ /**
+ * Subclasses may override this
+ * method to provide access to object values.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#get}.
+ */
+ get(dataHolder:Object):Object;
+ /**
+ * Subclasses may override this
+ * method to provide access to integer values.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#getInt}.
+ */
+ getInt(dataHolder:Object):number;
+ /**
+ * Subclasses may override this
+ * method to provide access to double values.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#getDouble}.
+ */
+ getDouble(dataHolder:Object):number;
+ /**
+ * Subclasses may override this
+ * method to provide access to boolean values.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataProvider#getBool}.
+ */
+ getBool(dataHolder:Object):boolean;
+ /**
+ * Returns false for all data holders.
+ * Subclasses
+ * should override this method to make clear for which data holders
+ * there is a value accessible via this data provider.
+ * @return {boolean} false.
+ */
+ defined(dataHolder:Object):boolean;
+ }
+ var DataProviderAdapter:{
+ $class:yfiles.lang.Class;
+ };
+ /**
+ * This class provides convenience and transformation services for DataProviders.
+ */
+ export interface DataProviders extends Object{
+ }
+ export module DataProviders{
+ /**
+ * This helper class can be used to overlay DataProviders registered at a graph
+ * with another DataProvider.
+ */
+ export interface DataProviderOverlayManager extends Object{
+ /**
+ * Adds the given DataProvider under the given key to the graph.
+ * Stores the previously set
+ * DataProvider instance so it can be restored at a later time using method {{@link yfiles.algorithms.DataProviders.DataProviderOverlayManager#restoreOriginalDataProviders}.
+ */
+ addDataProvider(dataProviderKey:Object,newDataProvider:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Restores all DataProvider bindings that have been changed using {{@link yfiles.algorithms.DataProviders.DataProviderOverlayManager#addDataProvider}.
+ * Calling this method resets the state its state.
+ */
+ restoreOriginalDataProviders():void;
+ }
+ }
+ var DataProviders:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns a DataProvider view of a double array defined for edges.
+ * The double value data[edge.index()] will be returned
+ * by the data provider upon the method call getDouble(edge).
+ * @param {number[]} data array data for each edge of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createEdgeDataProviderDouble(data:number[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of an int array defined for edges.
+ * The int value data[edge.index()] will be returned
+ * by the data provider upon the method call getInt(edge).
+ * @param {number[]} data array data for each edge of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createEdgeDataProviderInt(data:number[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of a boolean array defined for edges.
+ * The boolean value data[edge.index()] will be returned
+ * by the data provider upon the method call getBool(edge).
+ * @param {boolean[]} data array data for each edge of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createEdgeDataProviderBoolean(data:boolean[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of an Object array defined for edges.
+ * The Object value data[edge.index()] will be returned
+ * by the data provider upon the method call get(edge).
+ * @param {Object[]} data array data for each edge of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createEdgeDataProvider(data:Object[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of a double, int, boolean and Object
+ * array defined for edges.
+ * The double value doubleData[edge.index()] will be returned
+ * by the data provider upon the method call getDouble(edge).
+ * The int value intData[edge.index()] will be returned
+ * by the data provider upon the method call getInt(edge).
+ * The boolean value boolData[edge.index()] will be returned
+ * by the data provider upon the method call getBool(edge).
+ * The Object value objectData[edge.index()] will be returned
+ * by the data provider upon the method call get(edge).
+ * @param {number[]} doubleData double data for each edge of a static graph
+ * @param {number[]} intData int data for each edge of a static graph
+ * @param {boolean[]} boolData boolean data for each edge of a static graph
+ * @param {Object[]} objectData Object data for each edge of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given arrays
+ */
+ createEdgeDataProviderForArrays(doubleData:number[],intData:number[],boolData:boolean[],objectData:Object[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of a double array defined for nodes.
+ * The double value data[node.index()] will be returned
+ * by the data provider upon the method call getDouble(node).
+ * @param {number[]} data array data for each node of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createNodeDataProviderDouble(data:number[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of an int array defined for nodes.
+ * The int value data[node.index()] will be returned
+ * by the data provider upon the method call getInt(node).
+ * @param {number[]} data array data for each node of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createNodeDataProviderInt(data:number[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of a boolean array defined for nodes.
+ * The boolean value data[node.index()] will be returned
+ * by the data provider upon the method call getBool(node).
+ * @param {boolean[]} data array data for each node of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createNodeDataProviderBoolean(data:boolean[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of an Object array defined for nodes.
+ * The Object value data[node.index()] will be returned
+ * by the data provider upon the method call get(node).
+ * @param {Object[]} data array data for each node of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given array
+ */
+ createNodeDataProvider(data:Object[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider view of a double, int, boolean and Object
+ * array defined for nodes.
+ * The double value doubleData[node.index()] will be returned
+ * by the data provider upon the method call getDouble(node).
+ * The int value intData[node.index()] will be returned
+ * by the data provider upon the method call getInt(node).
+ * The boolean value boolData[node.index()] will be returned
+ * by the data provider upon the method call getBool(node).
+ * The Object value objectData[node.index()] will be returned
+ * by the data provider upon the method call get(node).
+ * @param {number[]} doubleData double data for each node of a static graph
+ * @param {number[]} intData int data for each node of a static graph
+ * @param {boolean[]} boolData boolean data for each node of a static graph
+ * @param {Object[]} objectData Object data for each node of a static graph
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of the given arrays
+ */
+ createNodeDataProviderWithArrays(doubleData:number[],intData:number[],boolData:boolean[],objectData:Object[]):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider that returns the given value for each
+ * key.
+ * @param {Object} data constant Object data returned by the created data provider.
+ * @return {yfiles.algorithms.IDataProvider} a data provider view of a single value.
+ */
+ createConstantDataProvider(data:Object):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider for edges that return the data provider values
+ * bound to their source nodes.
+ */
+ createSourceDataProvider(nodeData:yfiles.algorithms.IDataProvider):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider for edges that return the data provider values
+ * bound to their target nodes.
+ */
+ createTargetDataProvider(nodeData:yfiles.algorithms.IDataProvider):yfiles.algorithms.IDataProvider;
+ /**
+ * Returns a DataProvider that returns the negated boolean values
+ * provided by another data provider.
+ */
+ createNegatedDataProvider(data:yfiles.algorithms.IDataProvider):yfiles.algorithms.IDataProvider;
+ DataProviderOverlayManager:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a data provider overlay for the given graph instance.
+ */
+ new (graph:yfiles.algorithms.Graph):yfiles.algorithms.DataProviders;
+ };
+ };
+ /**
+ * An abstract adapter class for accepting data.
+ * The data accepting methods
+ * in this class throw a {@link yfiles.system.NotSupportedException} and
+ * {@link yfiles.algorithms.DataAcceptorAdapter#defined} always returns false.
+ *
+ * This class exists as a convenience for creating data acceptor objects.
+ *
+ * Extend this class to access either typed or untyped data for a
+ * certain lookup domain.
+ *
+ */
+ export interface DataAcceptorAdapter extends Object,yfiles.algorithms.IDataAcceptor{
+ /**
+ * Subclasses may override this
+ * method to set object values associated with a data holder.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#set}.
+ */
+ set(dataHolder:Object,value:Object):void;
+ /**
+ * Subclasses may override this
+ * method to set integer values associated with a data holder.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#setInt}.
+ */
+ setInt(dataHolder:Object,value:number):void;
+ /**
+ * Subclasses may override this
+ * method to set double values associated with a data holder.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#setDouble}.
+ */
+ setDouble(dataHolder:Object,value:number):void;
+ /**
+ * Subclasses may override this
+ * method to set boolean values associated with a data holder.
+ * @throws {yfiles.system.NotSupportedException} unless overwritten.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#setBool}.
+ */
+ setBool(dataHolder:Object,value:boolean):void;
+ /**
+ * Returns false for all data holders.
+ * Subclasses
+ * should override this method to make clear for which data holders
+ * there is a value accessible via this data provider.
+ * @return {boolean} false.
+ */
+ defined(dataHolder:Object):boolean;
+ }
+ var DataAcceptorAdapter:{
+ $class:yfiles.lang.Class;
+ };
+ /**
+ * This class provides access to some Comparator instances
+ * that are commonly used in yFiles.
+ */
+ export interface Comparators extends Object{
+ }
+ export module Comparators{
+ /**
+ * Tag interface to mark comparator or comparable implementations that do not
+ * define a total order but only a partial order. Implementations tagged with this
+ * interface use a special sorting algorithm that does not throw IllegalArgumentException
+ * if the specified comparator used for sorting does not define a total order.
+ * @see {@link yfiles.algorithms.Comparators#sort}
+ * @see {@link yfiles.algorithms.Comparators#sortListWithComparer}
+ * @see {@link yfiles.algorithms.Comparators#sortArrayPartWithComparer}
+ */
+ export interface IPartialOrder extends Object{
+ }
+ }
+ var Comparators:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns a comparator that compares objects of type
+ * {@link yfiles.algorithms.Edge}.
+ * Two edges are compared by comparing their
+ * source nodes. Each source node e.source() in turn
+ * is compared by the int value provided by the given data provider:
+ * dp.getInt(e.source()).
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return an int value for
+ * the source node of each edge being compared.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares edges.
+ */
+ createIntDataSourceComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares objects of type
+ * {@link yfiles.algorithms.Edge}.
+ * Two edges are compared by comparing their
+ * target nodes. Each target node e.target() in turn
+ * is compared by the int value provided by the given data provider:
+ * dp.getInt(e.target()).
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return an int value for
+ * the target node of each edge being compared.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares edges.
+ */
+ createIntDataTargetComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares objects of type
+ * {@link yfiles.algorithms.Edge}.
+ * Two edges are compared by comparing their
+ * source nodes. Each source node e.source() in turn
+ * is compared by the double value provided by the given data provider:
+ * dp.getDouble(e.source()).
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return a double value for
+ * the source node of each edge being compared.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares edges.
+ */
+ createDoubleDataSourceComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares objects of type
+ * {@link yfiles.algorithms.Edge}.
+ * Two edges are compared by comparing their
+ * target nodes. Each target node e.target() in turn
+ * is compared by the double value provided by the given data provider:
+ * dp.getDouble(e.target()).
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return a double value for
+ * the target node of each edge being compared.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares edges.
+ */
+ createDoubleDataTargetComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares objects of arbitrary type.
+ * Two objects are compared by comparing the int value the given
+ * data provider returns for each of these objects.
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return an int value for
+ * each object that is being compared by this comparator.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares arbitrary objects.
+ */
+ createIntDataComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares objects of arbitrary type.
+ * Two objects are compared by comparing the double value the given
+ * data provider returns for each of these objects.
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return a double value for
+ * each object that is being compared by this comparator.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares arbitrary objects.
+ */
+ createDoubleDataComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares to Objects of type
+ * Comparable.
+ */
+ createComparableComparator():yfiles.objectcollections.IComparer;
+ /**
+ * Returns a comparator that compares objects of arbitrary type.
+ * Two objects are compared by comparing the Comparable instances
+ * the given data provider returns for each of these objects.
+ * @param {yfiles.algorithms.IDataProvider} dp
+ * a data provider that must return a Comparable for
+ * each object that is being compared by this comparator.
+ * @return {yfiles.objectcollections.IComparer} a comparator that compares arbitrary objects.
+ */
+ createComparableDataComparator(dp:yfiles.algorithms.IDataProvider):yfiles.objectcollections.IComparer;
+ /**
+ * Compares the specified integral numbers.
+ * Returns a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ * @param {number} i1 the first number to compare.
+ * @param {number} i2 the second number to compare.
+ * @return {number}
+ * a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ * @see {@link yfiles.objectcollections.IComparer#compare}
+ */
+ compareInts(i1:number,i2:number):number;
+ /**
+ * Compares the specified integral numbers.
+ * Returns a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ * @param {number} l1 the first number to compare.
+ * @param {number} l2 the second number to compare.
+ * @return {number}
+ * a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ * @see {@link yfiles.objectcollections.IComparer#compare}
+ */
+ compareLongs(l1:number,l2:number):number;
+ /**
+ * Compares the specified floating point numbers.
+ * Returns a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ *
+ * Warning: This method does not handle NaN!
+ * If you need NaN-safe comparison, use
+ * {@link yfiles.system.PrimitiveExtensions#compareNumbers} instead.
+ *
+ * @param {number} f1 the first number to compare.
+ * @param {number} f2 the second number to compare.
+ * @return {number}
+ * a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ * @see {@link yfiles.objectcollections.IComparer#compare}
+ */
+ compareFloats(f1:number,f2:number):number;
+ /**
+ * Compares the specified floating point numbers.
+ * Returns a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ *
+ * Warning: This method does not handle NaN!
+ * If you need NaN-safe comparison, use
+ * {@link yfiles.system.PrimitiveExtensions#compareNumbers} instead.
+ *
+ * @param {number} d1 the first number to compare.
+ * @param {number} d2 the second number to compare.
+ * @return {number}
+ * a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ * @see {@link yfiles.objectcollections.IComparer#compare}
+ */
+ compareDoubles(d1:number,d2:number):number;
+ /**
+ * Sorts the specified list of objects according to the order induced by
+ * the specified comparator.
+ *
+ * This sort is guaranteed to be stable:
+ * Equal elements will not be reordered as a result of the sort.
+ *
+ * Implementation note:
+ * If the comparator is marked with the
+ * {@link yfiles.algorithms.Comparators.IPartialOrder}
+ * interface,
+ * this implementation does not throw IllegalArgumentException
+ * if the specified comparator used for sorting does not define a total order.
+ *
+ * @param {yfiles.algorithms.IList} data the list to be sorted.
+ * @param {yfiles.objectcollections.IComparer} c
+ * the comparator to determine the order of the list.
+ * A null value indicates that the elements'
+ * {@link yfiles.lang.IObjectComparable natural ordering} should be used.
+ * @see {@link yfiles.algorithms.Comparators.IPartialOrder}
+ */
+ sortListWithComparer(data:yfiles.algorithms.IList,c:yfiles.objectcollections.IComparer):void;
+ /**
+ * Sorts the specified array of objects according to the order induced by
+ * the specified comparator.
+ *
+ * This sort is guaranteed to be stable:
+ * Equal elements will not be reordered as a result of the sort.
+ *
+ * Implementation note:
+ * If the comparator is marked with the
+ * {@link yfiles.algorithms.Comparators.IPartialOrder}
+ * interface,
+ * this implementation does not throw IllegalArgumentException if the
+ * specified comparator used for sorting does not define a total order.
+ *
+ * @param {Object} data the array to be sorted.
+ * @param {yfiles.objectcollections.IComparer} c
+ * the comparator to determine the order of the array.
+ * A null value indicates that the elements'
+ * {@link yfiles.lang.IObjectComparable natural ordering} should be used.
+ * @see {@link yfiles.algorithms.Comparators.IPartialOrder}
+ */
+ sort(data:Object,c:yfiles.objectcollections.IComparer):void;
+ /**
+ * Sorts the specified array of objects according to the order induced by
+ * the specified comparator.
+ *
+ * This sort is guaranteed to be stable:
+ * Equal elements will not be reordered as a result of the sort.
+ *
+ * Implementation note:
+ * If the comparator is marked with the
+ * {@link yfiles.algorithms.Comparators.IPartialOrder}
+ * interface,
+ * this implementation does not throw IllegalArgumentException
+ * if the specified comparator used for sorting does not define a total order.
+ *
+ * @param {Object} data the array to be sorted.
+ * @param {number} fromIndex the index of the first element (inclusive) to be sorted.
+ * @param {number} toIndex the index of the last element (exclusive) to be sorted.
+ * @param {yfiles.objectcollections.IComparer} c
+ * the comparator to determine the order of the array.
+ * A null value indicates that the elements'
+ * {@link yfiles.lang.IObjectComparable natural ordering} should be used.
+ * @throws {yfiles.system.ArgumentException} if fromIndex > toIndex.
+ * @throws {yfiles.system.IndexOutOfRangeException}
+ * if fromIndex < 0 or
+ * toIndex > a.length.
+ * @see {@link yfiles.algorithms.Comparators.IPartialOrder}
+ */
+ sortArrayPartWithComparer(data:Object,fromIndex:number,toIndex:number,c:yfiles.objectcollections.IComparer):void;
+ };
+ /**
+ * Provides utility methods for working with {@link yfiles.algorithms.ICursor cursors}
+ * and {@link yfiles.algorithms.IIterator iterators}.
+ */
+ export interface Cursors extends Object{
+ }
+ var Cursors:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates or fills an array with the values provided by the cursor.
+ * @param {yfiles.algorithms.ICursor} cursor the cursor
+ * @param {Object[]} dest
+ * the array to fill with the values or null if the
+ * method should create the array itself
+ * @return {Object[]} dest or a newly created array filled with the values from cursor
+ */
+ toArray(cursor:yfiles.algorithms.ICursor,dest:Object[]):Object[];
+ /**
+ * Creates a YCursor view of the given collection.
+ * Note that the returned cursor does not support the
+ * {@link yfiles.algorithms.ICursor#prev prev} and {@link yfiles.algorithms.ICursor#toLast toLast}
+ * operations.
+ * @param {yfiles.algorithms.ICollection} c The collection.
+ * @return {yfiles.algorithms.ICursor} The cursor view of the given collection.
+ * @see {@link yfiles.algorithms.Cursors#createEdgeCursor}
+ * @see {@link yfiles.algorithms.Cursors#createNodeCursor}
+ */
+ createCursorFromCollection(c:yfiles.algorithms.ICollection):yfiles.algorithms.ICursor;
+ /**
+ * Creates a cursor view of the given collection.
+ * Creates an ICursor view of the given collection.
+ * Note that the returned cursor does not support the
+ * {@link yfiles.algorithms.ICursor#prev prev}
+ * and
+ * {@link yfiles.algorithms.ICursor#toLast toLast}
+ * operations.
+ * @param {yfiles.collections.ICollection.} c
+ * The collection.
+ * @return {yfiles.algorithms.ICursor}
+ * The cursor view of the given collection.
+ */
+ createCursor(c:yfiles.collections.ICollection):yfiles.algorithms.ICursor;
+ /**
+ * Creates a cursor view of the given collection.
+ *
+ * Note that the returned cursor does not support the operations
+ * {@link yfiles.algorithms.ICursor#prev prev},
+ * {@link yfiles.algorithms.ICursor#toLast toLast}, and
+ * {@link yfiles.algorithms.IEdgeCursor#cyclicPrev}.
+ *
+ * @param {yfiles.algorithms.ICollection} c The collection.
+ * @return {yfiles.algorithms.IEdgeCursor}
+ * an {@link yfiles.algorithms.IEdgeCursor} view of the given collection.
+ * @see {@link yfiles.algorithms.Cursors#createNodeCursor}
+ */
+ createEdgeCursor(c:yfiles.algorithms.ICollection):yfiles.algorithms.IEdgeCursor;
+ /**
+ * Creates a cursor view of the given collection.
+ *
+ * Note that the returned cursor does not support the operations
+ * {@link yfiles.algorithms.ICursor#prev prev},
+ * {@link yfiles.algorithms.ICursor#toLast toLast}, and
+ * {@link yfiles.algorithms.INodeCursor#cyclicPrev}.
+ *
+ * @param {yfiles.algorithms.ICollection} c The collection.
+ * @return {yfiles.algorithms.INodeCursor}
+ * an {@link yfiles.algorithms.INodeCursor} view of the given collection.
+ * @see {@link yfiles.algorithms.Cursors#createEdgeCursor}
+ */
+ createNodeCursor(c:yfiles.algorithms.ICollection):yfiles.algorithms.INodeCursor;
+ /**
+ * Creates a first-to-last Iterator view of the given cursor.
+ *
+ * Note that the returned iterator does not support the
+ * {@link yfiles.algorithms.IIterator#remove remove} operation.
+ *
+ * @param {yfiles.algorithms.ICursor} cursor The cursor.
+ * @return {yfiles.algorithms.IIterator} The iterator view of the given cursor.
+ */
+ createIterator(cursor:yfiles.algorithms.ICursor):yfiles.algorithms.IIterator;
+ /**
+ * Creates a last-to-first Iterator view of the given cursor.
+ *
+ * Note that the returned iterator does not support the
+ * {@link yfiles.algorithms.IIterator#remove remove} operation.
+ *
+ * @param {yfiles.algorithms.ICursor} cursor The cursor.
+ * @return {yfiles.algorithms.IIterator} The iterator view of the given cursor.
+ */
+ createReverseIterator(cursor:yfiles.algorithms.ICursor):yfiles.algorithms.IIterator;
+ /**
+ * Creates a new cursor that provides a logical view
+ * on the concatenation of the two given cursors.
+ * @param {yfiles.algorithms.ICursor} c1 - first concatenation argument
+ * @param {yfiles.algorithms.ICursor} c2 - second concatenation argument
+ */
+ concatenate(c1:yfiles.algorithms.ICursor,c2:yfiles.algorithms.ICursor):yfiles.algorithms.ICursor;
+ };
+ /**
+ * Provides functionality to hide and unhide partitions of nodes and their adjacent edges of a graph temporarily for algorithmic operations.
+ *
+ * This class can be used to temporarily hide away certain elements
+ * of a graph and to unhide that parts at a later time again.
+ * Instances of this class keep track of graph elements that were
+ * hidden from a graph in order to make them visible again
+ * at a later time.
+ *
+ *
+ * Note that this class should not be used to hide elements from a Graph2D for pure hiding purposes.
+ * Since this class will by default prevent the graph instance from firing events, other code
+ * might cease to work correctly. Use this class for short term removal of nodes and edges, only.
+ *
+ */
+ export interface GraphPartitionManager extends Object{
+ /**
+ * Initializes internal data structures using the new DataProvider.
+ * This method must also be called whenever the content of the given
+ * DataProvider changes.
+ * @param {yfiles.algorithms.IDataProvider} partitionId
+ * the data provider that holds the partitionIds for all
+ * elements.
+ */
+ initPartitions(partitionId:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Hides nodes and adjacent edges that have the given partitionId associated.
+ * @param {Object} partitionId the id
+ */
+ hidePartition(partitionId:Object):void;
+ /**
+ * Unhides nodes that have the given partitionId associated.
+ * @param {Object} partitionId the id
+ */
+ unhidePartition(partitionId:Object):void;
+ /**
+ * Assures that only nodes are visible in the graph that are associated with
+ * the given partitionId.
+ * @param {Object} partitionId the partitionId for the nodes that will be made visible
+ */
+ displayPartition(partitionId:Object):void;
+ /**
+ * Specifies whether or not this partition manager should fire graph events.
+ * By default the partition manager does not fire graph events.
+ */
+ fireGraphEventsEnabled:boolean;
+ /**
+ * Hides all nodes and edges from this graph.
+ * The hidden elements will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideAll():void;
+ /**
+ * Hides all edges from this graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdges():void;
+ /**
+ * Hides all self-loop edges from this graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideSelfLoops():void;
+ /**
+ * Hides all self-loops and multiple edges from the graph.
+ * The overall effect of this method is that the minimum number of
+ * edges are hidden from the graph such that it contains no
+ * self-loops and no multiple edges anymore.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ simplifyGraph():void;
+ /**
+ * Hides multiple edges from the graph.
+ * If there are multiple edges connecting two nodes then
+ * all but one (representative) of these edges will be hidden.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideMultipleEdges():void;
+ /**
+ * Unhides all formerly hidden elements in the graph.
+ */
+ unhideAll():void;
+ /**
+ * Unhides all formerly hidden nodes in the graph.
+ * Note that this
+ * method does not unhide hidden edges.
+ */
+ unhideNodes():void;
+ /**
+ * Unhides all formerly hidden edges in the graph.
+ * Precondition:
+ * Both source or target node of all
+ * such edges must be contained in the graph.
+ */
+ unhideEdges():void;
+ /**
+ * Hides the given node and all it's adjacent edges from the graph.
+ * The hidden elements will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Hides the given edge from the graph.
+ * The hidden edge will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Hides the given list of edges from the graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdgeList(el:yfiles.algorithms.EdgeList):void;
+ /**
+ * Hides the given list of nodes from the graph.
+ * The hidden nodes and adjacent edges will be stored
+ * so that they can be unhidden
+ * again at a later time.
+ */
+ hideNodeList(nl:yfiles.algorithms.NodeList):void;
+ /**
+ * Hides the given edges from the graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdgeCursor(ec:yfiles.algorithms.IEdgeCursor):void;
+ /**
+ * Hides the given nodes from the graph.
+ * The hidden nodes and adjacent edges will be stored
+ * so that they can be unhidden
+ * again at a later time.
+ */
+ hideNodeCursor(nc:yfiles.algorithms.INodeCursor):void;
+ /**
+ * Hides the given elements from the graph.
+ * The hidden nodes and adjacent edges will be stored
+ * so that they can be unhidden
+ * again at a later time.
+ */
+ hideItemCursor(cursor:yfiles.algorithms.ICursor):void;
+ /**
+ * The Graph for which this partition manager was
+ * created.
+ */
+ graph:yfiles.algorithms.Graph;
+ /**
+ * This method will be called whenever the partition manager is requested to
+ * unhide the given edge from the graph.
+ */
+ unhideEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * This method will be called whenever the partition manager is requested to
+ * unhide the given node from the graph.
+ */
+ unhideNode(v:yfiles.algorithms.Node):void;
+ }
+ var GraphPartitionManager:{
+ $class:yfiles.lang.Class;
+ /**
+ * Instantiates a new GraphPartitionManager for the given graph.
+ * All non-static hiding and unhiding methods will refer
+ * to the given graph.
+ */
+ new (graph:yfiles.algorithms.Graph,partitionId:yfiles.algorithms.IDataProvider):yfiles.algorithms.GraphPartitionManager;
+ };
+ /**
+ * Provides functionality to hide and unhide nodes and edges of a graph temporarily for algorithmic operations.
+ *
+ * This class can be used to temporarily hide away certain elements
+ * of a graph and to unhide that parts at a later time again.
+ * Instances of this class keep track of graph elements that were
+ * hidden from a graph in order to make them visible again
+ * at a later time.
+ *
+ *
+ * Note that this class should not be used to hide elements from a Graph2D for pure hiding purposes.
+ * Since this class will by default prevent the graph instance from firing events, other code
+ * might cease to work correctly. Use this class for short term removal of nodes and edges, only.
+ *
+ */
+ export interface GraphHider extends Object{
+ /**
+ * holds the list of the hidden edges in stack order.
+ */
+ hiddenEdgesF:yfiles.algorithms.EdgeList;
+ /**
+ * holds the list of the hidden nodes in stack order.
+ */
+ hiddenNodesF:yfiles.algorithms.NodeList;
+ /**
+ * Specifies whether or not this hider should fire graph events.
+ * By default the hider does not fire graph events.
+ */
+ fireGraphEvents:boolean;
+ /**
+ * Hides all nodes and edges from this graph.
+ * The hidden elements will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideAll():void;
+ /**
+ * Hides all edges from this graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdges():void;
+ /**
+ * Hides all self-loop edges from this graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideSelfLoops():void;
+ /**
+ * Hides all self-loops and multiple edges from the graph.
+ * The overall effect of this method is that the minimum number of
+ * edges are hidden from the graph such that it contains no
+ * self-loops and no multiple edges anymore.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ simplifyGraph():void;
+ /**
+ * Hides multiple edges from the graph.
+ * If there are multiple edges connecting two nodes then
+ * all but one (representative) of these edges will be hidden.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideMultipleEdges():void;
+ /**
+ * Unhides all formerly hidden elements in the graph.
+ */
+ unhideAll():void;
+ /**
+ * Unhides all formerly hidden nodes in the graph.
+ * Note that this
+ * method does not unhide hidden edges.
+ */
+ unhideNodes():void;
+ /**
+ * Unhides all formerly hidden edges in the graph.
+ * Precondition:
+ * Both source or target node of all
+ * such edges must be contained in the graph.
+ */
+ unhideEdges():void;
+ /**
+ * Hides the given node and all it's adjacent edges from the graph.
+ * The hidden elements will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Hides the given edge from the graph.
+ * The hidden edge will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hide(e:yfiles.algorithms.Edge):void;
+ /**
+ * Hides the given list of edges from the graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdgeList(el:yfiles.algorithms.EdgeList):void;
+ /**
+ * Hides the given list of nodes from the graph.
+ * The hidden nodes and adjacent edges will be stored
+ * so that they can be unhidden
+ * again at a later time.
+ */
+ hideNodeList(nl:yfiles.algorithms.NodeList):void;
+ /**
+ * Hides the given edges from the graph.
+ * The hidden edges will be stored so that they can be unhidden
+ * again at a later time.
+ */
+ hideEdgeCursor(ec:yfiles.algorithms.IEdgeCursor):void;
+ /**
+ * Hides the given nodes from the graph.
+ * The hidden nodes and adjacent edges will be stored
+ * so that they can be unhidden
+ * again at a later time.
+ */
+ hideNodeCursor(nc:yfiles.algorithms.INodeCursor):void;
+ /**
+ * Hides the given elements from the graph.
+ * The hidden nodes and adjacent edges will be stored
+ * so that they can be unhidden
+ * again at a later time.
+ */
+ hideItemCursor(cursor:yfiles.algorithms.ICursor):void;
+ /**
+ * The Graph for which this GraphHider was
+ * created.
+ */
+ graph:yfiles.algorithms.Graph;
+ /**
+ * This method will be called whenever
+ * the hider is requested to unhide the given edge
+ * from the graph.
+ */
+ unhideOneEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Unhides the given edge.
+ * Also updates {@link yfiles.algorithms.GraphHider#hiddenEdgesF}.
+ * Complexity: O(hiddenEdges.size())
+ * @param {yfiles.algorithms.Edge} e the edge that will be unhidden
+ */
+ unhideEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Unhides the given edges.
+ * Also updates {@link yfiles.algorithms.GraphHider#hiddenEdgesF}.
+ * Complexity: O(hiddenEdges.size())
+ * @param {yfiles.algorithms.EdgeList} edges the edges that will be unhidden
+ */
+ unhideEdgeList(edges:yfiles.algorithms.EdgeList):void;
+ /**
+ * Unhides the given nodes and if requested its adjacent edges.
+ * Also updates {@link yfiles.algorithms.GraphHider#hiddenNodesF} and {@link yfiles.algorithms.GraphHider#hiddenEdgesF}.
+ * Complexity: O(hiddenNodes.size()+hiddenEdges.size())
+ * @param {yfiles.algorithms.NodeList} nodes the nodes that will be unhidden
+ * @param {boolean} unhideAdjacentEdges
+ * whether of not to unhide previously hidden edges connected at the given nodes whose other end point
+ * is not hidden, i.e. it is part of the graph.
+ */
+ unhideNodeList(nodes:yfiles.algorithms.NodeList,unhideAdjacentEdges:boolean):void;
+ /**
+ * Unhides the given node and if requested its adjacent edges.
+ * Also updates {@link yfiles.algorithms.GraphHider#hiddenNodesF} and {@link yfiles.algorithms.GraphHider#hiddenEdgesF}.
+ * Complexity: O(hiddenNodes.size()+hiddenEdges.size())
+ * @param {yfiles.algorithms.Node} v the node that will be unhidden
+ * @param {boolean} unhideAdjacentEdges
+ * whether of not to unhide previously hidden edges connected at v whose other end point
+ * is not hidden, i.e. it is part of the graph.
+ */
+ unhideNode(v:yfiles.algorithms.Node,unhideAdjacentEdges:boolean):void;
+ /**
+ * This method will be called whenever
+ * the hider is requested to unhide the given node
+ * from the graph.
+ */
+ unhideOneNode(v:yfiles.algorithms.Node):void;
+ /**
+ * The nodes that are currently hidden.
+ * @return {yfiles.algorithms.INodeCursor} a NodeList containing the currently hidden nodes
+ */
+ hiddenNodes():yfiles.algorithms.INodeCursor;
+ /**
+ * The edges that are currently hidden.
+ * @return {yfiles.algorithms.IEdgeCursor} an EdgeList containing the currently hidden edges
+ */
+ hiddenEdges():yfiles.algorithms.IEdgeCursor;
+ }
+ var GraphHider:{
+ $class:yfiles.lang.Class;
+ /**
+ * Instantiates a new GraphHider for the given graph.
+ * All non-static hiding and unhiding methods will refer
+ * to the given graph.
+ */
+ new (g:yfiles.algorithms.Graph):yfiles.algorithms.GraphHider;
+ /**
+ * Unhides the subgraph induced by the given edges in the given graph.
+ * The induced subgraph defined by the given edges consists
+ * of the given edges and all nodes that are either source
+ * or target of at least one of the given edges.
+ * Parts of the subgraph that are already contained in the given
+ * graph will not be unhidden and pose no problem to this method.
+ */
+ unhideSubgraph(graph:yfiles.algorithms.Graph,ec:yfiles.algorithms.IEdgeCursor):void;
+ /**
+ * Hides the subgraph induced by the given edges from the given graph.
+ * The induced subgraph defined by the given edges consists
+ * of the given edges and all nodes that are solely connected
+ * to the rest of the graph by the given edges.
+ */
+ hideSubgraph(graph:yfiles.algorithms.Graph,ec:yfiles.algorithms.IEdgeCursor):void;
+ };
+ /**
+ * This class implements a priority queue for objects whose priority
+ * values are of type double.
+ * The implementation is based on binary heaps.
+ */
+ export interface DoubleObjectPQ extends Object{
+ /**
+ * Adds the given object with given priority to this queue.
+ * Precondition: !contains(o)
+ * Complexity: O(log(size()))
+ */
+ add(o:Object,priority:number):void;
+ /**
+ * Decreases the priority value of the given object.
+ * Precondition: contains(o)
+ * Precondition: priority < getPriority(o)
+ * Complexity: O(log(size()))
+ */
+ decreasePriority(o:Object,priority:number):void;
+ /**
+ * Increases the priority value of the given object.
+ * Precondition: contains(o)
+ * Precondition: priority > getPriority(o)
+ * Complexity: O(log(size()))
+ */
+ increasePriority(o:Object,priority:number):void;
+ /**
+ * Changes the priority value of the given object.
+ * Precondition: contains(o)
+ * Complexity: O(log(size()))
+ */
+ changePriority(o:Object,priority:number):void;
+ /**
+ * Removes the object with smallest priority from this queue.
+ * Precondition: !isEmpty()
+ * Complexity: O(log(size()))
+ * @return {Object} the removed object with smallest priority
+ */
+ removeMin():Object;
+ /**
+ * The object with smallest priority in this queue.
+ * Precondition: !isEmpty()
+ */
+ min:Object;
+ /**
+ * The minimum priority value in this queue.
+ */
+ minPriority:number;
+ /**
+ * Returns whether or not the given object is contained.
+ * in this queue.
+ * Complexity: O(1)
+ */
+ contains(o:Object):boolean;
+ /**
+ * Specifies whether or not this queue is empty.
+ * Complexity: O(1)
+ */
+ empty:boolean;
+ /**
+ * Returns the number of nodes currently in this queue.
+ * Complexity: O(1)
+ */
+ size():number;
+ /**
+ * Returns the current priority of the given object.
+ * Precondition: contains(o)
+ */
+ getPriority(o:Object):number;
+ /**
+ * Removes the given object from this queue.
+ * Precondition: contains(o)
+ * Complexity: O(log(size()))
+ */
+ remove(o:Object):void;
+ /**
+ * Makes this queue the empty queue.
+ * Complexity: O(size())
+ */
+ clear():void;
+ /**
+ * Does nothing.
+ */
+ dispose():void;
+ }
+ var DoubleObjectPQ:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an empty ObjectPQ using the given {@link yfiles.algorithms.IDataProvider} and
+ * {@link yfiles.algorithms.IDataAcceptor} to store and retrieve Object support information.
+ * The contents of the provider should be modified through the use of the
+ * acceptor, i.e. they should be based on the same initially empty backing store.
+ * Additionally this backing store should not be modified externally as long as
+ * this PQ is still in use.
+ */
+ new (initialSize:number,provider:yfiles.algorithms.IDataProvider,acceptor:yfiles.algorithms.IDataAcceptor):yfiles.algorithms.DoubleObjectPQ;
+ };
+ /**
+ * This class is an empty abstract implementation of the EdgeMap interface.
+ */
+ export interface EdgeMapAdapter extends Object,yfiles.algorithms.IEdgeMap{
+ /**
+ * Associates the given value to with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#set}.
+ */
+ set(edge:Object,value:Object):void;
+ /**
+ * Returns the value bound to the given edge.
+ * @return {Object} null
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#get}.
+ */
+ get(edge:Object):Object;
+ /**
+ * Associates the given boolean value to with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#setBool}.
+ */
+ setBool(edge:Object,value:boolean):void;
+ /**
+ * Returns the boolean value bound to the given edge.
+ * Precondition:
+ * The value must have been associated to the given edge by
+ * a call to setBool.
+ * @return {boolean} false
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#getBool}.
+ */
+ getBool(edge:Object):boolean;
+ /**
+ * Associates the given double value to with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#setDouble}.
+ */
+ setDouble(edge:Object,value:number):void;
+ /**
+ * Returns the double value bound to the given edge.
+ * Precondition:
+ * The value must have been associated to the given edge by
+ * a call to setDouble.
+ * @return {number} 0.0d
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#getDouble}.
+ */
+ getDouble(edge:Object):number;
+ /**
+ * Associates the given integer value to with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#setInt}.
+ */
+ setInt(edge:Object,value:number):void;
+ /**
+ * Returns the integer value bound to the given edge.
+ * Precondition:
+ * The value must have been associated to the given edge by
+ * a call to setInt.
+ * @return {number} 0
+ * @see Specified by {@link yfiles.algorithms.IEdgeMap#getInt}.
+ */
+ getInt(edge:Object):number;
+ }
+ var EdgeMapAdapter:{
+ $class:yfiles.lang.Class;
+ };
+ /**
+ * A utility class that can be used to copy a graph's structure and possibly associated data to another instance.
+ * This
+ * class relies on implementations of {@link yfiles.algorithms.GraphCopier.ICopyFactory} that can either be any of the default
+ * implementations or any other implementation that can be associated with a {@link yfiles.algorithms.Graph}'s {@link yfiles.algorithms.Graph#graphCopyFactory copy factory property}.
+ * @see {@link yfiles.algorithms.GraphCopier.ICopyFactory}
+ * @see {@link yfiles.algorithms.GraphCopier#copy}
+ */
+ export interface GraphCopier extends Object{
+ /**
+ * Determines whether automatic copying of node map contents is enabled.
+ * The default is false. Copying
+ * will be done by reference on Object basis. To store these objects, new {@link yfiles.algorithms.INodeMap}s are created for the target
+ * graph.
+ * In order to access these NodeMaps it is necessary to store the number of NodeMaps in
+ * the target graph before creating the NodeMaps as they will be appended. After copying the graph a
+ * NodeMap can be found using this number as offset and add the index of the map in the original graph.
+ * Note: To be able to control and access NodeMaps more easily, it is recommended to use
+ * {@link yfiles.algorithms.IDataProvider}s instead and have them copied.
+ * @see {@link yfiles.algorithms.GraphCopier.NodeMapCopyFactory}
+ * @see {@link yfiles.algorithms.Graph#registeredNodeMaps}
+ * @see {@link yfiles.algorithms.GraphCopier#dataProviderContentCopying}
+ */
+ nodeMapCopying:boolean;
+ /**
+ * Determines whether automatic copying of edge map contents is enabled.
+ * The default is false. Copying
+ * will be done by reference on Object basis. To store these objects, new {@link yfiles.algorithms.IEdgeMap}s are created for the target
+ * graph.
+ * In order to access these EdgeMaps it is necessary to store the number of NodeMaps in
+ * the target graph before creating the EdgeMaps as they will be appended. After copying the graph a
+ * EdgeMap can be found using this number as offset and add the index of the map in the original graph.
+ * Note: To be able to control and access EdgeMaps more easily, it is recommended to use
+ * {@link yfiles.algorithms.IDataProvider}s instead and have them copied.
+ * @see {@link yfiles.algorithms.GraphCopier.EdgeMapCopyFactory}
+ * @see {@link yfiles.algorithms.Graph#registeredEdgeMaps}
+ * @see {@link yfiles.algorithms.GraphCopier#dataProviderContentCopying}
+ */
+ edgeMapCopying:boolean;
+ /**
+ * Determines whether automatic copying of edge map contents should be performed.
+ * The default is false.
+ * Copying will be done by reference on Object basis. The backing store for the content will be HashMap based.
+ * @see {@link yfiles.algorithms.GraphCopier.ItemDataProviderCopyFactory}
+ */
+ dataProviderContentCopying:boolean;
+ /**
+ * Copies the contents of the source graph to the target graph and returns the newly created nodes in the target
+ * graph.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to copy the contents from
+ * @param {yfiles.algorithms.Graph} targetGraph the target graph to copy the contents to, it will not be cleared prior to the copying
+ * @return {yfiles.algorithms.NodeList} the list of Nodes that have been copied to the target graph.
+ * @see {@link yfiles.algorithms.GraphCopier#copySubgraphNodes}
+ */
+ copyFromSourceToTargetGraph(sourceGraph:yfiles.algorithms.Graph,targetGraph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ /**
+ * Copies the contents of the source graph to a newly created target graph and returns the new graph.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to copy the contents from
+ * @return {yfiles.algorithms.Graph} the newly created graph
+ * @see {@link yfiles.algorithms.GraphCopier.ICopyFactory#createGraph}
+ */
+ copy(sourceGraph:yfiles.algorithms.Graph):yfiles.algorithms.Graph;
+ /**
+ * Copies the subgraph contained in graph induced by the source nodes to a newly created graph.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to copy
+ * @param {yfiles.algorithms.INodeCursor} sourceNodes the nodes in the sourceGraph to copy to the new graph
+ * @return {yfiles.algorithms.Graph} the newly created graph
+ * @see {@link yfiles.algorithms.GraphCopier.ICopyFactory#createGraph}
+ */
+ copyWithSourceGraphAndSourceNodes(sourceGraph:yfiles.algorithms.Graph,sourceNodes:yfiles.algorithms.INodeCursor):yfiles.algorithms.Graph;
+ /**
+ * The currently used copy factory.
+ */
+ copyFactory:yfiles.algorithms.GraphCopier.ICopyFactory;
+ /**
+ * Callback that uses the given factory to create a new graph.
+ * This method simply delegates to {@link yfiles.algorithms.GraphCopier.ICopyFactory#createGraph} and can be overwritten to change the behavior.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} factory the factory to use for the creation
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph that will be
+ * @return {yfiles.algorithms.Graph} the newly created graph
+ */
+ createGraph(factory:yfiles.algorithms.GraphCopier.ICopyFactory,sourceGraph:yfiles.algorithms.Graph):yfiles.algorithms.Graph;
+ /**
+ * Copies the subgraph contained in sourceGraph induced by the source nodes to the targetGraph.
+ * targetGraph is not
+ * cleared prior to the copy operation.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to copy
+ * @param {yfiles.algorithms.INodeCursor} sourceNodes the nodes in the sourceGraph to copy to the new graph
+ * @param {yfiles.algorithms.Graph} targetGraph the graph to copy the sourceGraph's contents to
+ * @return {yfiles.algorithms.NodeList} the list of the new nodes in targetGraph
+ */
+ copySubgraphNodes(sourceGraph:yfiles.algorithms.Graph,sourceNodes:yfiles.algorithms.INodeCursor,targetGraph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ /**
+ * Copies the subgraph contained in sourceGraph induced by the source nodes and the provided source edges to the targetGraph.
+ * targetGraph is not cleared prior to the copy operation.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to copy
+ * @param {yfiles.algorithms.INodeCursor} sourceNodes the nodes in the sourceGraph to copy to the new graph
+ * @param {yfiles.algorithms.Graph} targetGraph the graph to copy the sourceGraph's contents to
+ * @param {yfiles.algorithms.IEdgeCursor} sourceEdges the edges in the sourceGraph to copy to the new graph
+ * @return {yfiles.algorithms.NodeList} the list of the new nodes in targetGraph
+ */
+ copySubgraph(sourceGraph:yfiles.algorithms.Graph,sourceNodes:yfiles.algorithms.INodeCursor,sourceEdges:yfiles.algorithms.IEdgeCursor,targetGraph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList;
+ /**
+ * Callback that uses the given factory to perform the copy operation.
+ * This method simply delegates to {@link yfiles.algorithms.GraphCopier.ICopyFactory#preCopyGraphData} and can be overwritten to change
+ * the behavior.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} copyFactory the factory delegate the operation to
+ */
+ preCopyGraphData(copyFactory:yfiles.algorithms.GraphCopier.ICopyFactory,sourceGraph:yfiles.algorithms.Graph,targetGraph:yfiles.algorithms.Graph):void;
+ /**
+ * Callback that uses the given factory to perform the copy operation.
+ * This method simply delegates to {@link yfiles.algorithms.GraphCopier.ICopyFactory#postCopyGraphData} and can
+ * be overwritten to change the behavior.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} copyFactory the factory delegate the operation to
+ */
+ postCopyGraphData(copyFactory:yfiles.algorithms.GraphCopier.ICopyFactory,sourceGraph:yfiles.algorithms.Graph,targetGraph:yfiles.algorithms.Graph,nodeMap:yfiles.algorithms.IMap,edgeMap:yfiles.algorithms.IMap):void;
+ /**
+ * Callback that creates the Map that will hold the mapping from the edges in the old source graph to the newly
+ * created edges in the target graph.
+ * @return {yfiles.algorithms.IMap} A map that can be used to store the mapping.
+ */
+ createEdgeMap():yfiles.algorithms.IMap;
+ /**
+ * Callback that uses the given factory to perform the copy operation.
+ * This method simply delegates to {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyEdge} and can be
+ * overwritten to change the behavior.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} copyFactory the factory delegate the operation to
+ */
+ copyEdge(copyFactory:yfiles.algorithms.GraphCopier.ICopyFactory,targetGraph:yfiles.algorithms.Graph,newSource:yfiles.algorithms.Node,newTarget:yfiles.algorithms.Node,edge:yfiles.algorithms.Edge):yfiles.algorithms.Edge;
+ /**
+ * Determines the set of edge candidates from the source graph that should be copied.
+ * Note that if any of the source
+ * or target node is not present in the target graph the edge will not be copied. This implementation simply returns
+ * {@link yfiles.algorithms.Graph#getEdgeCursor}
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to determine the edges to copy
+ * @return {yfiles.algorithms.IEdgeCursor} the edges to copy
+ */
+ getSourceEdges(sourceGraph:yfiles.algorithms.Graph):yfiles.algorithms.IEdgeCursor;
+ /**
+ * Callback that uses the given factory to perform the copy operation.
+ * This method simply delegates to {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyNode}
+ * and can be overwritten to change the behavior.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} copyFactory the factory delegate the operation to
+ */
+ copyNode(copyFactory:yfiles.algorithms.GraphCopier.ICopyFactory,targetGraph:yfiles.algorithms.Graph,node:yfiles.algorithms.Node):yfiles.algorithms.Node;
+ /**
+ * Callback that creates the Map that will hold the mapping from the nodes in the old source graph to the newly
+ * created nodes in the target graph.
+ * @return {yfiles.algorithms.IMap} A map that can be used to store the mapping.
+ */
+ createNodeMap():yfiles.algorithms.IMap;
+ /**
+ * Determines the set of node candidates from the source graph that should be copied if
+ * no other nodes are specified by the user.
+ * This implementation simply returns
+ * {@link yfiles.algorithms.Graph#getNodeCursor}
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph to determine the nodes to copy
+ * @return {yfiles.algorithms.INodeCursor} the nodes to copy
+ */
+ getSourceNodes(sourceGraph:yfiles.algorithms.Graph):yfiles.algorithms.INodeCursor;
+ }
+ export module GraphCopier{
+ /**
+ * An abstract base implementation of a delegating CopyFactory that copies data for items being copied.
+ * The actual
+ * copying will be performed by the wrapped delegate. Instances of this class should be used to wrap existing copy
+ * factories. Subclasses should override any or all of the {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#copyNodeData}, {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#copyEdgeData}, {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#preCopyData}, and {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#postCopyData} methods.
+ */
+ export interface GraphDataCopyFactory extends Object,yfiles.algorithms.GraphCopier.ICopyFactory{
+ /**
+ * Calls {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#preCopyData} and then the delegate.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#preCopyGraphData}.
+ */
+ preCopyGraphData(srcGraph:yfiles.algorithms.Graph,newGraph:yfiles.algorithms.Graph):void;
+ /**
+ * Calls the delegate and then {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#postCopyData}.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#postCopyGraphData}.
+ */
+ postCopyGraphData(srcGraph:yfiles.algorithms.Graph,newGraph:yfiles.algorithms.Graph,nodeMap:yfiles.algorithms.IMap,edgeMap:yfiles.algorithms.IMap):void;
+ /**
+ * Delegates the copying of the data to {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#copyNodeData}.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyNode}.
+ */
+ copyNode(graph:yfiles.algorithms.Graph,hint:yfiles.algorithms.Node):yfiles.algorithms.Node;
+ /**
+ * Creates a new graph instance that will be the target graph of the copy operation.
+ * This method is called if no target graph is specified by the user.
+ * @return {yfiles.algorithms.Graph} the graph to use as the target graph
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#createGraph}.
+ */
+ createGraph():yfiles.algorithms.Graph;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ */
+ preCopyData(src:yfiles.algorithms.Graph,dst:yfiles.algorithms.Graph):void;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.IMap} nodeMap a Map that maps old node instances to their new copies
+ * @param {yfiles.algorithms.IMap} edgeMap a Map that maps old edge instances to their new copies
+ */
+ postCopyData(src:yfiles.algorithms.Graph,dst:yfiles.algorithms.Graph,nodeMap:yfiles.algorithms.IMap,edgeMap:yfiles.algorithms.IMap):void;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Node} src the old entity
+ * @param {yfiles.algorithms.Node} dst the new entity
+ */
+ copyNodeData(src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node):void;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Edge} src the old entity
+ * @param {yfiles.algorithms.Edge} dst the new entity
+ */
+ copyEdgeData(src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge):void;
+ /**
+ * Delegates the copying of the data to {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#copyEdgeData}.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyEdge}.
+ */
+ copyEdge(graph:yfiles.algorithms.Graph,source:yfiles.algorithms.Node,target:yfiles.algorithms.Node,hint:yfiles.algorithms.Edge):yfiles.algorithms.Edge;
+ }
+ /**
+ * Abstract helper class that provides helper methods to copy DataProvider contents.
+ */
+ export interface DataProviderCopyFactory extends yfiles.algorithms.GraphCopier.GraphDataCopyFactory{
+ /**
+ * The DataProvider key.
+ */
+ dpKey:Object;
+ /**
+ * Calls {@link yfiles.algorithms.GraphCopier.DataProviderCopyFactory#createMap} and registers that map on the target graph if there is no {@link yfiles.algorithms.IDataMap} registered on the target graph yet.
+ * @see Overrides {@link yfiles.algorithms.GraphCopier.GraphDataCopyFactory#preCopyData}
+ */
+ preCopyData(src:yfiles.algorithms.Graph,dst:yfiles.algorithms.Graph):void;
+ /**
+ * Factory callback to create the backing storage.
+ */
+ createMap(dst:yfiles.algorithms.Graph):yfiles.algorithms.IDataMap;
+ /**
+ * Helper method that retrieves the map for the given graph instance.
+ * @param {yfiles.algorithms.Graph} graph Graph instance for which the map is retrieved
+ * @return {yfiles.algorithms.IDataMap} the map for the given graph instance
+ */
+ getMap(graph:yfiles.algorithms.Graph):yfiles.algorithms.IDataMap;
+ }
+ /**
+ * Helper class implementation of {@link yfiles.algorithms.GraphCopier.ICopyFactory} that can be used to copy the contents of a
+ * DataProvider registered with the source graph onto the target graph storing the values in newly created {@link yfiles.algorithms.Graph#createNodeMap node map}.
+ * @see {@link yfiles.algorithms.GraphCopier.NodeDataProviderCopyFactory#copyNodeDataToNode}
+ */
+ export interface NodeDataProviderCopyFactory extends yfiles.algorithms.GraphCopier.DataProviderCopyFactory{
+ /**
+ * Factory callback to create the backing storage.
+ */
+ createMap(dst:yfiles.algorithms.Graph):yfiles.algorithms.IDataMap;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Node} src the old entity
+ * @param {yfiles.algorithms.Node} dst the new entity
+ */
+ copyNodeData(src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node):void;
+ /**
+ * Callback method that performs the actual copying of the data.
+ * This implementation simply returns the reference.
+ */
+ copyNodeDataToNode(dpKey:Object,src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node,value:Object):Object;
+ }
+ /**
+ * A helper wrapping implementation of the {@link yfiles.algorithms.GraphCopier.ICopyFactory} interface that copies the contents
+ * of the node maps from the source to the target graph.
+ * @see {@link yfiles.algorithms.GraphCopier.NodeMapCopyFactory#copy}
+ */
+ export interface NodeMapCopyFactory extends yfiles.algorithms.GraphCopier.GraphDataCopyFactory{
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ */
+ preCopyData(src:yfiles.algorithms.Graph,dst:yfiles.algorithms.Graph):void;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Node} src the old entity
+ * @param {yfiles.algorithms.Node} dst the new entity
+ */
+ copyNodeData(src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node):void;
+ /**
+ * Callback method that performs the actual copying of the data.
+ * This implementation simply returns the reference.
+ */
+ copy(src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node,value:Object):Object;
+ }
+ /**
+ * A helper wrapping implementation of the {@link yfiles.algorithms.GraphCopier.ICopyFactory} interface that copies the contents
+ * of the edge maps from the source to the target graph.
+ * @see {@link yfiles.algorithms.GraphCopier.EdgeMapCopyFactory#copy}
+ */
+ export interface EdgeMapCopyFactory extends yfiles.algorithms.GraphCopier.GraphDataCopyFactory{
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ */
+ preCopyData(src:yfiles.algorithms.Graph,dst:yfiles.algorithms.Graph):void;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Edge} src the old entity
+ * @param {yfiles.algorithms.Edge} dst the new entity
+ */
+ copyEdgeData(src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge):void;
+ /**
+ * Callback method that performs the actual copying of the data.
+ * This implementation simply returns the reference.
+ */
+ copy(src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge,value:Object):Object;
+ }
+ /**
+ * Helper class implementation of {@link yfiles.algorithms.GraphCopier.ICopyFactory} that can be used to copy the contents of a
+ * DataProvider registered with the source graph onto the target graph storing the values in newly created {@link yfiles.algorithms.HashMap} based {@link yfiles.algorithms.IDataMap}s.
+ * @see {@link yfiles.algorithms.GraphCopier.ItemDataProviderCopyFactory#copyNodeDataToNode}
+ * @see {@link yfiles.algorithms.GraphCopier.ItemDataProviderCopyFactory#copyEdgeDataToNode}
+ */
+ export interface ItemDataProviderCopyFactory extends yfiles.algorithms.GraphCopier.DataProviderCopyFactory{
+ /**
+ * Factory callback to create the backing storage.
+ */
+ createMap(dst:yfiles.algorithms.Graph):yfiles.algorithms.IDataMap;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Node} src the old entity
+ * @param {yfiles.algorithms.Node} dst the new entity
+ */
+ copyNodeData(src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node):void;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Edge} src the old entity
+ * @param {yfiles.algorithms.Edge} dst the new entity
+ */
+ copyEdgeData(src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge):void;
+ /**
+ * Callback method that performs the actual copying of the data.
+ * This implementation simply returns the reference.
+ */
+ copyNodeDataToNode(dpKey:Object,src:yfiles.algorithms.Node,dst:yfiles.algorithms.Node,value:Object):Object;
+ /**
+ * Callback method that performs the actual copying of the data.
+ * This implementation simply returns the reference.
+ */
+ copyEdgeDataToNode(dpKey:Object,src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge,value:Object):Object;
+ }
+ /**
+ * Helper class implementation of {@link yfiles.algorithms.GraphCopier.ICopyFactory} that can be used to copy the contents of a
+ * DataProvider registered with the source graph onto the target graph storing the values in newly a created {@link yfiles.algorithms.Graph#createEdgeMap edge map}.
+ * @see {@link yfiles.algorithms.GraphCopier.EdgeDataProviderCopyFactory#copy}
+ */
+ export interface EdgeDataProviderCopyFactory extends yfiles.algorithms.GraphCopier.DataProviderCopyFactory{
+ /**
+ * Factory callback to create the backing storage.
+ */
+ createMap(dst:yfiles.algorithms.Graph):yfiles.algorithms.IDataMap;
+ /**
+ * Empty stub to be overwritten by subclass implementations.
+ * @param {yfiles.algorithms.Edge} src the old entity
+ * @param {yfiles.algorithms.Edge} dst the new entity
+ */
+ copyEdgeData(src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge):void;
+ copy(dpKey:Object,src:yfiles.algorithms.Edge,dst:yfiles.algorithms.Edge,value:Object):Object;
+ }
+ /**
+ * The copy factory interface used by {@link yfiles.algorithms.GraphCopier} to delegate the actual work to.
+ */
+ export interface ICopyFactory extends Object{
+ /**
+ * Copies the originalNode from the source graph to the new targetGraph.
+ * @param {yfiles.algorithms.Graph} targetGraph the graph to create the new node in
+ * @param {yfiles.algorithms.Node} originalNode the original node from the source graph
+ * @return {yfiles.algorithms.Node} the newly created node
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyNode}.
+ */
+ copyNode(targetGraph:yfiles.algorithms.Graph,originalNode:yfiles.algorithms.Node):yfiles.algorithms.Node;
+ /**
+ * Copies the originalEdge from the source graph to the new targetGraph
+ * using the specified new source and target node in the target graph.
+ * @param {yfiles.algorithms.Graph} targetGraph the graph to create the new node in
+ * @param {yfiles.algorithms.Node} newSource the source node in the target graph to use for the newly created edge
+ * @param {yfiles.algorithms.Node} newTarget the target node in the target graph to use for the newly created edge
+ * @param {yfiles.algorithms.Edge} originalEdge the original edge from the source graph
+ * @return {yfiles.algorithms.Edge} the newly created edge
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyEdge}.
+ */
+ copyEdge(targetGraph:yfiles.algorithms.Graph,newSource:yfiles.algorithms.Node,newTarget:yfiles.algorithms.Node,originalEdge:yfiles.algorithms.Edge):yfiles.algorithms.Edge;
+ /**
+ * Creates a new graph instance that will be the target graph of the copy operation.
+ * This method is called if no target graph is specified by the user.
+ * @return {yfiles.algorithms.Graph} the graph to use as the target graph
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#createGraph}.
+ */
+ createGraph():yfiles.algorithms.Graph;
+ /**
+ * Callback that will be called before the copy operation takes place.
+ * At that point in time no entities have been copied to the new graph.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph that will be used to copy the entities from.
+ * @param {yfiles.algorithms.Graph} targetGraph the graph that will be used to copy the entities to.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#preCopyGraphData}.
+ */
+ preCopyGraphData(sourceGraph:yfiles.algorithms.Graph,targetGraph:yfiles.algorithms.Graph):void;
+ /**
+ * Callback that will be called after the copy operation has completed.
+ * At that point in time all entities have been copied to the new graph.
+ * @param {yfiles.algorithms.Graph} sourceGraph the graph that was used to copy the entities from.
+ * @param {yfiles.algorithms.Graph} targetGraph the graph that was used to copy the entities to.
+ * @param {yfiles.algorithms.IMap} nodeMap
+ * a map that contains a mapping between the nodes in the source graph
+ * to their corresponding nodes in the new graph.
+ * @param {yfiles.algorithms.IMap} edgeMap
+ * a map that contains a mapping between the edges in the source graph
+ * to their corresponding edges in the new graph.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#postCopyGraphData}.
+ */
+ postCopyGraphData(sourceGraph:yfiles.algorithms.Graph,targetGraph:yfiles.algorithms.Graph,nodeMap:yfiles.algorithms.IMap,edgeMap:yfiles.algorithms.IMap):void;
+ }
+ }
+ var GraphCopier:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance that uses a {@link yfiles.algorithms.GraphCopyFactory} as the default factory.
+ */
+ new ():yfiles.algorithms.GraphCopier;
+ GraphDataCopyFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance that delegates the actual copying process of the elements to the provided factory.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} delegatingFactory
+ */
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory):yfiles.algorithms.GraphCopier;
+ };
+ DataProviderCopyFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new delegating instance that copies the data for the given data provider key.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} delegatingFactory the factory to delegate to.
+ * @param {Object} dpKey the data provider key
+ */
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory,dpKey:Object):yfiles.algorithms.GraphCopier;
+ };
+ NodeDataProviderCopyFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance using the delegate for the given data provider key.
+ */
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory,dpKey:Object):yfiles.algorithms.GraphCopier;
+ };
+ NodeMapCopyFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance that copies the node map contents.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} delegatingFactory the factory to delegate the copying of the entities to.
+ */
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory):yfiles.algorithms.GraphCopier;
+ };
+ EdgeMapCopyFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance that copies the node map contents.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} delegatingFactory the factory to delegate the copying of the entities to.
+ */
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory):yfiles.algorithms.GraphCopier;
+ };
+ ItemDataProviderCopyFactory:{
+ $class:yfiles.lang.Class;
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory,dpKey:Object):yfiles.algorithms.GraphCopier;
+ };
+ EdgeDataProviderCopyFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance using the delegate for the given data provider key.
+ */
+ new (delegatingFactory:yfiles.algorithms.GraphCopier.ICopyFactory,dpKey:Object):yfiles.algorithms.GraphCopier;
+ };
+ /**
+ * Creates a new instance that uses the specified factory to perform the actual copy operations.
+ * @param {yfiles.algorithms.GraphCopier.ICopyFactory} copyFactory the factory to use, must be non-null.
+ * @throws {yfiles.system.ArgumentNullException} if copyFactory is null
+ */
+ WithFactory:{
+ new (copyFactory:yfiles.algorithms.GraphCopier.ICopyFactory):yfiles.algorithms.GraphCopier;
+ };
+ };
+ /**
+ * Provides algorithms to compute reachability information for directed, acyclic
+ * graphs.
+ * The following algorithms are available:
+ *
+ *
transitive closure
+ *
transitive reduction
+ *
+ */
+ export interface Transitivity extends Object{
+ }
+ var Transitivity:{
+ $class:yfiles.lang.Class;
+ /**
+ * Calculates the transitive closure for a directed acyclic graph.
+ * The reflexive, transitive closure is defined as follows:
+ * Let G = (V,E) be an directed acyclic graph.
+ * The directed acyclic graph G* = (V,E*) is the reflexive,
+ * transitive closure of G,
+ * if (v,w) in E* iff there is a path from v to
+ * w in G.
+ * REMARK:
+ * Note, that this implementation produces the transitive closure and
+ * not the reflexive, transitive closure of the specified graph, since
+ * no self-loops are added to the specified graph.
+ * Precondition:GraphChecker.isAcyclic(graph)
+ * @param {yfiles.algorithms.Graph} graph input graph to which this method will add transitive edges if necessary.
+ */
+ transitiveClosure(graph:yfiles.algorithms.Graph):void;
+ /**
+ * Like {@link yfiles.algorithms.Transitivity#transitiveClosure}, additionally this method returns the edges
+ * that have been added to the graph.
+ * Precondition:GraphChecker.isAcyclic(graph)
+ * @param {yfiles.algorithms.Graph} graph input graph to which this method will add transitive edges if necessary.
+ * @param {yfiles.algorithms.EdgeList} addedEdges contains edges that have been added to the graph by this method.
+ */
+ transitiveClosureWithAddedEdges(graph:yfiles.algorithms.Graph,addedEdges:yfiles.algorithms.EdgeList):void;
+ /**
+ * Calculates the transitive reduction for a directed acyclic graph.
+ * The transitive edges
+ * in the graph will be removed by this method.
+ * The transitive reduction is defined as follows:
+ * Let G = (V,E) be an directed acyclic graph.
+ * The directed acyclic graph G* = (V,E*) is the transitive
+ * reduction of G,
+ * if (v,w) in E* iff there is no path from v to
+ * w in G of length 2 or more.
+ * WARNING:
+ * This implementation is costly in terms of memory, since a
+ * (n x n)-Matrix is allocated to store reach
+ * data.
+ * Complexity:
+ * O(n^3), where n is
+ * the node count of the specified graph
+ * Precondition:GraphChecker.isAcyclic(graph)
+ */
+ transitiveReduction(graph:yfiles.algorithms.Graph):void;
+ /**
+ * Like {@link yfiles.algorithms.Transitivity#transitiveReduction} this method calculates the transitive reduction
+ * of a graph.
+ * The transitive edges will not be removed from the graph. Instead they will be returned
+ * in an EdgeList.
+ * Complexity:
+ * O(n^3), where n is
+ * the node count of the specified graph
+ * Precondition:GraphChecker.isAcyclic(graph)
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.EdgeList} transitiveEdges
+ * returns the result. It will contain all transitive
+ * edges of the given graph. Removal of these edges will yield the transitive
+ * reduction of the graph.
+ */
+ transitiveReductionWithTransitiveEdges(graph:yfiles.algorithms.Graph,transitiveEdges:yfiles.algorithms.EdgeList):void;
+ };
+ /**
+ * Provides diverse algorithms and services for tree-structured graphs or subgraphs.
+ */
+ export interface Trees extends Object{
+ }
+ var Trees:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns an array of EdgeList objects each containing edges that belong to a
+ * maximal directed subtree of the given graph.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {yfiles.algorithms.EdgeList[]}
+ * an array of {@link yfiles.algorithms.EdgeList} objects each containing edges that belong to a maximal directed subtree.
+ * @see {@link yfiles.algorithms.Trees#getTreeNodes}
+ */
+ getTreeEdges(graph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList[];
+ /**
+ * Same as {@link yfiles.algorithms.Trees#getTreeEdges} but more efficient if
+ * the treeNodes where calculated before by {@link yfiles.algorithms.Trees#getTreeNodes}.
+ * Furthermore, the method can also be applied to the result obtained by {@link yfiles.algorithms.Trees#getUndirectedTreeNodes}.
+ * In this case the subtrees are considered to be undirected.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @param {yfiles.algorithms.NodeList[]} treeNodes
+ * An array of {@link yfiles.algorithms.NodeList}s formerly calculated by {@link yfiles.algorithms.Trees#getTreeNodes}.
+ * @return {yfiles.algorithms.EdgeList[]}
+ * an array of {@link yfiles.algorithms.EdgeList} objects each containing edges that belong to a maximal subtree.
+ */
+ getTreeEdgesForNodes(graph:yfiles.algorithms.Graph,treeNodes:yfiles.algorithms.NodeList[]):yfiles.algorithms.EdgeList[];
+ /**
+ * Returns an array of NodeList objects each containing nodes
+ * that belong to a maximal directed subtree
+ * of the given graph.
+ * For each list of tree nodes the first node
+ * element is the root of a tree. On each such root all
+ * outgoing edges connect to nodes in the subtree and each
+ * root's indegree is at least two.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {yfiles.algorithms.NodeList[]}
+ * an array of {@link yfiles.algorithms.NodeList} objects each containing nodes that belong to a maximal directed subtree.
+ */
+ getTreeNodes(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList[];
+ /**
+ * Returns an array of NodeList objects each containing nodes
+ * that belong to a maximal undirected subtree
+ * of the given graph.
+ * For each list of tree nodes the first node
+ * is the only node of the subtree that may be incident to non-tree edges.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {yfiles.algorithms.NodeList[]}
+ * an array of {@link yfiles.algorithms.NodeList} objects each containing nodes that belong to a maximal undirected subtree.
+ */
+ getUndirectedTreeNodes(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList[];
+ /**
+ * Checks whether the given graph is a directed rooted tree where each
+ * node has a maximum of n children.
+ * @param {yfiles.algorithms.Graph} g the given graph.
+ * @param {number} n the allowed maximum of children.
+ * @return {boolean}
+ * true if the given graph is a directed rooted tree where each
+ * node has a maximum of n children. Otherwise, the method returns false.
+ */
+ isNaryTree(g:yfiles.algorithms.Graph,n:number):boolean;
+ /**
+ * Checks whether the given graph is a directed rooted tree.
+ * Note: isRootedTree(graph) => isTree(graph).
+ * @param {yfiles.algorithms.Graph} g the given graph.
+ * @return {boolean}
+ * true if the given graph is a directed rooted tree.
+ * Otherwise, the method returns false.
+ */
+ isRootedTree(g:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph is an undirected tree.
+ * Note: isRootedTree(graph) => isTree(graph).
+ * @param {yfiles.algorithms.Graph} g the given graph.
+ * @return {boolean}
+ * true if the given graph is an undirected tree.
+ * Otherwise, the method returns false.
+ */
+ isTree(g:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether the given graph is a forest, that is,
+ * a graph whose connected components are directed rooted trees.
+ * @param {yfiles.algorithms.Graph} g the given graph.
+ * @return {boolean} true if the given graph is a forest. Otherwise, the method returns false.
+ */
+ isForest(g:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether the given graph is a forest.
+ * If directedRootedTree == true each component has to be a directed rooted tree.
+ * Otherwise, each component has to be an undirected tree.
+ * Note: isForest(graph, true) => isForest(graph, false).
+ * @param {yfiles.algorithms.Graph} g the given graph.
+ * @param {boolean} directedRootedTree whether to check for directed rooted trees.
+ * @return {boolean} true if the given graph is a forest. Otherwise, the method returns false.
+ */
+ isForestWithDirection(g:yfiles.algorithms.Graph,directedRootedTree:boolean):boolean;
+ /**
+ * Returns all leaf nodes of the given tree.
+ * A leaf node is a node with outdegree == 0 if the input is a directed rooted tree,
+ * and a node with degree == 1, otherwise.
+ * @param {yfiles.algorithms.Graph} tree the given tree.
+ * @param {boolean} directedRootedTree whether or not to consider the tree as directed rooted tree.
+ * @return {yfiles.algorithms.NodeList} a NodeList that contains all leaf nodes of the given tree.
+ */
+ getLeafNodes(tree:yfiles.algorithms.Graph,directedRootedTree:boolean):yfiles.algorithms.NodeList;
+ /**
+ * Returns the center node of an undirected tree.
+ * The center node has the property of inducing a minimum depth
+ * tree when being used as the root of that tree.
+ * Precondition:!tree.isEmpty()
+ * Precondition:isTree(tree)
+ * @param {yfiles.algorithms.Graph} tree the given undirected tree.
+ * @return {yfiles.algorithms.Node} the center node of the given undirected tree.
+ */
+ getCenterRoot(tree:yfiles.algorithms.Graph):yfiles.algorithms.Node;
+ /**
+ * Returns a possible root for the given (undirected) tree.
+ * More precisely, if the input is a directed rooted tree or reversed directed rooted tree it returns the
+ * corresponding root node.
+ * Otherwise, if the input is a tree, the method returns a maximum weight center node as defined in
+ * {@link yfiles.algorithms.Trees#getWeightedCenterNode}.
+ * If the input is not a tree, the node with indegree == 0 (or outdegree == 0) is returned.
+ * Precondition:
+ * isTree(tree)
+ * or there is exactly one node with indegree == 0
+ * or there is exactly one node with outdegree == 0
+ * Precondition:!tree.isEmpty()
+ * @param {yfiles.algorithms.Graph} tree the given tree.
+ * @return {yfiles.algorithms.Node} a possible root for the given tree.
+ */
+ getRoot(tree:yfiles.algorithms.Graph):yfiles.algorithms.Node;
+ /**
+ * Reverses some edges of the given tree such that it is
+ * a directed rooted tree afterwards.
+ * A list of all reversed edges will be returned by this method.
+ * Precondition: The given graph must be a tree.
+ * Precondition:!graph.isEmpty()
+ * @param {yfiles.algorithms.Graph} tree the given tree.
+ * @return {yfiles.algorithms.EdgeList}
+ * an {@link yfiles.algorithms.EdgeList} that contains the reversed edges.
+ */
+ directTree(tree:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Finds a node which is used by the greatest number of all (undirected) paths interconnecting
+ * all nodes with each other.
+ * Precondition: The given graph must be a tree (may be undirected).
+ * Precondition:!graph.isEmpty()
+ * @param {yfiles.algorithms.Graph} tree the given tree.
+ * @return {yfiles.algorithms.Node} a node which is used by the greatest number of all undirected paths.
+ */
+ getWeightedCenterNode(tree:yfiles.algorithms.Graph):yfiles.algorithms.Node;
+ /**
+ * Finds a node which is used by the greatest number of all (undirected) paths interconnecting
+ * all nodes with each other.
+ * The number of paths per node are stored in the given
+ * NodeMap.
+ * Precondition: The given graph must be a tree (may be undirected).
+ * Precondition:!graph.isEmpty()
+ * @param {yfiles.algorithms.Graph} tree the given tree.
+ * @param {yfiles.algorithms.INodeMap} intWeight
+ * a {@link yfiles.algorithms.INodeMap} that is used to store the number of paths per node.
+ * @return {yfiles.algorithms.Node} a node which is used by the greatest number of all undirected paths.
+ */
+ getWeightedCenterNodeWithWeight(tree:yfiles.algorithms.Graph,intWeight:yfiles.algorithms.INodeMap):yfiles.algorithms.Node;
+ /**
+ * Reverses some edges of the given tree such that it is
+ * a directed rooted tree with the given node as root element.
+ * A list of all reversed edges will be returned by this method.
+ * Precondition: The given graph must be a tree.
+ * Precondition: The given node must be part of the given graph
+ * @param {yfiles.algorithms.Graph} tree the given tree.
+ * @param {yfiles.algorithms.Node} root the given root element.
+ * @return {yfiles.algorithms.EdgeList}
+ * an {@link yfiles.algorithms.EdgeList} that contains the reversed edges.
+ */
+ directTreeWithRoot(tree:yfiles.algorithms.Graph,root:yfiles.algorithms.Node):yfiles.algorithms.EdgeList;
+ /**
+ * Collects all nodes of the subtree starting with root.
+ * @deprecated For internal use only. Might be changed or removed in the future.
+ * @param {yfiles.algorithms.Node} root
+ * @param {yfiles.algorithms.NodeList} nodes the resulting node list
+ */
+ collectSubtree(root:yfiles.algorithms.Node,nodes:yfiles.algorithms.NodeList):void;
+ /**
+ * Returns the nearest common ancestor of a subset of nodes within a directed rooted tree.
+ * It is not part of the
+ * given subset.
+ * Precondition: isTree(tree)
+ * Complexity: O(tree.N())
+ * @param {yfiles.algorithms.Graph} tree the given directed rooted tree.
+ * @param {yfiles.algorithms.Node} root the root of the tree.
+ * @param {boolean} rootedDownward
+ * whether the tree is directed from the root to the leaves (true) or from the
+ * leaves to the root (false).
+ * @param {yfiles.algorithms.NodeList} nodes the subset of nodes.
+ * @return {yfiles.algorithms.Node} the nearest common ancestor of the given subset of nodes.
+ */
+ getNearestCommonAncestor(tree:yfiles.algorithms.Graph,root:yfiles.algorithms.Node,rootedDownward:boolean,nodes:yfiles.algorithms.NodeList):yfiles.algorithms.Node;
+ /**
+ * Returns for a rooted directed tree the depths of each of its subtrees.
+ * @param {yfiles.algorithms.Graph} tree a rooted directed tree graph.
+ * @param {yfiles.algorithms.INodeMap} subtreeDepthMap
+ * node map that will hold for each node the depth of the subtree rooted at it. The resulting
+ * depth values can be retrieved using the map method {@link yfiles.algorithms.INodeMap#getInt}.
+ */
+ getSubTreeDepths(tree:yfiles.algorithms.Graph,subtreeDepthMap:yfiles.algorithms.INodeMap):void;
+ /**
+ * Returns for a rooted directed tree the size (number of nodes) of each of its subtrees.
+ * @param {yfiles.algorithms.Graph} tree a rooted directed tree graph
+ * @param {yfiles.algorithms.INodeMap} subtreeSizeMap
+ * node map that will hold for each node the size of the subtree rooted at it. The resulting
+ * size values can be retrieved using the map method {@link yfiles.algorithms.INodeMap#getInt}.
+ */
+ getSubTreeSizes(tree:yfiles.algorithms.Graph,subtreeSizeMap:yfiles.algorithms.INodeMap):void;
+ };
+ /**
+ * This class provides methods for efficiently sorting graph elements in graph
+ * structures.
+ */
+ export interface Sorting extends Object{
+ }
+ var Sorting:{
+ $class:yfiles.lang.Class;
+ /**
+ * Sort nodes by degree in ascending order.
+ */
+ sortNodesByDegree(graph:yfiles.algorithms.Graph):yfiles.algorithms.Node[];
+ /**
+ * Sort nodes by an integer key associated to each node through the given data provider.
+ * The nodes are sorted in ascending order.
+ */
+ sortNodesByIntKey(graph:yfiles.algorithms.Graph,keys:yfiles.algorithms.IDataProvider):yfiles.algorithms.Node[];
+ };
+ /**
+ * Provides (minimum) spanning tree algorithms for graphs.
+ * A spanning tree of an undirected connected graph is a subset of its edges
+ * that form a tree connecting all edges of the graph.
+ * If the edges of a graph have a cost or a weight associated with
+ * them then it is possible to calculate a minimum spanning tree of that graph,
+ * i.e. a spanning tree whose edges have minimum overall cost of all spanning
+ * trees of that graph.
+ */
+ export interface SpanningTrees extends Object{
+ }
+ var SpanningTrees:{
+ $class:yfiles.lang.Class;
+ /**
+ * Calculates a minimum spanning tree for the given graph using our
+ * favorite algorithm for that problem.
+ * Precondition: GraphComponents.isConnected(graph)
+ * Precondition: cost.length == graph.E();
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IDataProvider} cost
+ * a data provider that must return a double value for each
+ * edge in the graph.
+ * @return {yfiles.algorithms.EdgeList}
+ * a list that contains the edges that make up the minimum spanning
+ * tree.
+ */
+ minimum(graph:yfiles.algorithms.Graph,cost:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ /**
+ * Calculates a minimum spanning tree for the given graph.
+ * The implementation
+ * is based on an algorithm originally published in
+ * J.B. Kruskal. On the shortest spanning subtree of a graph and the
+ * traveling salesman problem. Proceedings of the American Mathematical
+ * Society, pages 48-50, 1956.
+ * Precondition: GraphComponents.isConnected(graph)
+ * Precondition: cost.length == graph.E();
+ * Complexity: graph.E()+graph.N()*log(graph.N())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IDataProvider} cost
+ * a data provider that must return a double value for each
+ * edge in the graph.
+ * @return {yfiles.algorithms.EdgeList}
+ * a list that contains the edges that make up the minimum spanning
+ * tree.
+ */
+ kruskal(graph:yfiles.algorithms.Graph,cost:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ /**
+ * Calculates a minimum spanning tree for the given graph.
+ * The implementation
+ * is based on an algorithm originally published in
+ * R.C. Prim. Shortest connection networks and some generalizations.
+ * Bell System Technical Journal, 36:1389-1401, 1957.
+ * Precondition: GraphComponents.isConnected(graph)
+ * Precondition: cost.length == graph.E();
+ * Complexity: graph.E()*log(graph.N())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IDataProvider} cost
+ * a data provider that must return a double value for each
+ * edge in the graph.
+ * @return {yfiles.algorithms.EdgeList}
+ * a list that contains the edges that make up the minimum spanning
+ * tree.
+ */
+ prim(graph:yfiles.algorithms.Graph,cost:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ /**
+ * Calculates a spanning tree for the given graph.
+ * Each edge has
+ * assumed uniform cost of 1.0.
+ * Precondition: GraphComponents.isConnected(graph)
+ * Complexity: O(graph.E()+graph.N())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @return {yfiles.algorithms.EdgeList}
+ * a list that contains the edges that make up the minimum spanning
+ * tree.
+ */
+ uniform(graph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Returns the overall cost of a previously calculated minimum
+ * spanning tree.
+ * @param {yfiles.algorithms.EdgeList} treeEdges edges that make up a minimum spanning tree.
+ * @param {yfiles.algorithms.IDataProvider} edgeCost
+ * a data provider that returns the double valued
+ * cost of each of the tree edges.
+ * @return {number} the overall cost of the tree edges.
+ */
+ cost(treeEdges:yfiles.algorithms.EdgeList,edgeCost:yfiles.algorithms.IDataProvider):number;
+ };
+ /**
+ * This class represents a priority queue for nodes where
+ * the priority values are of type Object
+ * The implementation is based on binary heaps.
+ * In case the priority values are of type double then using {@link yfiles.algorithms.BHeapDoubleNodePQ}
+ * is slightly more efficient than using this generic NodePQ.
+ */
+ export interface BHeapNodePQ extends Object,yfiles.algorithms.INodePQ{
+ /**
+ * Adds the given node with with given priority to this queue.
+ * Precondition: !contains(v)
+ * Complexity: O(log(size()))
+ * @see Specified by {@link yfiles.algorithms.INodePQ#add}.
+ */
+ add(v:yfiles.algorithms.Node,priority:Object):void;
+ /**
+ * Decreases the priority value of the given node.
+ * Precondition: contains(v)
+ * Precondition:
+ * c.compare(priority,getPriority(v)) < 0, where
+ * c is the corresponding comparator for the priorities in this
+ * queue.
+ * Complexity: O(log(size()))
+ * @see Specified by {@link yfiles.algorithms.INodePQ#decreasePriority}.
+ */
+ decreasePriority(v:yfiles.algorithms.Node,priority:Object):void;
+ increasePriority(v:yfiles.algorithms.Node,priority:Object):void;
+ /**
+ * Changes the priority value of the given node.
+ * Precondition: contains(v)
+ * Complexity: O(log(size()))
+ */
+ changePriority(v:yfiles.algorithms.Node,priority:Object):void;
+ /**
+ * Removes the node with smallest priority from this queue.
+ * Precondition: !isEmpty()
+ * Complexity: O(log(size()))
+ * @return {yfiles.algorithms.Node} the removed node with smallest priority
+ * @see Specified by {@link yfiles.algorithms.INodePQ#removeMin}.
+ */
+ removeMin():yfiles.algorithms.Node;
+ /**
+ * He node with smallest priority in this queue.
+ * Precondition: !isEmpty()
+ * @see Specified by {@link yfiles.algorithms.INodePQ#min}.
+ */
+ min:yfiles.algorithms.Node;
+ /**
+ * The minimum priority value in this queue.
+ */
+ minPriority:Object;
+ /**
+ * Removes the given node from this queue.
+ * Precondition: contains(v)
+ * Complexity: O(log(size()))
+ */
+ remove(v:yfiles.algorithms.Node):void;
+ /**
+ * Makes this queue the empty queue.
+ * in this queue.
+ * Complexity: O(graph.N())
+ * @see Specified by {@link yfiles.algorithms.INodePQ#clear}.
+ */
+ clear():void;
+ /**
+ * Returns whether or not the given node is contained
+ * in this queue.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.INodePQ#contains}.
+ */
+ contains(v:yfiles.algorithms.Node):boolean;
+ /**
+ * Specifies whether or not this queue is empty.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.INodePQ#empty}.
+ */
+ empty:boolean;
+ /**
+ * Returns the number of nodes currently in this queue.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.INodePQ#size}.
+ */
+ size():number;
+ /**
+ * Returns the current priority of the given node.
+ * Precondition: contains(v)
+ * @see Specified by {@link yfiles.algorithms.INodePQ#getPriority}.
+ */
+ getPriority(v:yfiles.algorithms.Node):Object;
+ }
+ var BHeapNodePQ:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an empty NodePQ for nodes contained
+ * in the given graph.
+ * The given comparator
+ * must be able to compare all nodes residing in this
+ * queue by their priority.
+ * Neither the node set nor the indices of the nodes
+ * of the given graph may change while this queue is being used.
+ */
+ new (graph:yfiles.algorithms.Graph,c:yfiles.objectcollections.IComparer):yfiles.algorithms.BHeapNodePQ;
+ /**
+ * Creates an empty NodePQ for nodes contained
+ * in the given graph.
+ * The given comparator
+ * must be able to compare all nodes residing in this
+ * queue by their priority.
+ * By providing a NodeMap that can handle dynamic
+ * changes of its definition range this queue will
+ * be enabled to function even when the node set of
+ * the given graph changes.
+ */
+ FromMap:{
+ new (graph:yfiles.algorithms.Graph,c:yfiles.objectcollections.IComparer,dynamicMap:yfiles.algorithms.INodeMap):yfiles.algorithms.BHeapNodePQ;
+ };
+ };
+ /**
+ * This class implements a priority queue for nodes whose priority
+ * values are of type int.
+ *
+ * The implementation is based on binary heaps.
+ *
+ */
+ export interface BHeapIntNodePQ extends Object,yfiles.algorithms.IIntNodePQ{
+ /**
+ * Adds the given node with with given priority to this queue.
+ * Precondition: !contains(v)
+ * Complexity: O(log(size()))
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#add}.
+ */
+ add(v:yfiles.algorithms.Node,priority:number):void;
+ /**
+ * Decreases the priority value of the given node.
+ * Precondition: contains(v)
+ * Precondition: priority < getPriority(v)
+ * Complexity: O(log(size()))
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#decreasePriority}.
+ */
+ decreasePriority(v:yfiles.algorithms.Node,priority:number):void;
+ /**
+ * Increases the priority value of the given node.
+ * Precondition: contains(v)
+ * Precondition: priority > getPriority(v)
+ * Complexity: O(log(size()))
+ */
+ increasePriority(v:yfiles.algorithms.Node,priority:number):void;
+ /**
+ * Changes the priority value of the given node.
+ * Precondition: contains(v)
+ * Complexity: O(log(size()))
+ */
+ changePriority(v:yfiles.algorithms.Node,p:number):void;
+ /**
+ * Removes the node with smallest priority from this queue.
+ * Precondition: !isEmpty()
+ * Complexity: O(log(size()))
+ * @return {yfiles.algorithms.Node} the removed node with smallest priority
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#removeMin}.
+ */
+ removeMin():yfiles.algorithms.Node;
+ /**
+ * He node with smallest priority in this queue.
+ * Precondition: !isEmpty()
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#min}.
+ */
+ min:yfiles.algorithms.Node;
+ /**
+ * The minimum priority value in this queue.
+ */
+ minPriority:number;
+ /**
+ * Returns whether or not the given node is contained
+ * in this queue.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#contains}.
+ */
+ contains(v:yfiles.algorithms.Node):boolean;
+ /**
+ * Specifies whether or not this queue is empty.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#empty}.
+ */
+ empty:boolean;
+ /**
+ * Returns the number of nodes currently in this queue.
+ * Complexity: O(1)
+ */
+ size():number;
+ /**
+ * Returns the current priority of the given node.
+ * Precondition: contains(v)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#getPriority}.
+ */
+ getPriority(v:yfiles.algorithms.Node):number;
+ /**
+ * Removes the given node from this queue.
+ * Precondition: contains(v)
+ * Complexity: O(log(size()))
+ */
+ remove(v:yfiles.algorithms.Node):void;
+ /**
+ * Makes this queue the empty queue.
+ * in this queue.
+ * Complexity: O(graph.N())
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#clear}.
+ */
+ clear():void;
+ /**
+ * Does nothing.
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#dispose}.
+ */
+ dispose():void;
+ }
+ var BHeapIntNodePQ:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an empty NodePQ for nodes contained
+ * in the given graph.
+ * Neither the node set nor the indices of the nodes
+ * of the given graph may change while this queue is being used.
+ */
+ new (graph:yfiles.algorithms.Graph):yfiles.algorithms.BHeapIntNodePQ;
+ };
+ /**
+ * Implements a priority queue for nodes based on a
+ * array with bucket lists.
+ * The priority values must be less than a maximal-value
+ * which must be provided to the constructor.
+ * Certain operations have time-complexity dependent on this value.
+ * The priority values of the nodes must be non-negative.
+ * While the priority queue is used, the graph must not change.
+ */
+ export interface ArrayIntNodePQ extends Object,yfiles.algorithms.IIntNodePQ{
+ /**
+ * Removes all entries from the queue.
+ * Complexity:O(maxSize)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#clear}.
+ */
+ clear():void;
+ /**
+ * Specifies whether or not this queue is empty.
+ * Complexity:O(1)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#empty}.
+ */
+ empty:boolean;
+ /**
+ * Returns whether or not the given node is contained within this queue.
+ * Complexity:O(1)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#contains}.
+ */
+ contains(n:yfiles.algorithms.Node):boolean;
+ /**
+ * Inserts a node into the queue.
+ * Complexity:O(1)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#add}.
+ */
+ add(n:yfiles.algorithms.Node,value:number):void;
+ /**
+ * Removes a node from the priority queue.
+ * Time complexity in worst-case O(maxSize).
+ * Complexity:
+ * Amortized time complexity is O(maxSize), given
+ * that the sequence of minimal keys is non-decreasing
+ */
+ remove(n:yfiles.algorithms.Node):void;
+ /**
+ * The node with the minimal value in the queue.
+ * Complexity:O(1)
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#min}.
+ */
+ min:yfiles.algorithms.Node;
+ /**
+ * Decreases the value of a node in the queue to a certain value.
+ * Complexity:O(1)
+ * @param {yfiles.algorithms.Node} n a node in the priority queue.
+ * @param {number} value the new priority value of the node.
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#decreasePriority}.
+ */
+ decreasePriority(n:yfiles.algorithms.Node,value:number):void;
+ /**
+ * Increases the value of a node in the queue to a certain value.
+ * Complexity: O(1).
+ * @param {yfiles.algorithms.Node} n a node in the priority queue.
+ * @param {number} value the new priority value of the node.
+ */
+ increasePriority(n:yfiles.algorithms.Node,value:number):void;
+ /**
+ * Changes the value of a node in the queue to a certain value.
+ * Complexity: O(1).
+ * @param {yfiles.algorithms.Node} n a node in the priority queue.
+ * @param {number} value the new priority value of the node.
+ */
+ changePriority(n:yfiles.algorithms.Node,value:number):void;
+ /**
+ * Removes the node with the minimal value from the queue.
+ * Time complexity like {@link yfiles.algorithms.ArrayIntNodePQ#remove}.
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#removeMin}.
+ */
+ removeMin():yfiles.algorithms.Node;
+ /**
+ * Returns the current priority of the given node.
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#getPriority}.
+ */
+ getPriority(v:yfiles.algorithms.Node):number;
+ /**
+ * Disposes this queue.
+ * It is important to call this method after the queue
+ * is not needed anymore, to free bound resources.
+ * @see Specified by {@link yfiles.algorithms.IIntNodePQ#dispose}.
+ */
+ dispose():void;
+ /**
+ * Returns the list for a given slot.
+ * If there is no list yet, create one.
+ */
+ getList(value:number):yfiles.algorithms.YList;
+ }
+ var ArrayIntNodePQ:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns an empty Priority-Queue.
+ * @param {yfiles.algorithms.Graph} _graph the graph which contains the nodes
+ * @param {number} maxSize the maximum value of a node in the priority queue
+ */
+ new (_graph:yfiles.algorithms.Graph,maxSize:number):yfiles.algorithms.ArrayIntNodePQ;
+ /**
+ * Returns a new Priority-Queue initialized with all nodes of the graph.
+ * @param {yfiles.algorithms.Graph} _graph the graph which contains the nodes
+ * @param {yfiles.algorithms.IDataProvider} _initValues the initial priority values of the nodes.
+ */
+ WithInitValues:{
+ new (_graph:yfiles.algorithms.Graph,_initValues:yfiles.algorithms.IDataProvider):yfiles.algorithms.ArrayIntNodePQ;
+ };
+ /**
+ * Returns an empty Priority-Queue.
+ * This constructor takes a NodeMap as argument
+ * which is used to store the priority values.
+ * @param {yfiles.algorithms.Graph} _graph the graph which contains the nodes
+ * @param {yfiles.algorithms.INodeMap} _valueMap here the priority values are stored
+ * @param {number} maxSize the maximum value of a node in the priority queue
+ */
+ WithValueMapAndMaxSize:{
+ new (_graph:yfiles.algorithms.Graph,_valueMap:yfiles.algorithms.INodeMap,maxSize:number):yfiles.algorithms.ArrayIntNodePQ;
+ };
+ };
+ /**
+ * This class implements a priority queue for nodes whose priority
+ * values are of type double.
+ * The implementation is based on binary heaps.
+ */
+ export interface BHeapDoubleNodePQ extends Object,yfiles.algorithms.IDoubleNodePQ{
+ /**
+ * Adds the given node with with given priority to this queue.
+ * Precondition: !contains(v)
+ * Complexity: O(log(size()))
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#add}.
+ */
+ add(v:yfiles.algorithms.Node,value:number):void;
+ /**
+ * Decreases the priority value of the given node.
+ * Precondition: contains(v)
+ * Precondition:
+ * c.compare(p,getPriority(v)) < 0, where
+ * c is the corresponding comparator for the priorities in this
+ * queue.
+ * Complexity: O(log(size()))
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#decreasePriority}.
+ */
+ decreasePriority(v:yfiles.algorithms.Node,priority:number):void;
+ increasePriority(v:yfiles.algorithms.Node,priority:number):void;
+ /**
+ * Changes the priority value of the given node.
+ * Precondition: contains(v)
+ * Complexity: O(log(size()))
+ */
+ changePriority(v:yfiles.algorithms.Node,p:number):void;
+ /**
+ * Removes the node with smallest priority from this queue.
+ * Precondition: !isEmpty()
+ * Complexity: O(log(size()))
+ * @return {yfiles.algorithms.Node} the removed node with smallest priority
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#removeMin}.
+ */
+ removeMin():yfiles.algorithms.Node;
+ /**
+ * He node with smallest priority in this queue.
+ * Precondition: !isEmpty()
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#min}.
+ */
+ min:yfiles.algorithms.Node;
+ /**
+ * The minimum priority value in this queue.
+ */
+ minPriority:number;
+ /**
+ * Returns whether or not the given node is contained
+ * in this queue.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#contains}.
+ */
+ contains(v:yfiles.algorithms.Node):boolean;
+ /**
+ * Specifies whether or not this queue is empty.
+ * Complexity: O(1)
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#empty}.
+ */
+ empty:boolean;
+ /**
+ * Returns the number of nodes currently in this queue.
+ * Complexity: O(1)
+ */
+ size():number;
+ /**
+ * Returns the current priority of the given node.
+ * Precondition: contains(v)
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#getPriority}.
+ */
+ getPriority(v:yfiles.algorithms.Node):number;
+ /**
+ * Removes the given node from this queue.
+ * Precondition: contains(v)
+ * Complexity: O(log(size()))
+ */
+ remove(v:yfiles.algorithms.Node):void;
+ /**
+ * Makes this queue the empty queue.
+ * in this queue.
+ * Complexity: O(graph.N())
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#clear}.
+ */
+ clear():void;
+ /**
+ * Does nothing.
+ * @see Specified by {@link yfiles.algorithms.IDoubleNodePQ#dispose}.
+ */
+ dispose():void;
+ }
+ var BHeapDoubleNodePQ:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an empty NodePQ for nodes contained
+ * in the given graph.
+ * Neither the node set nor the indices of the nodes
+ * of the given graph may change while this queue is being used.
+ */
+ new (graph:yfiles.algorithms.Graph):yfiles.algorithms.BHeapDoubleNodePQ;
+ };
+ /**
+ * This class provides algorithms for the triangulation of point
+ * sets in the plane.
+ */
+ export interface Triangulator extends Object{
+ }
+ var Triangulator:{
+ $class:yfiles.lang.Class;
+ /**
+ * Computes a triangulation of the given points.
+ * The calculated triangulation is represented by an embedded graph,
+ * i.e. to each edge there exists a reverse edge and the outedges
+ * around each node are in embedded order. The returned edge and
+ * the (optional) reverseEdgeMap can be used to construct all faces of the
+ * plane graph and to determine its outer face.
+ * @param {yfiles.algorithms.Graph} result
+ * a graph whose nodes represent the points that need
+ * to be triangulated.
+ * @param {yfiles.algorithms.IDataProvider} pointData must provide the location (YPoint) for each node in the given graph.
+ * @param {yfiles.algorithms.IEdgeMap} reverseEdgeMap
+ * a node map that will contain for each edge its reverse
+ * edge. If this argument is null then no reverse edge information
+ * will be available.
+ * @return {yfiles.algorithms.Edge} an edge on the outer face of the result graph.
+ */
+ triangulatePoints(result:yfiles.algorithms.Graph,pointData:yfiles.algorithms.IDataProvider,reverseEdgeMap:yfiles.algorithms.IEdgeMap):yfiles.algorithms.Edge;
+ /**
+ * Computes a triangulation of the given points.
+ * The calculated triangulation is represented by an embedded graph,
+ * i.e. to each edge there exists a reverse edge and the outedges
+ * around each node are in embedded order. The returned edge and
+ * the (optional) reverseEdgeMap can be used to construct all faces of the
+ * plane graph and to determine its outer face.
+ * @param {yfiles.algorithms.YList} points
+ * the point set to be triangulated. The points must be provided
+ * as a YList of YPoints.
+ * @param {yfiles.algorithms.Graph} result the resulting triangulation
+ * @param {yfiles.algorithms.INodeMap} resultMap the node map that forms the link between a point and a node.
+ * @param {yfiles.algorithms.IEdgeMap} reverseEdgeMap
+ * a node map that will contain for each edge its reverse
+ * edge. If this argument is null then no reverse edge information
+ * will be available.
+ * @return {yfiles.algorithms.Edge} an edge on the outer face of the result graph.
+ */
+ triangulatePointsFromList(points:yfiles.algorithms.YList,result:yfiles.algorithms.Graph,resultMap:yfiles.algorithms.INodeMap,reverseEdgeMap:yfiles.algorithms.IEdgeMap):yfiles.algorithms.Edge;
+ /**
+ * Computes a Delauney triangulation of the given points.
+ * A Delauney triangulation
+ * is a triangulation such that none of the given points is inside the circumcircle
+ * of any of the calculated triangles.
+ *
+ * The calculated triangulation is represented by an embedded graph,
+ * i.e. to each edge there exists a reverse edge and the outedges
+ * around each node are in embedded order. The returned edge and
+ * the (optional) reverseEdgeMap can be used to construct all faces of the
+ * plane graph and to determine its outer face.
+ *
+ * @param {yfiles.algorithms.Graph} result
+ * a graph whose nodes represent the points that need
+ * to be triangulated.
+ * @param {yfiles.algorithms.IDataProvider} pointData must provide the location (YPoint) for each node in the given graph.
+ * @param {yfiles.algorithms.IEdgeMap} revMap
+ * a node map that will contain for each edge its reverse
+ * edge. If this argument is null then no reverse edge information
+ * will be available.
+ * @return {yfiles.algorithms.Edge} an edge on the outer face of the result graph.
+ */
+ calcDelauneyTriangulation(result:yfiles.algorithms.Graph,pointData:yfiles.algorithms.IDataProvider,revMap:yfiles.algorithms.IEdgeMap):yfiles.algorithms.Edge;
+ };
+ /**
+ * This interface describes a 2-dimensional object which has a finite
+ * bounding box.
+ */
+ export interface IPlaneObject extends Object{
+ /**
+ * The smallest Rectangle which contains the object.
+ * @see Specified by {@link yfiles.algorithms.IPlaneObject#boundingBox}.
+ */
+ boundingBox:yfiles.algorithms.YRectangle;
+ }
+ var IPlaneObject:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * This is an interface for a sequence of instances of YPoint.
+ */
+ export interface IPointCursor extends Object,yfiles.algorithms.ICursor{
+ /**
+ * The instance of YPoint the cursor is currently pointing on.
+ * @see Specified by {@link yfiles.algorithms.IPointCursor#point}.
+ */
+ point:yfiles.algorithms.YPoint;
+ }
+ var IPointCursor:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * This class represents a line segment in the plane.
+ * A line segment is defined by its two end points.
+ */
+ export interface LineSegment extends Object,yfiles.algorithms.IPlaneObject{
+ /**
+ * If this segment is considered vertical, i.e.
+ * the x values of the end point differ less then 0.00000001
+ */
+ isVertical:boolean;
+ /**
+ * Determines if the interval is horizontal.
+ */
+ isHorizontal:boolean;
+ /**
+ * The first end point of the line segment.
+ */
+ firstEndPoint:yfiles.algorithms.YPoint;
+ /**
+ * The second end point of the line segment.
+ */
+ secondEndPoint:yfiles.algorithms.YPoint;
+ /**
+ * Returns if the projection on the Y axis of the line segment
+ * covers a certain point on the Y Axis.
+ */
+ isInYIntervall(y:number):boolean;
+ /**
+ * Returns if the projection on the X axis of the line segment
+ * covers a certain point on the X Axis.
+ */
+ isInXIntervall(x:number):boolean;
+ /**
+ * The y value of the line on x coordinate 0.
+ */
+ xOffset:number;
+ /**
+ * The slope of the line segment.
+ */
+ slope:number;
+ /**
+ * Returns the length of the line segment,
+ * this is the value of the Euclidean norm.
+ * @return {number} an value > 0.
+ */
+ length():number;
+ /**
+ * The smallest Rectangle which contains the object.
+ * @see Specified by {@link yfiles.algorithms.IPlaneObject#boundingBox}.
+ */
+ boundingBox:yfiles.algorithms.YRectangle;
+ /**
+ * Checks whether the line segment intersects a box.
+ * @param {yfiles.algorithms.YRectangle} box A rectangle.
+ * @return {boolean}
+ * true if the line segments intersects the box,
+ * false otherwise.
+ */
+ intersectsRectangle(box:yfiles.algorithms.YRectangle):boolean;
+ /**
+ * Checks whether a given point lies on this line segment.
+ * @param {yfiles.algorithms.YPoint} point an arbitrary point.
+ * @return {boolean}
+ * true if the line segments intersects the box,
+ * false otherwise.
+ */
+ contains(point:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Checks whether the line segment intersects a point.
+ * @param {yfiles.algorithms.YPoint} p a point
+ * @return {boolean}
+ * true if the line segments intersects the box,
+ * false otherwise.
+ */
+ intersectsPoint(p:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Returns the vector pointing from the first end point to the second
+ * end point of the line segment.
+ */
+ toYVector():yfiles.algorithms.YVector;
+ /**
+ * Returns the affine line defined by the end points of the
+ * line segment.
+ */
+ toAffineLine():yfiles.algorithms.AffineLine;
+ /**
+ * The distance from start to end point in x-coordinates.
+ */
+ deltaX:number;
+ /**
+ * The distance from start to end point in y-coordinates.
+ */
+ deltaY:number;
+ /**
+ * String representation of the line.
+ */
+ toString():string;
+ }
+ var LineSegment:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns a new LineSegment.
+ * @param {yfiles.algorithms.YPoint} p1 the first end point of the line segment.
+ * @param {yfiles.algorithms.YPoint} p2 the second end point of the line segment.
+ */
+ new (p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):yfiles.algorithms.LineSegment;
+ /**
+ * Checks whether a line segment intersects a box.
+ * @param {yfiles.algorithms.YRectangle} box A rectangle.
+ * @param {yfiles.algorithms.YPoint} s first end point of the line segment.
+ * @param {yfiles.algorithms.YPoint} t second end point of the line segment.
+ * @return {boolean}
+ * true if the line segments intersects the box,
+ * false otherwise.
+ */
+ boxIntersectsSegment(box:yfiles.algorithms.YRectangle,s:yfiles.algorithms.YPoint,t:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Checks whether a line segment intersects a box.
+ * Implemented using the Cohen-Sutherland algorithm.
+ * @param {yfiles.algorithms.YRectangle} box A rectangle
+ * @param {number} x1 X-coordinate of start point of vector
+ * @param {number} y1 Y-coordinate of start point of vector
+ * @param {number} x2 X-coordinate of target point of vector
+ * @param {number} y2 Y-coordinate of target point of vector
+ * @return {boolean}
+ * true if the line segments intersects the box,
+ * false otherwise.
+ */
+ boxIntersectsSegmentDouble(box:yfiles.algorithms.YRectangle,x1:number,y1:number,x2:number,y2:number):boolean;
+ /**
+ * Returns intersection point between the two line segments, if there is
+ * one or null if the two line segments do not intersect.
+ * @param {yfiles.algorithms.LineSegment} s1 first line segment
+ * @param {yfiles.algorithms.LineSegment} s2 second line segment
+ */
+ getIntersection(s1:yfiles.algorithms.LineSegment,s2:yfiles.algorithms.LineSegment):yfiles.algorithms.YPoint;
+ };
+ /**
+ * This class defines a rectangle and provides utility methods for it.
+ */
+ export interface YRectangle extends yfiles.algorithms.YDimension,yfiles.algorithms.IPlaneObject{
+ /**
+ * Returns the Manhattan distance to the passed rectangle.
+ * If they overlap the distance is 0.
+ * @param {yfiles.algorithms.YRectangle} other the second rectangle.
+ * @return {number} the distance to the given rectangle.
+ */
+ getManhattanDistance(other:yfiles.algorithms.YRectangle):number;
+ /**
+ * X-coordinate of upper left corner.
+ */
+ x:number;
+ /**
+ * Y-coordinate of upper left corner.
+ */
+ y:number;
+ /**
+ * Coordinates of upper left corner.
+ */
+ location:yfiles.algorithms.YPoint;
+ /**
+ * This object.
+ * @see Specified by {@link yfiles.algorithms.IPlaneObject#boundingBox}.
+ */
+ boundingBox:yfiles.algorithms.YRectangle;
+ /**
+ * Checks whether or not this YRectangle contains the
+ * given point.
+ * @param {number} x the x-coordinate of the point to check.
+ * @param {number} y the x-coordinate of the point to check.
+ * @return {boolean}
+ * true if the point lies inside the rectangle;
+ * false otherwise.
+ */
+ containsPointDouble(x:number,y:number):boolean;
+ /**
+ * Checks whether or not this YRectangle contains the
+ * given point.
+ */
+ contains(p:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Checks whether or not this YRectangle contains the
+ * given rectangle.
+ */
+ containsRectangle(p:yfiles.algorithms.YRectangle):boolean;
+ /**
+ * Checks whether or not this YRectangle contains the
+ * rectangle defined by the given frame.
+ */
+ containsRectangleDouble(x:number,y:number,width:number,height:number):boolean;
+ /**
+ * Returns a string representation of this rectangle.
+ * @see Overrides {@link yfiles.algorithms.YDimension#toString}
+ */
+ toString():string;
+ /**
+ * @see Overrides {@link yfiles.algorithms.YDimension#hashCode}
+ */
+ hashCode():number;
+ /**
+ * @see Overrides {@link yfiles.algorithms.YDimension#equals}
+ */
+ equals(o:Object):boolean;
+ /**
+ * Compares this object to the given object of the same type.
+ * @param {Object} obj The object to compare this to.
+ * @return {number}
+ *
-1: this is less than obj
+ *
0: this is equal to obj
+ *
1: this is greater than obj
+ *
+ * @see Specified by {@link yfiles.lang.IObjectComparable#compareToObject}.
+ */
+ compareToObject(o:Object):number;
+ /**
+ * Creates a {@link yfiles.geometry.RectD} from a given {@link yfiles.algorithms.YRectangle}.
+ * This is a bridge method that delegates to {@link yfiles.algorithms.GeomExtensions#toRectD}.
+ * @return {yfiles.geometry.RectD} The {@link yfiles.geometry.RectD}.
+ */
+ toRectD():yfiles.geometry.RectD;
+ }
+ var YRectangle:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new rectangle with upper left corner (0,0) and size (0,0).
+ */
+ new ():yfiles.algorithms.YRectangle;
+ /**
+ * Creates a new rectangle with given upper left corner and size.
+ * @param {yfiles.algorithms.YPoint} pos upper left corner of the rectangle.
+ * @param {yfiles.algorithms.YDimension} size size of the rectangle.
+ */
+ FromPointAndSize:{
+ new (pos:yfiles.algorithms.YPoint,size:yfiles.algorithms.YDimension):yfiles.algorithms.YRectangle;
+ };
+ /**
+ * Creates a new rectangle with given upper left corner and size.
+ * @param {number} x x-coordinate of upper left corner of the rectangle.
+ * @param {number} y y-coordinate of upper left corner of the rectangle.
+ * @param {number} width width of the rectangle.
+ * @param {number} height height of the rectangle.
+ */
+ FromDouble:{
+ new (x:number,y:number,width:number,height:number):yfiles.algorithms.YRectangle;
+ };
+ /**
+ * Determines whether the specified rectangle contains the specified point.
+ * @param {number} rx the x-coordinate of the upper left corner of the rectangle.
+ * @param {number} ry the y-coordinate of the upper left corner of the rectangle.
+ * @param {number} rw the width of the rectangle.
+ * @param {number} rh the height of the rectangle.
+ * @param {number} x the x-coordinate of the point to check.
+ * @param {number} y the x-coordinate of the point to check.
+ * @return {boolean}
+ * true if the point lies inside the rectangle;
+ * false otherwise.
+ */
+ containsRectangleCoordinates(rx:number,ry:number,rw:number,rh:number,x:number,y:number):boolean;
+ /**
+ * Determines whether the specified rectangle contains the specified point.
+ * @param {number} rx the x-coordinate of the upper left corner of the rectangle.
+ * @param {number} ry the y-coordinate of the upper left corner of the rectangle.
+ * @param {number} rw the width of the rectangle.
+ * @param {number} rh the height of the rectangle.
+ * @param {number} x the x-coordinate of the point to check.
+ * @param {number} y the x-coordinate of the point to check.
+ * @param {boolean} closed
+ * if true, all points on the border of the
+ * rectangle are considered to be contained.
+ * @return {boolean}
+ * true if the point lies inside the rectangle;
+ * false otherwise.
+ */
+ containsRectangleCoordinatesWithBorder(rx:number,ry:number,rw:number,rh:number,x:number,y:number,closed:boolean):boolean;
+ /**
+ * Returns whether or not the given rectangles intersect.
+ */
+ intersects(r1:yfiles.algorithms.YRectangle,r2:yfiles.algorithms.YRectangle):boolean;
+ };
+ /**
+ * This class represents a vector in the 2-dimensional real vector space.
+ * This vector is an ordered 2 tuple and is defined by two doubles.
+ */
+ export interface YVector extends Object{
+ /**
+ * The first coordinate of the vector.
+ */
+ x:number;
+ /**
+ * The second coordinate of the vector.
+ */
+ y:number;
+ /**
+ * Assigns unit length to the vector.
+ * Postcondition: length() == 1.
+ */
+ norm():void;
+ /**
+ * Returns a new YVector instance that is obtained by rotating
+ * this vector by the given angle (measured in radians) in clockwise
+ * direction (with regards to screen coordinates).
+ * Screen coordinates mean positive x-direction is from left to right and
+ * positive y-direction is from top to bottom.
+ * @param {number} angle the angle of rotation in radians.
+ * @return {yfiles.algorithms.YVector} the rotated vector.
+ */
+ rotate(angle:number):yfiles.algorithms.YVector;
+ /**
+ * Adds a vector to this vector.
+ * @param {yfiles.algorithms.YVector} v the vector to add.
+ */
+ add(v:yfiles.algorithms.YVector):void;
+ /**
+ * Scales the vector by an factor.
+ * @param {number} factor the scale factor, with which the length is multiplied.
+ */
+ scale(factor:number):void;
+ /**
+ * Returns the length of the vector, this is the value of the euclidean norm.
+ * @return {number} a value > 0.
+ */
+ length():number;
+ /**
+ * Returns a string representation of this vector.
+ */
+ toString():string;
+ /**
+ * Creates a {@link yfiles.geometry.PointD} from a given {@link yfiles.algorithms.YVector}.
+ * This is a bridge method that delegates to {@link yfiles.algorithms.GeomExtensions#toPointDFromVector}.
+ * @return {yfiles.geometry.PointD} The {@link yfiles.geometry.PointD}.
+ */
+ toPointD():yfiles.geometry.PointD;
+ }
+ var YVector:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new vector with given direction.
+ * @param {number} dx the first coordinate
+ * @param {number} dy the second coordinate
+ */
+ FromOrigin:{
+ new (dx:number,dy:number):yfiles.algorithms.YVector;
+ };
+ /**
+ * Creates a new vector which is a copy of another vector.
+ * @param {yfiles.algorithms.YVector} v the vector, whose values are copied.
+ */
+ FromVector:{
+ new (v:yfiles.algorithms.YVector):yfiles.algorithms.YVector;
+ };
+ /**
+ * Creates a new vector, whose direction is given by two points.
+ * The vector is defined by p1 - p2.
+ * @param {yfiles.algorithms.YPoint} p1 the first point.
+ * @param {yfiles.algorithms.YPoint} p2 the second point.
+ */
+ FromPoints:{
+ new (p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):yfiles.algorithms.YVector;
+ };
+ /**
+ * Creates a new vector, whose direction is given by a point.
+ * The vector is defined by p1 - (0,0).
+ * @param {yfiles.algorithms.YPoint} p1 the point.
+ */
+ FromPoint:{
+ new (p1:yfiles.algorithms.YPoint):yfiles.algorithms.YVector;
+ };
+ /**
+ * Creates a new vector, whose direction is given by two points.
+ * The vector is defined by (x1 - x2, y1 - y2).
+ * @param {number} x1 the X-coordinate of the first point.
+ * @param {number} y1 the Y-coordinate of the first point.
+ * @param {number} x2 the X-coordinate of the second point.
+ * @param {number} y2 the Y-coordinate of the second point.
+ */
+ new (x1:number,y1:number,x2:number,y2:number):yfiles.algorithms.YVector;
+ /**
+ * Adds two vectors and returns the result.
+ * @param {yfiles.algorithms.YVector} v first vector to sum.
+ * @param {yfiles.algorithms.YVector} w second vector to sum.
+ * @return {yfiles.algorithms.YVector} v+w
+ */
+ addVectors(v:yfiles.algorithms.YVector,w:yfiles.algorithms.YVector):yfiles.algorithms.YVector;
+ /**
+ * Adds the vector to a point and returns the resulting point.
+ * @param {yfiles.algorithms.YPoint} p a point.
+ * @param {yfiles.algorithms.YVector} v the vector to add to the point.
+ * @return {yfiles.algorithms.YPoint} p+v
+ */
+ addPointToVector(p:yfiles.algorithms.YPoint,v:yfiles.algorithms.YVector):yfiles.algorithms.YPoint;
+ /**
+ * Returns true if vector v1 is on the right side of v2.
+ */
+ rightOf(v1:yfiles.algorithms.YVector,v2:yfiles.algorithms.YVector):boolean;
+ /**
+ * Returns this vector with unit length.
+ */
+ getNormal(v:yfiles.algorithms.YVector):yfiles.algorithms.YVector;
+ /**
+ * Returns the vector which is orthogonal to the given one and has unit
+ * length.
+ * @param {yfiles.algorithms.YVector} v a vector.
+ * @return {yfiles.algorithms.YVector} a vector which is orthogonal to v with unit length.
+ */
+ orthoNormal(v:yfiles.algorithms.YVector):yfiles.algorithms.YVector;
+ /**
+ * Returns the value of the scalar product of two vectors.
+ * @param {yfiles.algorithms.YVector} v1 the first vector.
+ * @param {yfiles.algorithms.YVector} v2 the second vector.
+ * @return {number} v1.x * v2.x + v1.y * v2.y
+ */
+ scalarProduct(v1:yfiles.algorithms.YVector,v2:yfiles.algorithms.YVector):number;
+ /**
+ * Returns the angle (measured in radians) between two vectors in
+ * clockwise order (with regards to screen coordinates) from v1 to v2.
+ * Screen coordinates mean positive x-direction is from left to right and
+ * positive y-direction is from top to bottom:
+ */
+ angle(v1:yfiles.algorithms.YVector,v2:yfiles.algorithms.YVector):number;
+ };
+ /**
+ * This class implements a directed graph structure.
+ * Basically, a directed graph consists of a set of objects called "nodes" (represented
+ * by instances of class {@link yfiles.algorithms.Node}) and a set of node pairs which are called
+ * "edges" (represented by instances of class {@link yfiles.algorithms.Edge}).
+ * The directed stems from the fact that all edges in the graph have direction,
+ * i.e., they have a distinct source node and a distinct target node.
+ * Using the aforementioned pair notation, an edge would be written as
+ * (<source node>, <target node>).
+ * Class Graph presents a proper data type that provides support for all essential
+ * operations like element creation, removal, access, and iteration.
+ * Important:
+ * Class Graph is the single authority for any structural changes to the graph data
+ * type.
+ * Specifically, this means that there is no way to create or delete a node or an
+ * edge without using an actual Graph instance.
+ * Furthermore, this class is also responsible for providing access to its elements.
+ * This is done by means of bidirectional cursors that present a read-only view
+ * on the node set (interface {@link yfiles.algorithms.INodeCursor}) and edge set (interface
+ * {@link yfiles.algorithms.IEdgeCursor}).
+ * Class Graph fires notification events that signal structural changes, like, e.g.,
+ * creation, removal, reinsertion, or modification of graph elements.
+ * Classes that implement the {@link yfiles.algorithms.IGraphListener} interface can be registered
+ * with this class using the {@link yfiles.algorithms.Graph#addGraphListener addGraphListener}
+ * method in order to receive such events.
+ * This class provides direct support for the notion of data accessors.
+ * It allows to register so-called data providers (implementations of interface
+ * {@link yfiles.algorithms.IDataProvider}) that hold arbitrary data which is associated to its nodes
+ * and/or edges.
+ * Also, it serves as a factory to create so-called maps ({@link yfiles.algorithms.INodeMap},
+ * {@link yfiles.algorithms.IEdgeMap}) that can be utilized to bind arbitrary data to nodes and edges.
+ * General Concepts in yFiles
+ * Working With the Graph Structure
+ */
+ export interface Graph extends Object,yfiles.algorithms.IGraphInterface{
+ /**
+ * The copy factory that is associated with this instance.
+ * The factory should be used by software that wants to create
+ * copies of this graph instance if it is in need of a factory.
+ * If no factory has been set, this method will initialize this instance's
+ * factory using factory method {@link yfiles.algorithms.Graph#createGraphCopyFactory}.
+ * @see {@link yfiles.algorithms.Graph#createGraphCopyFactory}
+ * @see {@link yfiles.algorithms.Graph#createGraphCopyFactory}
+ */
+ graphCopyFactory:yfiles.algorithms.GraphCopier.ICopyFactory;
+ /**
+ * Factory method that is called by {@link yfiles.algorithms.Graph#graphCopyFactory}
+ * to create a (possibly shared) instance.
+ * @return {yfiles.algorithms.GraphCopier.ICopyFactory} the (possibly shared) instance.
+ */
+ createGraphCopyFactory():yfiles.algorithms.GraphCopier.ICopyFactory;
+ /**
+ * Determines whether there are listeners registered with this instance.
+ */
+ hasListeners():boolean;
+ /**
+ * Creates a copy of this graph.
+ * Invokes .
+ * @return {yfiles.algorithms.Graph} The newly created Graph object.
+ */
+ createCopy():yfiles.algorithms.Graph;
+ /**
+ * Creates a new node in this graph and fires a corresponding notification event
+ * to inform registered listeners.
+ * @return {yfiles.algorithms.Node} The newly created Node object.
+ */
+ createNode():yfiles.algorithms.Node;
+ /**
+ * Creates a new edge in this graph and fires a corresponding notification event
+ * to inform registered listeners.
+ * The new edge has source node v and target node w,
+ * i.e., would be written as edge e = (v, w).
+ * The edge is appended to the lists of incoming and outgoing edges at the source
+ * node and target node, respectively.
+ * @param {yfiles.algorithms.Node} v The source node of the edge.
+ * @param {yfiles.algorithms.Node} w The target node of the edge.
+ * @return {yfiles.algorithms.Edge} The newly created Edge object.
+ */
+ createEdgeBetween(v:yfiles.algorithms.Node,w:yfiles.algorithms.Node):yfiles.algorithms.Edge;
+ /**
+ * Creates a new edge in this graph to be ordered before or after a given edge
+ * and fires a corresponding notification event to inform registered listeners.
+ * The new edge e has source node v and target node
+ * w, i.e., would be written as edge e = (v, w).
+ * Edge e is inserted in such a way that an iteration over the edges
+ * at node v returns e
+ *
+ *
+ * after e1, if d1 == AFTER
+ *
+ *
+ * before e1, if d1 == BEFORE,
+ *
+ *
+ * and an iteration over the edges at w returns e
+ *
+ *
+ * after e2, if d2 == AFTER
+ *
+ *
+ * before e2, if d2 == BEFORE.
+ *
+ *
+ * Precondition:
+ * Edge e1 must have source node v
+ * and
+ * edge e2 must have target node w.
+ * @param {yfiles.algorithms.Node} v The source node of the edge.
+ * @param {yfiles.algorithms.Edge} e1 An edge with source node v.
+ * @param {yfiles.algorithms.Node} w The target node of the edge.
+ * @param {yfiles.algorithms.Edge} e2 An edge with target node w.
+ * @param {yfiles.algorithms.GraphElementInsertion} d1
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ * @param {yfiles.algorithms.GraphElementInsertion} d2
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ * @return {yfiles.algorithms.Edge} The newly created Edge object.
+ */
+ createEdgeWithGraphElementInsertion(v:yfiles.algorithms.Node,e1:yfiles.algorithms.Edge,w:yfiles.algorithms.Node,e2:yfiles.algorithms.Edge,d1:yfiles.algorithms.GraphElementInsertion,d2:yfiles.algorithms.GraphElementInsertion):yfiles.algorithms.Edge;
+ /**
+ * Removes the given node from this graph.
+ * All edges connecting to the given node are removed as well (preceding the actual
+ * node removal).
+ * Corresponding notification events are fired to inform registered listeners.
+ * The node will be deselected before it gets removed.
+ * @param {yfiles.algorithms.Node} v The node to be removed from this graph.
+ */
+ removeNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Removes the given edge from this graph and fires a corresponding notification
+ * event to inform registered listeners.
+ * The edge will be deselected before it gets removed.
+ * @param {yfiles.algorithms.Edge} e The edge to be removed.
+ */
+ removeEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Reinserts a formerly removed node into this graph and fires a corresponding
+ * notification event to inform registered listeners.
+ * The reinserted node is appended to the sequence of nodes in this graph, i.e.,
+ * normally, its new position does not match the position before its removal.
+ * @param {yfiles.algorithms.Node} v The node to be reinserted.
+ * @see {@link yfiles.algorithms.Graph#removeNode}
+ */
+ reInsertNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Reinserts a formerly removed edge into this graph and fires a corresponding
+ * notification event to inform registered listeners.
+ * The reinserted edge is appended to the sequence of edges in this graph, i.e.,
+ * normally, its new position does not match the position before its removal.
+ * The same holds for the edge's positions in the list of incoming and outgoing
+ * edges at its source node and target node, respectively.
+ * @param {yfiles.algorithms.Edge} e The edge to be reinserted.
+ * @see {@link yfiles.algorithms.Graph#removeEdge}
+ */
+ reInsertEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Redefines an edge's end points and fires corresponding notification events
+ * to inform registered listeners.
+ * Edge e has
+ * source node v := e1.source()
+ * and
+ * target node w := e2.target().
+ * Edge e is inserted in such a way that an iteration over the edges
+ * at v returns e
+ *
+ *
+ * after e1, if d1 == AFTER
+ *
+ *
+ * before e1, if d1 == BEFORE,
+ *
+ *
+ * and an iteration over the edges at w returns e
+ *
+ *
+ * after e2, if d2 == AFTER
+ *
+ *
+ * before e2, if d2 == BEFORE.
+ *
+ *
+ * Precondition:
+ * Edges e, e1, and e2 must belong to this
+ * graph.
+ * @param {yfiles.algorithms.Edge} e The edge to be changed.
+ * @param {yfiles.algorithms.Edge} e1 Reference edge for insertion at a new source node.
+ * @param {yfiles.algorithms.Edge} e2 Reference edge for insertion at a new target node.
+ * @param {yfiles.algorithms.GraphElementInsertion} d1
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ * @param {yfiles.algorithms.GraphElementInsertion} d2
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ */
+ changeEdgeWithReferences(e:yfiles.algorithms.Edge,e1:yfiles.algorithms.Edge,e2:yfiles.algorithms.Edge,d1:yfiles.algorithms.GraphElementInsertion,d2:yfiles.algorithms.GraphElementInsertion):void;
+ /**
+ * Redefines an edge's end points and fires corresponding notification events
+ * to inform registered listeners.
+ * Edge e has
+ * source node v := sourceReference.source() or v := newSource,
+ * if sourceReference == null
+ * and
+ * target node w := targetReference.target() or w := newTarget,
+ * if targetReference == null.
+ * Edge e is inserted in such a way that an iteration over the edges
+ * at v returns e
+ *
+ *
+ * after sourceReference, if sourceD == AFTER
+ *
+ *
+ * before sourceReference, if sourceD == BEFORE,
+ *
+ *
+ * and an iteration over the edges at w returns e
+ *
+ *
+ * after targetReference, if targetD == AFTER
+ *
+ *
+ * before targetReference, if targetD == BEFORE.
+ *
+ *
+ * Precondition:
+ * Edge e must belong to this graph.
+ * Also, either sourceReference or newSource must be
+ * non-null and belong to this graph, and either targetReference
+ * or newTarget must be non-null and belong to this graph.
+ * @param {yfiles.algorithms.Edge} e The edge to be changed.
+ * @param {yfiles.algorithms.Node} newSource The new source node.
+ * @param {yfiles.algorithms.Edge} sourceReference Reference edge for insertion at the new source node.
+ * @param {yfiles.algorithms.GraphElementInsertion} sourceD
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ * @param {yfiles.algorithms.Node} newTarget The new target node.
+ * @param {yfiles.algorithms.Edge} targetReference Reference edge for insertion at the new target node.
+ * @param {yfiles.algorithms.GraphElementInsertion} targetD
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ */
+ changeEdgeWithReference(e:yfiles.algorithms.Edge,newSource:yfiles.algorithms.Node,sourceReference:yfiles.algorithms.Edge,sourceD:yfiles.algorithms.GraphElementInsertion,newTarget:yfiles.algorithms.Node,targetReference:yfiles.algorithms.Edge,targetD:yfiles.algorithms.GraphElementInsertion):void;
+ /**
+ * Redefines an edge's end points and fires corresponding notification events
+ * to inform registered listeners.
+ * The edge is appended to the lists of incoming and outgoing edges at the given
+ * source node and target node, respectively.
+ * Precondition:newSource and newTarget must belong to this graph.
+ * @param {yfiles.algorithms.Edge} e The edge to be changed.
+ * @param {yfiles.algorithms.Node} newSource The new source node of the given edge.
+ * @param {yfiles.algorithms.Node} newTarget The new target node of the given edge.
+ */
+ changeEdge(e:yfiles.algorithms.Edge,newSource:yfiles.algorithms.Node,newTarget:yfiles.algorithms.Node):void;
+ /**
+ * Reverses the given edge and fires corresponding notification events to inform
+ * registered listeners.
+ * This operation exchanges source and target node of the edge.
+ */
+ reverseEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Hides the given edge from this graph.
+ * Hiding an edge means to (temporarily) remove the edge from the graph.
+ * The only difference to a proper edge removal as performed by {@link yfiles.algorithms.Graph#removeEdge}
+ * is that no {@link yfiles.algorithms.GraphEvent} will be emitted that signals the structural change
+ * (i.e. the edge's removal).
+ * Generally, hiding should only be used in the sense of temporarily removing
+ * an object that will be reinserted shortly after.
+ * To reinsert a hidden edge use {@link yfiles.algorithms.Graph#unhideEdge}.
+ * @see {@link yfiles.algorithms.Graph#hideNode}
+ * @see {@link yfiles.algorithms.Graph#unhideNode}
+ */
+ hideEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Unhides the given edge in this graph.
+ * Unhiding an edge means to reinsert an edge that was formerly hidden from this
+ * graph by a call to {@link yfiles.algorithms.Graph#hideEdge}.
+ * The only difference to a proper edge reinsertion as performed by {@link yfiles.algorithms.Graph#reInsertEdge}
+ * is that no {@link yfiles.algorithms.GraphEvent} will be emitted that signals the structural change
+ * (i.e. the edge's reinsertion).
+ * @see {@link yfiles.algorithms.Graph#hideNode}
+ * @see {@link yfiles.algorithms.Graph#unhideNode}
+ */
+ unhideEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Hides the given node from this graph.
+ * Hiding a node means to (temporarily) remove the node from the graph.
+ * The only difference to a proper node removal as performed by {@link yfiles.algorithms.Graph#removeNode}
+ * is that no {@link yfiles.algorithms.GraphEvent} will be emitted that signals the structural change
+ * (i.e. the node's removal).
+ * Generally, hiding should only be used in the sense of temporarily removing
+ * an object that will be reinserted shortly after.
+ * To reinsert a hidden node use {@link yfiles.algorithms.Graph#unhideNode}.
+ * @see {@link yfiles.algorithms.Graph#hideEdge}
+ * @see {@link yfiles.algorithms.Graph#unhideEdge}
+ */
+ hideNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Unhides the given node in this graph.
+ * Unhiding a node means to reinsert a node that was formerly hidden from this
+ * graph by a call to {@link yfiles.algorithms.Graph#hideNode}.
+ * The only difference to a proper node reinsertion as performed by {@link yfiles.algorithms.Graph#reInsertNode}
+ * is that no {@link yfiles.algorithms.GraphEvent} will be emitted that signals the structural change
+ * (i.e. the node's reinsertion).
+ */
+ unhideNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Moves the given node to the last position within the sequence of nodes in this
+ * graph.
+ */
+ moveToLastNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Moves the given node to the first position within the sequence of nodes in
+ * this graph.
+ */
+ moveToFirstNode(v:yfiles.algorithms.Node):void;
+ /**
+ * Moves the given edge to the last position within the sequence of edges in this
+ * graph.
+ */
+ moveToLastEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * Moves the given edge to the first position within the sequence of edges in
+ * this graph.
+ */
+ moveToFirstEdge(e:yfiles.algorithms.Edge):void;
+ /**
+ * The number of nodes in this graph.
+ * Same as {@link yfiles.algorithms.Graph#nodeCount}.
+ */
+ n:number;
+ /**
+ * The number of nodes in this graph.
+ */
+ nodeCount:number;
+ /**
+ * The number of edges in this graph.
+ * Same as {@link yfiles.algorithms.Graph#edgeCount}.
+ */
+ e:number;
+ /**
+ * The number of edges in this graph.
+ */
+ edgeCount:number;
+ /**
+ * true if this graph contains no nodes.
+ */
+ empty:boolean;
+ /**
+ * Removes all nodes and edges from this graph and fires corresponding notification
+ * events to inform registered listeners.
+ */
+ clear():void;
+ /**
+ * Whether or not this graph contains the given node.
+ */
+ containsNode(v:yfiles.algorithms.Node):boolean;
+ /**
+ * Whether or not this graph contains the given edge.
+ */
+ containsEdge(e:yfiles.algorithms.Edge):boolean;
+ /**
+ * Returns whether or not this graph contains an edge that connects the given
+ * nodes.
+ * @param {yfiles.algorithms.Node} source The source node.
+ * @param {yfiles.algorithms.Node} target The target node.
+ * @see {@link yfiles.algorithms.Node#getEdgeTo}
+ * @see {@link yfiles.algorithms.Node#getEdgeFrom}
+ * @see {@link yfiles.algorithms.Node#getEdge}
+ */
+ containsEdgeBetweenNodes(source:yfiles.algorithms.Node,target:yfiles.algorithms.Node):boolean;
+ /**
+ * The first node in this graph.
+ * Precondition:!isEmpty()
+ */
+ firstNode:yfiles.algorithms.Node;
+ /**
+ * The first edge in this graph.
+ * Precondition:edgeCount() > 0
+ */
+ firstEdge:yfiles.algorithms.Edge;
+ /**
+ * The last node in this graph.
+ * Precondition:!isEmpty()
+ */
+ lastNode:yfiles.algorithms.Node;
+ /**
+ * The last edge in this graph.
+ * Precondition:edgeCount() > 0
+ */
+ lastEdge:yfiles.algorithms.Edge;
+ /**
+ * Returns an array containing all nodes of this graph.
+ */
+ getNodeArray():yfiles.algorithms.Node[];
+ /**
+ * Returns an array containing all edges of this graph.
+ */
+ getEdgeArray():yfiles.algorithms.Edge[];
+ /**
+ * Provides access to the nodes of the graph.
+ * @return {yfiles.algorithms.INodeCursor} A NodeCursor to iterate over the nodes in the graph.
+ */
+ getNodeCursor():yfiles.algorithms.INodeCursor;
+ /**
+ * Provides access to the edges of the graph.
+ * @return {yfiles.algorithms.IEdgeCursor} An EdgeCursor to iterate over the edges in the graph.
+ */
+ getEdgeCursor():yfiles.algorithms.IEdgeCursor;
+ /**
+ * Moves an induced subgraph to another graph.
+ * Precondition: The nodes in subNodes must belong to this graph.
+ * @param {yfiles.algorithms.NodeList} subNodes A list of nodes that induce the subgraph to be moved.
+ * @param {yfiles.algorithms.Graph} targetGraph The graph where the subgraph is moved to.
+ * @return {yfiles.algorithms.EdgeList} A list of removed edges that connected the induced subgraph to this graph.
+ */
+ moveSubGraph(subNodes:yfiles.algorithms.NodeList,targetGraph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Creates an empty base object of the same type as this graph.
+ * Subclasses should override this method.
+ */
+ createGraph():yfiles.algorithms.Graph;
+ /**
+ * Sorts the internally held list of edges.
+ * If the given comparator is null, then the edges will not be sorted.
+ * This list determines the order of the edges as returned by {@link yfiles.algorithms.Graph#getEdgeCursor}.
+ * @param {yfiles.objectcollections.IComparer} comp The comparator used for the edges.
+ */
+ sortEdges(comp:yfiles.objectcollections.IComparer):void;
+ /**
+ * Sorts the internally held list of nodes.
+ * If the given comparator is null, then the nodes will not be sorted.
+ * This list determines the order of the nodes as returned by {@link yfiles.algorithms.Graph#getNodeCursor}.
+ * @param {yfiles.objectcollections.IComparer} comp The comparator used for the nodes.
+ */
+ sortNodes(comp:yfiles.objectcollections.IComparer):void;
+ /**
+ * Sorts incoming and outgoing edges at each node of the graph.
+ * If a given comparator is null, then the corresponding edges (i.e.,
+ * incoming/outgoing) will not be sorted.
+ * This sorts the order of the edges as returned by {@link yfiles.algorithms.Node#getOutEdgeCursor}
+ * and {@link yfiles.algorithms.Node#getInEdgeCursor} respectively.
+ * @param {yfiles.objectcollections.IComparer} inComp The comparator used for the incoming edges at each node.
+ * @param {yfiles.objectcollections.IComparer} outComp The comparator used for the outgoing edges at each node.
+ */
+ sortEdgesInAndOut(inComp:yfiles.objectcollections.IComparer,outComp:yfiles.objectcollections.IComparer):void;
+ /**
+ * Registers the given graph listener with this graph.
+ * The listener will receive graph events that signal structural changes occurring
+ * within this graph.
+ * @see {@link yfiles.algorithms.GraphEvent}
+ */
+ addGraphListener(listener:yfiles.algorithms.IGraphListener):void;
+ /**
+ * Removes the given graph listener from this graph.
+ */
+ removeGraphListener(listener:yfiles.algorithms.IGraphListener):void;
+ /**
+ * An iterator that grants access to all registered graph listeners.
+ */
+ graphListeners:yfiles.algorithms.IIterator;
+ /**
+ * Propagates a so-called PRE event to all registered graph listeners.
+ * This method should only be used if a corresponding call to {@link yfiles.algorithms.Graph#firePostEvent}
+ * follows.
+ * Generally, PRE and POST events serve as a means to bracket a sequence of graph
+ * events.
+ * @see {@link yfiles.algorithms.IGraphListener}
+ */
+ firePreEvent():void;
+ /**
+ * Like {@link yfiles.algorithms.Graph#firePreEvent}.
+ * Additionally, an event ID may be specified.
+ * @param {Object} id An identifying tag for the event.
+ * @see {@link yfiles.algorithms.IGraphListener}
+ */
+ firePreEventWithId(id:Object):void;
+ /**
+ * Propagates a so-called POST event to all registered graph listeners.
+ * This method should only be used if a corresponding call to {@link yfiles.algorithms.Graph#firePreEvent}
+ * was made.
+ * Generally, PRE and POST events serve as a means to bracket a sequence of graph
+ * events.
+ * @see {@link yfiles.algorithms.IGraphListener}
+ */
+ firePostEvent():void;
+ /**
+ * Like {@link yfiles.algorithms.Graph#firePostEvent}.
+ * Additionally, an event ID may be specified.
+ * @param {Object} id An identifying tag for the event.
+ * @see {@link yfiles.algorithms.IGraphListener}
+ */
+ firePostEventWithId(id:Object):void;
+ /**
+ * Propagates the given graph event to all registered graph listeners.
+ */
+ fireGraphEvent(e:yfiles.algorithms.GraphEvent):void;
+ /**
+ * Returns a newly created node map that is valid for the nodes in this graph.
+ * The implementation returned by this method can be used for any node that is
+ * part of this Graph instance at any point of time, i.e., it is safe to modify
+ * the graph structure (add and remove nodes and edges) freely.
+ * The implementation returned uses O(n) memory at all times and
+ * provides true O(1) read and write access for each node.
+ * In order to release the resources held by this map, {@link yfiles.algorithms.Graph#disposeNodeMap}
+ * has to be called.
+ */
+ createNodeMap():yfiles.algorithms.INodeMap;
+ /**
+ * Returns a newly created edge map that is valid for the edges in this graph.
+ * The implementation returned by this method can be used for any edge that is
+ * part of this Graph instance at any point of time, i.e., it is safe to modify
+ * the graph structure (add and remove nodes and edges) freely.
+ * The implementation returned uses O(m) memory at all times and
+ * provides true O(1) read and write access for each edge.
+ * In order to release the resources held by this map, {@link yfiles.algorithms.Graph#disposeEdgeMap}
+ * has to be called.
+ */
+ createEdgeMap():yfiles.algorithms.IEdgeMap;
+ /**
+ * Informs the graph that the given node map is no longer needed.
+ * This method is used for NodeMap implementations that have been obtained using
+ * the {@link yfiles.algorithms.Graph#createNodeMap} factory method.
+ * Calling this method will destroy the node map and associated resources can
+ * be freed.
+ * It is strongly recommended to dispose of all node maps that are not needed
+ * anymore using this method.
+ */
+ disposeNodeMap(map:yfiles.algorithms.INodeMap):void;
+ /**
+ * Informs the graph that the given edge map is no longer needed.
+ * This method is used for EdgeMap implementations that have been obtained using
+ * the {@link yfiles.algorithms.Graph#createEdgeMap} factory method.
+ * Calling this method will destroy the edge map and associated resources can
+ * be freed.
+ * It is strongly recommended to dispose of all edge maps that are not needed
+ * anymore using this method.
+ */
+ disposeEdgeMap(map:yfiles.algorithms.IEdgeMap):void;
+ /**
+ * All node maps that have been created by this graph but have not yet
+ * been disposed.
+ * @see {@link yfiles.algorithms.Graph#createNodeMap}
+ * @see {@link yfiles.algorithms.Graph#disposeNodeMap}
+ */
+ registeredNodeMaps:yfiles.algorithms.INodeMap[];
+ /**
+ * All edge maps that have been created by this graph but have not yet
+ * been disposed.
+ * @see {@link yfiles.algorithms.Graph#createEdgeMap}
+ * @see {@link yfiles.algorithms.Graph#disposeEdgeMap}
+ */
+ registeredEdgeMaps:yfiles.algorithms.IEdgeMap[];
+ /**
+ * Returns the source node associated with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#getSource}.
+ */
+ getSource(edge:Object):Object;
+ /**
+ * Returns the target node associated with the given edge.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#getTarget}.
+ */
+ getTarget(edge:Object):Object;
+ /**
+ * Returns an iterator that provides access to all nodes residing in this graph.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#nodeObjects}.
+ */
+ nodeObjects():yfiles.algorithms.IIterator;
+ /**
+ * Returns an iterator that provides access to all edges residing in this graph.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#edgeObjects}.
+ */
+ edgeObjects():yfiles.algorithms.IIterator;
+ /**
+ * Returns the data provider that is registered with the graph using the given
+ * look-up key.
+ * The look-up domain of a returned data provider normally consists of either
+ * the nodes of the graph, or its edges, or both.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#getDataProvider}.
+ */
+ getDataProvider(providerKey:Object):yfiles.algorithms.IDataProvider;
+ /**
+ * Registers the given data provider using the given look-up key.
+ * If there is already a data provider registered with that key, then it will
+ * be overwritten with the new one.
+ */
+ addDataProvider(providerKey:Object,data:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Removes the data provider that is registered using the given look-up key.
+ */
+ removeDataProvider(providerKey:Object):void;
+ /**
+ * An array of all data provider look-up keys that are registered with
+ * this graph.
+ * @see Specified by {@link yfiles.algorithms.IGraphInterface#dataProviderKeys}.
+ */
+ dataProviderKeys:Object[];
+ /**
+ * For internal debugging purposes only.
+ */
+ printNodeSlotSize():void;
+ /**
+ * Returns a String representation of this graph.
+ * The result contains the String representations of all nodes followed by the
+ * String representations of all edges.
+ */
+ toString():string;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Node}s that can be used to iterate over the nodes that are contained in this instance.
+ * This is a live enumerable and will thus reflect the current state of the graph.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ */
+ nodes:yfiles.collections.IEnumerable;
+ /**
+ * Yields a dynamic {@link yfiles.collections.IEnumerable}
+ * for {@link yfiles.algorithms.Edge}s that can be used to iterate over the edges that are contained in this instance.
+ * This is a live enumerable and will thus reflect the current state of the graph.
+ * Note that changes to the graph structure during the traversal should be carried out with great care.
+ */
+ edges:yfiles.collections.IEnumerable;
+ }
+ var Graph:{
+ $class:yfiles.lang.Class;
+ /**
+ * Instantiates an empty Graph object.
+ */
+ new ():yfiles.algorithms.Graph;
+ /**
+ * Instantiates a new Graph object as a copy of the given graph.
+ * Values bound to the argument graph via node and edge keys are available in
+ * the new Graph instance with the keys registered with argGraph.
+ * Only references to these values are copied.
+ * The new Graph instance also inherits all graph listeners registered with the
+ * given graph.
+ * This constructor does not use a {@link yfiles.algorithms.GraphCopier}.
+ * @param {yfiles.algorithms.Graph} argGraph The graph to be copied.
+ */
+ FromOther:{
+ new (argGraph:yfiles.algorithms.Graph):yfiles.algorithms.Graph;
+ };
+ /**
+ * Instantiates a new Graph object as a partial copy of the given graph.
+ * Only the subgraph induced by the given cursor will be copied to the new Graph
+ * instance.
+ * Values bound to the argument graph via node and edge keys are available in
+ * the new Graph instance with the keys registered with graph.
+ * Only references to these values are copied.
+ * The new Graph instance also inherits all graph listeners registered with the
+ * given graph.
+ * This constructor does not use a {@link yfiles.algorithms.GraphCopier}.
+ * @param {yfiles.algorithms.Graph} graph The graph to be (partially) copied.
+ * @param {yfiles.algorithms.ICursor} subNodes
+ * A cursor to iterate over the nodes that actually induce the subgraph to be
+ * copied.
+ */
+ FromSubset:{
+ new (graph:yfiles.algorithms.Graph,subNodes:yfiles.algorithms.ICursor):yfiles.algorithms.Graph;
+ };
+ /**
+ * Low-level iteration support for adjacent edges.
+ */
+ firstOutEdge(v:yfiles.algorithms.Node):yfiles.algorithms.Edge;
+ };
+ /**
+ * This class represents an ordered list of points in the plane.
+ */
+ export interface YPointPath extends Object{
+ /**
+ * Get the points in the path.
+ */
+ cursor():yfiles.algorithms.ICursor;
+ /**
+ * Get the points in the path.
+ */
+ points():yfiles.algorithms.IPointCursor;
+ /**
+ * Get the points in the path.
+ */
+ iterator():yfiles.algorithms.IIterator;
+ /**
+ * The first point in the path.
+ */
+ first:yfiles.algorithms.YPoint;
+ /**
+ * The last point in the path.
+ */
+ last:yfiles.algorithms.YPoint;
+ /**
+ * Get the points in the path as list.
+ * @return {yfiles.algorithms.IList}
+ * a list of {@link yfiles.algorithms.YPoint} instances.
+ */
+ toList():yfiles.algorithms.IList;
+ /**
+ * Get the points in the list as array.
+ */
+ toArray():yfiles.algorithms.YPoint[];
+ /**
+ * Create a point path with reverse ordering of the points.
+ */
+ createReverse():yfiles.algorithms.YPointPath;
+ /**
+ * Get the number of points in the path.
+ */
+ length():number;
+ /**
+ * The number of line segments in the path.
+ */
+ lineSegmentCount:number;
+ /**
+ * Get the points in the path.
+ */
+ lineSegments():yfiles.algorithms.ILineSegmentCursor;
+ /**
+ * Returns a line segment in the path.
+ */
+ getLineSegment(i:number):yfiles.algorithms.LineSegment;
+ toString():string;
+ /**
+ * Calculate the (geometric) length of the path.
+ * The length of the path is the sum of lengths of all line segments making
+ * up the path.
+ * @return {number} the (geometric) length of the path
+ */
+ calculateLength():number;
+ }
+ var YPointPath:{
+ $class:yfiles.lang.Class;
+ /**
+ * Defines a path with no points.
+ */
+ EMPTY_PATH:yfiles.algorithms.YPointPath;
+ /**
+ * Creates a new empty path.
+ */
+ new ():yfiles.algorithms.YPointPath;
+ /**
+ * Creates a new path from a list of points.
+ * @param {yfiles.algorithms.IList} l
+ * a list of {@link yfiles.algorithms.YPoint} instances.
+ */
+ FromList:{
+ new (l:yfiles.algorithms.IList):yfiles.algorithms.YPointPath;
+ };
+ /**
+ * Creates a new path from an array of points.
+ */
+ FromPoints:{
+ new (path:yfiles.algorithms.YPoint[]):yfiles.algorithms.YPointPath;
+ };
+ };
+ /**
+ * This class represents the size of an object.
+ * An instance of this class implements the immutable design pattern.
+ */
+ export interface YDimension extends Object,yfiles.lang.IObjectComparable{
+ /**
+ * The width of the dimension object.
+ */
+ width:number;
+ /**
+ * The height of the dimension object.
+ */
+ height:number;
+ /**
+ * Tests a dimension to equality to another dimension.
+ */
+ equals(o:Object):boolean;
+ hashCode():number;
+ /**
+ * Returns the size in the form: "W: width H: height"
+ */
+ toString():string;
+ /**
+ * Compares this object to the given object of the same type.
+ * @param {Object} obj The object to compare this to.
+ * @return {number}
+ *
-1: this is less than obj
+ *
0: this is equal to obj
+ *
1: this is greater than obj
+ *
+ * @see Specified by {@link yfiles.lang.IObjectComparable#compareToObject}.
+ */
+ compareToObject(o:Object):number;
+ /**
+ * Creates a {@link yfiles.geometry.SizeD} from a given {@link yfiles.algorithms.YDimension}.
+ * This is a bridge method that delegates to {@link yfiles.algorithms.GeomExtensions#toSizeD}.
+ * @return {yfiles.geometry.SizeD} The {@link yfiles.geometry.SizeD}.
+ */
+ toSizeD():yfiles.geometry.SizeD;
+ }
+ var YDimension:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new YDimension2D object for given size.
+ */
+ new (width:number,height:number):yfiles.algorithms.YDimension;
+ };
+ /**
+ * An oriented rectangle in 2D coordinate space with double precision
+ * coordinates.
+ * The rectangle's height extends from its
+ * {@link yfiles.algorithms.YOrientedRectangle#anchor anchor point} in the direction of its up
+ * vector ({@link yfiles.algorithms.YOrientedRectangle#upX ux}, {@link yfiles.algorithms.YOrientedRectangle#upY uy}).
+ * Its width extends from its
+ * {@link yfiles.algorithms.YOrientedRectangle#anchor anchor point} in direction
+ * (-uy, ux) (i.e. perpendicular to the up vector).
+ * This means that an oriented rectangle with anchor point (0, 0)
+ * width 100, height 10, and up vector
+ * (0, -1) is a paraxial rectangle with upper left corner
+ * (0, -10) and lower right corner (100, 0).
+ */
+ export interface YOrientedRectangle extends Object,yfiles.algorithms.IPlaneObject{
+ /**
+ * Specifies whether this instance has negative width or height.
+ */
+ empty:boolean;
+ /**
+ * The anchor of this oriented rectangle.
+ */
+ anchor:yfiles.algorithms.YPoint;
+ /**
+ * Sets the anchor of this rectangle.
+ * @param {number} x the new x-coordinate of the anchor point.
+ * @param {number} y the new y-coordinate of the anchor point.
+ */
+ setAnchor(x:number,y:number):void;
+ /**
+ * The x-coordinate of this rectangle's anchor point.
+ */
+ anchorX:number;
+ /**
+ * The y-coordinate of this rectangle's anchor point.
+ */
+ anchorY:number;
+ /**
+ * The size of this rectangle.
+ */
+ size:yfiles.algorithms.YDimension;
+ /**
+ * Sets the size of this rectangle.
+ * @param {number} width the new width.
+ * @param {number} height the new height.
+ */
+ setSize(width:number,height:number):void;
+ /**
+ * The width of this rectangle.
+ */
+ width:number;
+ /**
+ * The height of this rectangle.
+ */
+ height:number;
+ /**
+ * Sets the components of the up vector to the new values.
+ * @param {number} upX The x component of the normalized up vector.
+ * @param {number} upY The y component of the normalized up vector.
+ */
+ setUpVector(upX:number,upY:number):void;
+ /**
+ * The x-component of this rectangle's up vector.
+ */
+ upX:number;
+ /**
+ * The y-component of this rectangle's up vector.
+ */
+ upY:number;
+ /**
+ * The angle (measured in radians) of this rectangle.
+ * The angle of an oriented rectangle is the angle between the vector
+ * (0, -1) and the rectangle's up vector in counter clockwise
+ * order.
+ * An angle of 0 means the up vector points up in direction (0, -1).
+ */
+ angle:number;
+ /**
+ * Moves this rectangle by applying the offset to the anchor.
+ * @param {number} dx The x offset to move the rectangle's position by.
+ * @param {number} dy The y offset to move the rectangle's position by.
+ */
+ moveBy(dx:number,dy:number):void;
+ /**
+ * The current center of the oriented rectangle.
+ */
+ center:yfiles.algorithms.YPoint;
+ /**
+ * Sets the anchor of the OrientedRectangle so that the center of the
+ * rectangle coincides with the given coordinate pair.
+ * @param {number} cx The x coordinate of the center.
+ * @param {number} cy The y coordinate of the center.
+ */
+ setCenter(cx:number,cy:number):void;
+ /**
+ * Calculates the paraxial bounding box of this oriented rectangle.
+ * @see Specified by {@link yfiles.algorithms.IPlaneObject#boundingBox}.
+ */
+ boundingBox:yfiles.algorithms.YRectangle;
+ /**
+ * Determines whether or not the specified point lies inside this oriented
+ * rectangle.
+ * @param {number} x the x-coordinate of the point to check.
+ * @param {number} y the y-coordinate of the point to check.
+ * @return {boolean}
+ * true iff the specified point lies inside;
+ * false otherwise.
+ */
+ containsPoint(x:number,y:number):boolean;
+ /**
+ * Determines whether or not the specified point lies inside this oriented
+ * rectangle.
+ * @param {number} x the x-coordinate of the point to check.
+ * @param {number} y the y-coordinate of the point to check.
+ * @param {boolean} closed
+ * if true, all points on the border of the
+ * rectangle are considered to be contained.
+ * @return {boolean}
+ * true iff the specified point lies inside;
+ * false otherwise.
+ */
+ containsPointWithBorder(x:number,y:number,closed:boolean):boolean;
+ toString():string;
+ equals(o:Object):boolean;
+ hashCode():number;
+ /**
+ * Creates a new OrientedRectangle instance whose anchor point
+ * is moved by the specified distance values, but has the same width, height,
+ * and up vector as this rectangle.
+ * @param {number} dx
+ * the distance to move the anchor point in x-direction. A positive
+ * value means "move" to the right, a negative value means "move" to the left.
+ * @param {number} dy
+ * the distance to move the anchor point in y-direction. A positive
+ * value means "move" downwards, a negative value means "move" upwards.
+ * @return {yfiles.algorithms.YOrientedRectangle}
+ * a new OrientedRectangle instance whose anchor point
+ * is moved by the specified distance values.
+ */
+ getMovedInstance(dx:number,dy:number):yfiles.algorithms.YOrientedRectangle;
+ /**
+ * Creates a new OrientedRectangle instance that has the
+ * specified width and height, but has the same anchor point and up vector
+ * as this rectangle.
+ * @param {number} width the width of the new rectangle.
+ * @param {number} height the height of the new rectangle.
+ * @return {yfiles.algorithms.YOrientedRectangle}
+ * a new OrientedRectangle instance that has the
+ * specified width and height.
+ */
+ getResizedInstance(width:number,height:number):yfiles.algorithms.YOrientedRectangle;
+ /**
+ * Copies the actual values from the given OrientedRectangle to this instance.
+ * @param {yfiles.algorithms.YOrientedRectangle} other the OrientedRectangle to retrieve the values from
+ */
+ adoptValues(other:yfiles.algorithms.YOrientedRectangle):void;
+ /**
+ * Creates an immutable {@link yfiles.geometry.IOrientedRectangle} from a given {@link yfiles.algorithms.YOrientedRectangle}.
+ * This is a bridge method that delegates to {@link yfiles.algorithms.GeomExtensions#toImmutableOrientedRectangle}.
+ * @return {yfiles.geometry.IOrientedRectangle} The {@link yfiles.geometry.IOrientedRectangle}.
+ */
+ toImmutableOrientedRectangle():yfiles.geometry.IOrientedRectangle;
+ }
+ var YOrientedRectangle:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new instance using the provided rectangle's values to initialize
+ * anchor and size.
+ * The oriented rectangle's up vector will be
+ * (0, -1).
+ * @param {yfiles.algorithms.YRectangle} rect the provided rectangle.
+ */
+ FromRect:{
+ new (rect:yfiles.algorithms.YRectangle):yfiles.algorithms.YOrientedRectangle;
+ };
+ /**
+ * Creates a new instance using the provided rectangle's values to initialize
+ * anchor, size, and up vector.
+ * @param {yfiles.algorithms.YOrientedRectangle} rect the provided rectangle.
+ */
+ YOrientedRectangle:{
+ new (rect:yfiles.algorithms.YOrientedRectangle):yfiles.algorithms.YOrientedRectangle;
+ };
+ /**
+ * Creates a new instance using the provided values to initialize the anchor and size.
+ * The oriented rectangle's up vector will be (0, -1).
+ * @param {yfiles.algorithms.YPoint} anchor The provider for the dynamic anchor of this instance.
+ * @param {yfiles.algorithms.YDimension} size The provider for the dynamic size of this instance.
+ */
+ FromAnchorAndSize:{
+ new (anchor:yfiles.algorithms.YPoint,size:yfiles.algorithms.YDimension):yfiles.algorithms.YOrientedRectangle;
+ };
+ /**
+ * Creates a new instance using the provided values to initialize anchor,
+ * size, and up vector.
+ * @param {yfiles.algorithms.YPoint} position The provider for the dynamic anchor of this instance.
+ * @param {yfiles.algorithms.YDimension} size The provider for the dynamic size of this instance.
+ * @param {yfiles.algorithms.YVector} upVector The up vector.
+ */
+ FromPositionSizeAndUpVector:{
+ new (position:yfiles.algorithms.YPoint,size:yfiles.algorithms.YDimension,upVector:yfiles.algorithms.YVector):yfiles.algorithms.YOrientedRectangle;
+ };
+ /**
+ * Creates a new instance using the provided values to initialize anchor and
+ * size.
+ * The oriented rectangle's up vector will be
+ * (0, -1).
+ * @param {number} anchorX The x coordinate of the anchor of the oriented rectangle.
+ * @param {number} anchorY The y coordinate of the anchor of the oriented rectangle.
+ * @param {number} width The width of the rectangle.
+ * @param {number} height The height of the rectangle.
+ */
+ FromAnchorXAnchorYWidthAndHeight:{
+ new (anchorX:number,anchorY:number,width:number,height:number):yfiles.algorithms.YOrientedRectangle;
+ };
+ /**
+ * Creates a new instance using the provided values to initialize anchor,
+ * size, and up vector.
+ * @param {number} anchorX The x coordinate of the anchor of the oriented rectangle.
+ * @param {number} anchorY The y coordinate of the anchor of the oriented rectangle.
+ * @param {number} width The width of the rectangle.
+ * @param {number} height The height of the rectangle.
+ * @param {number} upX The x component of the up vector.
+ * @param {number} upY The y component of the up vector.
+ */
+ FromAnchorXAnchorYWidthHeightUpXAndUpY:{
+ new (anchorX:number,anchorY:number,width:number,height:number,upX:number,upY:number):yfiles.algorithms.YOrientedRectangle;
+ };
+ /**
+ * Determines the four corner points of an oriented rectangle.
+ * @param {yfiles.algorithms.YOrientedRectangle} rect The rectangle to determine the bounds.
+ * @return {yfiles.algorithms.YPoint[]} the array of corner points.
+ */
+ calcPoints(rect:yfiles.algorithms.YOrientedRectangle):yfiles.algorithms.YPoint[];
+ /**
+ * Determines whether a rectangle intersects an oriented rectangle, given an epsilon.
+ * @param {yfiles.algorithms.YOrientedRectangle} orientedRectangle The oriented rectangle to test.
+ * @param {yfiles.algorithms.YRectangle} rectangle The rectangle to test.
+ * @param {number} eps
+ * A positive value allows for fuzzy hit testing. If the point lies outside the given object
+ * but it's distance is less than or equal to that value, it will be considered a hit.
+ * @return {boolean} Whether they have a non-empty intersection.
+ */
+ intersectsRectangle(orientedRectangle:yfiles.algorithms.YOrientedRectangle,rectangle:yfiles.algorithms.YRectangle,eps:number):boolean;
+ /**
+ * Determines whether the given oriented rectangle contains the provided
+ * point, using an epsilon value.
+ * @param {yfiles.algorithms.YOrientedRectangle} rect The rectangle.
+ * @param {yfiles.algorithms.YPoint} p The point to test.
+ * @param {number} eps
+ * fuzziness range. A positive value allows for fuzzy hit testing.
+ * If a point lies outside the given rectangle, but its distance is less than
+ * or equal to that value, it will be considered a hit.
+ * @return {boolean}
+ * true if the point lies inside the rectangle;
+ * false otherwise.
+ */
+ containsPointWithEps(rect:yfiles.algorithms.YOrientedRectangle,p:yfiles.algorithms.YPoint,eps:number):boolean;
+ /**
+ * Determines whether the given oriented rectangle contains the provided
+ * point, using an epsilon value.
+ * @param {yfiles.algorithms.YOrientedRectangle} rect The rectangle.
+ * @param {number} x x-coordinate of the point to test.
+ * @param {number} y y-coordinate of the point to test.
+ * @param {number} eps
+ * fuzziness range. A positive value allows for fuzzy hit testing.
+ * If a point lies outside the given rectangle, but its distance is less than
+ * or equal to that value, it will be considered a hit.
+ * @return {boolean}
+ * true if the point lies inside the rectangle;
+ * false otherwise.
+ */
+ containsPointCoordsWithEps(rect:yfiles.algorithms.YOrientedRectangle,x:number,y:number,eps:number):boolean;
+ /**
+ * Determines whether the given rectangle r1 contains rectangle r2, using an epsilon value.
+ * @param {yfiles.algorithms.YOrientedRectangle} r1 The first rectangle.
+ * @param {yfiles.algorithms.YOrientedRectangle} r2 The second rectangle.
+ * @param {number} eps
+ * A positive value allows for fuzzy hit testing. If the point lies outside the given object but it's
+ * distance is less than or equal to that value, it will be considered a hit.
+ * @return {boolean} true iff the r1 contains r2.
+ */
+ containsRectangle(r1:yfiles.algorithms.YOrientedRectangle,r2:yfiles.algorithms.YOrientedRectangle,eps:number):boolean;
+ /**
+ * Determines whether or not the specified oriented rectangle and the
+ * specified line segment intersect.
+ * @return {boolean}
+ * true if the rectangle and the segment intersect and
+ * false otherwise.
+ */
+ intersectsLine(rect:yfiles.algorithms.YOrientedRectangle,line:yfiles.algorithms.LineSegment,eps:number):boolean;
+ /**
+ * Determines an intersection point of the specified oriented rectangle and
+ * the specified line segment.
+ * Note: there might be more than one intersection point. However this method only returns one intersection point
+ * or null if there is no intersection.
+ * @return {yfiles.algorithms.YPoint}
+ * an intersection point of the specified oriented rectangle and
+ * the specified line segment or null if the rectangle and the
+ * segment do not intersect.
+ */
+ intersectionPoint(rect:yfiles.algorithms.YOrientedRectangle,line:yfiles.algorithms.LineSegment,eps:number):yfiles.algorithms.YPoint;
+ };
+ /**
+ * This class represents a point in the plane with double coordinates.
+ * This class implements the immutable design pattern.
+ */
+ export interface YPoint extends Object,yfiles.lang.IObjectComparable{
+ /**
+ * The x-coordinate of the point object.
+ */
+ x:number;
+ /**
+ * The y-coordinate of the point object.
+ */
+ y:number;
+ /**
+ * Returns the euclidean distance between this point and a given point.
+ * @param {number} x the x coordinate of an arbitrary point
+ * @param {number} y the y coordinate of an arbitrary point
+ * @return {number} the Euclidean distance between this point and the point (x,y).
+ */
+ distanceToDouble(x:number,y:number):number;
+ /**
+ * Returns the euclidean distance between this point and a given point.
+ * @param {yfiles.algorithms.YPoint} p an arbitrary point
+ * @return {number} the Euclidean distance between this point and p.
+ */
+ distanceTo(p:yfiles.algorithms.YPoint):number;
+ /**
+ * Returns the point, got by moving this point to another position.
+ * @param {number} x the value which is added on the x-coordinate of the point.
+ * @param {number} y the value which is added on the y-coordinate of the point.
+ * @return {yfiles.algorithms.YPoint}
+ * a new instance of YPoint which is the result of the moving
+ * operation.
+ */
+ moveBy(x:number,y:number):yfiles.algorithms.YPoint;
+ /**
+ * Tests a point to equality to another point.
+ * This test returns true if the o is also an instance of
+ * YPoint and has the same coordinates as the instance on which equals is
+ * invoked.
+ * @param {Object} o an arbitrary instance.
+ */
+ equals(o:Object):boolean;
+ hashCode():number;
+ /**
+ * Returns the coordinates of the point as string.
+ */
+ toString():string;
+ /**
+ * Comparable implementation.
+ * YPoints are ordered by ascending x-coordinates.
+ * If the x-coordinates of two points equal, then these points are ordered by
+ * ascending y-coordinates.
+ * @see Specified by {@link yfiles.lang.IObjectComparable#compareToObject}.
+ */
+ compareToObject(o:Object):number;
+ /**
+ * Creates a {@link yfiles.geometry.PointD} from a given {@link yfiles.algorithms.YPoint}.
+ * This is a bridge method that delegates to {@link yfiles.algorithms.GeomExtensions#toPointD}.
+ * @return {yfiles.geometry.PointD} The {@link yfiles.geometry.PointD}.
+ */
+ toPointD():yfiles.geometry.PointD;
+ }
+ var YPoint:{
+ $class:yfiles.lang.Class;
+ /**
+ * A YPoint constant with coordinates (0,0).
+ */
+ ORIGIN:yfiles.algorithms.YPoint;
+ /**
+ * Creates a new YPoint at location (0,0).
+ */
+ AtOrigin:{
+ new ():yfiles.algorithms.YPoint;
+ };
+ /**
+ * Creates a new YPoint object for a given position.
+ * @param {number} x the x coordinate of the point.
+ * @param {number} y the y coordinate of the point.
+ */
+ new (x:number,y:number):yfiles.algorithms.YPoint;
+ /**
+ * Returns the euclidean distance between two points.
+ * @param {yfiles.algorithms.YPoint} p1 an arbitrary point
+ * @param {yfiles.algorithms.YPoint} p2 an arbitrary point
+ * @return {number} the Euclidean distance between p1 and p2.
+ */
+ distance(p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):number;
+ /**
+ * Returns the euclidean distance between two points.
+ * @param {number} x1 x-coordinate of first point
+ * @param {number} y1 y-coordinate of first point
+ * @param {number} x2 x-coordinate of second point
+ * @param {number} y2 y-coordinate of second point
+ * @return {number} the euclidean distance between first and second point
+ */
+ distanceDouble(x1:number,y1:number,x2:number,y2:number):number;
+ /**
+ * Adds two points and returns the result.
+ * @param {yfiles.algorithms.YPoint} p1 an arbitrary instance of YPoint.
+ * @param {yfiles.algorithms.YPoint} p2 an arbitrary instance of YPoint.
+ */
+ add(p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ /**
+ * Subtracts two points (p1 - p2) and returns the result.
+ * @param {yfiles.algorithms.YPoint} p1 an arbitrary instance of YPoint.
+ * @param {yfiles.algorithms.YPoint} p2 an arbitrary instance of YPoint.
+ */
+ subtract(p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ /**
+ * Returns a point that geometrically lies in
+ * in the middle of the line formed by the given points.
+ * @param {yfiles.algorithms.YPoint} p1 an arbitrary instance of YPoint.
+ * @param {yfiles.algorithms.YPoint} p2 an arbitrary instance of YPoint.
+ */
+ midPoint(p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ /**
+ * Returns a copy of the given point with exchanged
+ * x- and y-coordinates.
+ * @param {yfiles.algorithms.YPoint} p an arbitrary instance of YPoint.
+ */
+ swap(p:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ };
+ export enum BfsDirection{
+ /**
+ * Edge direction specifier for incoming edges.
+ * @see {@link yfiles.algorithms.Bfs#getLayersWithDirection}
+ */
+ PREDECESSOR,
+ /**
+ * Edge direction specifier for outgoing edges.
+ * @see {@link yfiles.algorithms.Bfs#getLayersWithDirection}
+ */
+ SUCCESSOR,
+ /**
+ * Edge direction specifier for both incoming and outgoing edges.
+ * @see {@link yfiles.algorithms.Bfs#getLayersWithDirection}
+ */
+ BOTH
+ }
+ export enum GraphEventType{
+ /**
+ * Type constant that identifies an event that gets fired immediately after a
+ * node has been created.
+ * The data of the event is the newly created node.
+ */
+ NODE_CREATION,
+ /**
+ * Type constant that identifies an event that gets fired immediately after an
+ * edge has been created.
+ * The data of the event is the newly created edge.
+ */
+ EDGE_CREATION,
+ /**
+ * Type constant that identifies an event that gets fired immediately before a
+ * node will be removed from the graph.
+ * The data of the event is the node to be removed.
+ */
+ PRE_NODE_REMOVAL,
+ /**
+ * Type constant that identifies an event that gets fired immediately after a
+ * node has been removed from the graph.
+ * The data of the event is the removed node.
+ */
+ POST_NODE_REMOVAL,
+ /**
+ * Type constant that identifies an event that gets fired immediately before an
+ * edge will be removed from the graph.
+ * The data of the event is the edge to be removed.
+ */
+ PRE_EDGE_REMOVAL,
+ /**
+ * Type constant that identifies an event that gets fired immediately after an
+ * edge has been removed from the graph.
+ * The data of the event is the removed edge.
+ */
+ POST_EDGE_REMOVAL,
+ /**
+ * Type constant that identifies an event that gets fired immediately after a
+ * node has been reinserted into the graph.
+ * The data of the event is the reinserted node.
+ */
+ NODE_REINSERTION,
+ /**
+ * Type constant that identifies an event that gets fired immediately after an
+ * edge has been reinserted into the graph.
+ * The data of the event is the reinserted edge.
+ */
+ EDGE_REINSERTION,
+ /**
+ * Type constant that identifies an event that gets fired immediately before the
+ * end points of an edge will be changed.
+ * The data of the event is the edge to be redefined.
+ */
+ PRE_EDGE_CHANGE,
+ /**
+ * Type constant that identifies an event that gets fired immediately after the
+ * end points of an edge have been changed.
+ * The data of the event is the redefined edge.
+ */
+ POST_EDGE_CHANGE,
+ /**
+ * Type constant that identifies an event that gets fired after a subgraph of
+ * a graph G has been moved to the emitting graph.
+ * The data of the event is a {@link yfiles.algorithms.NodeList} containing the nodes that induce
+ * the moved subgraph.
+ * This event gets fired just after the {@link yfiles.algorithms.GraphEventType#SUBGRAPH_REMOVAL} event got fired
+ * on the subgraph's original graph G.
+ * Note that at the time the event gets fired, the nodes from the node list are
+ * already part of the emitting graph.
+ */
+ SUBGRAPH_INSERTION,
+ /**
+ * Type constant that identifies an event that gets fired after a subgraph of
+ * the emitting graph has been moved to a graph G.
+ * The data of the event is a {@link yfiles.algorithms.NodeList} containing the nodes that induce
+ * the moved subgraph.
+ * This event gets fired just before the {@link yfiles.algorithms.GraphEventType#SUBGRAPH_INSERTION} event will
+ * be fired on the subgraph's new graph G.
+ * Note that at the time the event gets fired, the nodes from the node list are
+ * already part of graph G.
+ */
+ SUBGRAPH_REMOVAL,
+ /**
+ * Type constant that signals the start of a some logically coherent event sequence.
+ * If specified, the data of this event is its ID.
+ */
+ PRE_EVENT,
+ /**
+ * Type constant that signals the end of a some logically coherent event sequence.
+ * If specified, the data of this event is its ID.
+ */
+ POST_EVENT
+ }
+ /**
+ * This class represents a line in the 2D-dimensional affine space.
+ * The line is defined by the equation ax + by + c = 0
+ */
+ export interface AffineLine extends Object{
+ /**
+ * A from ax+by+c = 0.
+ */
+ a:number;
+ /**
+ * B from ax+by+c = 0.
+ */
+ b:number;
+ /**
+ * C from ax+by+c = 0.
+ */
+ c:number;
+ /**
+ * Returns the equation of the line as String.
+ */
+ toString():string;
+ /**
+ * Projects an point on the line in direction of the X-axis.
+ */
+ getXProjection(p:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ /**
+ * Projects an point on the line in direction of the Y-axis.
+ */
+ getYProjection(p:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ }
+ var AffineLine:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an affine line which is defined by a point
+ * and a vector.
+ */
+ FromPointAndVector:{
+ new (p1:yfiles.algorithms.YPoint,v:yfiles.algorithms.YVector):yfiles.algorithms.AffineLine;
+ };
+ /**
+ * Creates an affine line which is defined by two points.
+ */
+ new (p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint):yfiles.algorithms.AffineLine;
+ /**
+ * Returns the crossing of two lines.
+ * If the lines are parallel, null is returned.
+ */
+ getCrossing(l1:yfiles.algorithms.AffineLine,l2:yfiles.algorithms.AffineLine):yfiles.algorithms.YPoint;
+ };
+ export enum GraphElementInsertion{
+ /**
+ * Object insertion specifier.
+ * An object gets inserted before another one.
+ */
+ BEFORE,
+ /**
+ * Object insertion specifier.
+ * An object gets inserted after another one.
+ */
+ AFTER
+ }
+ /**
+ * This is an interface for a sequence of instances of LineSegment.
+ */
+ export interface ILineSegmentCursor extends Object,yfiles.algorithms.ICursor{
+ /**
+ * The instance of LineSegment the cursor is currently pointing on.
+ * @see Specified by {@link yfiles.algorithms.ILineSegmentCursor#lineSegment}.
+ */
+ lineSegment:yfiles.algorithms.LineSegment;
+ }
+ var ILineSegmentCursor:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * This class calculates the intersection of rectangles in the plane with
+ * the help of a sweep-line algorithm.
+ * The complexity is O(n log n + s) where n
+ * is the number of rectangles and s the number of intersections.
+ */
+ export interface IntersectionAlgorithm extends Object{
+ }
+ export module IntersectionAlgorithm{
+ /**
+ * An instance of this interface handles intersections found by the
+ * IntersectionAlgorithm,.
+ */
+ export interface IIntersectionHandler extends Object{
+ /**
+ * This method is called at every intersection.
+ * @see Specified by {@link yfiles.algorithms.IntersectionAlgorithm.IIntersectionHandler#checkIntersection}.
+ */
+ checkIntersection(a:Object,b:Object):void;
+ }
+ }
+ var IntersectionAlgorithm:{
+ $class:yfiles.lang.Class;
+ /**
+ * Calculates the intersections of rectangles in the plane.
+ * Every found intersection is reported to an
+ * IntersectionHandler.
+ * Rectangles with negative size are completely ignored by this implementation (i.e.
+ * never generate intersections)
+ * @param {yfiles.algorithms.YList} objects a list of PlaneObject objects.
+ * @param {yfiles.algorithms.IntersectionAlgorithm.IIntersectionHandler} iHandler intersections are reported to this class.
+ */
+ intersect(objects:yfiles.algorithms.YList,iHandler:yfiles.algorithms.IntersectionAlgorithm.IIntersectionHandler):void;
+ /**
+ * Initializes the sweep line data structures from a set of objects.
+ */
+ createXStruct(objects:yfiles.algorithms.YList):yfiles.algorithms.YList;
+ };
+ /**
+ * This class provides useful geometric primitives and advanced
+ * geometric algorithms.
+ * This class is intended to provide static methods for geometric
+ * calculations. It can be compared to the class java.lang.Math
+ * which provides methods for general mathematical calculations.
+ */
+ export interface Geom extends Object{
+ }
+ var Geom:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns the orientation of point r relative to the directed
+ * line from point p to point q.
+ * The given tuple of points is said to have positive orientation if
+ * p and q are distinct and r lies
+ * to the left of the oriented line passing through p
+ * and q and oriented from p to q.
+ * The tuple is said to have negative orientation if
+ * p and q are distinct and r lies
+ * to the right of the line, and the tuple is said to have orientation zero
+ * if the three points are collinear.
+ * @return {number}
+ * +1 in the case of positive orientation, -1 in the
+ * case of negative orientation and 0 in the case of zero
+ * orientation.
+ */
+ orientation(p:yfiles.algorithms.YPoint,q:yfiles.algorithms.YPoint,r:yfiles.algorithms.YPoint):number;
+ /**
+ * Same as {@link yfiles.algorithms.Geom#orientation} with double values as arguments.
+ */
+ orientationDouble(px:number,py:number,qx:number,qy:number,rx:number,ry:number):number;
+ /**
+ * Same as {@link yfiles.algorithms.Geom#orientation orientation(p,q,r) > 0}.
+ */
+ leftTurn(p:yfiles.algorithms.YPoint,q:yfiles.algorithms.YPoint,r:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Same as {@link yfiles.algorithms.Geom#orientation orientation(p,q,r) < 0}.
+ */
+ rightTurn(p:yfiles.algorithms.YPoint,q:yfiles.algorithms.YPoint,r:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Returns true iff the given points are collinear, i.e.
+ * all
+ * three points lie on a common line.
+ * Same as {@link yfiles.algorithms.Geom#orientation orientation(p,q,r) == 0}
+ */
+ collinear(p:yfiles.algorithms.YPoint,q:yfiles.algorithms.YPoint,r:yfiles.algorithms.YPoint):boolean;
+ /**
+ * Returns +1 if point d lies left of the directed circle through
+ * points a, b, and c,
+ * 0 if a,b,c and d are cocircular, and -1 otherwise.
+ */
+ sideOfCircle(a:yfiles.algorithms.YPoint,b:yfiles.algorithms.YPoint,c:yfiles.algorithms.YPoint,d:yfiles.algorithms.YPoint):number;
+ /**
+ * Calculates the convex hull for a set of points.
+ * Complexity:O(n)*log(n), n := points.size()
+ * @param {yfiles.algorithms.YList} points
+ * a list of {@link yfiles.algorithms.YPoint} objects
+ * @return {yfiles.algorithms.YList}
+ * a list of {@link yfiles.algorithms.YPoint} objects that constitute the convex hull of
+ * the given points. The list contains points in counter clockwise order
+ * around the hull. The first point is the one with the smallest
+ * x coordinate. If two such points exist then of these points
+ * the one with the smallest y coordinate is chosen as the first
+ * one.
+ */
+ calcConvexHull(points:yfiles.algorithms.YList):yfiles.algorithms.YList;
+ /**
+ * Converts the given degree value from angular to radian.
+ */
+ toRadians(angdeg:number):number;
+ /**
+ * Converts the given degree value from radian to angular.
+ */
+ toDegrees(angrad:number):number;
+ /**
+ * Calculates the intersection point of two affine lines.
+ * Each line is given by a point and a direction vector.
+ * @param {yfiles.algorithms.YPoint} p1 origin point of the first line.
+ * @param {yfiles.algorithms.YVector} d1 direction vector of the first line.
+ * @param {yfiles.algorithms.YPoint} p2 origin point of the second line.
+ * @param {yfiles.algorithms.YVector} d2 direction vector of the second line.
+ * @return {yfiles.algorithms.YPoint}
+ * the intersection point of the specified lines or null
+ * if there is no intersection.
+ */
+ calcIntersectionWithPointsAndVectors(p1:yfiles.algorithms.YPoint,d1:yfiles.algorithms.YVector,p2:yfiles.algorithms.YPoint,d2:yfiles.algorithms.YVector):yfiles.algorithms.YPoint;
+ /**
+ * Calculates the intersection point of two affine lines.
+ * Each line is given by two points.
+ * @param {yfiles.algorithms.YPoint} p1 one point on the first line.
+ * @param {yfiles.algorithms.YPoint} p2 another point on the first line.
+ * @param {yfiles.algorithms.YPoint} p3 one point on the second line.
+ * @param {yfiles.algorithms.YPoint} p4 another point on the second line.
+ * @return {yfiles.algorithms.YPoint}
+ * the intersection point of the specified lines or null
+ * if there is no intersection.
+ */
+ calcIntersectionWithPoints(p1:yfiles.algorithms.YPoint,p2:yfiles.algorithms.YPoint,p3:yfiles.algorithms.YPoint,p4:yfiles.algorithms.YPoint):yfiles.algorithms.YPoint;
+ /**
+ * Calculates the intersection point of two affine lines.
+ * Each line is given by the coordinates of two points.
+ * @param {number} x1 x-coordinate of one point on the first line.
+ * @param {number} y1 y-coordinate of one point on the first line.
+ * @param {number} x2 x-coordinate of another point on the first line.
+ * @param {number} y2 y-coordinate of another point on the first line.
+ * @param {number} x3 x-coordinate of one point on the second line.
+ * @param {number} y3 y-coordinate of one point on the second line.
+ * @param {number} x4 x-coordinate of another point on the second line.
+ * @param {number} y4 y-coordinate of another point on the second line.
+ * @return {yfiles.algorithms.YPoint}
+ * the intersection point of the specified lines or null
+ * if there is no intersection.
+ */
+ calcIntersectionWithCoordinates(x1:number,y1:number,x2:number,y2:number,x3:number,y3:number,x4:number,y4:number):yfiles.algorithms.YPoint;
+ /**
+ * Returns whether the two lines defined by the given coordinates intersect or not.
+ */
+ linesIntersect(x1:number,y1:number,x2:number,y2:number,x3:number,y3:number,x4:number,y4:number):boolean;
+ /**
+ * Determines the projection of the point p onto the line
+ * segment [l1, l2].
+ * The resulting point is
+ *
+ *
the orthogonal projection of p onto the line through
+ * l1 and l2, iff the projection lies on the
+ * line segment [l1, l2]
+ *
the end point of the line segment [l1, l2] that is closest
+ * to p
, otherwise
+ *
+ * @param {number} pointX the x coordinate of p
+ * @param {number} pointY the y coordinate of p
+ * @param {number} lineX1 the x coordinate of l1
+ * @param {number} lineY1 the y coordinate of l1
+ * @param {number} lineX2 the x coordinate of l2
+ * @param {number} lineY2 the y coordinate of l2
+ */
+ projection(pointX:number,pointY:number,lineX1:number,lineY1:number,lineX2:number,lineY2:number):yfiles.algorithms.YPoint;
+ /**
+ * Determines the distance of the point p to the line segment
+ * [l1, l2].
+ * @param {number} pointX the x coordinate of p
+ * @param {number} pointY the y coordinate of p
+ * @param {number} lineX1 the x coordinate of l1
+ * @param {number} lineY1 the y coordinate of l1
+ * @param {number} lineX2 the x coordinate of l2
+ * @param {number} lineY2 the y coordinate of l2
+ */
+ distanceToLineSegment(pointX:number,pointY:number,lineX1:number,lineY1:number,lineX2:number,lineY2:number):number;
+ /**
+ * Unions the pair of source Rectangle2D objects
+ * and puts the result into the specified destination
+ * Rectangle2D object.
+ * If one of the source rectangles has negative width or height,
+ * it is excluded from the union.
+ * If both source rectangles have negative width or height,
+ * the destination rectangle will become a copy of r1.
+ * One of the source rectangles can also be the destination to avoid creating
+ * a third Rectangle2D object, but in this case the original points of this
+ * source rectangle will be overwritten by this method.
+ * If the destination is null, a new Rectangle2D
+ * is created.
+ * @param {yfiles.algorithms.Rectangle2D} r1
+ * the first of a pair of Rectangle2D
+ * objects to be combined with each other
+ * @param {yfiles.algorithms.Rectangle2D} r2
+ * the second of a pair of Rectangle2D
+ * objects to be combined with each other
+ * @param {yfiles.algorithms.Rectangle2D} dest
+ * the Rectangle2D that holds the
+ * results of the union of r1 and
+ * r2
+ */
+ calcUnion(r1:yfiles.algorithms.Rectangle2D,r2:yfiles.algorithms.Rectangle2D,dest:yfiles.algorithms.Rectangle2D):yfiles.algorithms.Rectangle2D;
+ /**
+ * Intersects the pair of specified source Rectangle2D
+ * objects and puts the result into the specified destination
+ * Rectangle2D object.
+ * If one or both of the source rectangles have negative width or height,
+ * the resulting rectangle will be located at (0,0) with a width and height
+ * of -1.
+ * One of the source rectangles can also be the destination to avoid
+ * creating a third Rectangle2D object, but in this case the original
+ * points of this source rectangle will be overwritten by this method.
+ * @param {yfiles.algorithms.Rectangle2D} r1
+ * the first of a pair of Rectangle2D
+ * objects to be intersected with each other
+ * @param {yfiles.algorithms.Rectangle2D} r2
+ * the second of a pair of Rectangle2D
+ * objects to be intersected with each other
+ * @param {yfiles.algorithms.Rectangle2D} dest
+ * the Rectangle2D that holds the
+ * results of the intersection of r1 and
+ * r2
+ */
+ calcIntersection(r1:yfiles.algorithms.Rectangle2D,r2:yfiles.algorithms.Rectangle2D,dest:yfiles.algorithms.Rectangle2D):yfiles.algorithms.Rectangle2D;
+ };
+ /**
+ * Specialized list implementation for instances of type {@link yfiles.algorithms.Edge}.
+ */
+ export interface EdgeList extends yfiles.algorithms.YList{
+ /**
+ * Returns an edge cursor for this edge list.
+ * @return {yfiles.algorithms.IEdgeCursor} An edge cursor granting access to the edges within this list.
+ */
+ edges():yfiles.algorithms.IEdgeCursor;
+ /**
+ * Returns the first edge in this list, or null when the list is
+ * empty.
+ * @return {yfiles.algorithms.Edge} The first edge in the list.
+ */
+ firstEdge():yfiles.algorithms.Edge;
+ /**
+ * Returns the last edge in this list, or null when the list is empty.
+ * @return {yfiles.algorithms.Edge} The last edge in the list.
+ */
+ lastEdge():yfiles.algorithms.Edge;
+ /**
+ * Removes the first edge from this list and returns it.
+ * @return {yfiles.algorithms.Edge} The first edge from the list.
+ */
+ popEdge():yfiles.algorithms.Edge;
+ /**
+ * Returns an edge array containing all elements of this list in the canonical
+ * order.
+ */
+ toEdgeArray():yfiles.algorithms.Edge[];
+ getEnumerator():yfiles.collections.IEnumerator;
+ }
+ var EdgeList:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates an empty edge list.
+ */
+ new ():yfiles.algorithms.EdgeList;
+ /**
+ * Creates a list that is initialized with the edges provided by the given array
+ * of edges.
+ */
+ FromEdgeArray:{
+ new (a:yfiles.algorithms.Edge[]):yfiles.algorithms.EdgeList;
+ };
+ /**
+ * Creates a list that is initialized with the edges provided by the given EdgeCursor
+ * object.
+ */
+ FromEdgeCursor:{
+ new (c:yfiles.algorithms.IEdgeCursor):yfiles.algorithms.EdgeList;
+ };
+ /**
+ * Creates a list that is initialized with those edges from the given EdgeCursor
+ * object for which the given data provider returns true upon
+ * calling its {@link yfiles.algorithms.IDataProvider#getBool getBool} method.
+ * @param {yfiles.algorithms.IEdgeCursor} ec An edge cursor providing edges that should be added to this list.
+ * @param {yfiles.algorithms.IDataProvider} predicate
+ * A data provider that acts as a inclusion predicate for each edge accessible
+ * by the given edge cursor.
+ */
+ FromEdgeCursorFiltered:{
+ new (ec:yfiles.algorithms.IEdgeCursor,predicate:yfiles.algorithms.IDataProvider):yfiles.algorithms.EdgeList;
+ };
+ /**
+ * Creates a list that is initialized with the elements provided by the given
+ * Iterator object.
+ */
+ FromIterator:{
+ new (it:yfiles.algorithms.IIterator):yfiles.algorithms.EdgeList;
+ };
+ /**
+ * Creates a list that is initialized with a single edge provided.
+ */
+ WithEdge:{
+ new (e:yfiles.algorithms.Edge):yfiles.algorithms.EdgeList;
+ };
+ /**
+ * Creates a list that is initialized with an EdgeList.
+ */
+ FromEdgeList:{
+ new (edgeList:yfiles.algorithms.EdgeList):yfiles.algorithms.EdgeList;
+ };
+ };
+ /**
+ * This class can be used to easily model an orthogonal
+ * border line or sky-line.
+ * It provides methods for measuring
+ * the distance between different BorderLine instances, merging
+ * multiple instances, modifying and efficiently moving them around.
+ */
+ export interface BorderLine extends Object{
+ /**
+ * Creates a copy of this borderline.
+ * Optionally negates the values or offsets.
+ * @param {boolean} negateValues whether the values are negated
+ * @param {boolean} negateOffsets whether the offsets are negated
+ * @return {yfiles.algorithms.BorderLine} the copy of the borderline
+ */
+ createCopy(negateValues:boolean,negateOffsets:boolean):yfiles.algorithms.BorderLine;
+ /**
+ * Assures that all values in the given interval are less or equal than the given value.
+ * @param {number} min the lower end of the interval
+ * @param {number} max the upper end of the interval
+ * @param {number} value the greatest possible value for the interval
+ */
+ setMinValue(min:number,max:number,value:number):void;
+ /**
+ * Assures that all values in the given interval are greater or equal than the given value.
+ * @param {number} min the lower end of the interval
+ * @param {number} max the upper end of the interval
+ * @param {number} value the smallest possible value for the interval
+ */
+ setMaxValue(min:number,max:number,value:number):void;
+ /**
+ * Convenience method that copies the actual data from the given
+ * argument to this instance.
+ * @param {yfiles.algorithms.BorderLine} other the argument to retrieve the values from
+ */
+ adoptValues(other:yfiles.algorithms.BorderLine):void;
+ /**
+ * Sets a specific interval described by min and max to a given value.
+ * @param {number} min the left side of the interval.
+ * @param {number} max the right side of the interval.
+ * @param {number} value the value for the whole interval.
+ */
+ setValue(min:number,max:number,value:number):void;
+ /**
+ * Sets a specific interval to a slope starting at a given value.
+ * @param {number} min the left side of the interval.
+ * @param {number} max the right side of the interval.
+ * @param {number} value the value at min where the slope starts.
+ * @param {number} slope the slope of the segment in the given interval.
+ * @throws {yfiles.system.ArgumentException} if min is greater than max.
+ */
+ setSloped(min:number,max:number,value:number,slope:number):void;
+ /**
+ * Adds the given offset to the current values of
+ * the whole borderline.
+ * This method has complexity O(1).
+ * @param {number} delta the delta to add to the values
+ */
+ addValueOffset(delta:number):void;
+ /**
+ * Adds the given offset to the segments' positions.
+ * This method has complexity O(1).
+ * @param {number} delta the delta to add to the positions
+ */
+ addOffset(delta:number):void;
+ /**
+ * The smallest position of this borderline.
+ */
+ min:number;
+ /**
+ * The greatest position of this borderline.
+ */
+ max:number;
+ /**
+ * The minimum value that is set on this borderline.
+ */
+ minValue:number;
+ /**
+ * The maximum value that is set on this borderline.
+ */
+ maxValue:number;
+ /**
+ * Returns the value that is set on this borderline
+ * at the specified position.
+ * @param {number} pos the position
+ * @return {number} the value
+ * @throws {yfiles.system.IndexOutOfRangeException} if the position is outside of the borderline.
+ */
+ getValueAt(pos:number):number;
+ /**
+ * Returns the value that is set on this borderline at the specified position.
+ * The position must lie within the range of the segment that is stored in cell.
+ * @param {yfiles.algorithms.ListCell} cell The list cell containing the segment whose value shall be returned.
+ * @param {number} pos the position
+ * @return {number} the value
+ * @throws {yfiles.system.ArgumentException} if pos is outside the segment's range that is stored in cell.
+ */
+ getValueAtWithListCell(cell:yfiles.algorithms.ListCell,pos:number):number;
+ /**
+ * Returns the value that is set on this borderline at the specified position.
+ * The position must lie within the range of the segment.
+ * @param {yfiles.algorithms.BorderLine.Segment} segment The segment whose value shall be returned.
+ * @param {number} pos the position where the value will be retrieved.
+ * @return {number} the value
+ * @throws {yfiles.system.ArgumentException} if pos is outside the segment's range.
+ */
+ getValueAtWithSegment(segment:yfiles.algorithms.BorderLine.Segment,pos:number):number;
+ /**
+ * Merges this borderline with the given borderline
+ * using the "maximum" policy.
+ * That means the resulting borderline will have greater value of both borderline on each position. If you imagine
+ * each borderline as a the upper border of a plane, the resulting borderline will be the upper border of the merged
+ * planes.
+ * @param {yfiles.algorithms.BorderLine} other the other borderline
+ * @return {yfiles.algorithms.BorderLine} a new borderline that is the result of the merge
+ */
+ createMax(other:yfiles.algorithms.BorderLine):yfiles.algorithms.BorderLine;
+ /**
+ * Merges this borderline with the given borderline
+ * using the "minimum" policy.
+ * That means the resulting borderline will have smaller value of both borderline on each position. If you imagine
+ * each borderline as a the lower border of a plane, the resulting borderline will be the lower border of the merged
+ * planes.
+ * @param {yfiles.algorithms.BorderLine} other the other borderline
+ * @return {yfiles.algorithms.BorderLine} a new borderline that is the result of the merge
+ */
+ createMin(other:yfiles.algorithms.BorderLine):yfiles.algorithms.BorderLine;
+ /**
+ * Merges this borderline with the given borderline
+ * using the "maximum" policy.
+ * @param {yfiles.algorithms.BorderLine} other the other borderline
+ */
+ mergeWithMax(other:yfiles.algorithms.BorderLine):void;
+ /**
+ * Merges this borderline with the given borderline
+ * using the "minimum" policy.
+ * @param {yfiles.algorithms.BorderLine} other the other borderline
+ */
+ mergeWithMin(other:yfiles.algorithms.BorderLine):void;
+ /**
+ * Returns the value of the minimum of the given segment.
+ * If the segment's slope is 0, it's the value of the whole
+ * segment. In case the slope differs from 0, it's the value of the start of the slope.
+ * @param {yfiles.algorithms.BorderLine.Segment} s the segment
+ */
+ getValue(s:yfiles.algorithms.BorderLine.Segment):number;
+ /**
+ * Returns the minimum position of the given segment.
+ * @param {yfiles.algorithms.BorderLine.Segment} s the segment
+ */
+ getMin(s:yfiles.algorithms.BorderLine.Segment):number;
+ /**
+ * Returns the slope of the given segment.
+ * @param {yfiles.algorithms.BorderLine.Segment} s the segment
+ */
+ getSlope(s:yfiles.algorithms.BorderLine.Segment):number;
+ /**
+ * Returns the segment at the given position.
+ * @param {number} pos the position
+ */
+ getSegmentAt(pos:number):yfiles.algorithms.BorderLine.Segment;
+ /**
+ * Returns the maximum position of the given segment.
+ * @param {yfiles.algorithms.BorderLine.Segment} s the segment
+ */
+ getMax(s:yfiles.algorithms.BorderLine.Segment):number;
+ /**
+ * Returns the first segment or null if there is
+ * no such segment.
+ */
+ firstSegment():yfiles.algorithms.BorderLine.Segment;
+ /**
+ * Returns the last segment or null if there is
+ * no such segment.
+ */
+ lastSegment():yfiles.algorithms.BorderLine.Segment;
+ /**
+ * Returns the previous segment or null if there is
+ * no such segment.
+ */
+ prev(s:yfiles.algorithms.BorderLine.Segment):yfiles.algorithms.BorderLine.Segment;
+ /**
+ * Returns the next segment or null if there is
+ * no such segment.
+ */
+ next(s:yfiles.algorithms.BorderLine.Segment):yfiles.algorithms.BorderLine.Segment;
+ /**
+ * Calculates the maximum value in the interval from->to.
+ */
+ getMaxValue(from:number,to:number):number;
+ /**
+ * Calculates the minimum value in the interval from->to.
+ */
+ getMinValue(from:number,to:number):number;
+ /**
+ * Calculates the minimal distance between this borderline and the other one.
+ * The other one is treated as if the values were all greater.
+ */
+ getDistanceTo(greater:yfiles.algorithms.BorderLine):number;
+ /**
+ * Returns a lengthy String representation of this borderline.
+ */
+ toString():string;
+ /**
+ * Grows this BorderLine horizontally, so that the {@link yfiles.algorithms.BorderLine#getValueAtWithSegment values}
+ * of the BorderLine stay the same however their {@link yfiles.algorithms.BorderLine#getMin start} and
+ * {@link yfiles.algorithms.BorderLine#getMax end} points are moved in the direction of toMin
+ * and toMax.
+ * This is useful for scenarios where a BorderLine is needed that consists of an enlarged border.
+ *
+ * Note that this method normalizes the segments, i.e., it transforms each segment with slope != 0 to
+ * a segment with slope == 0.
+ *
+ * @param {number} toMin the delta by which the border should be extended towards -Infinity
+ * @param {number} toMax the delta by which the border should be extended towards +Infinity
+ * @param {boolean} positive
+ * whether the BorderLine should be interpreted to point in positive direction. This influences the
+ * direction into which a segment's border is extended.
+ */
+ grow(toMin:number,toMax:number,positive:boolean):void;
+ }
+ export module BorderLine{
+ /**
+ * The handle of a segment of a borderline.
+ */
+ export interface Segment extends Object{
+ /**
+ * Returns the segment's value at the given position.
+ * Note: In case the position lies outside the segments range, the calculated value might be invalid. As the segment
+ * is not aware of any offsets the position also must not include any offsets.
+ * @param {number} position the position the value is retrieved for.
+ * @return {number} the segment's value at the given position.
+ */
+ getValueAt(position:number):number;
+ /**
+ * The end of this segment.
+ */
+ end:number;
+ /**
+ * Returns the previous segment or null if there is
+ * no such segment.
+ */
+ prev():yfiles.algorithms.BorderLine.Segment;
+ /**
+ * Returns the next segment or null if there is
+ * no such segment.
+ */
+ next():yfiles.algorithms.BorderLine.Segment;
+ toString():string;
+ }
+ }
+ var BorderLine:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new BorderLine with the given value
+ * from -Double.MAX_VALUE to Double.MAX_VALUE.
+ * @param {number} value the value of the segment
+ */
+ WithValue:{
+ new (value:number):yfiles.algorithms.BorderLine;
+ };
+ /**
+ * Creates a new BorderLine from a single segment.
+ * @param {number} min the beginning of this borderline
+ * @param {number} max the ending of this borderline
+ * @param {number} value the value of the segment
+ */
+ FromMinToMax:{
+ new (min:number,max:number,value:number):yfiles.algorithms.BorderLine;
+ };
+ /**
+ * Creates a new BorderLine from a single segment.
+ * @param {number} min the beginning of this borderline
+ * @param {number} max the ending of this borderline
+ * @param {number} valueAtMin the value of the segment at the beginning of this borderline
+ * @param {number} valueAtMax the value of the segment at the ending of this borderline
+ */
+ FromSegment:{
+ new (min:number,max:number,valueAtMin:number,valueAtMax:number):yfiles.algorithms.BorderLine;
+ };
+ };
+ /**
+ * This class provides a means for early termination of graph algorithms.
+ * Instances of this class may be attached to and retrieved from a graph
+ * and may receive requests for stopping and canceling an algorithm working
+ * on the graph.
+ *
+ * Client Code Usage:
+ * The handler's
+ * {@link yfiles.algorithms.AbortHandler#stopDuration}
+ * and
+ * {@link yfiles.algorithms.AbortHandler#cancelDuration}
+ * methods can be used to automatically stop or cancel an algorithm after a specified
+ * period of time has elapsed.
+ *
+ *
+ * Stop
+ *
+ * The algorithm should terminate gracefully, delivering a consistent result.
+ * Although the termination will be early, it usually will not be immediate.
+ *
+ * Cancel
+ *
+ * The algorithm should terminate immediately, all work done so far will be
+ * discarded.
+ * IMPORTANT: It is not guaranteed that the processed graph will be in a
+ * consistent state after cancellation. For this reason it is strongly
+ * recommended to cancel only algorithms that work on copies of the real
+ * graph structure such as layout algorithms running in buffered mode.
+ * Furthermore, the state of the used layouter
+ * instance may become corrupted. Hence, a new
+ * instance has to be created after each cancellation.
+ *
+ *
+ * If a graph with an attached handler is processed by multiple algorithms
+ * (or multiple times by one algorithm), the attached handler has to be
+ * {@link yfiles.algorithms.AbortHandler#reset} between algorithm runs. Otherwise, previous requests for
+ * early termination may lead to an undesired early termination of the next
+ * algorithm run. Typically, the LayoutExecutor takes care of this.
+ *
+ *
+ * Usage in Algorithms:
+ * Algorithms have to retrieve an instance of this class from the graph
+ * that is processed using method {@link yfiles.algorithms.AbortHandler#getFromGraph}.
+ * The algorithm then needs to query the retrieved instance of this class for
+ * stop or cancel requests using method {@link yfiles.algorithms.AbortHandler#check}.
+ * Alternatively, convenience method {@link yfiles.algorithms.AbortHandler#check} for
+ * one-time checks is available. For performance critical code that checks
+ * repeatedly, it is recommended to follow the first approach, though.
+ * When handling a stop request, algorithms should ensure that the resulting
+ * graph is still in a consistent state.
+ *
+ */
+ export interface AbortHandler extends Object{
+ /**
+ * Schedules a stop request.
+ * Algorithms that detect stop requests should terminate gracefully and ensure
+ * that the processed graph remains in a consistent state.
+ *
+ * Since JavaScript is not multi-threaded, this method is not meant to be called
+ * in an interactive context on user request. Instead, it can be used in
+ * an algorithm or layout stage to end the complete current calculation.
+ *
+ * @see {@link yfiles.algorithms.AbortHandler#check}
+ */
+ stop():void;
+ /**
+ * Returns whether or not a stop request was scheduled explicitly with the {@link yfiles.algorithms.AbortHandler#stop} method.
+ */
+ stopRequested:boolean;
+ /**
+ * Determines the remaining time (in milliseconds) until an algorithm that
+ * {@link yfiles.algorithms.AbortHandler#check checks} this handler is stopped automatically.
+ * @return {number}
+ * the remaining time (in milliseconds) until the algorithm is
+ * stopped automatically.
+ * @see {@link yfiles.algorithms.AbortHandler#stopDuration}
+ * @see {@link yfiles.algorithms.AbortHandler#reset}
+ * @see {@link yfiles.algorithms.AbortHandler#stop}
+ */
+ timeToStop():number;
+ /**
+ * The duration (in milliseconds) an algorithm may run before being
+ * stopped automatically.
+ * An algorithm is terminated gracefully, if the time in between
+ * or {@link yfiles.algorithms.AbortHandler#reset resetting} this handler
+ * and calling {@link yfiles.algorithms.AbortHandler#check} exceeds the stop duration.
+ *
+ * Note, automatic termination will only occur for positive values.
+ *
+ * Defaults to 0, i.e. no automatic termination will occur.
+ *
+ * @see {@link yfiles.algorithms.AbortHandler#timeToStop}
+ * @see {@link yfiles.algorithms.AbortHandler#reset}
+ * @see {@link yfiles.algorithms.AbortHandler#stop}
+ */
+ stopDuration:number;
+ /**
+ * Determines the remaining time (in milliseconds) until an algorithm that
+ * {@link yfiles.algorithms.AbortHandler#check checks}
+ * this handler is cancelled automatically.
+ * @return {number}
+ * the remaining time (in milliseconds) until the algorithm is
+ * cancelled automatically.
+ * @see {@link yfiles.algorithms.AbortHandler#cancelDuration}
+ * @see {@link yfiles.algorithms.AbortHandler#reset}
+ */
+ timeToCancel():number;
+ /**
+ * The duration (in milliseconds) an algorithm may run before being
+ * cancelled automatically.
+ * An algorithm is terminated immediately, if the time in between
+ * or {@link yfiles.algorithms.AbortHandler#reset resetting} this handler
+ * and calling {@link yfiles.algorithms.AbortHandler#check} exceeds the cancel duration.
+ *
+ * Note, automatic termination will only occur for positive values.
+ *
+ * Defaults to 0, i.e. no automatic termination will occur.
+ *
+ * @see {@link yfiles.algorithms.AbortHandler#timeToCancel}
+ * @see {@link yfiles.algorithms.AbortHandler#reset}
+ */
+ cancelDuration:number;
+ /**
+ * true if method{@link yfiles.algorithms.AbortHandler#check} or {@link yfiles.algorithms.AbortHandler#check}
+ * were called after a stop or cancel event.
+ * More precisely, it returns true if one of the check methods
+ * either threw an {@link yfiles.algorithms.AlgorithmAbortedException} or returned true to indicate
+ * that the calling algorithm should terminate gracefully.
+ * Otherwise, this method returns false.
+ * @see {@link yfiles.algorithms.AbortHandler#check}
+ * @see {@link yfiles.algorithms.AbortHandler#check}
+ */
+ checkFailed:boolean;
+ /**
+ * Determines if an algorithm should terminate its work early.
+ * This method returns true if the algorithm should terminate
+ * gracefully and ensures that the processed graph remains in a consistent
+ * state.
+ * This method throws an {@link yfiles.algorithms.AlgorithmAbortedException} if the algorithm
+ * should terminate immediately.
+ * @return {boolean}
+ * true, if the algorithm should stop as soon as possible
+ * while still providing some valid result and false if the
+ * algorithm should continue normally.
+ * @throws {yfiles.algorithms.AlgorithmAbortedException}
+ * if the algorithm should terminate
+ * immediately.
+ * @see {@link yfiles.algorithms.AbortHandler#stop}
+ */
+ check():boolean;
+ /**
+ * Resets the state of the handler.
+ * Resetting the handler discards any
+ * previous stop or cancel requests. Moreover, the handler's internal
+ * timestamp that is used to determine whether or not an algorithm should
+ * be stopped or cancelled automatically is updated to the
+ * current time
+ * as well.
+ *
+ * This method should be called whenever a graph with an attached handler
+ * is processed an additional time to prevent previous requests for
+ * early termination to result in an undesired early termination of the next
+ * algorithm run.
+ *
+ * @see {@link yfiles.algorithms.AbortHandler#cancelDuration}
+ * @see {@link yfiles.algorithms.AbortHandler#stopDuration}
+ */
+ reset():void;
+ }
+ var AbortHandler:{
+ $class:yfiles.lang.Class;
+ /**
+ * {@link yfiles.algorithms.IDataProvider} key used to attach an {@link yfiles.algorithms.AbortHandler} instance to a graph.
+ * Only instances of {@link yfiles.algorithms.AbortHandler} should be assigned to this data provider, otherwise a
+ * {@link yfiles.system.InvalidCastException} will occur.
+ * Layout algorithms will use the attached handler to check for requests to cancel or stop the layout process.
+ */
+ ABORT_HANDLER_DP_KEY:Object;
+ /**
+ * Initializes a new AbortHandler instance with the
+ * {@link yfiles.algorithms.Runtime#currentTimeMillis current time} to be used as timestamp
+ * for determining whether or not an algorithm should be stopped or cancelled
+ * automatically.
+ * @see {@link yfiles.algorithms.AbortHandler#stopDuration}
+ * @see {@link yfiles.algorithms.AbortHandler#cancelDuration}
+ * @see {@link yfiles.algorithms.AbortHandler#reset}
+ */
+ new ():yfiles.algorithms.AbortHandler;
+ /**
+ * Creates an instance of this class and attaches it to the given graph.
+ * If the given graph already has an attached handler instance, said instance
+ * will be returned and this method will not create a new handler instance.
+ *
+ * This method should be called by client code prior to starting a graph
+ * algorithm that may be terminated early.
+ *
+ * @param {yfiles.algorithms.Graph} graph the graph to which the handler will be attached.
+ * @return {yfiles.algorithms.AbortHandler} the handler instance for the given graph.
+ * @throws {yfiles.system.ArgumentNullException} if the given graph is null.
+ * @see {@link yfiles.algorithms.AbortHandler#hasHandler}
+ */
+ createForGraph(graph:yfiles.algorithms.Graph):yfiles.algorithms.AbortHandler;
+ /**
+ * Removes any attached instance of this class from the given graph.
+ * @param {yfiles.algorithms.Graph} graph the graph from which the handler will be removed.
+ * @throws {yfiles.system.ArgumentNullException} if the given graph is null.
+ */
+ removeFromGraph(graph:yfiles.algorithms.Graph):void;
+ /**
+ * Returns an instance of this class for the given graph.
+ * If {@link yfiles.algorithms.AbortHandler#createForGraph} has been used to attach a new
+ * handler to the given graph, said instance is returned. Otherwise a
+ * non-functional instance is returned whose methods do nothing. Use
+ * {@link yfiles.algorithms.AbortHandler#hasHandler} whether or not a handler
+ * has been already attached to the given graph.
+ * @param {yfiles.algorithms.Graph} graph the graph for which the handler should be retrieved.
+ * @return {yfiles.algorithms.AbortHandler}
+ * a handler for the given graph. Maybe a non-functional instance
+ * if no handler has been previously created.
+ * @throws {yfiles.system.ArgumentNullException} if the given graph is null.
+ * @see {@link yfiles.algorithms.AbortHandler#createForGraph}
+ * @see {@link yfiles.algorithms.AbortHandler#hasHandler}
+ */
+ getFromGraph(graph:yfiles.algorithms.Graph):yfiles.algorithms.AbortHandler;
+ /**
+ * Attaches the handler instance of the given source graph to the target
+ * graph as well.
+ *
+ * Note, if there is a handler attached to the given target graph,
+ * this method will silently replace said instance with the one attached
+ * to the source graph.
+ *
+ * @param {yfiles.algorithms.Graph} source the graph whose handler is attached to the target graph.
+ * @param {yfiles.algorithms.Graph} target
+ * the graph to which the handler of the source graph is
+ * attached.
+ * @throws {yfiles.system.ArgumentNullException} if the given source is null.
+ */
+ copyHandler(source:yfiles.algorithms.Graph,target:yfiles.algorithms.Graph):void;
+ /**
+ * Determines whether or not an instance of this class is attached to the
+ * given graph.
+ * @param {yfiles.algorithms.Graph} graph the graph which to check for a handler.
+ * @return {boolean}
+ * true if a handler is attached to the given graph;
+ * false otherwise.
+ * @throws {yfiles.system.ArgumentNullException} if the given graph is null.
+ */
+ hasHandler(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Determines if an algorithm should terminate its work early.
+ * This method returns true if the algorithm should terminate
+ * gracefully and ensure that the processed graph remains in a consistent
+ * state.
+ * This method throws an {@link yfiles.algorithms.AlgorithmAbortedException} if the algorithm
+ * should terminate immediately.
+ *
+ * This convenience method is meant for one-time checks only.
+ * For performance critical code that checks repeatedly, it is recommended to
+ * retrieve the given graph's attached handler once and only call the
+ * handler's {@link yfiles.algorithms.AbortHandler#check} method repeatedly.
+ *
+ * @return {boolean}
+ * true, if the algorithm should stop as soon as possible
+ * while still providing some valid result and false if the
+ * algorithm should continue normally.
+ * @throws {yfiles.algorithms.AlgorithmAbortedException}
+ * if the algorithm should terminate
+ * immediately.
+ * @throws {yfiles.system.ArgumentNullException} if the given graph is null.
+ * @see {@link yfiles.algorithms.AbortHandler#check}
+ * @see {@link yfiles.algorithms.AbortHandler#stop}
+ */
+ check(graph:yfiles.algorithms.Graph):boolean;
+ };
+ /**
+ * Common base type for both {@link yfiles.algorithms.Node} and {@link yfiles.algorithms.Edge}.
+ * This type does not add public functionality to its base type.
+ */
+ export interface GraphObject extends Object{
+ }
+ var GraphObject:{
+ $class:yfiles.lang.Class;
+ };
+ /**
+ * Exception that gets thrown by an algorithm if a immediate termination
+ * request is detected.
+ * @see {@link yfiles.algorithms.AbortHandler}
+ * @see {@link yfiles.algorithms.AbortHandler}
+ * @see {@link yfiles.algorithms.AbortHandler#check}
+ */
+ export interface AlgorithmAbortedException extends yfiles.lang.Exception{
+ }
+ var AlgorithmAbortedException:{
+ $class:yfiles.lang.Class;
+ WithMessage:{
+ new (msg:string):yfiles.algorithms.AlgorithmAbortedException;
+ };
+ new ():yfiles.algorithms.AlgorithmAbortedException;
+ };
+ /**
+ * Responsible for graph bipartition problems.
+ * A bipartite graph is a graph whose node set can be partitioned
+ * into two sets in such a way that all edges in the graph
+ * connect nodes that belong to different partitions. In other words,
+ * there are no edges connecting nodes that belong to the same
+ * partition.
+ */
+ export interface Bipartitions extends Object{
+ }
+ var Bipartitions:{
+ $class:yfiles.lang.Class;
+ /**
+ * Marker for a node that belongs to the red partition.
+ */
+ RED:Object;
+ /**
+ * Marker for a node that belongs to the blue partition.
+ */
+ BLUE:Object;
+ /**
+ * Tests whether or not the given graph is bipartite.
+ * Complexity:O(nodeCount()+edgeCount())
+ */
+ isBipartite(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Calculates a bipartition of the given graph if one exists.
+ * If the graph is bipartite then for all nodes of the
+ * given graph either {@link yfiles.algorithms.Bipartitions#RED} or {@link yfiles.algorithms.Bipartitions#BLUE}
+ * objects will put in the given node map, depending on
+ * the partition the node belongs to.
+ * Complexity:O(nodeCount()+edgeCount())
+ * @return {boolean} isBipartite(graph)
+ */
+ getBipartition(graph:yfiles.algorithms.Graph,markMap:yfiles.algorithms.INodeMap):boolean;
+ };
+ /**
+ * This class provides services that center around breadth first search (BFS).
+ */
+ export interface Bfs extends Object{
+ }
+ var Bfs:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns layers of nodes constructed by a breadth first search.
+ * The first of these layers contains all nodes within the given NodeList.
+ * These nodes are the core nodes from where an
+ * undirected breath first search to the other nodes starts.
+ * In the i-th layer are previously unassigned nodes that are
+ * connected to nodes in the (i-1)-th layer.
+ * Complexity: O(graph.N()+graph.E())
+ */
+ getLayersFromNodeList(graph:yfiles.algorithms.Graph,coreNodes:yfiles.algorithms.NodeList):yfiles.algorithms.NodeList[];
+ /**
+ * Like {@link yfiles.algorithms.Bfs#getLayersFromNodeList}, but this time the core nodes
+ * are identified by a boolean predicate.
+ * Precondition: isCoreNode.getBool(node) defined for all nodes in graph.
+ */
+ getLayersFromNodeMap(graph:yfiles.algorithms.Graph,isCoreNode:yfiles.algorithms.IDataProvider):yfiles.algorithms.NodeList[];
+ /**
+ * Like {@link yfiles.algorithms.Bfs#getLayersFromNodeMap}.
+ * Additionally
+ * the provided node map will be filled with integers that
+ * hold the layer number for each node.
+ */
+ getLayersFromNodeMapToMap(graph:yfiles.algorithms.Graph,isCoreNode:yfiles.algorithms.IDataProvider,layerIDMap:yfiles.algorithms.INodeMap):yfiles.algorithms.NodeList[];
+ /**
+ * Like {@link yfiles.algorithms.Bfs#getLayersFromNodeList}.
+ * Additionally
+ * the provided node map will be filled with integers that
+ * hold the layer number for each node.
+ */
+ getLayersFromNodeListUndirected(graph:yfiles.algorithms.Graph,coreNodes:yfiles.algorithms.NodeList,layerIDMap:yfiles.algorithms.INodeMap):yfiles.algorithms.NodeList[];
+ /**
+ * Returns layers of nodes constructed by a breadth first search.
+ * The first of these layers contains all nodes within the given NodeList.
+ * These nodes are the core nodes from where either a directed or undirected
+ * breath first search to the other nodes starts.
+ * In the i-th layer are previously unassigned nodes that are
+ * successors to nodes in the (i-1)-th layer.
+ * Complexity: O(graph.N()+graph.E())
+ */
+ getLayersFromNodeListToMap(graph:yfiles.algorithms.Graph,coreNodes:yfiles.algorithms.NodeList,directed:boolean,layerIDMap:yfiles.algorithms.INodeMap):yfiles.algorithms.NodeList[];
+ /**
+ * Returns layers of nodes constructed by a breadth first search.
+ * The first of these layers contains all nodes within the given NodeList.
+ * These nodes are the core nodes from where either a directed or undirected
+ * breath first search to the other nodes starts.
+ * In the i-th layer are previously unassigned nodes that are
+ * successors to nodes in the (i-1)-th layer.
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the graph the bfs is running on
+ * @param {yfiles.algorithms.NodeList} coreNodes contains the nodes the bfs run starts from
+ * @param {boolean} directed true: only outgoing edges are attended, false: all edges
+ * @param {yfiles.algorithms.INodeMap} layerIDMap is used to store the layer depths information in
+ * @param {number} maxLayers number of layers that will be returned. "0" for all layers
+ * @return {yfiles.algorithms.NodeList[]}
+ * an array of {@link yfiles.algorithms.NodeList}s representing the layers
+ */
+ getLayersWithMaxLayers(graph:yfiles.algorithms.Graph,coreNodes:yfiles.algorithms.NodeList,directed:boolean,layerIDMap:yfiles.algorithms.INodeMap,maxLayers:number):yfiles.algorithms.NodeList[];
+ /**
+ * Returns layers of nodes constructed by a breadth first search.
+ * The first of these layers contains all nodes within the given NodeList.
+ * These nodes are the core nodes from where either a directed or undirected
+ * breath first search to the other nodes starts.
+ * In the i-th layer are previously unassigned nodes that are
+ * successors to nodes in the (i-1)-th layer.
+ * Complexity: O(graph.N()+graph.E())
+ * @param {yfiles.algorithms.Graph} graph the graph the bfs is running on
+ * @param {yfiles.algorithms.NodeList} coreNodes contains the nodes the bfs run starts from
+ * @param {yfiles.algorithms.BfsDirection} direction
+ * specifies which edges to follow. One of
+ *
{@link yfiles.algorithms.BfsDirection#SUCCESSOR}, or
+ *
{@link yfiles.algorithms.BfsDirection#BOTH}
+ *
+ * @param {yfiles.algorithms.INodeMap} layerIDMap is used to store the layer depths information in
+ * @param {number} maxLayers number of layers that will be returned. "0" for all layers
+ * @return {yfiles.algorithms.NodeList[]}
+ * an array of {@link yfiles.algorithms.NodeList}s representing the layers
+ */
+ getLayersWithDirection(graph:yfiles.algorithms.Graph,coreNodes:yfiles.algorithms.NodeList,direction:yfiles.algorithms.BfsDirection,layerIDMap:yfiles.algorithms.INodeMap,maxLayers:number):yfiles.algorithms.NodeList[];
+ };
+ /**
+ * A general interface for iterating over a collection of objects.
+ * It can be regarded as a read-only view of such a collection.
+ * A YCursor acts like a movable pointer on the elements of a collection.
+ * The pointer can be moved forward and backward and the element currently pointed
+ * on can be accessed.
+ * The removal of elements can only be performed on the provider of the cursor,
+ * not on the cursor itself.
+ * (That's why the cursor presents a read-only view.)
+ * Implementations of this interface do not need to support operations marked "optional."
+ */
+ export interface ICursor extends Object{
+ /**
+ * true if the current cursor position is valid.
+ * @see Specified by {@link yfiles.algorithms.ICursor#ok}.
+ */
+ ok:boolean;
+ /**
+ * Moves this cursor one position forward.
+ * @see Specified by {@link yfiles.algorithms.ICursor#next}.
+ */
+ next():void;
+ /**
+ * Moves this cursor one position backward (optional).
+ * @see Specified by {@link yfiles.algorithms.ICursor#prev}.
+ */
+ prev():void;
+ /**
+ * Moves this cursor to the first valid cursor position (optional).
+ * @see Specified by {@link yfiles.algorithms.ICursor#toFirst}.
+ */
+ toFirst():void;
+ /**
+ * Moves this cursor to the last valid cursor position (optional).
+ * @see Specified by {@link yfiles.algorithms.ICursor#toLast}.
+ */
+ toLast():void;
+ /**
+ * The object currently pointed on.
+ * @see Specified by {@link yfiles.algorithms.ICursor#current}.
+ */
+ current:Object;
+ /**
+ * The number of elements that can be accessed with this cursor.
+ * @see Specified by {@link yfiles.algorithms.ICursor#size}.
+ */
+ size:number;
+ }
+ var ICursor:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * A general interface for setting data.
+ * A data acceptor associates data with data holders.
+ * It constitutes a write-only view on particular data.
+ */
+ export interface IDataAcceptor extends Object{
+ /**
+ * Sets an object value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#set}.
+ */
+ set(dataHolder:Object,value:Object):void;
+ /**
+ * Sets an integer value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#setInt}.
+ */
+ setInt(dataHolder:Object,value:number):void;
+ /**
+ * Sets a double value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#setDouble}.
+ */
+ setDouble(dataHolder:Object,value:number):void;
+ /**
+ * Sets a boolean value associated with the given data holder.
+ * This method may throw an UnsupportedOperationException.
+ * @see Specified by {@link yfiles.algorithms.IDataAcceptor#setBool}.
+ */
+ setBool(dataHolder:Object,value:boolean):void;
+ }
+ var IDataAcceptor:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * Interface that combines the {@link yfiles.algorithms.IDataProvider} and {@link yfiles.algorithms.IDataAcceptor}
+ * interfaces.
+ * This interface does not declare any additional methods.
+ */
+ export interface IDataMap extends Object,yfiles.algorithms.IDataProvider,yfiles.algorithms.IDataAcceptor{
+ }
+ var IDataMap:{
+ $class:yfiles.lang.Class;
+ isInstance(o:Object):boolean;
+ };
+ /**
+ * This class provides methods for automatically partitioning nodes of a graph into groups.
+ */
+ export interface Groups extends Object{
+ }
+ var Groups:{
+ $class:yfiles.lang.Class;
+ /**
+ * Partitions the graph into groups using edge betweenness centrality (see {@link yfiles.algorithms.Centrality#edgeBetweenness}.
+ * In each iteration the edge with the highest
+ * betweenness centrality is removed from the graph. The method stops, if there are no more edges to remove. The
+ * clustering with the best quality reached during the process will be returned.
+ * Complexity:
+ * O(graph.E())*O(edgeBetweenness) (Note: is practical faster because edge betweenness is computed for
+ * subgraphs during the process and this algorithm terminates after maxGroupCount groups have been
+ * determined.)
+ * Precondition:minGroupCount <= maxGroupCount
+ * Precondition:minGroupCount <= graph.N()
+ * Precondition:maxGroupCount > 0
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} clusterIDs used as return value. This map gets a cluster ID of integer type for every node.
+ * @param {boolean} directed whether or not to consider the edges of the graph as directed.
+ * @param {number} minGroupCount the minimum number of groups to be returned.
+ * @param {number} maxGroupCount
+ * the maximum number of groups to be returned. The smaller this value is chosen the faster the
+ * overall computation time. Note that the upper bound on the number of groups is
+ * graph.N(). Note, that the number of returned groups is never less than the number
+ * of connected components of the graph.
+ * @param {yfiles.algorithms.IDataProvider} edgeCosts
+ * if null the edges of the graph are considered to have equal cost. Otherwise
+ * it must provide a non-negative double value (its cost) for every edge.
+ * @return {number} the number of different groups found.
+ */
+ edgeBetweennessClusteringWithCost(graph:yfiles.algorithms.Graph,clusterIDs:yfiles.algorithms.INodeMap,directed:boolean,minGroupCount:number,maxGroupCount:number,edgeCosts:yfiles.algorithms.IDataProvider):number;
+ /**
+ * Partitions the graph into groups using Edge Betweenness Clustering proposed by Girvan and Newman.
+ * In each
+ * iteration the edge with the highest betweenness centrality is removed from the graph. The method stops, if there
+ * are no more edges to remove or if the requested maximum number of groups is found. The clustering with the best
+ * quality reached during the process is returned.
+ * The algorithm includes several heuristic speed-up techniques available through the quality/time ratio. For the
+ * highest quality setting, it is used almost unmodified. The fast betweenness approximation of Brandes und Pich
+ * (Centrality Estimation in Large Networks) is employed for values around 0.5. Typically, this results in a
+ * tiny decrease in quality but a large speed-up and is the recommended setting. To achieve the lowest running time, a
+ * local betweenness calculation is used (Gregory: Local Betweenness for Finding Communities in Networks).
+ * Complexity:
+ * O(graph.E())*O(edgeBetweenness) (Note: is practical faster because edge betweenness is computed for
+ * subgraphs during the process and this algorithm terminates after maxGroupCount groups have been
+ * determined.)
+ * Precondition:minGroupCount <= maxGroupCount
+ * Precondition:minGroupCount <= graph.N()
+ * Precondition:maxGroupCount > 0
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} clusterIDs used as return value. This map gets a cluster ID of integer type for every node.
+ * @param {number} qualityTimeRatio
+ * a value between 0.0 (low quality, fast) and 1.0 (high quality, slow). The recommended value
+ * is 0.5.
+ * @param {number} minGroupCount the minimum number of groups to be returned.
+ * @param {number} maxGroupCount
+ * the maximum number of groups to be returned. The smaller this value is chosen the faster
+ * the overall computation time. Note, that the upper bound on the number of groups is
+ * graph.N() and that the number of returned groups is never less than the number
+ * of connected components of the graph.
+ * @param {boolean} refine whether the algorithm refines or discards the current grouping.
+ * @return {number} the number of different groups found
+ */
+ edgeBetweennessClustering(graph:yfiles.algorithms.Graph,clusterIDs:yfiles.algorithms.INodeMap,qualityTimeRatio:number,minGroupCount:number,maxGroupCount:number,refine:boolean):number;
+ /**
+ * This method partitions the graph by analyzing its biconnected component structure.
+ * Nodes will be grouped in a way
+ * that the nodes within each group are biconnected. Nodes that belong to multiple biconnected components will be
+ * assigned to exactly one of these components.
+ *
+ * Note:
+ * Biconnected components are defined for undirected graphs only.
+ * As a consequence, this algorithm ignores selfloops and isolated nodes with
+ * only selfloop edges or no edges at all are not assigned to any group,
+ * i.e. the groupID for such a node will be null.
+ *
+ * Complexity: O(graph.E()+graph.N())
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} groupIDs used as return value. This map gets a cluster ID of integer type for every node.
+ * @return {number} the number of different groups found.
+ */
+ biconnectedComponentGrouping(graph:yfiles.algorithms.Graph,groupIDs:yfiles.algorithms.INodeMap):number;
+ };
+ /**
+ * Represents an edge, i.e., a directed connection between two nodes (represented
+ * by instances of class {@link yfiles.algorithms.Node}) in the directed graph data type {@link yfiles.algorithms.Graph}.
+ * The directed stems from the fact that an edge has a distinct source node
+ * and a distinct target node.
+ * Using pair notation, an edge would be written as
+ * (<source node>, <target node>).
+ * Most notably, an edge provides access to its source node ({@link yfiles.algorithms.Edge#source})
+ * and its target node ({@link yfiles.algorithms.Edge#target}).
+ * Note that an edge can have the same node as its source and target.
+ * Such an edge is then called "self-loop" and method {@link yfiles.algorithms.Edge#selfLoop} yields
+ * true.
+ * Important:
+ * Class Graph is the single authority for any structural changes to the graph data
+ * type.
+ * Specifically, this means that there is no way to create or delete a node or an
+ * edge without using an actual Graph instance.
+ */
+ export interface Edge extends yfiles.algorithms.GraphObject{
+ /**
+ * Creates a copy of this edge that will be inserted into the given graph connecting
+ * the given source and target nodes.
+ * @param {yfiles.algorithms.Graph} g The graph the created edge will belong to.
+ * @param {yfiles.algorithms.Node} v The source node of the created edge.
+ * @param {yfiles.algorithms.Node} w The target node of the created edge.
+ * @return {yfiles.algorithms.Edge} The newly created Edge object.
+ */
+ createCopy(g:yfiles.algorithms.Graph,v:yfiles.algorithms.Node,w:yfiles.algorithms.Node):yfiles.algorithms.Edge;
+ /**
+ * The graph this edge belongs to.
+ * If the edge does not belong to a graph, because it was removed or hidden from
+ * it, this method returns null.
+ */
+ graph:yfiles.algorithms.Graph;
+ /**
+ * The index of this edge within its graph G.
+ * Edge indices represent the ordering of standard edge iteration on G.
+ * The value of an index is >= 0 and < G.edgeCount().
+ * Note that indices are subject to change whenever the sequence of edges in a
+ * graph is modified by either removing, hiding, reinserting, or unhiding an edge,
+ * or by explicitly changing its position in the sequence.
+ * Precondition: This edge must belong to some graph.
+ * @see {@link yfiles.algorithms.Graph#removeEdge}
+ * @see {@link yfiles.algorithms.Graph#hideEdge}
+ * @see {@link yfiles.algorithms.Graph#reInsertEdge}
+ * @see {@link yfiles.algorithms.Graph#unhideEdge}
+ * @see {@link yfiles.algorithms.Graph#moveToFirstEdge}
+ * @see {@link yfiles.algorithms.Graph#moveToLastEdge}
+ */
+ index:number;
+ /**
+ * The source node connected to this edge.
+ * @see {@link yfiles.algorithms.Edge#target}
+ */
+ source:yfiles.algorithms.Node;
+ /**
+ * The target node connected to this edge.
+ * @see {@link yfiles.algorithms.Edge#source}
+ */
+ target:yfiles.algorithms.Node;
+ /**
+ * Returns the node at the opposite edge end with respect to the given node.
+ * Note that self-loops have the same node at both edge ends.
+ * Precondition: The given node must be either the edge's source node or target node.
+ */
+ opposite(v:yfiles.algorithms.Node):yfiles.algorithms.Node;
+ /**
+ * true if and only if this edge is a self-loop.
+ * An edge is called a self-loop, if it is adjacent to only one node, i.e.,
+ * source node and target node are the same.
+ */
+ selfLoop:boolean;
+ /**
+ * Returns a String representation of this edge.
+ */
+ toString():string;
+ /**
+ * Callback method that is invoked from a graph just before this edge will be
+ * reinserted into that graph.
+ */
+ onReinsert():void;
+ /**
+ * The successor of this edge in the list of outgoing edges at its source
+ * node.
+ * If this edge is the last outgoing edge at its source node, then null
+ * is returned.
+ * Precondition: This edge must belong to some graph.
+ * @see {@link yfiles.algorithms.Edge#prevOutEdge}
+ * @see {@link yfiles.algorithms.Edge#nextInEdge}
+ */
+ nextOutEdge:yfiles.algorithms.Edge;
+ /**
+ * The successor of this edge in the list of incoming edges at its target
+ * node.
+ * If this edge is the last incoming edge at its target node, then null
+ * is returned.
+ * Precondition: This edge must belong to some graph.
+ * @see {@link yfiles.algorithms.Edge#prevInEdge}
+ * @see {@link yfiles.algorithms.Edge#nextOutEdge}
+ */
+ nextInEdge:yfiles.algorithms.Edge;
+ /**
+ * The predecessor of this edge in the list of outgoing edges at its source
+ * node.
+ * If this edge is the first outgoing edge at its source node, then null
+ * is returned.
+ * Precondition: This edge must belong to some graph.
+ * @see {@link yfiles.algorithms.Edge#nextOutEdge}
+ * @see {@link yfiles.algorithms.Edge#prevInEdge}
+ */
+ prevOutEdge:yfiles.algorithms.Edge;
+ /**
+ * The predecessor of this edge in the list of incoming edges at its target
+ * node.
+ * If this edge is the first incoming edge at its target node, then null
+ * is returned.
+ * Precondition: This edge must belong to some graph.
+ * @see {@link yfiles.algorithms.Edge#nextInEdge}
+ * @see {@link yfiles.algorithms.Edge#prevOutEdge}
+ */
+ prevInEdge:yfiles.algorithms.Edge;
+ }
+ var Edge:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new edge that belongs to the given graph.
+ * The new edge e has source node v and target node
+ * w.
+ * Edge e is inserted in such a way that an iteration over the edges
+ * at node v returns e
+ *
+ *
+ * after e1, if d1 == AFTER
+ *
+ *
+ * before e1, if d1 == BEFORE,
+ *
+ *
+ * and an iteration over the edges at w returns e
+ *
+ *
+ * after e2, if d2 == AFTER
+ *
+ *
+ * before e2, if d2 == BEFORE.
+ *
+ *
+ * Precondition:
+ * Edge e1 must have source node v and edge e2
+ * must have target node w.
+ * @param {yfiles.algorithms.Node} v The source node of the edge.
+ * @param {yfiles.algorithms.Edge} e1 An edge with source node v.
+ * @param {yfiles.algorithms.Node} w The target node of the edge.
+ * @param {yfiles.algorithms.Edge} e2 An edge with target node w.
+ * @param {yfiles.algorithms.GraphElementInsertion} d1
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ * @param {yfiles.algorithms.GraphElementInsertion} d2
+ * One of the object insertion specifiers {@link yfiles.algorithms.GraphElementInsertion#BEFORE} or {@link yfiles.algorithms.GraphElementInsertion#AFTER}.
+ */
+ new (g:yfiles.algorithms.Graph,v:yfiles.algorithms.Node,e1:yfiles.algorithms.Edge,w:yfiles.algorithms.Node,e2:yfiles.algorithms.Edge,d1:yfiles.algorithms.GraphElementInsertion,d2:yfiles.algorithms.GraphElementInsertion):yfiles.algorithms.Edge;
+ };
+ /**
+ * An event which indicates that a graph structure change occurred.
+ * This low-level event is generated by a graph when its structure changes.
+ * The event is passed to every {@link yfiles.algorithms.IGraphListener} object that registered to
+ * receive such events using the graph's
+ * {@link yfiles.algorithms.Graph#addGraphListener addGraphListener} method.
+ * The object that implements the GraphListener interface gets this GraphEvent when
+ * the event occurs.
+ * Each GraphEvent has a type that signals what kind of change occurred in the graph
+ * and a data object that is the object (either node or edge) that was involved
+ * in the structural change of the graph, e.g., the node that has been created or
+ * the edge that has been reversed.
+ */
+ export interface GraphEvent extends Object{
+ /**
+ * The type of this GraphEvent.
+ * It can be either of the type constants defined in this class.
+ */
+ type:yfiles.algorithms.GraphEventType;
+ /**
+ * The data object associated with this graph event.
+ * For a "Node"-associated event, it returns an object of type y.base.Node.
+ * For an "Edge"-associated event, it returns an object of type y.base.Edge.
+ * To check the type of event, see the method getType()
+ */
+ data:Object;
+ /**
+ * The graph that is the emitter of this event.
+ */
+ graph:yfiles.algorithms.Graph;
+ /**
+ * Returns a String representation of this GraphEvent object's type.
+ */
+ toString():string;
+ }
+ var GraphEvent:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new GraphEvent instance with given type and data.
+ */
+ new (source:yfiles.algorithms.Graph,type:yfiles.algorithms.GraphEventType,data:Object):yfiles.algorithms.GraphEvent;
+ };
+ /**
+ * Provides methods that check structural properties of a given graph.
+ */
+ export interface GraphChecker extends Object{
+ }
+ var GraphChecker:{
+ $class:yfiles.lang.Class;
+ /**
+ * Checks whether or not the given graph is acyclic, that is, if it contains no directed cycle.
+ * Note: isAcyclic(graph) <=> !isCyclic(graph).
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is acyclic; false, otherwise.
+ */
+ isAcyclic(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph is cyclic, that is, if it contains a directed cycle.
+ * Note: isCyclic(graph) <=> !isAcyclic(graph).
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is cyclic; false, otherwise.
+ */
+ isCyclic(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph is planar.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is planar; false, otherwise.
+ */
+ isPlanar(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph is connected.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is connected; false, otherwise.
+ */
+ isConnected(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given directed graph is strongly connected.
+ * @param {yfiles.algorithms.Graph} graph the given directed graph.
+ * @return {boolean} true if the graph is strongly connected; false, otherwise.
+ */
+ isStronglyConnected(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given undirected graph is biconnected.
+ * @param {yfiles.algorithms.Graph} graph the given undirected graph.
+ * @return {boolean} true if the graph is biconnected; false, otherwise.
+ */
+ isBiconnected(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given undirected graph is bipartite.
+ * @param {yfiles.algorithms.Graph} graph the given undirected graph.
+ * @return {boolean} true if the graph is bipartite; false, otherwise.
+ */
+ isBipartite(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph is a directed rooted tree
+ * where each node has a maximum of n children.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean}
+ * true if the graph is a directed rooted tree where each node has <= n children;
+ * false, otherwise.
+ */
+ isNaryTree(graph:yfiles.algorithms.Graph,n:number):boolean;
+ /**
+ * Checks whether or not the given graph is a directed rooted tree.
+ * Note: isRootedTree(graph) => isTree(graph).
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is a directed rooted tree; false, otherwise.
+ */
+ isRootedTree(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph is an undirected tree.
+ * Note: isRootedTree(graph) => isTree(graph).
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is an undirected tree; false, otherwise.
+ */
+ isTree(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether the given graph is a forest, that is,
+ * a graph whose connected components are directed rooted trees.
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph is a forest; false, otherwise.
+ */
+ isForest(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given graph contains no self-loops.
+ * Note: !isSelfLoopFree(graph) => !isAcyclic(graph).
+ * @param {yfiles.algorithms.Graph} graph the given graph.
+ * @return {boolean} true if the graph contains no self-loops; false, otherwise.
+ */
+ isSelfLoopFree(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given directed graph is simple.
+ * A graph is called simple if it contains no two distinct edges e1, e2 where
+ * e1.source() == e2.source() && e1.target() == e2.target().
+ * Note: isMultipleEdgeFree(graph) => isSimple(graph).
+ * @param {yfiles.algorithms.Graph} graph the given directed graph.
+ * @return {boolean} true if the graph is simple; false, otherwise.
+ */
+ isSimple(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Checks whether or not the given undirected graph contains no multiple edges.
+ * More precisely, the method returns true if the graph contains no two distinct
+ * edges e1, e2 that connect the same pairs of nodes in either direction.
+ * Note: isMultipleEdgeFree(graph) => isSimple(graph).
+ * @param {yfiles.algorithms.Graph} graph the given undirected graph.
+ * @return {boolean} true if the graph contains no multiple edges; false, otherwise.
+ */
+ isMultipleEdgeFree(graph:yfiles.algorithms.Graph):boolean;
+ };
+ /**
+ * Provides algorithms for determining certain connectivity components within a graph.
+ * Also provides convenience method for working with these components.
+ */
+ export interface GraphConnectivity extends Object{
+ }
+ var GraphConnectivity:{
+ $class:yfiles.lang.Class;
+ /**
+ * Returns the connected components of a given graph.
+ * A graph G is called connected if there is an
+ * undirected path between each pair of nodes belonging to G.
+ * The connected components of G are connected
+ * subgraphs that G consists of.
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @return {yfiles.algorithms.NodeList[]}
+ * an array of NodeLists each of which contains the nodes that belong to
+ * a common connected component of the graph.
+ */
+ connectedComponents(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList[];
+ /**
+ * Returns the connected components of a given graph.
+ * A graph G is called connected if there is an
+ * undirected path between each pair of nodes belonging to G.
+ * The connected components of G are connected
+ * subgraphs that G consists of.
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.INodeMap} compNum
+ * return value that will hold the zero-based number
+ * of the connected component that it belongs to. The component number of
+ * Node v is compNum.getInt().
+ * @return {number} the number of connected components of this graph.
+ */
+ connectedComponentsWithIndex(graph:yfiles.algorithms.Graph,compNum:yfiles.algorithms.INodeMap):number;
+ /**
+ * Makes a graph connected by adding additional edges to the graph.
+ * The number of edges that will be added is equal to one less the number of
+ * separate components of the original graph.
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @return {yfiles.algorithms.EdgeList} an edge list containing the edges added to this graph.
+ */
+ makeConnected(graph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Transforms the return values of {@link yfiles.algorithms.GraphConnectivity#connectedComponentsWithIndex} to
+ * an array of type NodeList, like it is returned by
+ * {@link yfiles.algorithms.GraphConnectivity#connectedComponents}.
+ */
+ toNodeListArray(graph:yfiles.algorithms.Graph,compNum:yfiles.algorithms.INodeMap,maxCompNum:number):yfiles.algorithms.NodeList[];
+ /**
+ * Checks whether or not the given graph is connected.
+ */
+ isConnected(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Calculates the biconnected components of a given undirected graph.
+ * The result is returned as an array of EdgeList objects each containing all
+ * edges that belong to the same biconnected component of
+ * the graph.
+ *
+ * Note: Selfloops do not belong to any biconnected component.
+ * Therefore no selfloops are included in the returned edge lists.
+ *
+ * Precondition: GraphChecker.isConnected(graph)
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ */
+ biconnectedComponents(graph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList[];
+ /**
+ * Calculates the biconnected components of a given undirected graph.
+ * The main result is returned in the form of an EdgeMap that provides
+ * for each edge a zero-based index of the biconnected component it belongs to.
+ *
+ * Note: Selfloops do not belong to any biconnected component.
+ * Therefore the component index for selfloops is always -1.
+ *
+ * Precondition: GraphChecker.isConnected(graph)
+ * Precondition: compNum defined for each edge in the graph.
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IEdgeMap} compNum
+ * return value that provides for each edge a zero-based index
+ * of the biconnected component it belongs to or
+ * -1 for selfloops.
+ * @return {number} the number of biconnected components found
+ */
+ biconnectedComponentsWithIndex(graph:yfiles.algorithms.Graph,compNum:yfiles.algorithms.IEdgeMap):number;
+ /**
+ * Calculates the biconnected components of a given undirected graph.
+ * Additionally, this method calculates the articulation points of the input
+ * graph. Articulation points are returned in the form of a NodeMap that
+ * provides for each node a boolean value indicating whether or not it is an
+ * articulation point.
+ *
+ * Note: Selfloops do not belong to any biconnected component.
+ * Therefore the component index for selfloops is always -1.
+ *
+ * Precondition: aPoint defined for each node in the graph
+ * @param {yfiles.algorithms.INodeMap} aPoint
+ * return value that provides for each node a boolean value
+ * indicating whether or not it is an articulation point.
+ */
+ biconnectedComponentsWithIndexAndArticulationPoint(graph:yfiles.algorithms.Graph,compNum:yfiles.algorithms.IEdgeMap,aPoint:yfiles.algorithms.INodeMap):number;
+ /**
+ * Transforms the return values of {@link yfiles.algorithms.GraphConnectivity#biconnectedComponentsWithIndex} to
+ * an array of {@link yfiles.algorithms.EdgeList}s, like it is returned by
+ * {@link yfiles.algorithms.GraphConnectivity#biconnectedComponents}.
+ */
+ toEdgeListArray(graph:yfiles.algorithms.Graph,compNum:yfiles.algorithms.IEdgeMap,maxCompNum:number):yfiles.algorithms.EdgeList[];
+ /**
+ * Makes the given graph biconnected by inserting a minimum number of edges
+ * in the graph.
+ * The given graph is considered to be undirected.
+ * Precondition: GraphChecker.isConnected(graph)
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @return {yfiles.algorithms.EdgeList} an edge list containing the edges added to this graph.
+ */
+ makeBiconnected(graph:yfiles.algorithms.Graph):yfiles.algorithms.EdgeList;
+ /**
+ * Checks whether or not the given graph is biconnected.
+ */
+ isBiconnected(graph:yfiles.algorithms.Graph):boolean;
+ /**
+ * Determines the set of nodes that can be reached in the given graph when starting
+ * from a given node.
+ * Precondition: reached.length = graph.N()
+ * @param {yfiles.algorithms.Graph} graph the graph the search is performed on
+ * @param {yfiles.algorithms.Node} start the node the search is started from
+ * @param {boolean} directed
+ * traverses edges only from source to target if true. Otherwise
+ * traverses edges in both directions.
+ * @param {boolean[]} reached
+ * the return value. a boolean array that has value true at field
+ * v.index() iff node v can be reached by the dfs search.
+ */
+ reachable(graph:yfiles.algorithms.Graph,start:yfiles.algorithms.Node,directed:boolean,reached:boolean[]):void;
+ /**
+ * Similar to {@link yfiles.algorithms.GraphConnectivity#reachable}.
+ * Additionally
+ * it is possible to specify a set of forbidden edges that will not be traversed
+ * when performing the search.
+ * Precondition: forbiddenEdges.length = graph.E()
+ * @param {yfiles.algorithms.Graph} graph the graph DFS is performed on
+ * @param {yfiles.algorithms.Node} start the node DFS is started from
+ * @param {boolean} directed
+ * traverses edges only from source to target if true. Otherwise
+ * traverses edges in both directions.
+ * @param {boolean[]} forbidden
+ * marks edges that may not be traversed by DFS. An edge e
+ * is marked as forbidden if forbidden[e.index()] == true.
+ * @param {boolean[]} reached
+ * the return value. a boolean array that has value true at field
+ * v.index() iff node v can be reached by the dfs search.
+ */
+ reachableWithForbidden(graph:yfiles.algorithms.Graph,start:yfiles.algorithms.Node,directed:boolean,forbidden:boolean[],reached:boolean[]):void;
+ /**
+ * Determines the direct or indirect successors of a given set of nodes.
+ * A direct successor
+ * of a node is the target node of an outgoing edge connected to a node.
+ * An indirect successor of a node is a direct successor to another successor of a node.
+ * @param {yfiles.algorithms.Graph} graph the graph to act upon
+ * @param {yfiles.algorithms.NodeList} startNodes contains the node the search is started from
+ * @param {number} maxDistance
+ * limits the distance between a start node and a returned node. For all returned
+ * nodes there must be a path to a start node that has a length equal or smaller than maxDistance.
+ * Setting maxDistance to 1 will only yield the direct successors of all start nodes. On the other hand,
+ * setting maxDistance to graph.N() or larger, will yield all successors of all start nodes.
+ * @return {yfiles.algorithms.NodeList}
+ * a NodeList that contains all direct and indirect successors of a node. The order
+ * of the returned nodes follows is determined by a breadth first search.
+ * No start node will be part of the resulting set.
+ */
+ getSuccessors(graph:yfiles.algorithms.Graph,startNodes:yfiles.algorithms.NodeList,maxDistance:number):yfiles.algorithms.NodeList;
+ /**
+ * Determines the direct or indirect predecessors of a given set of nodes.
+ * A direct predecessor
+ * of a node is the source node of an ingoing edge connected to a node.
+ * An indirect predecessor of a node is a direct predecessor to another predecessor of a node.
+ * @param {yfiles.algorithms.Graph} graph the graph to act upon
+ * @param {yfiles.algorithms.NodeList} startNodes contains the node the search is started from
+ * @param {number} maxDistance
+ * limits the distance between a start node and a returned node. For all returned
+ * nodes there must be a path to a start node that has a length equal or smaller than maxDistance.
+ * Setting maxDistance to 1 will only yield the direct predecessors of all start nodes. On the other hand,
+ * setting maxDistance to graph.N() or larger, will yield all predecessors of all start nodes.
+ * @return {yfiles.algorithms.NodeList}
+ * a NodeList that contains all direct and indirect predecessors of a node. The order
+ * of the returned nodes follows is determined by a breadth first search.
+ * No start node will be part of the resulting set.
+ */
+ getPredecessors(graph:yfiles.algorithms.Graph,startNodes:yfiles.algorithms.NodeList,maxDistance:number):yfiles.algorithms.NodeList;
+ /**
+ * Determines the direct or indirect neighbors of a given set of nodes.
+ * A direct neighbor
+ * of a node is directly connected by an edge to that node.
+ * An indirect neighbor of a node is directly connected to another direct or indirect neighbor of a node.
+ * @param {yfiles.algorithms.Graph} graph the graph to act upon
+ * @param {yfiles.algorithms.NodeList} startNodes contains the node the search is started from
+ * @param {number} maxDistance
+ * limits the distance between a start node and a returned node. For all returned
+ * nodes there must be a path to a start node that has a length equal or smaller than maxDistance.
+ * Setting maxDistance to 1 will only yield the direct neighbors of all start nodes. On the other hand,
+ * setting maxDistance to graph.N() or larger, will yield all neighbors of all start nodes.
+ * @return {yfiles.algorithms.NodeList}
+ * a NodeList that contains all direct and indirect neighbors of a node.
+ * The order of the returned nodes follows is determined by a breadth first search.
+ * No start node will be part of the resulting set.
+ */
+ getNeighbors(graph:yfiles.algorithms.Graph,startNodes:yfiles.algorithms.NodeList,maxDistance:number):yfiles.algorithms.NodeList;
+ /**
+ * Returns the connected components of a given graph.
+ * A graph G is called strongly connected if there is an
+ * directed path between each pair of nodes belonging to G.
+ * The strongly connected components of G are strongly connected
+ * subgraphs that G consists of.
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @return {yfiles.algorithms.NodeList[]}
+ * an array of NodeLists each of which contains the nodes that belong to
+ * a common connected component of the graph.
+ */
+ stronglyConnectedComponents(graph:yfiles.algorithms.Graph):yfiles.algorithms.NodeList[];
+ /**
+ * Returns the connected components of a given graph.
+ * A graph G is called strongly connected if there is an
+ * directed path between each pair of nodes belonging to G.
+ * The strongly connected components of G are strongly connected
+ * subgraphs that G consists of.
+ * Complexity: O(graph.N() + graph.E())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.INodeMap} compNum
+ * return value that will hold the zero-based number
+ * of the strongly connected component that it belongs to. The component number of
+ * Node v is compNum.getInt().
+ * @return {number} the number of strongly connected components of this graph.
+ */
+ stronglyConnectedComponentsWithIndex(graph:yfiles.algorithms.Graph,compNum:yfiles.algorithms.INodeMap):number;
+ /**
+ * Checks whether or not the given graph is strongly connected.
+ */
+ isStronglyConnected(graph:yfiles.algorithms.Graph):boolean;
+ };
+ /**
+ * Very simple default implementation of a Copy Factory that creates {@link yfiles.algorithms.Graph} instances
+ * and simply delegates to the {@link yfiles.algorithms.Graph#createNode} and
+ * {@link yfiles.algorithms.Graph#createEdgeBetween} method.
+ */
+ export interface GraphCopyFactory extends Object,yfiles.algorithms.GraphCopier.ICopyFactory{
+ /**
+ * This implementation does nothing.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#preCopyGraphData}.
+ */
+ preCopyGraphData(hint:yfiles.algorithms.Graph,newGraph:yfiles.algorithms.Graph):void;
+ /**
+ * This implementation does nothing.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#postCopyGraphData}.
+ */
+ postCopyGraphData(originalGraph:yfiles.algorithms.Graph,newGraph:yfiles.algorithms.Graph,nodeMap:yfiles.algorithms.IMap,edgeMap:yfiles.algorithms.IMap):void;
+ /**
+ * Copies the originalNode from the source graph to the new targetGraph.
+ * @param {yfiles.algorithms.Graph} targetGraph the graph to create the new node in
+ * @param {yfiles.algorithms.Node} originalNode the original node from the source graph
+ * @return {yfiles.algorithms.Node} the newly created node
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyNode}.
+ */
+ copyNode(targetGraph:yfiles.algorithms.Graph,originalNode:yfiles.algorithms.Node):yfiles.algorithms.Node;
+ /**
+ * Copies the originalEdge from the source graph to the new targetGraph
+ * using the specified new source and target node in the target graph.
+ * @param {yfiles.algorithms.Graph} targetGraph the graph to create the new node in
+ * @param {yfiles.algorithms.Node} newSource the source node in the target graph to use for the newly created edge
+ * @param {yfiles.algorithms.Node} newTarget the target node in the target graph to use for the newly created edge
+ * @param {yfiles.algorithms.Edge} originalEdge the original edge from the source graph
+ * @return {yfiles.algorithms.Edge} the newly created edge
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#copyEdge}.
+ */
+ copyEdge(targetGraph:yfiles.algorithms.Graph,source:yfiles.algorithms.Node,target:yfiles.algorithms.Node,originalEdge:yfiles.algorithms.Edge):yfiles.algorithms.Edge;
+ /**
+ * Creates a new {@link yfiles.algorithms.Graph}.
+ * @see Specified by {@link yfiles.algorithms.GraphCopier.ICopyFactory#createGraph}.
+ */
+ createGraph():yfiles.algorithms.Graph;
+ }
+ var GraphCopyFactory:{
+ $class:yfiles.lang.Class;
+ };
+ /**
+ * This class provides methods to determine various centrality indices of nodes or edges of a graph.
+ * Centrality indices serve to quantify an intuitive feeling that in most networks some nodes
+ * or edges are "more central" than others. The provided methods assign a value of type double to each node or edge of
+ * a graph that represents its centrality. The higher an assigned value the more central the element
+ * is considered by the algorithm.
+ * Also, this class provides convenience methods that normalize the returned centrality values to lie within
+ * the interval [0..1].
+ */
+ export interface Centrality extends Object{
+ }
+ var Centrality:{
+ $class:yfiles.lang.Class;
+ /**
+ * Computes betweenness centrality for each node of a given graph.
+ * Betweenness Centrality is a measure for how often a node lies on a shortest path between
+ * each pair of nodes in the graph. Removing a central node will cause many shortest paths to change.
+ * Complexity: O(graph.N()*graph.E()) for unweighted graphs, O(graph.N() * (graph.E()+graph.N()) * log(graph.N()) for weighted graphs.
+ * Precondition: NodeMap centrality with values initially zero
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} centrality return value. A NodeMap which will holds a non-negative centrality value of type double for each node.
+ * @param {boolean} directed
+ * whether to consider the edges of the graph as directed or undirected.
+ * If false, the algorithm traverse every edge in both direction regardless of the direction of the edge.
+ * @param {yfiles.algorithms.IDataProvider} edgeCosts
+ * if null the edges of the graph are considered to have equal cost. Otherwise
+ * it must provide a strictly positive double value (its cost) for every edge. Invalid values are assumed
+ * to be 1.0.
+ */
+ nodeBetweenness(graph:yfiles.algorithms.Graph,centrality:yfiles.algorithms.INodeMap,directed:boolean,edgeCosts:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Computes betweenness centrality for each edge of a given graph.
+ * Like {@link yfiles.algorithms.Centrality#nodeBetweenness} but applied to edges.
+ * Precondition: EdgeMap centrality with values initially zero
+ * @param {yfiles.algorithms.IEdgeMap} centrality return value. A EdgeMap which will hold a non-negative centrality value of type double for each edge.
+ */
+ edgeBetweenness(graph:yfiles.algorithms.Graph,centrality:yfiles.algorithms.IEdgeMap,directed:boolean,edgeCosts:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Computes betweenness centrality for each node and edge of a given graph.
+ * Like {@link yfiles.algorithms.Centrality#nodeBetweenness} but applied to both nodes and edges.
+ * Precondition: NodeMap nodeCentrality with values initially zero
+ * Precondition: EdgeMap edgeCentrality with values initially zero
+ * @param {yfiles.algorithms.INodeMap} nodeCentrality return value. A NodeMap which will hold the centrality value of type double for every node.
+ * @param {yfiles.algorithms.IEdgeMap} edgeCentrality return value. A EdgeMap which will hold the centrality value of type double for every edge.
+ */
+ nodeEdgeBetweenness(graph:yfiles.algorithms.Graph,nodeCentrality:yfiles.algorithms.INodeMap,edgeCentrality:yfiles.algorithms.IEdgeMap,directed:boolean,edgeCosts:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Computes the closeness centrality for the nodes of a graph.
+ * Closeness centrality is defined as the reciprocal
+ * of the sum of
+ * shortest path distances of a node to all other nodes in the graph. Therefore a node with high closeness
+ * centrality has short distances to all other nodes of a graph. Also note, that for unconnected graphs
+ * the centrality values of all nodes will be zero, since the distance to some nodes is infinite.
+ * Precondition:GraphChecker.isConnected(graph)
+ * Complexity:
+ * O(graph.N()^2 + graph.N()*graph.E()) for unweighted graphs, O( (graph.N()*graph.E()) + graph.N()^2 *log(graph.N()))
+ * or: O(graph.N()) * O(Uniform) for unweighted, O(allPairs) for weighted graphs
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} closeness return value. A map which hold the centrality value of type double for every node.
+ * @param {boolean} directed whether to consider the edges of the graph as directed or undirected.
+ * @param {yfiles.algorithms.IDataProvider} edgeCosts
+ * when null the edges of the graph are considered to have equal cost. Otherwise
+ * it must provide a non-negative double value (its cost) for every edge.
+ */
+ closenessCentrality(graph:yfiles.algorithms.Graph,closeness:yfiles.algorithms.INodeMap,directed:boolean,edgeCosts:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Computes the graph centrality for the nodes of a graph.
+ * Graph centrality is defined as the reciprocal
+ * of the maximum of all shortest path distances from a node to all other nodes in the graph.
+ * Nodes with high graph centrality have short distances to all other nodes in the graph.
+ * Also note, that for unconnected graphs the centrality values of all nodes will be zero, since the
+ * distance to some nodes is infinite.
+ * Complexity:
+ * O(graph.N()^2 + graph.N()*graph.E()) for unweighted graphs, O( (graph.N()*graph.E()) + graph.N()^2 *log(graph.N()))
+ * or: O(graph.N()) * O(Uniform) for unweighted, O(allPairs) for weighted graphs
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} centrality return value. A map which hold the centrality value of type double for every node.
+ * @param {boolean} directed whether to consider the edges of the graph as directed or undirected.
+ * @param {yfiles.algorithms.IDataProvider} edgeCosts
+ * when null the edges of the graph are considered to have equal cost. Otherwise
+ * it must provide a non-negative double value (its cost) for every edge.
+ */
+ graphCentrality(graph:yfiles.algorithms.Graph,centrality:yfiles.algorithms.INodeMap,directed:boolean,edgeCosts:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Computes the degree centrality for the nodes of a graph.
+ * Degree centrality measures in-, out- or overall degree of
+ * a node.
+ * Complexity: O(graph.N())
+ * Precondition: at least one of the flags considerInEdges and considerOutEdges must be true.
+ * @param {yfiles.algorithms.Graph} graph the input graph.
+ * @param {yfiles.algorithms.INodeMap} centrality return value. A map which provides the degree centrality as double value for every node.
+ */
+ degreeCentrality(graph:yfiles.algorithms.Graph,centrality:yfiles.algorithms.INodeMap,considerInEdges:boolean,considerOutEdges:boolean):void;
+ /**
+ * Computes the weight centrality for the nodes of a graph.
+ * Weight centrality measures the weight associated with incoming, outgoing, or
+ * all edges of a node.
+ * Note that weight centrality degenerates to degree centrality when the edges
+ * have uniform weight.
+ * In particular, when parameter 'edgeWeights' is null then
+ * {@link yfiles.algorithms.Centrality#degreeCentrality degreeCentrality}
+ * is invoked instead.
+ * Complexity: O(graph.E())
+ * @param {yfiles.algorithms.Graph} graph The input graph.
+ * @param {yfiles.algorithms.INodeMap} centrality
+ * Return value.
+ * A map which provides the value centrality as double value for
+ * every node.
+ * @param {boolean} considerInEdges Whether the weights associated with incoming edges should be considered.
+ * @param {boolean} considerOutEdges Whether the weights associated with outgoing edges should be considered.
+ * @param {yfiles.algorithms.IDataProvider} edgeWeights
+ * When null, the edges of the graph are considered to have uniform
+ * weight of 1.0.
+ * Otherwise it must provide a non-negative double value (the weight)
+ * for every edge.
+ */
+ weightCentrality(graph:yfiles.algorithms.Graph,centrality:yfiles.algorithms.INodeMap,considerInEdges:boolean,considerOutEdges:boolean,edgeWeights:yfiles.algorithms.IDataProvider):void;
+ /**
+ * This method normalizes the double values of a node map by dividing all values by the maximum of all values (maximum norm).
+ * Note, if the maximum value is Double.POSITIVE_INFINITY, all values other than Double.POSITIVE_INFINITY
+ * are set to 0.
+ * Precondition: for each node n: map.getDouble(n) >= 0
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.INodeMap} map return value that holds double values between zero and one.
+ */
+ normalizeNodeMap(graph:yfiles.algorithms.Graph,map:yfiles.algorithms.INodeMap):void;
+ /**
+ * Like {@link yfiles.algorithms.Centrality#normalizeNodeMap}, but for EdgeMap.
+ * Precondition: for each edge e: map.getDouble(e) >= 0
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IEdgeMap} map return value that holds double values between zero and one.
+ */
+ normalizeEdgeMap(graph:yfiles.algorithms.Graph,map:yfiles.algorithms.IEdgeMap):void;
+ };
+ /**
+ * Framework class for depth first search (DFS) based algorithms.
+ * To write graph algorithms that are based on a depth first search
+ * one can extend this class and overwrite appropriate callback
+ * methods provided by this class.
+ */
+ export interface Dfs extends Object{
+ /**
+ * NodeMap that indicates the state of the nodes as they
+ * are visited by this algorithm.
+ * Possible states of a node are
+ * {@link yfiles.algorithms.Dfs#WHITE WHITE}, {@link yfiles.algorithms.Dfs#GRAY GRAY} and {@link yfiles.algorithms.Dfs#BLACK BLACK}.
+ */
+ stateMap:yfiles.algorithms.INodeMap;
+ /**
+ * Specifies whether or not to interpret the edges of the graph
+ * as directed.
+ * By default directed mode is disabled.
+ */
+ directedMode:boolean;
+ /**
+ * Specifies whether or not to continue the depth first search
+ * after all nodes reachable from the first node were
+ * visited.
+ * By default look further mode is active.
+ */
+ lookFurtherMode:boolean;
+ /**
+ * Starts a depth first search on the given graph.
+ * The first node in the graph will be visited first.
+ */
+ start(graph:yfiles.algorithms.Graph):void;
+ /**
+ * Starts a depth first search on the given graph.
+ * The given node will be visited first.
+ * If start is null, this method returns silently.
+ */
+ startFromNode(graph:yfiles.algorithms.Graph,start:yfiles.algorithms.Node):void;
+ /**
+ * Callback method that will be invoked whenever a formerly unvisited node
+ * gets visited the first time.
+ * The given int is the dfs number of that
+ * node.
+ * By default this method does nothing
+ */
+ preVisit(node:yfiles.algorithms.Node,dfsNumber:number):void;
+ /**
+ * Callback method that will be invoked whenever a node visit has
+ * been completed.
+ * The dfs number and the completion number
+ * of the given node will be passed in.
+ * By default this method does nothing
+ */
+ postVisit(node:yfiles.algorithms.Node,dfsNumber:number,compNumber:number):void;
+ /**
+ * Callback method that will be invoked if the given edge
+ * will be looked at in the search the first (and only) time.
+ * The given node is the node that will be visited next iff
+ * treeEdge == true.
+ * By default this method does nothing
+ */
+ preTraverse(edge:yfiles.algorithms.Edge,node:yfiles.algorithms.Node,treeEdge:boolean):void;
+ /**
+ * Callback method that will be invoked after the search returns
+ * from the given node.
+ * The node has been reached via the given edge.
+ * By default this method does nothing.
+ */
+ postTraverse(edge:yfiles.algorithms.Edge,node:yfiles.algorithms.Node):void;
+ /**
+ * Callback method that will be invoked whenever dfs continues
+ * its search at a new root node.
+ * By default this method does nothing
+ */
+ lookFurther(v:yfiles.algorithms.Node):void;
+ /**
+ * Subclasses can call this method to cancel the dfs.
+ */
+ cancel():void;
+ }
+ var Dfs:{
+ $class:yfiles.lang.Class;
+ /**
+ * Node state specifier.
+ * Indicates that a node was not yet visited.
+ */
+ WHITE:Object;
+ /**
+ * Node state specifier.
+ * Indicates that a node was already visited but
+ * has not been completed yet, i.e. it is still part of an active
+ * path of the dfs tree.
+ */
+ GRAY:Object;
+ /**
+ * Node state specifier.
+ * Indicates that the node has been completed,
+ * i.e. it has been visited before and is not part of an active
+ * path in the dfs tree anymore.
+ */
+ BLACK:Object;
+ /**
+ * Instantiates a new Dfs object.
+ */
+ new ():yfiles.algorithms.Dfs;
+ };
+ /**
+ * Responsible for finding cycles within a graph that have certain properties.
+ */
+ export interface Cycles extends Object{
+ }
+ var Cycles:{
+ $class:yfiles.lang.Class;
+ /**
+ * This method marks edges of a given graph whose removal or reversal would make
+ * that graph acyclic.
+ * This method tries to minimize the number of marked edges
+ * for that task heuristically, since it is a well known hard problem to come up
+ * with an optimal solution.
+ * Complexity: O(graph.E()+graph.N()*log(graph.E()))
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IEdgeMap} cycleEdges
+ * return value. cycleEdge.getBool(e) == true iff
+ * e is a detected cycle edge.
+ */
+ findCycleEdges(graph:yfiles.algorithms.Graph,cycleEdges:yfiles.algorithms.IEdgeMap):void;
+ /**
+ * This method is similar to {@link yfiles.algorithms.Cycles#findCycleEdges}, but instead of minimizing the
+ * number of marked edges it tries to find a set of marked edges, for which the associated
+ * cost is minimal.
+ * In case each edge has cost 1.0 the result will be
+ * the same as the one returned by {@link yfiles.algorithms.Cycles#findCycleEdges}.
+ * Complexity: O(graph.E()+graph.N()*log(graph.E()))
+ * @param {yfiles.algorithms.IDataProvider} costDP
+ * data provider that yields the reversal cost for each edge. The reversal cost
+ * for each edge must be a non-negative value of type double.
+ */
+ findCycleEdgesWithCost(graph:yfiles.algorithms.Graph,cycleEdges:yfiles.algorithms.IEdgeMap,costDP:yfiles.algorithms.IDataProvider):void;
+ /**
+ * Like {@link yfiles.algorithms.Cycles#findCycleEdges} this method marks
+ * edges of a given graph whose removal or reversal would make
+ * that graph acyclic.
+ * The implementation of this method is
+ * based on a Depth First Search. The number of marked cycle edges
+ * is expected to be slightly larger than when using
+ * {@link yfiles.algorithms.Cycles#findCycleEdges}. The advantage of this method
+ * is that the result set is more stable when edges get added or removed
+ * over the time.
+ * Complexity: O(graph.E()+graph.N())
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {yfiles.algorithms.IEdgeMap} cycleEdges
+ * return value. cycleEdge.getBool(e) == true iff
+ * e is a detected cycle edge.
+ */
+ findCycleEdgesDFS(graph:yfiles.algorithms.Graph,cycleEdges:yfiles.algorithms.IEdgeMap):void;
+ /**
+ * Returns an edge list that contains the edges of a cycle
+ * found in the given graph.
+ * The edges are returned in the
+ * order they appear in the found cycle.
+ * If the returned cycle is empty then no cycle has been
+ * found in the given graph.
+ * Complexity: O(graph.N()+graph.E())
+ */
+ findCycle(graph:yfiles.algorithms.Graph,directed:boolean):yfiles.algorithms.EdgeList;
+ /**
+ * Returns all edges that are part of at least one directed or undirected
+ * simple cycle.
+ * A simple cycle is a closed edge path without repeating edges.
+ * Moreover, selfloops are always considered to be cycle edges.
+ * @param {yfiles.algorithms.Graph} graph the input graph
+ * @param {boolean} directed whether or not to look for edges on directed cycles
+ * @return {yfiles.algorithms.EdgeList} all edges that belong to a cycle
+ */
+ findAllCycleEdges(graph:yfiles.algorithms.Graph,directed:boolean):yfiles.algorithms.EdgeList;
+ };
+ /**
+ * Extension method holder class with utility conversion methods for geometry structs
+ * like {@link yfiles.geometry.PointD} and {@link yfiles.geometry.RectD}.
+ */
+ export interface GeomExtensions extends Object{
+ }
+ var GeomExtensions:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a {@link yfiles.geometry.RectD} from a given {@link yfiles.algorithms.Rectangle2D}.
+ * @param {yfiles.algorithms.Rectangle2D} rect The {@link yfiles.algorithms.Rectangle2D}.
+ * @return {yfiles.geometry.RectD} The {@link yfiles.geometry.RectD}.
+ */
+ toRectDFromRectangle2D(rect:yfiles.algorithms.Rectangle2D):yfiles.geometry.RectD;
+ /**
+ * Creates a {@link yfiles.geometry.RectD} from a given {@link yfiles.algorithms.Rectangle}.
+ * @param {yfiles.algorithms.Rectangle} rect The {@link yfiles.algorithms.Rectangle}.
+ * @return {yfiles.geometry.RectD} The {@link yfiles.geometry.RectD}.
+ */
+ toRectDFromRectangle(rect:yfiles.algorithms.Rectangle):yfiles.geometry.RectD;
+ /**
+ * Creates a {@link yfiles.geometry.RectD} from a given {@link yfiles.algorithms.YRectangle}.
+ * @param {yfiles.algorithms.YRectangle} rect The {@link yfiles.algorithms.YRectangle}.
+ * @return {yfiles.geometry.RectD} The {@link yfiles.geometry.RectD}.
+ */
+ toRectD(rect:yfiles.algorithms.YRectangle):yfiles.geometry.RectD;
+ /**
+ * Creates a {@link yfiles.geometry.InsetsD} from a given {@link yfiles.algorithms.Insets}.
+ * @param {yfiles.algorithms.Insets} insets The {@link yfiles.algorithms.Insets}.
+ * @return {yfiles.geometry.InsetsD} The {@link yfiles.geometry.InsetsD}.
+ */
+ toInsetsD(insets:yfiles.algorithms.Insets):yfiles.geometry.InsetsD;
+ /**
+ * Creates a {@link yfiles.geometry.SizeD} from a given {@link yfiles.algorithms.YDimension}.
+ * @param {yfiles.algorithms.YDimension} dimension The {@link yfiles.algorithms.YDimension}.
+ * @return {yfiles.geometry.SizeD} The {@link yfiles.geometry.SizeD}.
+ */
+ toSizeD(dimension:yfiles.algorithms.YDimension):yfiles.geometry.SizeD;
+ /**
+ * Creates a {@link yfiles.geometry.PointD} from a given {@link yfiles.algorithms.Point2D}.
+ * @param {yfiles.algorithms.Point2D} point The {@link yfiles.algorithms.Point2D}.
+ * @return {yfiles.geometry.PointD} The {@link yfiles.geometry.PointD}.
+ */
+ toPointDFromPoint2D(point:yfiles.algorithms.Point2D):yfiles.geometry.PointD;
+ /**
+ * Creates a {@link yfiles.geometry.PointD} from a given {@link yfiles.algorithms.YPoint}.
+ * @param {yfiles.algorithms.YPoint} point The {@link yfiles.algorithms.YPoint}.
+ * @return {yfiles.geometry.PointD} The {@link yfiles.geometry.PointD}.
+ */
+ toPointD(point:yfiles.algorithms.YPoint):yfiles.geometry.PointD;
+ /**
+ * Creates a {@link yfiles.geometry.PointD} from a given {@link yfiles.algorithms.YVector}.
+ * @param {yfiles.algorithms.YVector} point The {@link yfiles.algorithms.YVector}.
+ * @return {yfiles.geometry.PointD} The {@link yfiles.geometry.PointD}.
+ */
+ toPointDFromVector(point:yfiles.algorithms.YVector):yfiles.geometry.PointD;
+ /**
+ * Creates a {@link yfiles.algorithms.Rectangle2D.Double Rectangle2D.Double} from a given {@link yfiles.geometry.RectD}.
+ * @param {yfiles.geometry.RectD} rect The {@link yfiles.geometry.RectD}.
+ * @return {yfiles.algorithms.Rectangle2D.Double} The {@link yfiles.algorithms.Rectangle2D.Double Rectangle2D.Double}.
+ */
+ toRectangle2D(rect:yfiles.geometry.RectD):yfiles.algorithms.Rectangle2D.Double;
+ /**
+ * Creates a {@link yfiles.algorithms.Rectangle} from a given {@link yfiles.geometry.RectD}.
+ * @param {yfiles.geometry.RectD} rect The {@link yfiles.geometry.RectD}.
+ * @return {yfiles.algorithms.Rectangle} The {@link yfiles.algorithms.Rectangle}.
+ */
+ toRectangle(rect:yfiles.geometry.RectD):yfiles.algorithms.Rectangle;
+ /**
+ * Creates a {@link yfiles.algorithms.YOrientedRectangle} from a given {@link yfiles.geometry.IOrientedRectangle}.
+ * @param {yfiles.geometry.IOrientedRectangle} rect The {@link yfiles.geometry.RectD}.
+ * @return {yfiles.algorithms.YOrientedRectangle} The {@link yfiles.algorithms.YOrientedRectangle}.
+ */
+ toOrientedRectangle(rect:yfiles.geometry.IOrientedRectangle):yfiles.algorithms.YOrientedRectangle;
+ /**
+ * Creates an immutable {@link yfiles.geometry.IOrientedRectangle} from a given {@link yfiles.algorithms.YOrientedRectangle}.
+ * @param {yfiles.algorithms.YOrientedRectangle} rect The {@link yfiles.algorithms.YOrientedRectangle}.
+ * @return {yfiles.geometry.IOrientedRectangle} The {@link yfiles.geometry.IOrientedRectangle}.
+ */
+ toImmutableOrientedRectangle(rect:yfiles.algorithms.YOrientedRectangle):yfiles.geometry.IOrientedRectangle;
+ /**
+ * Creates a {@link yfiles.algorithms.YRectangle} from a given {@link yfiles.geometry.RectD}.
+ * @param {yfiles.geometry.RectD} rect The {@link yfiles.geometry.RectD}.
+ * @return {yfiles.algorithms.YRectangle} The {@link yfiles.algorithms.YRectangle}.
+ */
+ toYRectangle(rect:yfiles.geometry.RectD):yfiles.algorithms.YRectangle;
+ /**
+ * Creates a {@link yfiles.algorithms.YDimension} from a given {@link yfiles.geometry.SizeD}.
+ * @param {yfiles.geometry.SizeD} sizeD The {@link yfiles.geometry.SizeD}.
+ * @return {yfiles.algorithms.YDimension} The {@link yfiles.algorithms.YDimension}.
+ */
+ toYDimension(sizeD:yfiles.geometry.SizeD):yfiles.algorithms.YDimension;
+ /**
+ * Creates a {@link yfiles.algorithms.Insets} from a given {@link yfiles.geometry.InsetsD}.
+ * @param {yfiles.geometry.InsetsD} insetsD The {@link yfiles.geometry.InsetsD}.
+ * @return {yfiles.algorithms.Insets} The {@link yfiles.geometry.InsetsD}.
+ */
+ toInsets(insetsD:yfiles.geometry.InsetsD):yfiles.algorithms.Insets;
+ /**
+ * Creates a {@link yfiles.algorithms.YPoint} from a given {@link yfiles.geometry.PointD}.
+ * @param {yfiles.geometry.PointD} point The {@link yfiles.geometry.PointD}.
+ * @return {yfiles.algorithms.YPoint} The {@link yfiles.algorithms.YPoint}.
+ */
+ toYPoint(point:yfiles.geometry.PointD):yfiles.algorithms.YPoint;
+ /**
+ * Creates a {@link yfiles.algorithms.Point2D.Double} from a given {@link yfiles.geometry.PointD}.
+ * @param {yfiles.geometry.PointD} point The {@link yfiles.geometry.PointD}.
+ * @return {yfiles.algorithms.Point2D.Double} The {@link yfiles.algorithms.Point2D.Double}.
+ */
+ toPoint2D(point:yfiles.geometry.PointD):yfiles.algorithms.Point2D.Double;
+ /**
+ * Creates a {@link yfiles.algorithms.YVector} from a given {@link yfiles.geometry.PointD}.
+ * @param {yfiles.geometry.PointD} point The {@link yfiles.geometry.PointD}.
+ * @return {yfiles.algorithms.YVector} The {@link yfiles.algorithms.YVector}.
+ */
+ toYVector(point:yfiles.geometry.PointD):yfiles.algorithms.YVector;
+ };
+ /**
+ * A factory class that creates instances of the classes implementing
+ * {@link yfiles.algorithms.IMap}.
+ */
+ export interface MapFactory extends Object{
+ }
+ var MapFactory:{
+ $class:yfiles.lang.Class;
+ /**
+ * Creates a new {@link yfiles.algorithms.HashMap}.
+ * @return {yfiles.algorithms.IMap}
+ * a new instance of {@link yfiles.algorithms.HashMap}.
+ */
+ createHashMap():yfiles.algorithms.IMap;
+ /**
+ * Creates a new {@link yfiles.algorithms.HashMap} with the contents of the specified
+ * {@link yfiles.algorithms.IMap}.
+ * @return {yfiles.algorithms.IMap}
+ * a new instance of {@link yfiles.algorithms.HashMap}.
+ */
+ createHashMapFromMap(m:yfiles.algorithms.IMap):yfiles.algorithms.IMap;
+ /**
+ * Creates a new {@link yfiles.algorithms.TreeMap}.
+ * @return {yfiles.algorithms.IMap}
+ * a new instance of {@link yfiles.algorithms.TreeMap}.
+ */
+ createTreeMap():yfiles.algorithms.IMap;
+ /**
+ * Creates a new {@link yfiles.algorithms.TreeMap} with the contents of the specified
+ * {@link yfiles.algorithms.IMap}.
+ * @return {yfiles.algorithms.IMap}
+ * a new instance of {@link yfiles.algorithms.TreeMap}.
+ */
+ createTreeMapFromMap(m:yfiles.algorithms.IMap):yfiles.algorithms.IMap;
+ /**
+ * Creates a new {@link yfiles.algorithms.TreeMap} with the specified
+ * {@link yfiles.objectcollections.IComparer}.
+ * @return {yfiles.algorithms.IMap}
+ * a new instance of {@link yfiles.algorithms.TreeMap}.
+ */
+ createTreeMapWithComparator(comparator:yfiles.objectcollections.IComparer):yfiles.algorithms.IMap;
+ };
+ /**
+ * This class provides methods to generate pseudo-random numbers.
+ */
+ export interface Random extends Object{
+ /**
+ * Returns a pseudo-random uniformly distributed integer value of
+ * the number of bits specified by the argument bits.
+ * @param {number} bits The number of bits of the returned value.
+ * @return {number} A random integer.
+ */
+ next(bits:number):number;
+ /**
+ * Returns the next pseudo-random uniformly distributed boolean value.
+ * @return {boolean} A random boolean value.
+ */
+ nextBoolean():boolean;
+ /**
+ * Returns the next pseudo-random uniformly distributed random number between 0.0
+ * inclusively and 1.0 exclusively.
+ * @return {number} A random number between 0.0 and 1.0.
+ * @see {@link yfiles.algorithms.Random#nextFloat}
+ */
+ nextDouble():number;
+ /**
+ * Returns the next pseudo-random uniformly distributed random number between 0.0
+ * inclusively and 1.0 exclusively.
+ * @return {number} A random number between 0.0 and 1.0.
+ * @see {@link yfiles.algorithms.Random#nextDouble}
+ */
+ nextFloat():number;
+ /**
+ * Returns the next pseudo-random normally distributed
+ * number with mean 0.0 and a standard deviation value
+ * of 1.0.
+ * Implements G. E. P. Box, M. E. Muller, and G. Marsaglia's polar method
+ * found in The Art of Computer Programming, Volume 2: Seminumerical
+ * Algorithms, by Donald E. Knuth (section 3.4.1).
+ * @return {number} A random, normally distributed number.
+ * @see {@link yfiles.algorithms.Random#nextDouble}
+ */
+ nextGaussian():number;
+ /**
+ * Returns the next pseudo-random uniformly distributed integer.
+ * @return {number} A random integer.
+ * @see {@link yfiles.algorithms.Random#nextIntInRange}
+ * @see {@link yfiles.algorithms.Random#nextLong}
+ */
+ nextInt():number;
+ /**
+ * Returns the next pseudo-random uniformly distributed integer
+ * between 0 (inclusively) and n (exclusively).
+ * @param {number} n The upper limit of the returned random integer.
+ * @return {number} A random integer between 0 and n
+ */
+ nextIntInRange(n:number):number;
+ nextIntImpl():number;
+ nextIntInRangeImpl(max:number):number;
+ /**
+ * Returns the next pseudo-random uniformly distributed integer.
+ * @return {number} A random integer.
+ * @see {@link yfiles.algorithms.Random#nextInt}
+ * @see {@link yfiles.algorithms.Random#nextIntInRange}
+ */
+ nextLong():number;
+ /**
+ * The seed of this random number generator.
+ */
+ seed:number;
+ }
+ var Random:{
+ $class:yfiles.lang.Class;
+ /**
+ * Constructs a random generator with a seed based on the current time of day.
+ * @see {@link yfiles.algorithms.Random#seed}
+ */
+ new ():yfiles.algorithms.Random;
+ /**
+ * Construct a random generator with the given seed.
+ * @param {number} seed
+ * The seed of this random number generator.
+ * @see {@link yfiles.algorithms.Random#seed}
+ */
+ WithSeed:{
+ new (seed:number):yfiles.algorithms.Random;
+ };
+ };
+ /**
+ * An implementation of a doubly linked list that provides direct access to the
+ * cells that store the elements.
+ * The cells are represented by class {@link yfiles.algorithms.ListCell}.
+ * This class supports fast access and removal operations, specifically, it is possible
+ * to remove an element in constant time (i.e. O(1)) given a reference to its list
+ * cell.
+ * Class YList supports iteration over the elements either by using the list cells
+ * directly (methods {@link yfiles.algorithms.YList#firstCell}/{@link yfiles.algorithms.YList#lastCell} together with
+ * {@link yfiles.algorithms.YList#succCell}/{@link yfiles.algorithms.YList#predCell}, respectively) or by
+ * means of a cursor ({@link yfiles.algorithms.YList#cursor}).
+ * Furthermore, YList offers its own {@link yfiles.algorithms.YList#sort} method.
+ * Note that this class also provides all relevant methods to use the list like
+ * a stack data type.
+ * This implementation permits null as values.
+ * It implements the {@link yfiles.algorithms.IList} interface but does not support the
+ * {@link yfiles.algorithms.YList#subList} method. The implementation of this method will throw an
+ * {@link yfiles.system.NotSupportedException} if invoked.
+ * The {@link yfiles.algorithms.YList#iterator}s returned by instances of this class are fail fast, however
+ * the {@link yfiles.algorithms.YList#cursor} implementation is not.
+ */
+ export interface YList extends Object,yfiles.algorithms.ICollection,yfiles.algorithms.IList{
+ /**
+ * Inserts the given object at the head of this list.
+ * @return {yfiles.algorithms.ListCell} The newly created ListCell object that stores the given object.
+ */
+ addFirst(o:Object):yfiles.algorithms.ListCell;
+ /**
+ * Inserts the given object at the tail of this list.
+ * @return {yfiles.algorithms.ListCell} The newly created ListCell object that stores the given object.
+ */
+ addLast(o:Object):yfiles.algorithms.ListCell;
+ /**
+ * Adds a formerly removed ListCell object at the tail of this list.
+ * Attention: If the ListCell object is still part of any list, then that
+ * list will be corrupted afterwards.
+ * @param {yfiles.algorithms.ListCell} cell A list cell which is not part of any list.
+ */
+ addLastCell(cell:yfiles.algorithms.ListCell):void;
+ /**
+ * Adds a formerly removed ListCell object at the head of this list.
+ * Attention: If the ListCell object is still part of any list, then that
+ * list will be corrupted afterwards.
+ * @param {yfiles.algorithms.ListCell} cell A list cell which is not part of any list.
+ */
+ addFirstCell(cell:yfiles.algorithms.ListCell):void;
+ /**
+ * Same as {@link yfiles.algorithms.YList#addLast}.
+ * @return {boolean} true
+ * @see Specified by {@link yfiles.algorithms.ICollection#addObject}.
+ */
+ addObject(o:Object):boolean;
+ /**
+ * Appends all elements provided by the given collection to this list.
+ * @return {boolean} Whether there have been elements appended.
+ * @see Specified by {@link yfiles.algorithms.ICollection#addAll}.
+ */
+ addAll(collection:yfiles.algorithms.ICollection):boolean;
+ /**
+ * Appends all elements provided by the given cursor to this list.
+ * The cursor will be moved from its given position to the end.
+ * Be aware that a statement like aList.append(aList.cursor()) results
+ * in an infinite recursion.
+ */
+ addAllFromCursor(c:yfiles.algorithms.ICursor):void;
+ /**
+ * Inserts the given object into this list with respect to a given reference list
+ * cell.
+ * The (newly created) list cell that stores the object is inserted right before
+ * the reference list cell refCell.
+ * If refCell == null, the given object is appended to the list.
+ * Precondition:refCell must be part of this list.
+ * @param {Object} o The object to be inserted.
+ * @param {yfiles.algorithms.ListCell} refCell The list cell used to reference the position.
+ * @return {yfiles.algorithms.ListCell} The newly created ListCell object that stores object o.
+ */
+ insertBefore(o:Object,refCell:yfiles.algorithms.ListCell):yfiles.algorithms.ListCell;
+ /**
+ * Inserts a formerly removed ListCell object into this list with respect to a
+ * given reference list cell.
+ * The ListCell object is inserted right before the reference list cell refCell.
+ * Attention: If the ListCell object is still part of any list, then that
+ * list will be corrupted afterwards.
+ * Precondition:refCell must be part of this list.
+ * @param {yfiles.algorithms.ListCell} cellToInsert A list cell which is not part of any list.
+ * @param {yfiles.algorithms.ListCell} refCell The list cell used to reference the position.
+ */
+ insertCellBefore(cellToInsert:yfiles.algorithms.ListCell,refCell:yfiles.algorithms.ListCell):void;
+ /**
+ * Inserts a formerly removed ListCell object into this list with respect to a
+ * given reference list cell.
+ * The ListCell object is inserted right after the reference list cell refCell.
+ * Attention: If the ListCell object is still part of any list, then that
+ * list will be corrupted afterwards.
+ * Precondition:refCell must be part of this list.
+ * @param {yfiles.algorithms.ListCell} cellToInsert A list cell which is not part of any list.
+ * @param {yfiles.algorithms.ListCell} refCell The list cell used to reference the position.
+ */
+ insertCellAfter(cellToInsert:yfiles.algorithms.ListCell,refCell:yfiles.algorithms.ListCell):void;
+ /**
+ * Inserts the given object into this list with respect to a given reference list
+ * cell.
+ * The (newly created) list cell that stores the object is inserted right after
+ * the reference list cell refCell.
+ * If refCell == null, the given object is inserted at the head of
+ * the list.
+ * Precondition:refCell must be part of this list.
+ * @param {Object} o The object to be inserted.
+ * @param {yfiles.algorithms.ListCell} refCell The list cell used to reference the position.
+ * @return {yfiles.algorithms.ListCell} The newly created ListCell object that stores object o.
+ */
+ insertAfter(o:Object,refCell:yfiles.algorithms.ListCell):yfiles.algorithms.ListCell;
+ /**
+ * The number of elements in this list.
+ * @see Specified by {@link yfiles.algorithms.ICollection#count}.
+ */
+ count:number;
+ /**
+ * Checks whether this list contains elements.
+ * @see Specified by {@link yfiles.algorithms.ICollection#empty}.
+ */
+ empty:boolean;
+ /**
+ * Removes all elements from this list.
+ * @see Specified by {@link yfiles.algorithms.ICollection#clear}.
+ */
+ clear():void;
+ /**
+ * The first element of this list.
+ * Precondition:!isEmpty().
+ */
+ first:Object;
+ /**
+ * Removes the first element from this list and returns it.
+ */
+ pop():Object;
+ /**
+ * Equivalent to {@link yfiles.algorithms.YList#addFirst}.
+ */
+ push(o:Object):yfiles.algorithms.ListCell;
+ /**
+ * Equivalent to {@link yfiles.algorithms.YList#first}.
+ */
+ peek():Object;
+ /**
+ * The last element of this list.
+ * Precondition:!isEmpty().
+ */
+ last:Object;
+ /**
+ * Removes the last element from this list and returns it.
+ */
+ popLast():Object;
+ /**
+ * Returns the i-th element of this list.
+ * Precondition:i is a valid index, i.e., i >= 0 && i < size().
+ */
+ elementAt(i:number):Object;
+ /**
+ * Returns the zero-based index of the given element in this list.
+ * If the given element is not in the list, -1 is returned.
+ * @see Specified by {@link yfiles.algorithms.IList#indexOf}.
+ */
+ indexOf(obj:Object):number;
+ /**
+ * The first cell of this list.
+ * Precondition:!isEmpty().
+ */
+ firstCell:yfiles.algorithms.ListCell;
+ /**
+ * The last cell of this list.
+ * Precondition:!isEmpty().
+ */
+ lastCell:yfiles.algorithms.ListCell;
+ /**
+ * Returns the successor cell of the given list cell.
+ */
+ succCell(c:yfiles.algorithms.ListCell):yfiles.algorithms.ListCell;
+ /**
+ * Returns the predecessor cell of the given list cell.
+ */
+ predCell(c:yfiles.algorithms.ListCell):yfiles.algorithms.ListCell;
+ /**
+ * Returns the cyclic successor cell of the given list cell.
+ * The first cell is returned as the cyclic successor of the last list cell.
+ */
+ cyclicSucc(c:yfiles.algorithms.ListCell):yfiles.algorithms.ListCell;
+ /**
+ * Returns the cyclic predecessor cell of the given list cell.
+ * The last cell is returned as the cyclic predecessor of the first list cell.
+ */
+ cyclicPred(c:yfiles.algorithms.ListCell):yfiles.algorithms.ListCell;
+ /**
+ * Returns the element stored in the given list cell.
+ */
+ getInfo(c:yfiles.algorithms.ListCell):Object;
+ /**
+ * Updates the element stored in the given list cell with the given object.
+ */
+ setInfo(c:yfiles.algorithms.ListCell,value:Object):void;
+ /**
+ * Removes the given object from this list.
+ * Only the first element for which equality to o holds gets removed.
+ * Complexity: O(size())
+ * @see Specified by {@link yfiles.algorithms.ICollection#remove}.
+ */
+ remove(o:Object):boolean;
+ /**
+ * Removes the given collection of objects from this list.
+ * @return {boolean} Whether there have been elements removed.
+ * @see Specified by {@link yfiles.algorithms.ICollection#removeAll}.
+ */
+ removeAll(collection:yfiles.algorithms.ICollection):boolean;
+ /**
+ * Retains only those elements in this list which are contained in the given collection.
+ * Complexity:
+ * This operation has running time O(max(m, n)), were m and n are the sizes of
+ * this list and the given collection, respectively.
+ * @return {boolean} Whether there have been elements removed.
+ * @see Specified by {@link yfiles.algorithms.ICollection#retainAll}.
+ */
+ retainAll(collection:yfiles.algorithms.ICollection):boolean;
+ /**
+ * Removes the given list cell, and hence the element stored in it, from this
+ * list.
+ * Complexity: O(1)
+ * Precondition: The given list cell is part of this list.
+ * @return {Object} The element that is stored in the removed cell.
+ */
+ removeCell(c:yfiles.algorithms.ListCell):Object;
+ /**
+ * Removes the element pointed to by the given YCursor object.
+ * Precondition:
+ * The given cursor has been created by a call to this list's {@link yfiles.algorithms.YList#cursor}
+ * method and the element pointed to by it is contained in this list.
+ * @return {Object} The removed element.
+ */
+ removeItemPointedToByCursor(c:yfiles.algorithms.ICursor):Object;
+ /**
+ * Returns a cursor for this list.
+ * All cursor operations are supported.
+ * This cursor implementation is not fail-fast and continues to work
+ * if this list is modified during the traversal as long as the current
+ * ListCell the cursor points at is this in this list or has been removed
+ * from this list
+ * but has not been added to another instance since then.
+ */
+ cursor():yfiles.algorithms.ICursor;
+ /**
+ * Returns an iterator for that list.
+ * The remove operation is supported on the iterator. This iterator instance
+ * is fail-fast.
+ * @see Specified by {@link yfiles.algorithms.ICollection#iterator}.
+ */
+ iterator():yfiles.algorithms.IIterator;
+ /**
+ * Returns a list iterator that can be used to iterate over all items of this list
+ * in correct order.
+ * @return {yfiles.algorithms.IListIterator} a list iterator that iterates over the items of this list.
+ * @see Specified by {@link yfiles.algorithms.IList#listIterator}.
+ */
+ listIterator():yfiles.algorithms.IListIterator;
+ /**
+ * Whether or not this list contains the given element.
+ * Equality of elements is defined by the {@link Object#equals} method.
+ * @see Specified by {@link yfiles.algorithms.ICollection#contains}.
+ */
+ contains(o:Object):boolean;
+ /**
+ * Whether or not this list contains all the elements in the given collection.
+ * Equality of elements is defined by the {@link Object#equals} method.
+ * @see Specified by {@link yfiles.algorithms.ICollection#containsAll}.
+ */
+ containsAll(collection:yfiles.algorithms.ICollection):boolean;
+ /**
+ * Returns the {@link yfiles.algorithms.ListCell} where object o is stored.
+ * This operation returns null, if no such cell exists.
+ * Equality of elements is defined by the {@link Object#equals} method.
+ * The first element in the list that matches that criteria is returned.
+ * @return {yfiles.algorithms.ListCell}
+ * the ListCell that contains the element or null if no
+ * such ListCell was found
+ */
+ findCell(o:Object):yfiles.algorithms.ListCell;
+ /**
+ * Returns a string representation of this List.
+ */
+ toString():string;
+ /**
+ * Returns an array representation of this list.
+ * @see Specified by {@link yfiles.algorithms.ICollection#toArray}.
+ */
+ toArray():Object[];
+ /**
+ * Returns an array containing all list elements in the correct order.
+ * The runtime type of the returned array is that of the given array.
+ * If the list does not fit in the specified array, a new array is allocated with
+ * the runtime type of the specified array and the size of this list.
+ * If the list fits in the specified array with room to spare (i.e., the array
+ * has more elements than the list), the element in the array immediately following
+ * the end of the collection is set to null.
+ * This is useful in determining the length of the list only if the caller
+ * knows that the list does not contain any null elements.
+ * @param {Object} a
+ * The array into which the elements of the list are to be stored, if it is big
+ * enough.
+ * Otherwise, a new array of the same runtime type is allocated for this purpose.
+ * @return {Object} An array containing the elements of the list.
+ * @see Specified by {@link yfiles.algorithms.ICollection#toGivenArray}.
+ */
+ toGivenArray(a:Object):Object;
+ /**
+ * Reverses the sequence of elements in this list.
+ */
+ reverse():void;
+ /**
+ * Sorts the elements in this list according to the given comparator.
+ * NOTE: The elements will be assigned to different list cells by this method.
+ * Complexity: O(size() * log(size()))
+ */
+ sortWithComparer(comp:yfiles.objectcollections.IComparer):void;
+ /**
+ * Sorts the elements in this list into ascending order, according to their natural
+ * ordering.
+ * All elements must implement the {@link yfiles.lang.IObjectComparable} interface.
+ * Furthermore, all elements in this list must be mutually comparable (that is,
+ * e1.compareTo(e2) must not throw a ClassCastException for any elements
+ * e1 and e2 in this list).
+ * NOTE: The elements will be assigned to different list cells by this method.
+ * Complexity: O(size() * log(size()))
+ */
+ sort():void;
+ /**
+ * Transfers the contents of the given list to the end of this list.
+ * The given list will be empty after this operation.
+ * Note that this operation transfers the list cells of the given list to this
+ * list.
+ * No new list cells are created by this operation.
+ * Complexity: O(1)
+ */
+ splice(list:yfiles.algorithms.YList):void;
+ /**
+ * Adds all items of the given collection at the specified index.
+ *
+ * All subsequent items are shifted to the right by the number of items added.
+ *
+ * @param {number} index the index at which to insert the items.
+ * @param {yfiles.algorithms.ICollection} c the collection whose items will be added.
+ * @return {boolean} true if this list has been modified due to the call of this method.
+ * @see Specified by {@link yfiles.algorithms.IList#addAllAt}.
+ */
+ addAllAt(index:number,c:yfiles.algorithms.ICollection):boolean;
+ /**
+ * Gets the cell at the given index.
+ * @param {number} index the zero-based index of the cell in this list.
+ * @return {yfiles.algorithms.ListCell} The cell.
+ * @throws {yfiles.system.IndexOutOfRangeException}
+ * if the index is negative or greater or equal than the {@link yfiles.algorithms.YList#count}
+ */
+ getCell(index:number):yfiles.algorithms.ListCell;
+ /**
+ * Returns the index of the last occurrence of the specified item in this list,
+ * or -1 if the list does not contain the object.
+ * @param {Object} o the item whose last index is being returned.
+ * @return {number} the index of last occurrence of the specified item, or -1.
+ * @see Specified by {@link yfiles.algorithms.IList#lastIndexOf}.
+ */
+ lastIndexOf(o:Object):number;
+ /**
+ * Replaces the item at the specified index with the given item.
+ * @param {number} index the index at which to replace the item.
+ * @param {Object} item the item which should be set at the specified index.
+ * @return {Object} the item that was previously at the specified index.
+ * @see Specified by {@link yfiles.algorithms.IList#setAtListIndex}.
+ */
+ setAtListIndex(index:number,element:Object):Object;
+ /**
+ * Removes the object at the specified index.
+ *
+ * All subsequent list items are shifted to the left by one step.
+ *
+ * @param {number} index the index of the item to be removed.
+ * @return {Object} the object previously at the specified position
+ * @see Specified by {@link yfiles.algorithms.IList#removeAtIndex}.
+ */
+ removeAtIndex(index:number):Object;
+ /**
+ * Returns a list iterator that can be used to iterate over all items of this list
+ * in correct order.
+ * The iteration starts at the specified index.
+ * @param {number} index the index at which to start the iteration.
+ * @return {yfiles.algorithms.IListIterator}
+ * a list iterator that iterates over the items of this list, starting at the
+ * specified index.
+ * @see Specified by {@link yfiles.algorithms.IList#listIteratorFrom}.
+ */
+ listIteratorFrom(index:number):yfiles.algorithms.IListIterator;
+ /**
+ * Returns the item at the specified index.
+ * @param {number} index the index of the item that is retrieved.
+ * @return {Object} the item at the specified index.
+ * @see Specified by {@link yfiles.algorithms.IList#getAtListIndex}.
+ */
+ getAtListIndex(index:number):Object;
+ /**
+ * Adds the given object to the collection at the specified index.
+ *
+ * All subsequent items are shifted to the right one step.
+ *
+ * @param {number} index the index at which to insert the item
+ * @param {Object} item the item to insert
+ * @see Specified by {@link yfiles.algorithms.IList#addAt}.
+ */
+ addAt(index:number,element:Object):void;
+ /**
+ * Returns a list that contains the specified range of items in this list.
+ * @param {number} fromIndex the index of the item that is the first element of the returned list.
+ * @param {number} toIndex
+ * the end index the returned list. The item at this index is not included
+ * in the returned list.
+ * @return {yfiles.algorithms.IList} a list that contains the items of this list in the specified range.
+ * @see Specified by {@link yfiles.algorithms.IList#subList}.
+ */
+ subList(fromIndex:number,toIndex:number):yfiles.algorithms.IList;
+ equals(other:Object):boolean;
+ hashCode():number;
+ getObjectEnumerator():yfiles.objectcollections.IEnumerator;
+ copyTo(array:Object,index:number):void;
+ syncRoot:Object;
+ isSynchronized:boolean;
+ getEnumerator():yfiles.collections.IEnumerator