Class Document

java.lang.Object
org.tentackle.model.parse.Document

public class Document extends Object
The input document.
Author:
harald
  • Constructor Details

    • Document

      public Document(String text)
      Creates a document.
      Parameters:
      text - the model specification source
  • Method Details

    • getText

      public 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 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 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