/[classpath]/classpath/javax/swing/text/Segment.java
ViewVC logotype

Diff of /classpath/javax/swing/text/Segment.java

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

revision 1.3 by mkoch, Sat Jan 10 21:08:57 2004 UTC revision 1.4 by mark, Thu Jul 22 19:45:39 2004 UTC
# Line 37  exception statement from your version. * Line 37  exception statement from your version. *
37    
38  package javax.swing.text;  package javax.swing.text;
39    
40  public class Segment implements Cloneable, CharacterIterator  import java.text.CharacterIterator;
41    
42    
43    public class Segment
44      implements Cloneable, CharacterIterator
45  {  {
46      char[] array;    public char[] array;
47      int count;    public int count;
48      int offset;    public int offset;
49    
50      public Segment()
51      {
52      }
53    
54      public Segment(char[] array, int offset, int count)
55      {
56        this.array = array;
57        this.offset = offset;
58        this.count = count;
59      }
60            
61      public Object clone()      public Object clone()
62      {      {
63          try {      try
64          {
65              return super.clone();              return super.clone();
         } catch (Exception e) {  
             System.err.println("Huuuhhh, this class implements cloneable !!!!!!");  
             System.err.println("I think there is a bug in this JVM somewhere");  
66          }          }
67        catch (CloneNotSupportedException e)
68          {
69          return null;          return null;
70      }      }
71      }
72            
73      public char current()      public char current()
74      {      {
# Line 74  public class Segment implements Cloneabl Line 90  public class Segment implements Cloneabl
90      {      {
91          return offset + count;          return offset + count;
92      }      }
93    
94      public int getIndex()      public int getIndex()
95      {      {
96          return offset;          return offset;
97      }      }
98    
99      public char last()      public char last()
100      {      {
101          offset = getEndIndex() - 1;          offset = getEndIndex() - 1;
102          return array[offset];          return array[offset];
103      }      }
104    
105      public char next()      public char next()
106      {      {
107          offset++;          offset++;
108          return array[offset];          return array[offset];
109      }      }
110    
111      public char previous()      public char previous()
112      {      {
113          offset--;          offset--;
114          return array[offset];          return array[offset];
115      }      }
116    
117      public char setIndex(int position)      public char setIndex(int position)
118      {      {
119          offset = position;          offset = position;
# Line 104  public class Segment implements Cloneabl Line 125  public class Segment implements Cloneabl
125          return new String(array, offset, count);          return new String(array, offset, count);
126      }      }
127  }  }
   

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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