[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire/org/fenfire/loom Cursor.java
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] fenfire/org/fenfire/loom Cursor.java |
Date: |
Fri, 07 Mar 2003 16:03:50 -0500 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Changes by: Benja Fallenstein <address@hidden> 03/03/07 16:03:44
Modified files:
org/fenfire/loom: Cursor.java
Log message:
refactor more
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/Cursor.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/loom/Cursor.java
diff -u fenfire/org/fenfire/loom/Cursor.java:1.6
fenfire/org/fenfire/loom/Cursor.java:1.7
--- fenfire/org/fenfire/loom/Cursor.java:1.6 Fri Mar 7 15:48:08 2003
+++ fenfire/org/fenfire/loom/Cursor.java Fri Mar 7 16:03:43 2003
@@ -161,19 +161,18 @@
return s;
}
+ public int getConnectionCount() {
+ int negn = getConnections(-1).size();
+ int posn = getConnections(1).size();
+
+ return (negn>posn) ? negn : posn;
+ }
+
/** Rotate the view up or down.
* This moves the rotation of the cursor up or down.
*/
public void rotate(int dir) {
- SortedSet
- neg = getConnections(-1),
- pos = getConnections(1);
-
- int negn = neg.size();
- int posn = pos.size();
-
- int n = (negn>posn) ? negn : posn;
-
+ int n = getConnectionCount();
int abs = (n-1)/2 + rotation + dir;
if(abs<0 || abs>=n)
@@ -192,22 +191,16 @@
*/
public int getRotationIndex(int dir) {
int n = getConnections(dir).size();
- int abs = (n-1)/2 + rotation;
- return abs;
+ return getMiddle(n) + rotation;
}
protected Statement getRotationStmt(int dir) {
- Iterator iter = getConnections(dir).iterator();
- int n = getRotationIndex(dir);
- if(n < 0)
- // nothing there
+ List l = new ArrayList(getConnections(dir));
+ try {
+ return (Statement)l.get(getRotationIndex(dir));
+ } catch(IndexOutOfBoundsException _) {
return null;
- for(int i=0; i<n; i++) if(iter.hasNext()) iter.next();
- if(!iter.hasNext())
- // nothing there
- return null;
-
- return (Statement)iter.next();
+ }
}
/** Get the selected node in the given direction.
@@ -239,7 +232,9 @@
stmt.getPredicate(), 1);
}
- /** Move left/right. XXX
+ /** Move left/right. Focuses the node currently selected
+ * in the given direction. The rotation is set so that
+ * the old focus becomes selected.
*/
public void move(int dir) {
RDFNode node = getRotationNode(dir);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] fenfire/org/fenfire/loom Cursor.java,
Benja Fallenstein <=