站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

CharSubSequence (Editor Utilities) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.util/1 1.17

org.netbeans.lib.editor.util
Class CharSubSequence

java.lang.Object
  extended by org.netbeans.lib.editor.util.AbstractCharSequence
      extended by org.netbeans.lib.editor.util.CharSubSequence
All Implemented Interfaces:
CharSequence
Direct Known Subclasses:
CharSubSequence.StringLike

public class CharSubSequence
extends AbstractCharSequence

Subsequence of the given character sequence. The backing sequence is considered to be stable i.e. does not change length or content over time.


Nested Class Summary
static class CharSubSequence.StringLike
          Subclass providing string-like implementation of hashCode() and equals() method accepting strings with the same content like charsequence has.
 
Constructor Summary
CharSubSequence(CharSequence backingSequence, int start, int end)
          Construct character subsequence with the given backing character sequence.
 
Method Summary
protected  CharSequence backingSequence()
           
 char charAt(int index)
          Returns the character at the specified index.
static void checkIndexesValid(CharSequence text, int start, int end)
          Deprecated. use CharSequenceUtilities.checkIndexesValid(CharSequence, int, int)
 int length()
          Returns the length of this character sequence.
protected  int start()
           
 
Methods inherited from class org.netbeans.lib.editor.util.AbstractCharSequence
subSequence, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CharSubSequence

public CharSubSequence(CharSequence backingSequence,
                       int start,
                       int end)
Construct character subsequence with the given backing character sequence.

Parameters:
backingSequence - non-null backing character sequence. It is considered to be stable and not to change over time.
start - >=0 starting index of the subsequence within the backing character sequence.
end - >= ending index of the subsequence within the backing character sequence.
Throws:
IndexOutOfBoundsException - if the start or end are not within bounds of backingSequence.
Method Detail

checkIndexesValid

public static void checkIndexesValid(CharSequence text,
                                     int start,
                                     int end)
Deprecated. use CharSequenceUtilities.checkIndexesValid(CharSequence, int, int)

Ensure that the given start and end parameters are valid indices of the given text.

Throws:
IndexOutOfBoundsException - if the start or end are not within bounds of the given text.

backingSequence

protected CharSequence backingSequence()

start

protected int start()

length

public int length()
Description copied from class: AbstractCharSequence
Returns the length of this character sequence. The length is the number of 16-bit Unicode characters in the sequence.

Specified by:
length in interface CharSequence
Specified by:
length in class AbstractCharSequence
Returns:
the number of characters in this sequence

charAt

public char charAt(int index)
Description copied from class: AbstractCharSequence
Returns the character at the specified index. An index ranges from zero to length() - 1. The first character of the sequence is at index zero, the next at index one, and so on, as for array indexing.

Specified by:
charAt in interface CharSequence
Specified by:
charAt in class AbstractCharSequence
Parameters:
index - the index of the character to be returned
Returns:
the specified character

org.netbeans.modules.editor.util/1 1.17

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.