Record Class OptimizationBarrier<T>

java.lang.Object
java.lang.Record
tools.refinery.store.query.interpreter.internal.pquery.OptimizationBarrier<T>
Type Parameters:
T - The type of the term.
All Implemented Interfaces:
AnyTerm, Term<T>

public record OptimizationBarrier<T>(Term<T> body) extends Record implements Term<T>
Term wrapper that prevents AnyTerm.equalsWithSubstitution(LiteralEqualityHelper, AnyTerm) from being able to deduce the equality of two terms.

This can control the shape of Dnf precisely when we don't want the optimizer to reduce multiple equivalent assignments into a single one.

  • Constructor Details

    • OptimizationBarrier

      public OptimizationBarrier(Term<T> body)
      Creates an instance of a OptimizationBarrier record class.
      Parameters:
      body - the value for the body record component
  • Method Details

    • getType

      public Class<T> getType()
      Specified by:
      getType in interface AnyTerm
      Specified by:
      getType in interface Term<T>
    • evaluate

      public T evaluate(Valuation valuation)
      Specified by:
      evaluate in interface Term<T>
    • rewriteSubTerms

      public Term<T> rewriteSubTerms(TermRewriter termRewriter)
      Specified by:
      rewriteSubTerms in interface AnyTerm
      Specified by:
      rewriteSubTerms in interface Term<T>
    • substitute

      public Term<T> substitute(Substitution substitution)
      Specified by:
      substitute in interface AnyTerm
      Specified by:
      substitute in interface Term<T>
    • equalsWithSubstitution

      public boolean equalsWithSubstitution(LiteralEqualityHelper helper, AnyTerm other)
      Specified by:
      equalsWithSubstitution in interface AnyTerm
    • hashCodeWithSubstitution

      public int hashCodeWithSubstitution(LiteralHashCodeHelper helper)
      Specified by:
      hashCodeWithSubstitution in interface AnyTerm
    • getVariables

      public Set<Variable> getVariables()
      Specified by:
      getVariables in interface AnyTerm
    • getInputVariables

      public Set<Variable> getInputVariables(Set<? extends Variable> positiveVariablesInClause)
      Specified by:
      getInputVariables in interface AnyTerm
    • getPrivateVariables

      public Set<Variable> getPrivateVariables(Set<? extends Variable> positiveVariablesInClause)
      Specified by:
      getPrivateVariables in interface AnyTerm
    • equals

      public 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.
    • hashCode

      public 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
    • toString

      @NotNull public @NotNull 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
    • body

      public Term<T> body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component