Package org.onosproject.ui.table.cell
Class AbstractCellComparator
- java.lang.Object
-
- org.onosproject.ui.table.cell.AbstractCellComparator
-
- All Implemented Interfaces:
CellComparator
- Direct Known Subclasses:
DefaultCellComparator
public abstract class AbstractCellComparator extends java.lang.Object implements CellComparator
Base implementation of aCellComparator
. This class takes care of dealing with null inputs; subclasses should implement their comparison knowing that both inputs are guaranteed to be non-null.
-
-
Constructor Summary
Constructors Constructor Description AbstractCellComparator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compare(java.lang.Object o1, java.lang.Object o2)
Compares its two arguments for order.protected abstract int
nonNullCompare(java.lang.Object o1, java.lang.Object o2)
Compares its two arguments for order.
-
-
-
Method Detail
-
compare
public int compare(java.lang.Object o1, java.lang.Object o2)
Description copied from interface:CellComparator
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.Note that nulls are permitted, and should be sorted to the beginning of an ascending sort; i.e. null is considered to be "smaller" than non-null values.
- Specified by:
compare
in interfaceCellComparator
- Parameters:
o1
- the first object to be comparedo2
- the second object to be compared- Returns:
- an integer representing relative ordering
- See Also:
Comparator.compare(Object, Object)
-
nonNullCompare
protected abstract int nonNullCompare(java.lang.Object o1, java.lang.Object o2)
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.Note that both objects are guaranteed to be non-null.
- Parameters:
o1
- the first object to be comparedo2
- the second object to be compared- Returns:
- an integer representing relative ordering
- Throws:
java.lang.ClassCastException
- if the arguments' types prevent them from being compared by this comparator- See Also:
Comparator.compare(Object, Object)
-
-