com.taco.text
Class ReversedCharSequence

java.lang.Object
  extended by com.taco.text.ReversedCharSequence
All Implemented Interfaces:
java.io.Serializable, java.lang.CharSequence, java.lang.Cloneable

public final class ReversedCharSequence
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.lang.CharSequence

A CharSequence that represents the reversed version of another CharSequence, but avoids copying whenever possible.

See Also:
Serialized Form

Constructor Summary
ReversedCharSequence(java.lang.CharSequence forwardSequence)
          Construct a new instance that is the reversed version of the argument sequence.
 
Method Summary
 char charAt(int index)
           
 java.lang.CharSequence forwardSequence()
          Return the sequence that this instance is the reverse of.
 int length()
           
static void main(java.lang.String[] args)
           
 java.lang.CharSequence subSequence(int start, int end)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReversedCharSequence

public ReversedCharSequence(java.lang.CharSequence forwardSequence)
Construct a new instance that is the reversed version of the argument sequence. The argument sequence is not copied, so it must not change!

Method Detail

charAt

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

length

public int length()
Specified by:
length in interface java.lang.CharSequence

subSequence

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

toString

public java.lang.String toString()
Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class java.lang.Object

forwardSequence

public java.lang.CharSequence forwardSequence()
Return the sequence that this instance is the reverse of.


main

public static void main(java.lang.String[] args)