Class IDRuleCompilationCondition

java.lang.Object
fr.inria.rules.integraal.model.ruleCompilation.id.IDRuleCompilationCondition
All Implemented Interfaces:
RuleCompilationCondition

public class IDRuleCompilationCondition extends Object implements RuleCompilationCondition
Version as implemented by Melanie in graal
  • Constructor Details

    • IDRuleCompilationCondition

      public IDRuleCompilationCondition(int[] condBody, int[] condHead)
      Create a new condition with the given encoding
      Parameters:
      condBody - the conditions on the body
      condHead - the conditions on the head
    • IDRuleCompilationCondition

      public IDRuleCompilationCondition(Term[] body, Term[] head)
      Create a new condition with the given body and head as array
      Parameters:
      body - the body
      head - the head
    • IDRuleCompilationCondition

      public IDRuleCompilationCondition(List<Term> body, List<Term> head)
      Create a new condition with the given body and head as list
      Parameters:
      body - the body
      head - the head
  • Method Details

    • check

      public boolean check(Atom a, Atom b)
      Description copied from interface: RuleCompilationCondition
      Checks whether this condition applies between two atoms.
      Specified by:
      check in interface RuleCompilationCondition
      Parameters:
      a - an atom
      b - an atom
      Returns:
      true iff this condition applies for a <= b
    • instantiate

      public org.apache.commons.lang3.tuple.Pair<List<Term>, Substitution> instantiate(List<Term> head)
      Description copied from interface: RuleCompilationCondition
      Instantiates the body-side terms produced by this condition. The terms are returned with a substitution representing the specialization from the unification with the compiled rule.
      Specified by:
      instantiate in interface RuleCompilationCondition
      Parameters:
      head - a list of term
      Returns:
      a list of terms corresponding to the body of this condition
    • composeWith

      public RuleCompilationCondition composeWith(RuleCompilationCondition condition)
      Description copied from interface: RuleCompilationCondition
      Compose the current Condition with another Condition. (x,y,x) -> (x,y) with (x,x) -> (x) produce (x,x,x) -> (x) (x,y,x) -> (y,x) with (x,y) -> (y) produce (x,y,x) -> (y)
      Specified by:
      composeWith in interface RuleCompilationCondition
      Parameters:
      condition - another condition
      Returns:
      a new Condition representing the composition.
    • isIdentity

      public boolean isIdentity()
      Description copied from interface: RuleCompilationCondition
      Indicates whether this condition is the identity condition.
      Specified by:
      isIdentity in interface RuleCompilationCondition
      Returns:
      true if the current condition represents an identity condition, false otherwise.
    • homomorphism

      public Substitution homomorphism(List<Term> head, List<Term> to, Substitution initialSub)
      Description copied from interface: RuleCompilationCondition
      This method assumes that a <= b according to this condition.
      Compute the homomorphism from head to to with respect to initialSub
      Specified by:
      homomorphism in interface RuleCompilationCondition
      Parameters:
      head - a list of terms
      to - a list of terms
      initialSub - a substitution
      Returns:
      the substitution from head to to with respect to initialSub
    • unifier

      public TermPartition unifier(Atom a, Atom b)
      Description copied from interface: RuleCompilationCondition
      Computes the unifier between two atoms under this condition. This method assumes that a <= b according to this condition.
      Compute the unifier between a and b
      Specified by:
      unifier in interface RuleCompilationCondition
      Parameters:
      a - an atom
      b - an atom
      Returns:
      the unification of the terms of a and b
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object