Class Rule

All Implemented Interfaces:
LogicalFormula, Term, ToDOM, ToJson, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Term>

public class Rule
extends LiteralImpl
A rule is a Literal (head) with a body, as in "a :- b & c".
See Also:
Serialized Form
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
      Constant Field Values
    • logger

      private static java.util.logging.Logger logger
    • body

      private LogicalFormula body
    • isTerm

      private boolean isTerm
  • Constructor Details

  • Method Details

    • isRule

      public boolean isRule()
      Specified by:
      isRule in interface Term
      Overrides:
      isRule in class DefaultTerm
    • isAtom

      public boolean isAtom()
      Specified by:
      isAtom in interface Term
      Overrides:
      isAtom in class LiteralImpl
    • isGround

      public boolean isGround()
      Specified by:
      isGround in interface Term
      Overrides:
      isGround in class Pred
    • setAsTerm

      public void setAsTerm​(boolean b)
    • isTerm

      public boolean isTerm()
    • equals

      public boolean equals​(java.lang.Object o)
      Specified by:
      equals in interface Term
      Overrides:
      equals in class LiteralImpl
    • calcHashCode

      protected int calcHashCode()
      Overrides:
      calcHashCode in class LiteralImpl
    • getBody

      public LogicalFormula getBody()
    • getHead

      public Literal getHead()
    • makeVarsAnnon

      public Literal makeVarsAnnon​(Unifier un)
      Description copied from class: Literal
      replaces all variables of the term for unnamed variables (_).
      Overrides:
      makeVarsAnnon in class Pred
      Parameters:
      un - is the unifier that contains the map of replacements
    • capply

      public Term capply​(Unifier u)
      Description copied from interface: Term
      clone and applies together (and faster than clone and then apply)
      Specified by:
      capply in interface Term
      Overrides:
      capply in class LiteralImpl
    • clone

      public Rule clone()
      Description copied from class: Structure
      make a deep copy of the terms
      Specified by:
      clone in interface Term
      Overrides:
      clone in class LiteralImpl
    • headClone

      public Literal headClone()
    • headCApply

      public Literal headCApply​(Unifier u)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class Structure
    • hasVar

      public boolean hasVar​(VarTerm t, Unifier u)
      Specified by:
      hasVar in interface Term
      Overrides:
      hasVar in class Pred
    • countVars

      public void countVars​(java.util.Map<VarTerm,​java.lang.Integer> c)
      Specified by:
      countVars in interface Term
      Overrides:
      countVars in class Pred
    • getAsDOM

      public org.w3c.dom.Element getAsDOM​(org.w3c.dom.Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM
      Overrides:
      getAsDOM in class LiteralImpl