public int compareTo(int rowa, int rowb) {
// we take the treewalker which we built previously and use the visitednr
// attribute to specify sort order
Object a = messages.get(rowa);
Object b = messages.get(rowb); // both are messages; to be compared
TreeWalker treeWalker = getTreeWalker();
GenericTraversalNode gtna = treeWalker.getGenericTraversalNode(a);
GenericTraversalNode gtnb = treeWalker.getGenericTraversalNode(b);
int sortedposa = gtna.getVisitNumber(); // the visitednumber was determined
// by the sorting algorithm,
// therefore it is the sorted
// position
int sortedposb = gtnb.getVisitNumber();