|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjason.asSyntax.DefaultTerm
jason.asSyntax.Literal
public abstract class Literal
This class represents an abstract literal (an Atom, Structure, Predicate, etc), it is mainly the interface of a literal. To create a new Literal, one of the following concrete classes may be used:
There are useful static methods in class ASSyntax
to create Literals.
ASSyntax
,
Atom
,
Structure
,
Pred
,
LiteralImpl
,
Serialized FormField Summary | |
---|---|
static Literal |
LFalse
|
static boolean |
LNeg
|
static boolean |
LPos
|
static Literal |
LTrue
|
protected PredicateIndicator |
predicateIndicatorCache
|
Fields inherited from class jason.asSyntax.DefaultTerm |
---|
hashCodeCache, srcInfo |
Constructor Summary | |
---|---|
Literal()
|
Method Summary | |
---|---|
boolean |
addAnnot(Term t)
|
Literal |
addAnnots(java.util.List<Term> l)
adds some annots and return this |
Literal |
addAnnots(Term... terms)
adds some annots and return this |
void |
addSource(Term agName)
adds the annotation source(agName) |
void |
addTerm(Term t)
|
Literal |
addTerms(java.util.List<Term> l)
adds some terms and return this |
Literal |
addTerms(Term... ts)
adds some terms and return this |
boolean |
canBeAddedInBB()
returns this if this literal can be added in the belief base (Atoms, for instance, can not be) |
void |
clearAnnots()
removes all annotations |
Literal |
copy()
|
boolean |
delAnnot(Term t)
|
boolean |
delAnnots(java.util.List<Term> l)
removes all annots in this pred that are in the list l. |
boolean |
delSource(Term agName)
deletes one source(agName) annotation, return true if deleted |
void |
delSources()
deletes all source annotations |
void |
delTerm(int index)
|
boolean |
equalsAsStructure(java.lang.Object p)
|
Literal |
forceFullLiteralImpl()
Transforms this into a full literal (which implements all methods of Literal), if it is an Atom; otherwise returns 'this' |
ListTerm |
getAnnots()
returns all annotations of the literal |
ListTerm |
getAnnots(java.lang.String functor)
returns all annots with the specified functor e.g.: from annots [t(a), t(b), source(tom)] and functor "t", it returns [t(a),t(b)] in case that there is no such an annot, it returns an empty list. |
int |
getArity()
returns the number of terms of this literal |
ListTerm |
getAsListOfTerms()
returns this literal as a list with three elements: [functor, list of terms, list of annots] |
abstract java.lang.String |
getFunctor()
returns the functor of this literal |
PredicateIndicator |
getPredicateIndicator()
returns functor symbol "/" arity |
java.util.List<VarTerm> |
getSingletonVars()
returns all singleton vars (that appears once) in this literal |
ListTerm |
getSources()
returns the sources of this literal as a new list. |
Term |
getTerm(int i)
returns the i-th term (first term is 0) |
java.util.List<Term> |
getTerms()
returns all terms of this literal |
Term[] |
getTermsArray()
returns all terms of this literal as an array |
boolean |
hasAnnot()
returns true if the pred has at least one annot |
boolean |
hasAnnot(Term t)
returns true if there is some annotation t in the literal |
boolean |
hasSource()
returns true if this literal has some source annotation |
boolean |
hasSource(Term agName)
returns true if this literal has a "source(agName)" |
boolean |
hasSubsetAnnot(Literal p)
returns true if all this predicate annots are in p's annots |
boolean |
hasSubsetAnnot(Literal p,
Unifier u)
Returns true if all this predicate's annots are in p's annots using the unifier u. |
boolean |
hasTerm()
returns true if this literal has some term |
boolean |
importAnnots(Literal p)
"import" annots from another predicate p. |
boolean |
isLiteral()
|
java.util.Iterator<Unifier> |
logicalConsequence(Agent ag,
Unifier un)
logicalConsequence checks whether one particular predicate is a logical consequence of the belief base. |
void |
makeTermsAnnon()
replaces all terms by unnamed variables (_). |
Literal |
makeVarsAnnon()
replaces all variables by unnamed variables (_). |
Literal |
makeVarsAnnon(Unifier un)
replaces all variables of the term for unnamed variables (_). |
boolean |
negated()
returns whether this literal is negated or not, use Literal.LNeg and Literal.LPos to compare the returned value |
static Literal |
newFromListOfTerms(ListTerm lt)
creates a literal from a list with three elements: [functor, list of terms, list of annots] |
static Literal |
parseLiteral(java.lang.String sLiteral)
creates a new literal by parsing a string -- ASSyntax.parseLiteral or createLiteral are preferred. |
Literal |
setAnnots(ListTerm l)
|
Literal |
setNegated(boolean b)
changes the negation of the literal and return this |
void |
setTerm(int i,
Term t)
|
Literal |
setTerms(java.util.List<Term> l)
set all terms of the literal and return this |
Methods inherited from class jason.asSyntax.DefaultTerm |
---|
apply, calcHashCode, clone, compareTo, countVars, getErrorMsg, getSrcInfo, hashCode, hasVar, isArithExpr, isAtom, isGround, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isStructure, isUnnamedVar, isVar, parse, resetHashCodeCache, setSrcInfo |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jason.asSyntax.Term |
---|
apply, clone, countVars, equals, getSrcInfo, hasVar, isArithExpr, isAtom, isGround, isInternalAction, isList, isNumeric, isPlanBody, isPred, isRule, isString, isStructure, isUnnamedVar, isVar, setSrcInfo |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Methods inherited from interface jason.util.ToDOM |
---|
getAsDOM |
Field Detail |
---|
public static final boolean LPos
public static final boolean LNeg
public static final Literal LTrue
public static final Literal LFalse
protected PredicateIndicator predicateIndicatorCache
Constructor Detail |
---|
public Literal()
Method Detail |
---|
public static Literal parseLiteral(java.lang.String sLiteral)
public Literal copy()
public abstract java.lang.String getFunctor()
public boolean isLiteral()
isLiteral
in interface Term
isLiteral
in class DefaultTerm
public PredicateIndicator getPredicateIndicator()
public int getArity()
public boolean hasTerm()
public java.util.List<Term> getTerms()
public Term[] getTermsArray()
public java.util.List<VarTerm> getSingletonVars()
public void makeTermsAnnon()
public Literal makeVarsAnnon()
public Literal makeVarsAnnon(Unifier un)
un
- is the unifier that contains the map of replacementspublic ListTerm getAnnots()
public boolean hasAnnot(Term t)
public boolean hasAnnot()
public boolean hasSubsetAnnot(Literal p)
public boolean hasSubsetAnnot(Literal p, Unifier u)
public void clearAnnots()
public ListTerm getAnnots(java.lang.String functor)
public ListTerm getSources()
public boolean hasSource()
public boolean hasSource(Term agName)
public boolean canBeAddedInBB()
public boolean negated()
public boolean equalsAsStructure(java.lang.Object p)
public void addTerm(Term t)
public void delTerm(int index)
public Literal addTerms(Term... ts)
public Literal addTerms(java.util.List<Term> l)
public Term getTerm(int i)
public Literal setTerms(java.util.List<Term> l)
public void setTerm(int i, Term t)
public Literal setAnnots(ListTerm l)
public boolean addAnnot(Term t)
public Literal addAnnots(Term... terms)
public Literal addAnnots(java.util.List<Term> l)
public boolean delAnnot(Term t)
public boolean delAnnots(java.util.List<Term> l)
public boolean importAnnots(Literal p)
public void addSource(Term agName)
public boolean delSource(Term agName)
public void delSources()
public Literal setNegated(boolean b)
public java.util.Iterator<Unifier> logicalConsequence(Agent ag, Unifier un)
logicalConsequence
in interface LogicalFormula
public ListTerm getAsListOfTerms()
public static Literal newFromListOfTerms(ListTerm lt) throws JasonException
JasonException
public Literal forceFullLiteralImpl()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |