| Package | com.yworks.yfiles.util |
| Class | public class Comparators |
| Inheritance | Comparators YObject Object |
| Method | Defined By | ||
|---|---|---|---|
Comparators(init:Boolean = true) | Comparators | ||
compare(i1:int, i2:int):int [static]
Compares the specified integral numbers. | Comparators | ||
[static]
Compares the specified integral numbers. | Comparators | ||
compare3(f1:Number, f2:Number):int [static]
Compares the specified floating point numbers. | Comparators | ||
compare4(d1:Number, d2:Number):int [static]
Compares the specified floating point numbers. | Comparators | ||
[static]
Returns a comparator that compares to Objects of type Comparable. | Comparators | ||
[static]
Returns a comparator that compares objects of arbitrary type. | Comparators | ||
[static]
Returns a comparator that compares objects of arbitrary type. | Comparators | ||
[static]
Returns a comparator that compares objects of type com.yworks.yfiles.base.Edge. | Comparators | ||
[static]
Returns a comparator that compares objects of type com.yworks.yfiles.base.Edge. | Comparators | ||
[static]
Returns a comparator that compares objects of arbitrary type. | Comparators | ||
[static]
Returns a comparator that compares objects of type com.yworks.yfiles.base.Edge. | Comparators | ||
[static]
Returns a comparator that compares objects of type com.yworks.yfiles.base.Edge. | Comparators | ||
![]() | equals(o:Object):Boolean | YObject | |
getClass():Class [override] | Comparators | ||
![]() | hashCode():int | YObject | |
[static] | Comparators | ||
[static]
Sorts the specified list of objects according to the order induced by the specified comparator. | Comparators | ||
sort2(data:Vector.<Object>, c:Comparator):void [static]
Sorts the specified array of objects according to the order induced by the specified comparator. | Comparators | ||
sort3(data:Vector.<Object>, fromIndex:int, toIndex:int, c:Comparator):void [static]
Sorts the specified array of objects according to the order induced by the specified comparator. | Comparators | ||
| Method | Defined By | ||
|---|---|---|---|
initComparators():void | Comparators | ||
| Comparators | () | Constructor |
public function Comparators(init:Boolean = true)init:Boolean (default = true) |
| compare | () | method |
public static function compare(i1:int, i2:int):intCompares 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.
Parameters
i1:int — the first number to compare.
| |
i2:int — the second number to compare.
|
int — a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
|
See also
| compare2 | () | method |
public static function compare2(l1:LongImpl, l2:LongImpl):intCompares 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.
Parameters
l1:LongImpl — the first number to compare.
| |
l2:LongImpl — the second number to compare.
|
int — a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
|
See also
| compare3 | () | method |
public static function compare3(f1:Number, f2:Number):intCompares 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 com.yworks.bridge.util.Double.compare() instead.
Parameters
f1:Number — the first number to compare.
| |
f2:Number — the second number to compare.
|
int — a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
|
See also
| compare4 | () | method |
public static function compare4(d1:Number, d2:Number):intCompares 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 com.yworks.bridge.util.Double.compare() instead.
Parameters
d1:Number — the first number to compare.
| |
d2:Number — the second number to compare.
|
int — a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
|
See also
| createComparableComparator | () | method |
public static function createComparableComparator():ComparatorReturns a comparator that compares to Objects of type Comparable.
ReturnsComparator |
| createComparableDataComparator | () | method |
public static function createComparableDataComparator(dp:DataProvider):Comparator
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.
Parameters
dp:DataProvider — a data provider that must return a Comparable for each object that is being compared by this comparator.
|
Comparator — a comparator that compares arbitrary objects.
|
| createDoubleDataComparator | () | method |
public static function createDoubleDataComparator(dp:DataProvider):ComparatorReturns 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.
Parameters
dp:DataProvider — a data provider that must return a double value for each object that is being compared by this comparator.
|
Comparator — a comparator that compares arbitrary objects.
|
| createDoubleDataSourceComparator | () | method |
public static function createDoubleDataSourceComparator(dp:DataProvider):Comparator
Returns a comparator that compares objects of type com.yworks.yfiles.base.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()).
Parameters
dp:DataProvider — a data provider that must return a double value for the source node of each edge being compared.
|
Comparator — a comparator that compares edges.
|
See also
| createDoubleDataTargetComparator | () | method |
public static function createDoubleDataTargetComparator(dp:DataProvider):Comparator
Returns a comparator that compares objects of type com.yworks.yfiles.base.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()).
Parameters
dp:DataProvider — a data provider that must return a double value for the target node of each edge being compared.
|
Comparator — a comparator that compares edges.
|
See also
| createIntDataComparator | () | method |
public static function createIntDataComparator(dp:DataProvider):ComparatorReturns 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.
Parameters
dp:DataProvider — a data provider that must return an int value for each object that is being compared by this comparator.
|
Comparator — a comparator that compares arbitrary objects.
|
| createIntDataSourceComparator | () | method |
public static function createIntDataSourceComparator(dp:DataProvider):Comparator
Returns a comparator that compares objects of type com.yworks.yfiles.base.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()).
Parameters
dp:DataProvider — a data provider that must return an int value for the source node of each edge being compared.
|
Comparator — a comparator that compares edges.
|
See also
| createIntDataTargetComparator | () | method |
public static function createIntDataTargetComparator(dp:DataProvider):Comparator
Returns a comparator that compares objects of type com.yworks.yfiles.base.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()).
Parameters
dp:DataProvider — a data provider that must return an int value for the target node of each edge being compared.
|
Comparator — a comparator that compares edges.
|
See also
| getClass | () | method |
override public function getClass():ClassReturnsClass |
| initComparators | () | method |
protected final function initComparators():void| newComparators | () | method |
| sort | () | method |
public static function sort(data:List, c:Comparator):voidSorts 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 com.yworks.yfiles.util.Comparators_PartialOrder interface, this implementation is behavior-compatible with the pre-Java-7 version of com.yworks.bridge.util.Collections.sort() in the sense that it does not throw IllegalArgumentException if the specified comparator used for sorting does not define a total order.
Parameters
data:List — the list to be sorted.
| |
c:Comparator — the comparator to determine the order of the list. A null value indicates that the elements' natural ordering (com.yworks.bridge.util.Comparable) should be used.
|
See also
| sort2 | () | method |
public static function sort2(data:Vector.<Object>, c:Comparator):voidSorts 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 com.yworks.yfiles.util.Comparators_PartialOrder interface, this implementation is behavior-compatible with the pre-Java-7 version of com.yworks.bridge.util.Arrays.sort() in the sense that it does not throw IllegalArgumentException if the specified comparator used for sorting does not define a total order.
Parameters
data:Vector.<Object> — the array to be sorted.
| |
c:Comparator — the comparator to determine the order of the array. A null value indicates that the elements' natural ordering (com.yworks.bridge.util.Comparable) should be used.
|
See also
| sort3 | () | method |
public static function sort3(data:Vector.<Object>, fromIndex:int, toIndex:int, c:Comparator):voidSorts 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 com.yworks.yfiles.util.Comparators_PartialOrder interface, this implementation is behavior-compatible with the pre-Java-7 version of com.yworks.bridge.util.Arrays.sortObjectsRangeWithComparator() in the sense that it does not throw IllegalArgumentException if the specified comparator used for sorting does not define a total order.
Parameters
data:Vector.<Object> — the array to be sorted.
| |
fromIndex:int — the index of the first element (inclusive) to be sorted.
| |
toIndex:int — the index of the last element (exclusive) to be sorted.
| |
c:Comparator — the comparator to determine the order of the array. A null value indicates that the elements' natural ordering (com.yworks.bridge.util.Comparable) should be used.
|
IllegalArgumentException — if fromIndex > toIndex.
| |
RangeError — if fromIndex < 0 or toIndex > a.length.
|
See also