Class Chare


  • public final class Chare
    extends Object
    Represents a Chare, which provides location information on a character taken from a Stringe.
    • Constructor Summary

      Constructors 
      Constructor Description
      Chare​(Stringe source, char c, int offset)
      Constructs a new Chare with offset information.
      Chare​(Stringe source, char c, int offset, int line, int column)
      Constructs a new Chare with offset, line and column information.
    • Constructor Detail

      • Chare

        Chare​(Stringe source,
              char c,
              int offset)
        Constructs a new Chare with offset information.
        Parameters:
        source - The source Stringe this Chare was taken from.
        c - The char value of the Chare.
        offset - The offset of the Chare relative to the Stringe.
      • Chare

        Chare​(Stringe source,
              char c,
              int offset,
              int line,
              int column)
        Constructs a new Chare with offset, line and column information.
        Parameters:
        source - The source Stringe this Chare was taken from.
        c - The char value of the Chare.
        offset - The offset of the Chare relative to the Stringe.
        line - The 1-based line number in the Stringe.
        column - The 1-based column number in the Stringe.
    • Method Detail

      • getSource

        public Stringe getSource()
        Returns the Chare's source Stringe.
        Returns:
        The Stringe this Chare is part of.
      • getCharacter

        public char getCharacter()
        Returns the Chare's underlying character.
        Returns:
        The char value this Chare represents.
      • getOffset

        public int getOffset()
        Returns the Chare's offset.
        Returns:
        The offset of the Chare relative to its source Stringe.
      • getLine

        public int getLine()
        Returns the 1-based line number of the Chare.
        Returns:
        The line number this Chare is on.
      • getColumn

        public int getColumn()
        Returns the 1-based column number of the Chare.
        Returns:
        The column number this Chare is on.
      • toString

        public String toString()
        Returns the string representation of the current Chare.
        Overrides:
        toString in class Object
        Returns:
        The Chare as a String.