Class FileElement

java.lang.Object
io.github.syst3ms.skriptparser.file.FileElement
Direct Known Subclasses:
FileSection, VoidElement

public class FileElement extends Object
Represents any non-blank and not comment-only line in a file. It is important to note that information about comments is absent from this class, as they are discarded before being passed to the constructor.

IMPORTANT : even though FileSection inherits from this class, they are semantically different ; that is, FileSection will be treated separately, rather than just being treated as some inheritor with additional properties.
  • Constructor Details

    • FileElement

      public FileElement(String fileName, int line, String content, int indentation)
  • Method Details

    • getLineContent

      public String getLineContent()
      The returned String does not include the indentation of the line. To have the line content along with indentation, use toString()
      Returns:
      the text content of this line, excluding any indentation.
    • equals

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

      public int getIndentation()
      Returns:
      how much this line is indented, e.g shifted by either a tab character or 4 spaces.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getFileName

      public String getFileName()
      Returns:
      the name of the file this line is contained in
    • getLine

      public int getLine()
      Line numbering starts at 1, and blank and comment-only lines are accounted for.
      Returns:
      the line in the file where this line is located at.