45 |
*/ |
*/ |
46 |
public int rotation; |
public int rotation; |
47 |
|
|
48 |
/** The comparator used to order the nodes in the graph. |
/** The comparator used to order statements by subject. |
49 |
* The vertical order of nodes is determined by this Comparator. |
* The vertical order of object nodes |
50 |
|
* is determined by this Comparator. |
51 |
*/ |
*/ |
52 |
public Comparator order; |
protected Comparator subjOrder; |
53 |
|
|
54 |
/** Compare statements by their subjects. |
/** The comparator used to order statements by object. |
55 |
* <code>subjOrder</code> orders statements by applying |
* The vertical order of subject nodes |
56 |
* <code>order</code> to their subjects. |
* is determined by this Comparator. |
57 |
*/ |
*/ |
58 |
protected Comparator subjOrder = new Comparator() { |
protected Comparator objOrder; |
|
public int compare(Object o1, Object o2) { |
|
|
Statement s1 = (Statement)o1, s2 = (Statement)o2; |
|
|
return order.compare(s1.getSubject(), s2.getSubject()); |
|
|
} |
|
|
}; |
|
|
|
|
|
/** Compare statements by their objects. |
|
|
* <code>objOrder</code> orders statements by applying |
|
|
* <code>order</code> to their objects. |
|
|
*/ |
|
|
protected Comparator objOrder = new Comparator() { |
|
|
public int compare(Object o1, Object o2) { |
|
|
Statement s1 = (Statement)o1, s2 = (Statement)o2; |
|
|
return order.compare(s1.getObject(), s2.getObject()); |
|
|
} |
|
|
}; |
|
59 |
|
|
60 |
/** Create a new cursor without giving it a position yet. |
/** Create a new cursor without giving it a position yet. |
61 |
*/ |
*/ |
62 |
public Cursor(Comparator order) { |
public Cursor(Comparator subjOrder, Comparator objOrder) { |
63 |
this.order = order; |
this.subjOrder = subjOrder; |
64 |
|
this.objOrder = objOrder; |
65 |
} |
} |
66 |
|
|
67 |
/** Create a new cursor and give it a position. |
/** Create a new cursor and give it a position. |
68 |
*/ |
*/ |
69 |
public Cursor(Comparator order, Resource focus, int dir, |
public Cursor(Comparator subjOrder, Comparator objOrder, |
70 |
|
Resource focus, int dir, |
71 |
RDFNode rotation) { |
RDFNode rotation) { |
72 |
this(order); |
this(subjOrder, objOrder); |
73 |
set(focus, dir, rotation); |
set(focus, dir, rotation); |
74 |
} |
} |
75 |
|
|