|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.taleo.integration.client.customstep.util.csv.HierarchicalRowComparator
public class HierarchicalRowComparator
Comparator to sort CSV rows in hierarchical order (parent/child). Rows are of type String[].
Must be initialized by setting the parent key for each key, using the
setParent(String, Sting)
method. Row key does not have to be
unique, many rows with the same key will be sorted equal. However, two rows
with the same key but different parents, will cause an error.
Does not detect circular relationships and will not fail if that happens.
Constructor Summary | |
---|---|
HierarchicalRowComparator(int keyIndex)
Constructor with the column index of the row key. |
|
HierarchicalRowComparator(int keyIndex,
boolean topDown)
Constructor with the column index of the row key and the sort order. |
|
HierarchicalRowComparator(int keyIndex,
boolean topDown,
boolean ignoreCase)
Constructor with the column index of the row key, the sort order and the case sensitiveness. |
Method Summary | |
---|---|
int |
compare(java.util.List row1,
java.util.List row2)
Compare rows as List. |
int |
compare(java.lang.Object obj1,
java.lang.Object obj2)
|
int |
compare(java.lang.String[] row1,
java.lang.String[] row2)
Compare rows as String[]. |
java.lang.String |
getParent(java.lang.String key)
Get the parent key for a given child key. |
void |
setParent(java.lang.String key,
java.lang.String parentKey)
Set the parent key for a given child key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public HierarchicalRowComparator(int keyIndex)
keyIndex
- The column index of the row key.public HierarchicalRowComparator(int keyIndex, boolean topDown)
keyIndex
- The column index of the row key.topDown
- true
for top down (parent first) sorting.public HierarchicalRowComparator(int keyIndex, boolean topDown, boolean ignoreCase)
keyIndex
- The column index of the row key.topDown
- true
for top down (parent first) sorting.ignoreCase
- Indicate if case is considered when comparing keys.Method Detail |
---|
public void setParent(java.lang.String key, java.lang.String parentKey)
key
- The child key.parentKey
- The parent key.public java.lang.String getParent(java.lang.String key)
key
- The child key.
public int compare(java.lang.Object obj1, java.lang.Object obj2)
compare
in interface java.util.Comparator
public int compare(java.lang.String[] row1, java.lang.String[] row2)
row1
- row2
-
public int compare(java.util.List row1, java.util.List row2)
row1
- row2
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |