Constructor
new Comparator()
Create a new Comparator instance.
- Source:
Classes
Members
(constant) hashExtractor :HashExtractor
A hash extractor for use by the comparator and matching algorithms.
Type:
- Source:
Methods
compare(nodeA, nodeB) → {Number}
Compare content and composition of two nodes.
Parameters:
Name | Type | Description |
---|---|---|
nodeA |
Node | |
nodeB |
Node |
- Source:
Returns:
The comparison value from the range [0;1]
- Type
- Number
compareContent(nodeA, nodeB) → {Number}
Compare the content of two nodes.
Parameters:
Name | Type | Description |
---|---|---|
nodeA |
Node | |
nodeB |
Node |
- Source:
Returns:
The content comparison value from the range [0;1]
- Type
- Number
compareLcs(seqA, seqB, defaultValuenullable) → (nullable) {Number}
Perform an LCS-based comparison between two sequences.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
seqA |
Array.<any> | |||
seqB |
Array.<any> | |||
defaultValue |
Number |
<nullable> |
null | The result if the computation is invalid. |
- Source:
Returns:
The comparison value from the range [0;1]
- Type
- Number
comparePosition(nodeA, nodeB) → {Number}
Compare the position of two nodes, determined by their paths.
Parameters:
Name | Type | Description |
---|---|---|
nodeA |
Node | |
nodeB |
Node |
- Source:
Returns:
The positional comparison value from the range [0;1]
- Type
- Number
compareSet(setA, setB, defaultValuenullable) → (nullable) {Number}
Perform an comparison between two sets.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
setA |
Set.<any> | |||
setB |
Set.<any> | |||
defaultValue |
Number |
<nullable> |
null | The result if the computation is invalid. |
- Source:
Returns:
The comparison value from the range [0;1]
- Type
- Number
compareSize(nodeA, nodeB) → {Number}
Compare the size of two subtrees.
Parameters:
Name | Type | Description |
---|---|---|
nodeA |
Node | |
nodeB |
Node |
- Source:
Returns:
The size difference between the two trees.
- Type
- Number
compareString(strA, strB, defaultValuenullable) → (nullable) {Number}
Compare two strings.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
strA |
String | |||
strB |
String | |||
defaultValue |
Number |
<nullable> |
null | The result if the computation is invalid. |
- Source:
Returns:
The comparison value from the range [0;1]
- Type
- Number
weightedAverage(items, weights, defaultValuenullable) → (nullable) {Number}
Compute the weighted average for a set of comparison values and weights.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
items |
Array.<?Number> | The array of comparison values from the range [0,1]. A null value indicates a missing value that won't be considered. | ||
weights |
Array.<Number> | The array of weights. | ||
defaultValue |
Number |
<nullable> |
null | The result if the computation is invalid. |
- Source:
Returns:
The weighted average from the range [0,1] of the
supplied comparison values.
- Type
- Number