Record Class ExternalHaltingCondition

java.lang.Object
java.lang.Record
fr.inria.rules.integraal.component_builder.externalHaltingConditions.ExternalHaltingCondition
Record Components:
keyword - the keyword representing the condition.
value - the value of the condition.

public record ExternalHaltingCondition(InteGraalKeywords.Algorithms.ExternalHaltingConditions keyword, Object value) extends Record
Represents a pair of halting condition: a keyword and its associated value.
  • Constructor Details

    • ExternalHaltingCondition

      public ExternalHaltingCondition(InteGraalKeywords.Algorithms.ExternalHaltingConditions keyword, Object value)
      Custom constructor that enforces type constraints based on the keyword.
      Parameters:
      keyword - the halting condition keyword.
      value - the value associated with the keyword.
      Throws:
      IllegalArgumentException - if the value cannot be cast to Long or Duration, depending on the keyword.
  • Method Details

    • getValue

      public <T> T getValue()
      Returns the value cast to the correct type based on the keyword.
      Type Parameters:
      T - The expected type of the value.
      Returns:
      The value cast to the specified type.
      Throws:
      ClassCastException - if the value cannot be cast to the expected type.
    • 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.
    • keyword

      Returns the value of the keyword record component.
      Returns:
      the value of the keyword record component
    • value

      public Object value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component