Class LiteralImpl

All Implemented Interfaces:
LogicalFormula, Term, ToDOM, ToJson, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Term>
Direct Known Subclasses:
CyclicTerm, Rule, VarTerm

public class LiteralImpl
extends Pred
A Literal extends a Pred with strong negation (~).
See Also:
Serialized Form
  • Field Details

    • serialVersionUID

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

      private boolean type
  • Constructor Details

    • LiteralImpl

      public LiteralImpl​(java.lang.String functor)
      creates a positive literal
    • LiteralImpl

      public LiteralImpl​(boolean pos, java.lang.String functor)
      if pos == true, the literal is positive, otherwise it is negative
    • LiteralImpl

      public LiteralImpl​(Literal l)
    • LiteralImpl

      protected LiteralImpl​(Literal l, Unifier u)
    • LiteralImpl

      public LiteralImpl​(boolean pos, Literal l)
      if pos == true, the literal is positive, otherwise it is negative
    • LiteralImpl

      public LiteralImpl​(Atom namespace, boolean pos, java.lang.String functor)
      if pos == true, the literal is positive, otherwise it is negative
    • LiteralImpl

      public LiteralImpl​(Atom namespace, boolean pos, Literal l)
      creates a literal based on another but in another name space and signal
  • Method Details

    • isAtom

      public boolean isAtom()
      Specified by:
      isAtom in interface Term
      Overrides:
      isAtom in class Pred
    • canBeAddedInBB

      public boolean canBeAddedInBB()
      to be overridden by subclasses (as internal action)
      Overrides:
      canBeAddedInBB in class Literal
    • negated

      public boolean negated()
      Description copied from class: Literal
      returns whether this literal is negated or not, use Literal.LNeg and Literal.LPos to compare the returned value
      Overrides:
      negated in class Literal
    • setNegated

      public Literal setNegated​(boolean b)
      Description copied from class: Literal
      changes the negation of the literal and return this
      Overrides:
      setNegated in class Literal
    • equals

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

      public java.lang.String getErrorMsg()
      Overrides:
      getErrorMsg in class DefaultTerm
    • clone

      public Term clone()
      Description copied from class: Structure
      make a deep copy of the terms
      Specified by:
      clone in interface Term
      Overrides:
      clone in class Pred
    • 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 Pred
    • cloneNS

      public Literal cloneNS​(Atom newNameSpace)
      Description copied from interface: Term
      clone in another namespace
      Specified by:
      cloneNS in interface Term
      Overrides:
      cloneNS in class Pred
    • calcHashCode

      protected int calcHashCode()
      Overrides:
      calcHashCode in class Structure
    • getPredicateIndicator

      public PredicateIndicator getPredicateIndicator()
      returns [~] super.getPredicateIndicator
      Overrides:
      getPredicateIndicator in class Literal
    • 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 Pred