[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire/org/fenfire Fen.java NodeContent.java i...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] fenfire/org/fenfire Fen.java NodeContent.java i... |
Date: |
Thu, 24 Apr 2003 09:29:13 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Changes by: Tuomas J. Lukka <address@hidden> 03/04/24 09:29:12
Modified files:
org/fenfire : Fen.java NodeContent.java
org/fenfire/impl: SimpleNodeContent.java simplenodecontent.test
org/fenfire/modules/pp: Pp.java
org/fenfire/util: AlphContent.java
org/fenfire/view: DefaultNodeView.java
org/fenfire/view/buoy: ScrollBlockNodeLinker.java
Removed files:
org/fenfire/impl: CachingNodeContent.java
Log message:
Fen and nodecontent revamp
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/Fen.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/NodeContent.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/impl/SimpleNodeContent.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/impl/simplenodecontent.test.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/Pp.java.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/util/AlphContent.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/DefaultNodeView.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/ScrollBlockNodeLinker.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/Fen.java
diff -u fenfire/org/fenfire/Fen.java:1.7 fenfire/org/fenfire/Fen.java:1.8
--- fenfire/org/fenfire/Fen.java:1.7 Thu Apr 24 08:59:07 2003
+++ fenfire/org/fenfire/Fen.java Thu Apr 24 09:29:12 2003
@@ -41,30 +41,6 @@
new org.nongnu.alph.impl.Enfilade1DImpl.Enfilade1DImplMaker();
- /** For use with recursed Fens: indicate
- * that this Fen will not be used again
- * and may be recycled.
- */
- public void close() {
- txt._close();
- constgraph.close();
- }
-
- /** Obtain a new Fen which observes.
- * if the result of one of the methods
- * that were called for the returned Fen changes
- * through a structure change (i.e. a find() was
- * done and one of the found objects is removed
- * or an extra one is added), then Obs will be called.
- * Null may be returned if the current Fen is not observable.
- */
- Fen getObserved(Obs o) {
- Fen n = new Fen();
- n.constgraph = n.graph = graph.getObservedGraph(o);
- n.txt = txt._getObserved(n, o);
- return n;
- }
-
/** The set of xanadu links in use with this Fen.
*/
// public XuIndexer xuLinks;
Index: fenfire/org/fenfire/NodeContent.java
diff -u fenfire/org/fenfire/NodeContent.java:1.3
fenfire/org/fenfire/NodeContent.java:1.4
--- fenfire/org/fenfire/NodeContent.java:1.3 Thu Apr 24 08:59:07 2003
+++ fenfire/org/fenfire/NodeContent.java Thu Apr 24 09:29:12 2003
@@ -7,31 +7,17 @@
public interface NodeContent {
-// public NodeFunction getNodeFunction() ;
-
- /** Get the vstream in this node.
- * Never returns <code>null</code>.
- */
- org.nongnu.alph.Enfilade1D get(Object resource);
-
- /** Get the vstream in this node.
- * Never returns <code>null</code>.
+ /** Get the (uncaching) NodeFunction
+ * which returns the Enfilade1D for a given
+ * node.
*/
- org.nongnu.alph.Enfilade1D get(Object resource, Obs o);
+ public org.fenfire.swamp.NodeFunction getNodeFunction() ;
/** Set the vstream in this node.
*/
- void set(Object resource,
+ void set(Object node,
org.nongnu.alph.Enfilade1D vstream);
- NodeContent _getObserved(Fen obsFen,
- Obs o);
-
- /** For use with recursed Fens: indicate
- * that this Fen will not be used again
- * and may be recycled.
- */
- void _close();
}
Index: fenfire/org/fenfire/impl/SimpleNodeContent.java
diff -u fenfire/org/fenfire/impl/SimpleNodeContent.java:1.5
fenfire/org/fenfire/impl/SimpleNodeContent.java:1.6
--- fenfire/org/fenfire/impl/SimpleNodeContent.java:1.5 Tue Apr 15 23:53:08 2003
+++ fenfire/org/fenfire/impl/SimpleNodeContent.java Thu Apr 24 09:29:12 2003
@@ -20,7 +20,7 @@
public class SimpleNodeContent implements NodeContent {
public static boolean dbg = true;
-public static final String rcsid = "$Id: SimpleNodeContent.java,v 1.5
2003/04/16 03:53:08 tjl Exp $";
+public static final String rcsid = "$Id: SimpleNodeContent.java,v 1.6
2003/04/24 13:29:12 tjl Exp $";
private static void pa(String s) { System.out.println("AlphContent: "+s); }
SpanReader spanReader = new SpanReader();
@@ -41,17 +41,26 @@
this.fen = fen;
}
- public NodeContent _getObserved(Fen obsFen,
- Obs obs) {
- // We don't need to use obs since the graph will do it for us.
- return new SimpleNodeContent(obsFen);
+ private class Func implements org.fenfire.swamp.NodeFunction {
+ public Object f(org.fenfire.swamp.ConstGraph graph, Object node) {
+ Object c = graph.find1_11X(node, FF.content);
+ if(dbg) pa("Getting content: "+node+" "+c);
+ if(c == null) return empty;
+
+ if(!(c instanceof Literal)) {
+ if(dbg) pa("Was not literal: "+c);
+ throw new Error("Content not literal");
+ }
+ return enfiladeFromLiteral((Literal)c);
+ }
}
- public void _close() { }
- public org.nongnu.alph.Enfilade1D get(Object node) {
- return get(node, null);
+ Func func = new Func();
+ public org.fenfire.swamp.NodeFunction getNodeFunction() {
+ return func;
}
+
public org.nongnu.alph.Enfilade1D enfiladeFromLiteral(Literal l) {
if(dbg) pa("EnfiladeFromLiteral: "+l);
try {
@@ -75,19 +84,6 @@
if(dbg) pa("LiteralFromEnfilade: "+ser);
return Nodes.getRawXMLLiteral(ser);
}
-
- public org.nongnu.alph.Enfilade1D get(Object node, Obs o) {
- Object c = fen.constgraph.find1_11X(node, FF.content, o);
- if(dbg) pa("Getting content: "+node+" "+c);
- if(c == null) return empty;
-
- if(!(c instanceof Literal)) {
- if(dbg) pa("Was not literal: "+c);
- throw new Error("Content not literal");
- }
- return enfiladeFromLiteral((Literal)c);
- }
-
public void set(Object node, org.nongnu.alph.Enfilade1D enf) {
Literal lit = literalFromEnfilade(enf);
Index: fenfire/org/fenfire/impl/simplenodecontent.test
diff -u fenfire/org/fenfire/impl/simplenodecontent.test:1.2
fenfire/org/fenfire/impl/simplenodecontent.test:1.3
--- fenfire/org/fenfire/impl/simplenodecontent.test:1.2 Sun Apr 13 03:49:05 2003
+++ fenfire/org/fenfire/impl/simplenodecontent.test Thu Apr 24 09:29:12 2003
@@ -16,6 +16,7 @@
snc = fenfire.impl.SimpleNodeContent(fen)
fen.txt = snc
+ fen.txtfunc = snc.getNodeFunction()
spm = alph.impl.URN5SpanMaker()
em = alph.impl.Enfilade1DImpl.Enfilade1DImplMaker()
@@ -32,12 +33,12 @@
def testPutGet():
snc.set(node1, enf1)
- assert snc.get(node1).equals(enf1)
- assert snc.get(node2).length() == 0
+ assert fen.txtfunc.f(fen.constgraph,node1).equals(enf1)
+ assert fen.txtfunc.f(fen.constgraph,node2).length() == 0
snc.set(node1, enf2)
- assert snc.get(node1).equals(enf2)
- assert snc.get(node2).length() == 0
+ assert fen.txtfunc.f(fen.constgraph,node1).equals(enf2)
+ assert fen.txtfunc.f(fen.constgraph,node2).length() == 0
#def testWhat():
# snc.set(node1, enf1)
Index: fenfire/org/fenfire/modules/pp/Pp.java
diff -u fenfire/org/fenfire/modules/pp/Pp.java:1.31
fenfire/org/fenfire/modules/pp/Pp.java:1.32
--- fenfire/org/fenfire/modules/pp/Pp.java:1.31 Wed Apr 23 19:40:40 2003
+++ fenfire/org/fenfire/modules/pp/Pp.java Thu Apr 24 09:29:12 2003
@@ -28,7 +28,7 @@
public class Pp implements BuoyLinkListener {
-public static final String rcsid = "$Id: Pp.java,v 1.31 2003/04/23 23:40:40
mudyc Exp $";
+public static final String rcsid = "$Id: Pp.java,v 1.32 2003/04/24 13:29:12
tjl Exp $";
public static final boolean dbg = false;
protected static void p(String s) { if(dbg) pa(s); }
protected static void pa(String s) { System.out.println("Pp::"+s); }
@@ -63,7 +63,9 @@
fen = new Fen();
fen.constgraph = fen.graph = new HashGraph();
//fen.enfiladeOverlap = new XXX
- fen.txt = new CachingNodeContent(new SimpleNodeContent(fen));
+ fen.txt = new SimpleNodeContent(fen);
+ fen.txtfunc = new CachedNodeFunction(500, fen.constgraph,
+ fen.txt.getNodeFunction());
ppAct = new PPActionsImpl(fen);
Index: fenfire/org/fenfire/util/AlphContent.java
diff -u fenfire/org/fenfire/util/AlphContent.java:1.8
fenfire/org/fenfire/util/AlphContent.java:1.9
--- fenfire/org/fenfire/util/AlphContent.java:1.8 Tue Apr 15 23:53:08 2003
+++ fenfire/org/fenfire/util/AlphContent.java Thu Apr 24 09:29:12 2003
@@ -14,7 +14,7 @@
*/
public class AlphContent {
public static boolean dbg = true;
-public static final String rcsid = "$Id: AlphContent.java,v 1.8 2003/04/16
03:53:08 tjl Exp $";
+public static final String rcsid = "$Id: AlphContent.java,v 1.9 2003/04/24
13:29:12 tjl Exp $";
private static void pa(String s) { System.out.println("AlphContent: "+s); }
@@ -25,8 +25,8 @@
this.fen = fen;
}
- public String getText(Object node) {
- Enfilade1D enf = fen.txt.get(node);
+ public String getText(org.fenfire.swamp.ConstGraph graph, Object node) {
+ Enfilade1D enf = (Enfilade1D)fen.txtfunc.f(graph, node);
return enf.makeString();
}
@@ -37,7 +37,7 @@
}
public void insertText(Object node, int ind, String s, boolean user) {
- Enfilade1D old = fen.txt.get(node);
+ Enfilade1D old = (Enfilade1D)fen.txtfunc.f(fen.constgraph, node);
Enfilade1D enf = old.sub(0, ind);
enf = enf.plus(
@@ -49,7 +49,7 @@
}
public void deleteText(Object node, int begin, int end) {
- Enfilade1D old = fen.txt.get(node);
+ Enfilade1D old = (Enfilade1D)fen.txtfunc.f(fen.constgraph, node);
Enfilade1D enf = old.sub(0, begin);
enf = enf.plus(old.sub(end));
Index: fenfire/org/fenfire/view/DefaultNodeView.java
diff -u fenfire/org/fenfire/view/DefaultNodeView.java:1.8
fenfire/org/fenfire/view/DefaultNodeView.java:1.9
--- fenfire/org/fenfire/view/DefaultNodeView.java:1.8 Wed Apr 23 17:07:30 2003
+++ fenfire/org/fenfire/view/DefaultNodeView.java Thu Apr 24 09:29:12 2003
@@ -10,7 +10,7 @@
import java.awt.*;
public class DefaultNodeView extends NodeView {
-private static final String rcsid = "$Id: DefaultNodeView.java,v 1.8
2003/04/23 21:07:30 mudyc Exp $";
+private static final String rcsid = "$Id: DefaultNodeView.java,v 1.9
2003/04/24 13:29:12 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) {
System.out.println("DefaultNodeView::"+s); }
@@ -21,7 +21,7 @@
}
public void place(Object node, VobScene vs, int box) {
- Enfilade1D enf = fen.txt.get(node);
+ Enfilade1D enf = (Enfilade1D)fen.txtfunc.f(fen.constgraph, node);
List l = enf.getList();
if (l.get(0) instanceof TextSpan)
text.place(vs, box, enf);
@@ -32,12 +32,12 @@
public void getSize(Object node, float[] size, float scale) {
if (size == null) return;
- Enfilade1D enf = fen.txt.get(node);
+ Enfilade1D enf = (Enfilade1D)fen.txtfunc.f(fen.constgraph, node);
List l = enf.getList();
if (l.get(0) instanceof TextSpan)
- text.getSize(fen.txt.get(node), size);
+ text.getSize((Enfilade1D)fen.txtfunc.f(fen.constgraph, node), size);
else // PageSpan
- page.getSize(fen.txt.get(node), size);
+ page.getSize((Enfilade1D)fen.txtfunc.f(fen.constgraph, node), size);
size[0] *= scale;
size[1] *= scale;
Index: fenfire/org/fenfire/view/buoy/ScrollBlockNodeLinker.java
diff -u fenfire/org/fenfire/view/buoy/ScrollBlockNodeLinker.java:1.3
fenfire/org/fenfire/view/buoy/ScrollBlockNodeLinker.java:1.4
--- fenfire/org/fenfire/view/buoy/ScrollBlockNodeLinker.java:1.3 Wed Apr
23 17:07:30 2003
+++ fenfire/org/fenfire/view/buoy/ScrollBlockNodeLinker.java Thu Apr 24
09:29:12 2003
@@ -79,7 +79,7 @@
// Find all transclusion and put buoys of scrollblocks
// of pagespans
//
- Enfilade1D enf = fen.txt.get(node, null);
+ Enfilade1D enf = (Enfilade1D)fen.txtfunc.f(fen.constgraph, node);
for(Iterator i = org.nongnu.alph.util.EnfUtil.
getScrollBlockRepresentatives(enf).iterator();
i.hasNext(); ) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] fenfire/org/fenfire Fen.java NodeContent.java i...,
Tuomas J. Lukka <=