170 |
return abs; |
return abs; |
171 |
} |
} |
172 |
|
|
173 |
/** Get the selected node in the given direction. |
protected Statement getRotationStmt(int dir) { |
|
* getRotationNode(1) is the node we go to if |
|
|
* we hit 'Right.' getRotationNode(-1) is the node |
|
|
* we go to if we hit 'Left.' getRotationNode(0) |
|
|
* is the focused node. |
|
|
*/ |
|
|
public RDFNode getRotationNode(int dir) { |
|
|
if(dir == 0) |
|
|
return focus; |
|
174 |
Iterator iter = getConnections(dir).iterator(); |
Iterator iter = getConnections(dir).iterator(); |
175 |
int n = getRotationIndex(dir); |
int n = getRotationIndex(dir); |
176 |
if(n < 0) |
if(n < 0) |
181 |
// nothing there |
// nothing there |
182 |
return null; |
return null; |
183 |
|
|
184 |
Statement stmt = (Statement)iter.next(); |
return (Statement)iter.next(); |
185 |
|
} |
186 |
|
|
187 |
|
/** Get the selected node in the given direction. |
188 |
|
* getRotationNode(1) is the node we go to if |
189 |
|
* we hit 'Right.' getRotationNode(-1) is the node |
190 |
|
* we go to if we hit 'Left.' getRotationNode(0) |
191 |
|
* is the focused node. |
192 |
|
*/ |
193 |
|
public RDFNode getRotationNode(int dir) { |
194 |
|
if(dir == 0) |
195 |
|
return focus; |
196 |
|
|
197 |
|
Statement stmt = getRotationStmt(dir); |
198 |
|
if(stmt == null) return null; |
199 |
return (dir<0) ? stmt.getSubject() : stmt.getObject(); |
return (dir<0) ? stmt.getSubject() : stmt.getObject(); |
200 |
} |
} |
201 |
|
|
202 |
|
public NodeView.Nodespec getRotationNodespec(int dir) { |
203 |
|
if(dir == 0) |
204 |
|
return new NodeView.Nodespec(focus); |
205 |
|
|
206 |
|
Statement stmt = getRotationStmt(dir); |
207 |
|
if(stmt == null) return null; |
208 |
|
if(dir < 0) |
209 |
|
return new NodeView.Nodespec(stmt.getSubject(), |
210 |
|
stmt.getPredicate(), -1); |
211 |
|
else |
212 |
|
return new NodeView.Nodespec(stmt.getObject(), |
213 |
|
stmt.getPredicate(), 1); |
214 |
|
} |
215 |
|
|
216 |
/** Move left/right. XXX |
/** Move left/right. XXX |
217 |
*/ |
*/ |
218 |
public void move(int dir) { |
public void move(int dir) { |