## org.gjt.sp.util
Class CharIndexedSegment

    java.lang.Object
      org.gjt.sp.util.CharIndexedSegment

All Implemented Interfaces:
  CharIndexed, java.io.Serializable

public class CharIndexedSegment
extends java.lang.Object
implements CharIndexed, java.io.Serializable

Lets `gnu.regexp` search within `Segment` objects.

See Also:
  Serialized Form

Field Summary

Fields inherited from interface gnu.regexp.CharIndexed
`OUT_OF_BOUNDS`

Constructor Summary
`CharIndexedSegment(javax.swing.text.Segment seg, boolean reverse)` Creates a new `CharIndexedSegment`.
`CharIndexedSegment(javax.swing.text.Segment seg, int index)` Creates a new `CharIndexedSegment`.

Method Summary
`char` `charAt(int index)` Returns the character at the given offset past the current cursor position in the input.
`boolean` `isValid()` Returns true if the most recent move() operation placed the cursor position at a valid position in the input.
`boolean` `move(int index)` Shifts the input buffer by a given number of positions.
`void` `reset()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CharIndexedSegment

    public CharIndexedSegment(javax.swing.text.Segment seg,
                              int index)

  Creates a new `CharIndexedSegment`.

Since:
  jEdit 4.1pre3

### CharIndexedSegment

    public CharIndexedSegment(javax.swing.text.Segment seg,
                              boolean reverse)

  Creates a new `CharIndexedSegment`.

Since:
  jEdit 4.1pre1

Method Detail

### charAt

    public char charAt(int index)

  Description copied from interface: `CharIndexed`
  Returns the character at the given offset past the current cursor position in the input. The index of the current position is zero. It is possible for this method to be called with a negative index. This happens when using the '^' operator in multiline matching mode or the '\b' or '\<' word boundary operators. In any case, the lower bound is currently fixed at -2 (for '^' with a two-character newline).

  Specified by:
    `charAt` in interface `CharIndexed`
  Parameters:
    `index` - the offset position in the character field to examine
  Returns:
    the character at the specified index, or the OUT_OF_BOUNDS character defined by this interface.

### isValid

    public boolean isValid()

  Description copied from interface: `CharIndexed`
  Returns true if the most recent move() operation placed the cursor position at a valid position in the input.

  Specified by:
    `isValid` in interface `CharIndexed`

### reset

    public void reset()

### move

    public boolean move(int index)

  Description copied from interface: `CharIndexed`
  Shifts the input buffer by a given number of positions. Returns true if the new cursor position is valid.

  Specified by:
    `move` in interface `CharIndexed`