JTP API Documentation

jtp.fol
Class DefaultLiteral

java.lang.Object
  |
  +--jtp.fol.DefaultLiteral
All Implemented Interfaces:
Clause, CNFSentence, Literal, Serializable, Substitutable

public class DefaultLiteral
extends Object
implements Literal, Serializable

Default implementation of Literal.

See Also:
Serialized Form

Constructor Summary
DefaultLiteral(Symbol relation, Collection args, boolean polarity)
           
DefaultLiteral(Symbol relation, SubstitutableList args, boolean polarity)
           
 
Method Summary
 Collection clauses()
          Returns the collection of Clauses that make up this CNFSentence.
 boolean equals(Object o)
           
 List getArgs()
          Returns the arguments in this Literal.
 Symbol getRelation()
          Returns the relation of this Literal.
 int hashCode()
           
 boolean isPositive()
          Returns false if the Literal is negated; true otherwise.
 Collection literals()
          Returns the collection of Literals that make up this Clause.
 Object substitute(Map m)
          Performs substitution in this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultLiteral

public DefaultLiteral(Symbol relation,
                      Collection args,
                      boolean polarity)

DefaultLiteral

public DefaultLiteral(Symbol relation,
                      SubstitutableList args,
                      boolean polarity)
Method Detail

literals

public Collection literals()
Description copied from interface: Clause
Returns the collection of Literals that make up this Clause.

Specified by:
literals in interface Clause
Returns:
a Collection of Literals

clauses

public Collection clauses()
Description copied from interface: CNFSentence
Returns the collection of Clauses that make up this CNFSentence.

Specified by:
clauses in interface CNFSentence
Returns:
a Collection of Clauses

isPositive

public boolean isPositive()
Description copied from interface: Literal
Returns false if the Literal is negated; true otherwise.

Specified by:
isPositive in interface Literal
Returns:
true if the Literal positive; false if negative

getRelation

public Symbol getRelation()
Description copied from interface: Literal
Returns the relation of this Literal. Because this is a first-order logic represenatation, relations must always be constant Symbols.

Specified by:
getRelation in interface Literal
Returns:
relation of this Literal

getArgs

public List getArgs()
Description copied from interface: Literal
Returns the arguments in this Literal.

Specified by:
getArgs in interface Literal
Returns:
List of arguments

toString

public String toString()
Overrides:
toString in class Object

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

substitute

public Object substitute(Map m)
Description copied from interface: Substitutable
Performs substitution in this object. Specifically, this method produces an object derived from this Substitutable, with every occurrence of each key in the supplied map replaced by the corresponding value. This method shouldn't modify the original Substitutable, but rather construct a new instance, if changes are necessary. If this Substitutable does not contain any of the keys in the map, the method can and should return this.

Note that this method does not have to check if this object is itself a key in the substitution map and therefore has to be replaced. If you need that functionality, SubstUtils.substitute(Object, Map) should be used instead.

Specified by:
substitute in interface Substitutable
Returns:
the result of the substitution

JTP API Documentation