Package jason.bb
Class DefaultBeliefBase
java.lang.Object
jason.bb.BeliefBase
jason.bb.DefaultBeliefBase
- All Implemented Interfaces:
ToDOM,Serializable,Cloneable,Iterable<Literal>
Default implementation of Jason BB.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionset of beliefs with percept annot, used to improve performance of bufFields inherited from class jason.bb.BeliefBase
APercept, ASelf, TPercept, TSelf -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanabolish(Atom namespace, PredicateIndicator pi) booleanAdds a belief in the BB at index position, returns true if succeedbooleanAdds a belief in the end of the BB, returns true if succeed.protected booleanvoidclear()removes all beliefs from BBclone()Returns the literal l as it is in BB, this method does not consider annotations in the search.Gets the BB as XMLReturns an iterator for all literals relevant for l's predicate indicator, if l is a var, returns all beliefs.
The unifier u may contain values for variables in l.Returns an iterator for all literals in the default namespace of the BB that match the functor/arity of the parameter.getNameSpaceProp(Atom ns, Atom key) Returns all beliefs that have "percept" as sourcevoidCalled before the MAS execution with the agent that uses this BB and the args informed in .mas2j project.
Example in .mas2j:
agent BeliefBaseClass(1,bla);
the init args will be ["1", "bla"].iterator()Returns an iterator for all beliefs.booleanRemoves a literal from BB, returns true if succeedvoidsetNameSpaceProp(Atom ns, Atom key, Term value) intsize()Returns the number of beliefs in BBtoString()Methods inherited from class jason.bb.BeliefBase
abolish, getLock, stopMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
percepts
set of beliefs with percept annot, used to improve performance of buf
-
-
Constructor Details
-
DefaultBeliefBase
public DefaultBeliefBase()
-
-
Method Details
-
init
Description copied from class:BeliefBaseCalled before the MAS execution with the agent that uses this BB and the args informed in .mas2j project.
Example in .mas2j:
agent BeliefBaseClass(1,bla);
the init args will be ["1", "bla"].- Overrides:
initin classBeliefBase
-
getNameSpaces
- Overrides:
getNameSpacesin classBeliefBase
-
setNameSpaceProp
- Overrides:
setNameSpacePropin classBeliefBase
-
getNameSpaceProp
- Overrides:
getNameSpacePropin classBeliefBase
-
getNameSpaceProps
- Overrides:
getNameSpacePropsin classBeliefBase
-
size
public int size()Description copied from class:BeliefBaseReturns the number of beliefs in BB- Overrides:
sizein classBeliefBase
-
clear
public void clear()Description copied from class:BeliefBaseremoves all beliefs from BB- Overrides:
clearin classBeliefBase
-
getPercepts
Description copied from class:BeliefBaseReturns all beliefs that have "percept" as source- Overrides:
getPerceptsin classBeliefBase
-
add
Description copied from class:BeliefBaseAdds a belief in the end of the BB, returns true if succeed. The annots of l may be changed to reflect what was changed in the BB, for example, if l is p[a,b] in a BB with p[a], l will be changed to p[b] to produce the event +p[b], since only the annotation b is changed in the BB.- Overrides:
addin classBeliefBase- Throws:
JasonException
-
add
Description copied from class:BeliefBaseAdds a belief in the BB at index position, returns true if succeed- Overrides:
addin classBeliefBase- Throws:
JasonException
-
add
- Throws:
JasonException
-
remove
Description copied from class:BeliefBaseRemoves a literal from BB, returns true if succeed- Overrides:
removein classBeliefBase
-
iterator
Description copied from class:BeliefBaseReturns an iterator for all beliefs.- Specified by:
iteratorin interfaceIterable<Literal>- Specified by:
iteratorin classBeliefBase
-
abolish
- Overrides:
abolishin classBeliefBase
-
contains
Description copied from class:BeliefBaseReturns the literal l as it is in BB, this method does not consider annotations in the search.
Example, if BB={a(10)[a,b]},contains(a(10)[d])returns a(10)[a,b].- Overrides:
containsin classBeliefBase
-
getCandidateBeliefs
Description copied from class:BeliefBaseReturns an iterator for all literals in the default namespace of the BB that match the functor/arity of the parameter.- Specified by:
getCandidateBeliefsin classBeliefBase
-
getCandidateBeliefs
Description copied from class:BeliefBaseReturns an iterator for all literals relevant for l's predicate indicator, if l is a var, returns all beliefs.
The unifier u may contain values for variables in l. Example, if BB={a(10),a(20),a(2,1),b(f)}, thengetCandidateBeliefs(a(5), {})= {{a(10),a(20)}.
if BB={a(10),a(20)}, thengetCandidateBeliefs(X)= {{a(10),a(20)}. ThegetCandidateBeliefs(a(X), {X -> 5})should also return {{a(10),a(20)}.- Overrides:
getCandidateBeliefsin classBeliefBase
-
toString
-
clone
- Specified by:
clonein classBeliefBase
-
getAsDOM
Description copied from class:BeliefBaseGets the BB as XML- Specified by:
getAsDOMin interfaceToDOM- Overrides:
getAsDOMin classBeliefBase
-