/[gzz]/gzz/gzz/media/impl/FakeTextSpan.java
ViewVC logotype

Diff of /gzz/gzz/media/impl/FakeTextSpan.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by benja, Fri Aug 9 23:02:26 2002 UTC revision 1.6 by benja, Thu Jan 2 00:00:49 2003 UTC
# Line 24  FakeTextSpan.java Line 24  FakeTextSpan.java
24  package gzz.media.impl;  package gzz.media.impl;
25  import gzz.errors.*;  import gzz.errors.*;
26  import gzz.media.*;  import gzz.media.*;
27    import gzz.util.*;
28    
29  /** An object that behaves like a text span but is not really stable media.  /** An object that behaves like a text span but is not stored in a real Storm block.
30   * Used for things like coordinates or other computer-generated rapidly changing   * Used for things like coordinates or other computer-generated rapidly changing
31   * content.   * content. Must be atomic: if you give one piece away, you give
32     * the whole thing away. Must be short, because the whole thing
33     * is repeated whereever one piece goes. See PEG miniblocks--benja.
34   */   */
35    
36  public class FakeTextSpan implements TextSpan, java.io.Serializable {  public class FakeTextSpan implements TextSpan, java.io.Serializable {
37  public static final String rcsid = "$Id$";  public static final String rcsid = "$Id$";
38    
39      String text;      String text;
40        FakeTextScrollBlock sb;
41      transient char[] textarr;      transient char[] textarr;
     transient FakeTextScrollBlock sb;  
42    
43      public FakeTextSpan(String s) {      public FakeTextSpan(String s) {
44            String id = URN5Namespace.instance.getStormDataBlockId();
45            id = id + "," + URIUtil.escapeUTF8(s);
46    
47            sb = new FakeTextScrollBlock(/*s, id*/);
48          this.text = s;          this.text = s;
49      }      }
50    
# Line 67  public static final String rcsid = "$Id$ Line 74  public static final String rcsid = "$Id$
74      public String toString() { return "FAKESPAN "+text; }      public String toString() { return "FAKESPAN "+text; }
75      public boolean intersects(Span s) { return false; }      public boolean intersects(Span s) { return false; }
76    
77      public class FakeTextScrollBlock implements TextScrollBlock {      protected class FakeTextScrollBlock implements TextScrollBlock {
78          public String getID() { return ""; }          /*
79            protected String str, id;
80    
81            protected FakeTextScrollBlock(String id) {
82                if(!id.startsWith("storm:data:"))
83                    throw IllegalArgumentException("Cannot handle URI: "+id);
84    
85                // ignore everything between storm:data: and :[<mimetype>],<data>
86                int j = id.indexOf(',');
87                int i = id.lastIndexOf(':', j);
88                String type = str.substring(i+1, j);
89                if(!type.equals("") && !type.equals("text/plain;charset=UTF-8"))
90                    throw IllegalArgumentException("Cannot handle content type: "+type);
91    
92                this.str = URIUtil.unescapeUTF8(str.substring(j+1));
93                this.id = id;
94            }
95            */
96    
97            public String getID() { return "" /*id*/; }
98          public Span getCurrent() { return FakeTextSpan.this; }          public Span getCurrent() { return FakeTextSpan.this; }
99          public boolean isFinalized() { return true; }          public boolean isFinalized() { return true; }
100    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26