Class RuleBaseImpl

java.lang.Object
fr.inria.rules.integraal.model.kb.impl.RuleBaseImpl
All Implemented Interfaces:
RuleBase, Iterable<FORule>

public class RuleBaseImpl extends Object implements RuleBase
Default implementation of a RuleBase
Author:
Florent Tornil
  • Constructor Details

    • RuleBaseImpl

      public RuleBaseImpl()
      Default constructor, uses a HashSet to store rules
    • RuleBaseImpl

      public RuleBaseImpl(Collection<FORule> rules)
      Default constructor Also initializes the indexes
      Parameters:
      rules - the rules
  • Method Details

    • getRules

      public Collection<FORule> getRules()
      //////////////////////////////////////////////
      Specified by:
      getRules in interface RuleBase
      Returns:
      the rules of this base
    • getRulesByHeadPredicate

      public Collection<FORule> getRulesByHeadPredicate(Predicate p)
      Description copied from interface: RuleBase
      Returns the rules indexed by head predicate.
      Specified by:
      getRulesByHeadPredicate in interface RuleBase
      Parameters:
      p - a predicate
      Returns:
      the rules of this base that contains at least an atom with the given predicate in the head
    • getRulesByBodyPredicate

      public Collection<FORule> getRulesByBodyPredicate(Predicate p)
      Description copied from interface: RuleBase
      Returns the rules indexed by body predicate.
      Specified by:
      getRulesByBodyPredicate in interface RuleBase
      Parameters:
      p - a predicate
      Returns:
      the rules of this base that contains at least an atom with the given predicate in the body
    • add

      public void add(FORule r)
      Description copied from interface: RuleBase
      Add the given rule to the rule base
      Specified by:
      add in interface RuleBase
      Parameters:
      r - a rule
    • remove

      public void remove(FORule r)
      Description copied from interface: RuleBase
      Removes the given rule from the rule base
      Specified by:
      remove in interface RuleBase
      Parameters:
      r - a rule
    • hashCode

      public int hashCode()
      //////////////////////////////////////////////
      Overrides:
      hashCode in class Object
    • equals

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

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<FORule> iterator()
      Specified by:
      iterator in interface Iterable<FORule>