wt.part
Class PartStructureLineNumberComparator
java.lang.Object
wt.part.PartStructureLineNumberComparator
- All Implemented Interfaces:
- Comparator
- public class PartStructureLineNumberComparator
- extends Object
- implements Comparator
This Comparator can be used to compare the Line Number attribute of item 1 of an array,
which should be a WTPartUsageLink
,
delegating the comparison to a sub-Comparator if neither object has a Line Number.
Note that using this Comparator in a sort will result in all items without Line Numbers
coming at the end.
Supported API: true
Extendable: false
Method Summary |
int |
compare(Object o1,
Object o2)
Compares the value of the Line Number attribute of wt.part.WTPartUsageLinks s
using the getLineNumber method to extract the Line Numbers
from the link objects and delegating the comparison to the sub-Comparator if neither
object has a Line Number. |
private LineNumber |
getLineNumber(Object obj)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
subComparator
private Comparator subComparator
LESS_THAN
static final int LESS_THAN
- See Also:
- Constant Field Values
GREATER_THAN
static final int GREATER_THAN
- See Also:
- Constant Field Values
EQUAL
static final int EQUAL
- See Also:
- Constant Field Values
PartStructureLineNumberComparator
public PartStructureLineNumberComparator(Comparator subComparator)
- This constructor needs a subComparator to delegate the comparison to when it cannot perform the comparison itself.
For instance when neither has a
LineNumber
then the sub-Comparator, which might just compare
based on Name or Number of the part, would be used.
Supported API: true
Extendable: false
compare
public int compare(Object o1,
Object o2)
- Compares the value of the Line Number attribute of
wt.part.WTPartUsageLinks
s
using the getLineNumber
method to extract the Line Numbers
from the link objects and delegating the comparison to the sub-Comparator if neither
object has a Line Number.
Supported API: true
Extendable: false
- Specified by:
compare
in interface Comparator
getLineNumber
private LineNumber getLineNumber(Object obj)