Class Section

java.lang.Object
se.datadosen.tags.Section

public class Section extends Object
String section of a text document with knowledge of whole document, including source file. Enables correct file, line and column error reporting
Since:
13.6
  • Constructor Details

    • Section

      public Section(String doc, int beginIndex, int endIndex, File sourceFile)
    • Section

      public Section(String doc, int beginIndex, int endIndex)
    • Section

      public Section(String doc)
    • Section

      public Section(String doc, File sourceFile)
    • Section

      public Section(String doc, int beginIndex)
  • Method Details

    • derive

      public Section derive(String s)
      Hack in ElementNode to pass error context to ScriptletNode. This at least allows us to pass the right file and line number
      Parameters:
      s -
    • subsection

      public Section subsection(int beginIndex, int endIndex)
    • subsection

      public Section subsection(int beginIndex)
    • getBeginIndex

      public int getBeginIndex()
    • getSourceLineNumber

      public int getSourceLineNumber(int index)
      Parameters:
      index - position in document, relative to this Section
      Returns:
      Source file line number
    • getSourceColumn

      public int getSourceColumn(int index)
      Parameters:
      index - position in document, relative to this Section
      Returns:
      Source file column number
    • getSourceFile

      public File getSourceFile()
      Returns:
      Source file for context, null if missing
    • setSourceFile

      public void setSourceFile(File sourceFile)
      Set source file, for context
      Parameters:
      sourceFile -
    • charAt

      public char charAt(int index)
      Like its String equivalent, but for this Section
      Parameters:
      index -
      Returns:
    • indexOf

      public int indexOf(int ch, int fromIndex)
      Like its String equivalent, but for this Section
      Parameters:
      ch -
      fromIndex -
      Returns:
    • indexOf

      public int indexOf(int ch)
    • indexOf

      public int indexOf(String str, int fromIndex)
    • indexOf

      public int indexOf(String str)
    • startsWith

      public boolean startsWith(String prefix, int toffset)
      Like its String equivalent, but for this Section
      Parameters:
      prefix -
      toffset -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      String representation of this section
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • length

      public int length()
      Like its String equivalent, but for this Section
      Returns: