com.raelity.text
Class TextUtil.MySegment

java.lang.Object
  extended by javax.swing.text.Segment
      extended by com.raelity.text.TextUtil.MySegment
All Implemented Interfaces:
CharSequence, Cloneable, CharacterIterator
Enclosing class:
TextUtil

public static class TextUtil.MySegment
extends Segment
implements CharSequence

To support jdk1.5, need a segment that isa CharSequence. Also keep "docOffset" which is the offset in the document of the start of the segment; -1 implies not known.


Field Summary
 int docOffset
           
 
Fields inherited from class javax.swing.text.Segment
array, count, offset
 
Fields inherited from interface java.text.CharacterIterator
DONE
 
Constructor Summary
TextUtil.MySegment()
           
TextUtil.MySegment(char[] array, int offset, int count, int docOffset)
           
TextUtil.MySegment(TextUtil.MySegment seg)
           
 
Method Summary
 char charAt(int index)
           
 int length()
           
 CharSequence subSequence(int start, int end)
           
 
Methods inherited from class javax.swing.text.Segment
clone, current, first, getBeginIndex, getEndIndex, getIndex, isPartialReturn, last, next, previous, setIndex, setPartialReturn, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.CharSequence
toString
 

Field Detail

docOffset

public int docOffset
Constructor Detail

TextUtil.MySegment

public TextUtil.MySegment()

TextUtil.MySegment

public TextUtil.MySegment(TextUtil.MySegment seg)

TextUtil.MySegment

public TextUtil.MySegment(char[] array,
                          int offset,
                          int count,
                          int docOffset)
Method Detail

charAt

public char charAt(int index)
Specified by:
charAt in interface CharSequence

length

public int length()
Specified by:
length in interface CharSequence

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSequence