[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz gzz/index/impl/XuIndexer.java gzz/zzutil/Id...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz gzz/index/impl/XuIndexer.java gzz/zzutil/Id... |
Date: |
Tue, 17 Sep 2002 11:55:29 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 02/09/17 11:55:29
Modified files:
gzz/index/impl : XuIndexer.java
gzz/zzutil : Ids.java
test/gzz/index/impl: xuindexer.test
Added files:
gzz/index/impl : TransientXuIndexer.java
test/gzz/index/impl: xuindexer.meta
Log message:
extract API from xuindexer
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/index/impl/TransientXuIndexer.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/index/impl/XuIndexer.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/zzutil/Ids.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/index/impl/xuindexer.meta?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/index/impl/xuindexer.test.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/gzz/index/impl/XuIndexer.java
diff -c gzz/gzz/index/impl/XuIndexer.java:1.1
gzz/gzz/index/impl/XuIndexer.java:1.2
*** gzz/gzz/index/impl/XuIndexer.java:1.1 Mon Sep 16 09:53:14 2002
--- gzz/gzz/index/impl/XuIndexer.java Tue Sep 17 11:55:29 2002
***************
*** 6,35 ****
/** An index of xanadu links.
*/
! public class XuIndexer {
! EnfiladeOverlapIndex
! f = new EnfiladeOverlapIndex(),
! b = new EnfiladeOverlapIndex();
! /** Get an Index which, for Enfilade1Ds,
* returns all XuLink objects where
* the given enfilade overlaps the from
* member.
*/
! public Index getForwardIndex() { return f; }
! public Index getBackwardIndex() { return b; }
- public void add(XuLink link) {
- f.set(link, link.from);
- b.set(link, link.to);
- }
/** Remove a link.
* Note that since we don't have equivalence classes between
* links yet, this must be a XuLink that's really inside this
* object, either inserted through add() or obtained through
* an index.
*/
! public void remove(XuLink link) {
! f.set(link, null);
! b.set(link, null);
! }
}
--- 6,27 ----
/** An index of xanadu links.
*/
! public interface XuIndexer {
! /** Get an Index which, for Enfilade1Ds,
* returns all XuLink objects where
* the given enfilade overlaps the from
* member.
*/
! Index getForwardIndex();
! Index getBackwardIndex();
!
! void add(XuLink link);
/** Remove a link.
* Note that since we don't have equivalence classes between
* links yet, this must be a XuLink that's really inside this
* object, either inserted through add() or obtained through
* an index.
*/
! public void remove(XuLink link);
}
Index: gzz/gzz/zzutil/Ids.java
diff -c gzz/gzz/zzutil/Ids.java:1.3 gzz/gzz/zzutil/Ids.java:1.4
*** gzz/gzz/zzutil/Ids.java:1.3 Sun Aug 18 08:03:46 2002
--- gzz/gzz/zzutil/Ids.java Tue Sep 17 11:55:29 2002
***************
*** 1,5 ****
/*
! DimIds.java
*
* You may use and distribute under the terms of either the GNU Lesser
* General Public License, either version 2 of the license or,
--- 1,5 ----
/*
! Ids.java
*
* You may use and distribute under the terms of either the GNU Lesser
* General Public License, either version 2 of the license or,
***************
*** 44,49 ****
--- 44,55 ----
public static String d_2 =
"urn:urn-5:0000000008000000E7C2E550C700043E3EC208FC03C2F68A854DA58908F1DB16B43BC4ACD60637-32";
public static String d_3 =
"urn:urn-5:0000000008000000E7C2E550C700043E3EC208FC03C2F68A854DA58908F1DB16B43BC4ACD60637-31";
+
+ /** Dimension for xanalogical links.
+ * A link is three cells along d_xu_link currently: identity cell
(represents
+ * the link), first link set (as enfilade), second link set (as
enfilade).
+ */
+ public static String d_xu_link =
"urn:urn-5:9ESrVRkRG+FVFlWuokjDn4v-asg+:1";
// FOR COMPATIBILITY
Index: gzz/test/gzz/index/impl/xuindexer.test
diff -c gzz/test/gzz/index/impl/xuindexer.test:1.2
gzz/test/gzz/index/impl/xuindexer.test:1.3
*** gzz/test/gzz/index/impl/xuindexer.test:1.2 Mon Sep 16 09:57:22 2002
--- gzz/test/gzz/index/impl/xuindexer.test Tue Sep 17 11:55:29 2002
***************
*** 2,69 ****
import gzz
! xuindexer = gzz.index.impl.XuIndexer()
! spanMaker = gzz.media.impl.ScrollSpanMaker()
! enfiladeMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker()
!
! XuLink = gzz.index.XuLink
!
! def c(coll):
! """Collection into sorted list"""
! l = []
! for i in coll: l.append(i)
! l.sort()
! return l
!
! def test1():
! span1 = spanMaker.makeTextSpan("ABC")
! span2 = spanMaker.makeTextSpan("DEF")
!
! enf1 = enfiladeMaker.makeEnfilade(span1)
! enf2 = enfiladeMaker.makeEnfilade(span2)
!
! # Link A-D
!
! link1 = XuLink(enf1.sub(0,1), enf2.sub(0,1))
! xuindexer.add(link1)
!
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf2.sub(0,1))))
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(1,2))))
! failUnlessEqual([link1],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(0,1))))
!
! # Link C-A
! link2 = XuLink(enf1.sub(1,2), enf1.sub(0,1))
! xuindexer.add(link2)
!
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf2.sub(0,1))))
! failUnlessEqual([link2],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(1,2))))
! failUnlessEqual([link1],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(0,1))))
!
! xuindexer.remove(link1)
!
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf2.sub(0,1))))
! failUnlessEqual([link2],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(1,2))))
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(0,1))))
!
! xuindexer.remove(link2)
!
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf2.sub(0,1))))
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(1,2))))
! failUnlessEqual([],
! c(xuindexer.getForwardIndex().getMatches(enf1.sub(0,1))))
!
!
!
!
! # vim: set syntax=python :
--- 2,6 ----
import gzz
! xuindexer = gzz.index.impl.TransientXuIndexer()
! execfile("test/gzz/index/impl/xuindexer.meta")
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz gzz/index/impl/XuIndexer.java gzz/zzutil/Id...,
Benja Fallenstein <=