Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.text 6.9.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openide.text
Class Line.Set

    java.lang.Object
      org.openide.text.Line.Set

Direct Known Subclasses:
  DocumentLine.Set

Enclosing class:
  Line

    public abstract static class Line.Set

extends Object

Object that represents a snapshot of lines at the time it was created. It is used to create a mapping from line numbers to line objects, for example when the file is saved. Such a mapping can then be used by the compiler, e.g., to find the correct `Line` object, assuming it has a line number.

Mappings of line numbers to line objects will survive modifications of the text, and continue to represent the original lines as close as possible. For example: if a new line is inserted at the 10th line of a document and the compiler module asks for the 25th line (because the compiler reports an error at line 25 in the saved file) via the line set, the 26th line of the current document will be marked as being in error.

Constructor Summary
`Line.Set()` Create a new snapshot.

Method Summary
`abstract Line` | `getCurrent(int line)` Find line object representing the line in current document.
`Date` | `getDate()` Get creation time for this line set.
`abstract List` | `getLines()` Returns a set of line objects sorted by their line numbers.
`abstract Line` | `getOriginal(int line)` Find line object in the line set corresponding to original line number.
`int` | `getOriginalLineNumber(Line line)` Finds an original line number for given line in this line set.

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

Constructor Detail

### Line.Set

    public Line.Set()

  Create a new snapshot. Remembers the date when it was created.

Method Detail

### getLines

    public abstract List getLines()

  Returns a set of line objects sorted by their line numbers. This immutable list will contains all lines held by this line set.

  Returns:
    list of element type `Line`

### getDate

    public final Date getDate()

  Get creation time for this line set.

  Returns:
    time

### getOriginal

    public abstract Line getOriginal(int line)
                              throws IndexOutOfBoundsException

  Find line object in the line set corresponding to original line number. That is, finds the line in the current document which originally had the indicated line number. If there have been modifications of that line, find one as close as possible.

  Parameters:
    `line` - number of the line
  Returns:
    line object
  Throws:
    `IndexOutOfBoundsException` - if `line` is an invalid index for the original set of lines

### getCurrent

    public abstract Line getCurrent(int line)
                             throws IndexOutOfBoundsException

  Find line object representing the line in current document.

  Parameters:
    `line` - number of the line in current state of the document
  Returns:
    line object
  Throws:
    `IndexOutOfBoundsException` - if `line` is an invalid index for the original set of lines

### getOriginalLineNumber

    public int getOriginalLineNumber(Line line)

  Finds an original line number for given line in this line set.

  Parameters:
    `line` - the line to look for
  Returns:
    the number that best matches the line number of the line or -1 if the line does seem to be produced by this line set
  Since:
    4.38

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.text 6.9.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.