de.dfg.oc.logfileanalyzer.gui
Class TableElementComparator
java.lang.Object
de.dfg.oc.logfileanalyzer.gui.TableElementComparator
- All Implemented Interfaces:
- Comparator<String>
class TableElementComparator
- extends Object
- implements Comparator<String>
Compares the content of table cells to support sorting.
- Author:
- Clemens Gersbacher, Holger Prothmann
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TableElementComparator
TableElementComparator()
compare
public int compare(String s1,
String s2)
- Compares two
String
s provided as parameters. The method
tries to convert the given String
s to double
-values
before comparison. If the conversion fails, the comparator compares the
given String
s directly.
Use this method only for String
s that can both(!) be
either converted or not converted to double
s.
- Specified by:
compare
in interface Comparator<String>
- Parameters:
s1
- first String
to compares2
- second String
to compare
- Returns:
-1
if s1 < s1
, 0
if
s1 = s1
, 1
otherwise