This class is a ISequencer implementation that determines the sequence of nodes on the same layer based on a given comparison function.
Default Values of Properties
sequenceComparator | null | No comparison function is specified. |
Type Details
- yFiles module
- algorithms
Constructors
Creates a new instance of GivenSequenceSequencer using a given comparison for the sequencing.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- nodeComparator - function(LayoutNode, LayoutNode):number
- An optional comparison delegate used to determine the order of the nodes in the sequence.
Signature Details
function(x: LayoutNode, y: LayoutNode) : number
Encapsulates a method that compares two objects.Parameters
- x - LayoutNode
- The first object to compare.
- y - LayoutNode
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
- sequenceComparator - function(LayoutNode, LayoutNode):number
- The comparison function used by this GivenSequenceSequencer to determine the sequence of the nodes. This option sets the sequenceComparator property on the created object.
Signature Details
function(x: LayoutNode, y: LayoutNode) : number
Encapsulates a method that compares two objects.Parameters
- x - LayoutNode
- The first object to compare.
- y - LayoutNode
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
Properties
Gets or sets the comparison function used by this GivenSequenceSequencer to determine the sequence of the nodes.
Default Value
The default value is
null
.No comparison function is specified.
Property Value
A comparison function to order nodes.
Signature Details
function(x: LayoutNode, y: LayoutNode) : number
Encapsulates a method that compares two objects.
Parameters
- x - LayoutNode
- The first object to compare.
- y - LayoutNode
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
Methods
Calculates the sequence of the nodes within the layers in the given layoutContext
based on the specified sequenceComparator.
Remarks
This method is called by HierarchicalLayoutCore during the sequencing phase and finally writes back the calculated sequence using the setNodeOrder method.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- graph - LayoutGraph
- The input graph
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext providing context information about the nodes and edges of the graph, as well as the ItemFactory used for creating and destroying helper structures.