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

DocumentLine.Set (Text API) - NetBeans API Javadoc (Current Development Version)

org.openide.text 6.16

org.openide.text
Class DocumentLine.Set

java.lang.Object
  extended by org.openide.text.Line.Set
      extended by org.openide.text.DocumentLine.Set
Enclosing class:
DocumentLine

public abstract static class DocumentLine.Set
extends Line.Set

Abstract implementation of Line.Set. Defines ways to obtain a line set for documents following NetBeans conventions.


Constructor Summary
DocumentLine.Set(StyledDocument doc)
          Constructor.
 
Method Summary
protected abstract  Line createLine(int offset)
          Creates a Line for a given offset.
 Line getCurrent(int line)
          Find line object representing the line in current document.
 List<? extends Line> getLines()
          Returns a set of line objects sorted by their line numbers.
 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 org.openide.text.Line.Set
getDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentLine.Set

public DocumentLine.Set(StyledDocument doc)
Constructor.

Parameters:
doc - document to work on
Method Detail

getLines

public List<? extends Line> getLines()
Description copied from class: Line.Set
Returns a set of line objects sorted by their line numbers. This immutable list will contains all lines held by this line set.

Specified by:
getLines in class Line.Set
Returns:
list of lines

getOriginal

public Line getOriginal(int line)
                 throws IndexOutOfBoundsException
Description copied from class: Line.Set
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.

Specified by:
getOriginal in class Line.Set
Parameters:
line - number of the line (starting at 0)
Returns:
line object
Throws:
IndexOutOfBoundsException - if line is an invalid index for the original set of lines

getOriginalLineNumber

public int getOriginalLineNumber(Line line)
Description copied from class: Line.Set
Finds an original line number for given line in this line set.

Overrides:
getOriginalLineNumber in class Line.Set
Parameters:
line - the line to look for
Returns:
the number (starting at 0) that best matches the line number of the line or -1 if the line does seem to be produced by this line set

getCurrent

public Line getCurrent(int line)
                throws IndexOutOfBoundsException
Description copied from class: Line.Set
Find line object representing the line in current document.

Specified by:
getCurrent in class Line.Set
Parameters:
line - number of the line in current state of the document (starting at 0)
Returns:
line object
Throws:
IndexOutOfBoundsException - if line is an invalid index for the original set of lines

createLine

protected abstract Line createLine(int offset)
Creates a Line for a given offset.

Parameters:
offset - the beginning offset of the line
Returns:
line object representing the line at this offset

org.openide.text 6.16

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