Record Class Term

java.lang.Object
java.lang.Record
fluent.syntax.AST.Term
All Implemented Interfaces:
Entry, Identifiable, SyntaxNode

public record Term(@NotNull Identifier identifier, @NotNull Pattern value, @NotNull List<Attribute> attributes, Commentary.Comment _comment) extends Record implements Entry, Identifiable
  • Constructor Details

    • Term

      public Term(@NotNull @NotNull Identifier identifier, @NotNull @NotNull Pattern value, @NotNull @NotNull List<Attribute> attributes, @Nullable Commentary.Comment _comment)
      Creates an instance of a Term record class.
      Parameters:
      identifier - the value for the identifier record component
      value - the value for the value record component
      attributes - the value for the attributes record component
      _comment - the value for the _comment record component
    • Term

      public Term(@NotNull @NotNull Identifier id, @NotNull @NotNull Pattern value, @NotNull @NotNull List<Attribute> attributes)
  • Method Details

    • withComment

      public Term withComment(@Nullable Commentary.Comment newComment)
      Create a new Term, replacing the existing Comment, if any.
    • attribute

      public Optional<Attribute> attribute(Identifier id)
      Find attribute matching Identifier
    • attribute

      public Optional<Attribute> attribute(String id)
      Find attribute matching String
    • comment

      public Optional<Commentary.Comment> comment()
      The (optional) Comment
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • identifier

      @NotNull public @NotNull Identifier identifier()
      Returns the value of the identifier record component.
      Specified by:
      identifier in interface Identifiable
      Returns:
      the value of the identifier record component
    • value

      @NotNull public @NotNull Pattern value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • attributes

      @NotNull public @NotNull List<Attribute> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component
    • _comment

      @Nullable public Commentary.Comment _comment()
      Returns the value of the _comment record component.
      Returns:
      the value of the _comment record component