This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Java classes in Kawa


The attached patch allows Scheme lsist to be sorted.
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/
Index: LList.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/lists/LList.java,v
retrieving revision 1.5
diff -u -r1.5 LList.java
--- LList.java	8 Apr 2002 19:29:01 -0000	1.5
+++ LList.java	10 Jul 2002 19:38:50 -0000
@@ -176,6 +176,33 @@
     return ((Pair) next).car;
   }
 
+  public Object getPrevious(int ipos, Object xpos)
+  {
+    int isAfter = (ipos & 1);
+    if (isAfter > 0)
+      {
+	xpos = xpos == null ? this : ((Pair) xpos).cdr;
+      }
+    else
+      {
+        if (xpos == null)
+          xpos = Empty;
+      }
+    if (xpos == Empty)
+      return eofValue;
+    return ((Pair) xpos).car;
+  }
+
+  protected void setPrevious(int ipos, Object xpos, Object value)
+  {
+    int isAfter = (ipos & 1);
+    if (isAfter > 0)
+      {
+	xpos = xpos == null ? this : ((Pair) xpos).cdr;
+      }
+    ((Pair) xpos).car = value;
+  }
+
   public Object get (int index)
   {
     throw new ArrayIndexOutOfBoundsException (index);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]