net.sf.mmm.util.lang.base
Class CharSubSequence

java.lang.Object
  extended by net.sf.mmm.util.lang.base.CoreCharSequence
      extended by net.sf.mmm.util.lang.base.CharSubSequence
All Implemented Interfaces:
CharSequence

public class CharSubSequence
extends CoreCharSequence

This is an implementation of the CharSequence Interface that can be used to implement the method CharSequence.subSequence(int, int).
ATTENTION: This implementation assumes that the original char sequence has an immutable length (at least it should NOT shrink)!

Since:
1.0.2
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  int length
          the length of the sub-sequence
private  CharSequence original
          the original sequence that is wrapped here
private  int start
          the start position of the sub-sequence
 
Constructor Summary
CharSubSequence(CharSequence originalSequence, int startPosition, int endPosition)
          The constructor.
 
Method Summary
 char charAt(int index)
          
 int length()
          
 CharSequence subSequence(int startPosition, int endPosition)
          
 
Methods inherited from class net.sf.mmm.util.lang.base.CoreCharSequence
contentChanged, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

original

private final CharSequence original
the original sequence that is wrapped here


start

private final int start
the start position of the sub-sequence


length

private final int length
the length of the sub-sequence

Constructor Detail

CharSubSequence

public CharSubSequence(CharSequence originalSequence,
                       int startPosition,
                       int endPosition)
The constructor.

Parameters:
originalSequence - is the underlying sequence.
startPosition - is the start-index in originalSequence.
endPosition - is the end-index in originalSequence.
Method Detail

subSequence

public CharSequence subSequence(int startPosition,
                                int endPosition)


length

public int length()


charAt

public char charAt(int index)



Copyright © 2001-2010 mmm-Team. All Rights Reserved.