Record Class CelToken

java.lang.Object
java.lang.Record
org.impulsegraph.compiler.cel.CelToken

public record CelToken(CelTokenType type, String text, long intVal, double floatVal, boolean boolVal, int pos) extends Record
Immutable token record produced by the CEL lexer.
  • Constructor Details

    • CelToken

      public CelToken(CelTokenType type, String text, long intVal, double floatVal, boolean boolVal, int pos)
      Creates an instance of a CelToken record class.
      Parameters:
      type - the value for the type record component
      text - the value for the text record component
      intVal - the value for the intVal record component
      floatVal - the value for the floatVal record component
      boolVal - the value for the boolVal record component
      pos - the value for the pos record component
  • Method Details

    • of

      public static CelToken of(CelTokenType type, String text, int pos)
    • ofInt

      public static CelToken ofInt(long val, String text, int pos)
    • ofFloat

      public static CelToken ofFloat(double val, String text, int pos)
    • ofBool

      public static CelToken ofBool(boolean val, String text, int pos)
    • ofString

      public static CelToken ofString(String val, int pos)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public CelTokenType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • intVal

      public long intVal()
      Returns the value of the intVal record component.
      Returns:
      the value of the intVal record component
    • floatVal

      public double floatVal()
      Returns the value of the floatVal record component.
      Returns:
      the value of the floatVal record component
    • boolVal

      public boolean boolVal()
      Returns the value of the boolVal record component.
      Returns:
      the value of the boolVal record component
    • pos

      public int pos()
      Returns the value of the pos record component.
      Returns:
      the value of the pos record component