gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gzz slices/YAMLVersionFormatter.py view/Tex...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/gzz slices/YAMLVersionFormatter.py view/Tex...
Date: Wed, 08 Jan 2003 20:59:45 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/01/08 20:59:44

Modified files:
        gzz/slices     : YAMLVersionFormatter.py 
        gzz/view       : TextCellContentView.java 
Added files:
        gzz/slices     : SliceVersionReader.java YAMLVersionReader.java 

Log message:
        Since load/save currently seems to be the slowest part about the Gzz 
client,
        finally here's the rewrite of our YAML file reader in Java. One hopes
        this'll be faster than the Python one. The writer is still in Python,
        but should be trivial to convert. The change does already remove
        our dependency on PyYAML.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/slices/SliceVersionReader.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/slices/YAMLVersionReader.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/slices/YAMLVersionFormatter.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.34&tr2=1.35&r1=text&r2=text

Patches:
Index: gzz/gzz/slices/YAMLVersionFormatter.py
diff -u gzz/gzz/slices/YAMLVersionFormatter.py:1.13 
gzz/gzz/slices/YAMLVersionFormatter.py:1.14
--- gzz/gzz/slices/YAMLVersionFormatter.py:1.13 Wed Jan  1 07:31:45 2003
+++ gzz/gzz/slices/YAMLVersionFormatter.py      Wed Jan  8 20:59:44 2003
@@ -16,8 +16,6 @@
 #
 
 
-import yaml
-
 import gzz
 
 from gzz.media import *
@@ -49,73 +47,21 @@
        stream.close()
 
     def readVersion(self, stream):
-       struct = yaml.load(str(String(CopyUtil.readBytes(stream))))[0]
+        reader = gzz.slices.SliceVersionReader(stream, self.mediaserver,
+                                               self.enfiladeMaker)
+        return reader.readVersion()
+    
+       #struct = yaml.load(str(String(CopyUtil.readBytes(stream))))[0]
        #print struct
-       return SliceVersion(*parseVersion(struct, self.mediaserver, 
self.enfiladeMaker))
+       #return SliceVersion(*parseVersion(struct, self.mediaserver, 
self.enfiladeMaker))
 
     def readDiff(self, stream):
-       struct = yaml.load(str(String(CopyUtil.readBytes(stream))))[0]
-       return SliceVersion.Diff(*parseDiff(struct, self.mediaserver, 
self.enfiladeMaker))
-
-
-def parseVersion(struct, ms, maker):
-    connections = HashSet()
-    contents = HashMap()
-
-    if(struct.has_key('Connections')):
-        addConns(struct['Connections'], connections)
-
-    if(struct.has_key('Content')):
-        addContent(struct['Content'], contents, ms, maker)
-
-    return (connections, contents)
-
-def parseDiff(struct, ms, maker):
-    if(struct.has_key('Add')):
-        connects, contents = parseVersion(struct['Add'], ms, maker)
-    else:
-        connects, contents = HashSet(), HashMap()
-
-    if(struct.has_key('Remove')):
-        disconnects, discontents = parseVersion(struct['Remove'], ms, maker)
-    else:
-        disconnects, discontents = HashSet(), HashMap()
-
-    return (connects, disconnects, contents, discontents)
-
-def addConns(struct, into):
-    for (dim, conns) in struct.items():
-        for (neg, pos) in conns:
-            into.add(SliceVersion.Conn(dim, neg, pos))
-
-def addContent(struct, into, ms, maker):
-    for (cell, spanDefs) in struct.items():
-       spans = ArrayList()
-        #if type(spanDefs) == type({}):
-        #    # work around a bug(?) in PyYAML
-        #    into.put(cell, maker.makeEnfilade())
-        #    addContent(spanDefs, into, ms, maker)
-        #    continue
-
-        for spanDef in spanDefs:
-           t, id = spanDef[0:2]
-            if not id.startswith("storm:block:"):
-                raise IOException("Not a 'storm:block:' uri: %s" % (id,))
-            id = id[len("storm:block:"):]
-           id = Mediaserver.Id(id)
-           if t == 'TextSpan':
-               block = ScrollBlockManager.getTextScrollBlock(ms, id)
-               spans.add(block.getSpan(spanDef[2], 
-                       spanDef[2] + spanDef[3]))
-           elif t == 'ImageSpan' or t == 'PageSpan':
-                spans.add(ScrollBlockManager.getSpan(ms, id, 
-                   *spanDef[2:]))
-           else:
-               raise NotImplementedError("Unknown span type: %s" % (t,))
-
-       into.put(cell, maker.makeEnfilade(spans))
-
+        reader = gzz.slices.SliceVersionReader(stream, self.mediaserver,
+                                               self.enfiladeMaker)
+        return reader.readDiff()
 
+       #struct = yaml.load(str(String(CopyUtil.readBytes(stream))))[0]
+       #return SliceVersion.Diff(*parseDiff(struct, self.mediaserver, 
self.enfiladeMaker))
 
 
 def dumpVersion(connections, content, ms):
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.34 
gzz/gzz/view/TextCellContentView.java:1.35
--- gzz/gzz/view/TextCellContentView.java:1.34  Sat Dec  7 20:35:06 2002
+++ gzz/gzz/view/TextCellContentView.java       Wed Jan  8 20:59:44 2003
@@ -39,7 +39,7 @@
 /** A cell content view showing a cell's text.
  */
 public class TextCellContentView extends CellView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.34 
2002/12/08 01:35:06 benja Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.35 
2003/01/09 01:59:44 benja Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -51,7 +51,7 @@
     String widthString;
 
     public TextCellContentView(TextStyle style) {
-       this(style, "XXXXXXXXXX");
+       this(style, "XXXXXXXXXXXXXXXXXX");
     }
 
     public TextCellContentView(TextStyle style, String widthString) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]