- java.lang.Object
-
- org.tentackle.model.parse.Document
-
public class Document extends java.lang.ObjectThe input document.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description Document(java.lang.String text)Creates a document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLineNumber(int offsetInDocument)Gets the line number for a given offset within the document.java.util.List<Line>getLines()Gets the parsed lines.SourceInfogetSourceInfo()Gets the source info.java.lang.StringgetText()Gets the document text.protected LinenextLine(Line currentLine)Gets the next line.protected java.util.List<Line>parse()Parses the document and returns a list of lines.
-
-
-
Method Detail
-
getText
public java.lang.String getText()
Gets the document text.- Returns:
- the document text
-
getSourceInfo
public SourceInfo getSourceInfo()
Gets the source info.- Returns:
- the info, null if unknown
-
getLines
public java.util.List<Line> getLines() throws ModelException
Gets the parsed lines.- Returns:
- the lines, never null
- Throws:
ModelException- if parsing failed
-
getLineNumber
public int getLineNumber(int offsetInDocument)
Gets the line number for a given offset within the document.- Parameters:
offsetInDocument- the offset- Returns:
- the linenumber starting at 1
-
parse
protected java.util.List<Line> parse() throws ModelException
Parses the document and returns a list of lines.- Returns:
- the list of lines, never null
- Throws:
ModelException- if parsing failed
-
nextLine
protected Line nextLine(Line currentLine) throws ModelException
Gets the next line.- Parameters:
currentLine- the current line, null if start of document- Returns:
- the line, null if reached end of document
- Throws:
ModelException- if parsing failed
-
-