Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.text
Class GapTextStore

    java.lang.Object
      org.eclipse.jface.text.GapTextStore

All Implemented Interfaces:
  ITextStore

public class GapTextStore
extends Object
implements ITextStore

Implements a gap managing text store. The gap text store relies on the assumption that subsequent changes of a document are co-located. The start of the gap is always moved to the location of the last change. The size of the gap varies between the low water mark and the high water mark.

This class is not intended to be subclassed.

Constructor Summary
`GapTextStore(int lowWatermark, int highWatermark)` Creates a new empty text store using the specified low and high watermarks.

Method Summary
`char` | `get(int offset)` Returns the character at the specified offset.
`String` | `get(int offset, int length)` Returns the text of the specified character range.
`protected String` | `getContentAsString()` Returns a copy of the content of this text store.
`protected int` | `getGapEndIndex()` Returns the end index of the gap managed by this text store.
`protected int` | `getGapStartIndex()` Returns the start index of the gap managed by this text store.
`int` | `getLength()` Returns number of characters stored in this text store.
`void` | `replace(int offset, int length, String text)` Replaces the specified character range with the given text.
`void` | `set(String text)` Sets the content to `text` and removes the gap since there are no sensible predictions about where the next change will occur.

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

Constructor Detail

### GapTextStore

    public GapTextStore(int lowWatermark,
                        int highWatermark)

  Creates a new empty text store using the specified low and high watermarks.

Parameters:
  `lowWatermark` - if this gap is ever smaller than this, it will automatically be extended
  `highWatermark` - if the gap is ever larger than this, it will automatically be shrunken

Method Detail

### get

    public char get(int offset)

  Description copied from interface: `ITextStore`
  Returns the character at the specified offset.

  Specified by:
    `get` in interface `ITextStore`
  Parameters:
    `offset` - the offset in this text store
  Returns:
    the character at this offset

### get

    public String get(int offset,
                      int length)

  Description copied from interface: `ITextStore`
  Returns the text of the specified character range.

  Specified by:
    `get` in interface `ITextStore`
  Parameters:
    `offset` - the offset of the range
    `length` - the length of the range
  Returns:
    the text of the range

### getLength

    public int getLength()

  Description copied from interface: `ITextStore`
  Returns number of characters stored in this text store.

  Specified by:
    `getLength` in interface `ITextStore`
  Returns:
    the number of characters stored in this text store

### replace

    public void replace(int offset,
                        int length,
                        String text)

  Description copied from interface: `ITextStore`
  Replaces the specified character range with the given text. `replace(getLength(), 0, "some text")` is a valid call and appends text to the end of the text store.

  Specified by:
    `replace` in interface `ITextStore`
  Parameters:
    `offset` - the offset of the range to be replaced
    `length` - the number of characters to be replaced
    `text` - the substitution text

### set

    public void set(String text)

  Sets the content to `text` and removes the gap since there are no sensible predictions about where the next change will occur.

  Specified by:
    `set` in interface `ITextStore`
  Parameters:
    `text` - the new content of the text store
  See Also:
    `ITextStore.set(String)`

### getContentAsString

    protected String getContentAsString()

  Returns a copy of the content of this text store. For internal use only.

  Returns:
    a copy of the content of this text store

### getGapStartIndex

    protected int getGapStartIndex()

  Returns the start index of the gap managed by this text store. For internal use only.

  Returns:
    the start index of the gap managed by this text store

### getGapEndIndex

    protected int getGapEndIndex()

  Returns the end index of the gap managed by this text store. For internal use only.

  Returns:
    the end index of the gap managed by this text store

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.