Package jason.bb
Class IndexedBB
java.lang.Object
jason.bb.BeliefBase
jason.bb.ChainBBAdapter
jason.bb.IndexedBB
Customised version of Belief Base where some beliefs are unique (with primary keys) and
indexed for faster access.
E.g. in a .mas2j project file:
agents: bob beliefBaseClass jason.bb.IndexedBB("student(key,_)", "depot(_,_,_)")
The belief "student/2" has the first argument as its key, so the BB will never has
two students with the same key. Or, two students in the BB will have two different keys.
The belief "depot/3" has no key, so there will be always only one "depot" in the BB.
When some belief with the same key than another belief in BB is added,
the most recent remains in the BB and the older is removed.
-
Field Summary
Fields inherited from class jason.bb.ChainBBAdapter
nextBB
Fields inherited from class jason.bb.BeliefBase
APercept, ASelf, TPercept, TSelf
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a belief in the end of the BB, returns true if succeed.clone()
void
Called 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"].Methods inherited from class jason.bb.ChainBBAdapter
abolish, add, clear, contains, getAsDOM, getCandidateBeliefs, getCandidateBeliefs, getLastBB, getNameSpaces, getNextAdapter, getPercepts, iterator, remove, setNext, size, stop, toString
Methods inherited from class jason.bb.BeliefBase
abolish, getLock, getNameSpaceProp, getNameSpaceProps, setNameSpaceProp
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
IndexedBB
public IndexedBB() -
IndexedBB
-
-
Method Details
-
init
Description copied from class:BeliefBase
Called 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:
init
in classChainBBAdapter
-
add
Description copied from class:BeliefBase
Adds 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:
add
in classChainBBAdapter
- Throws:
JasonException
-
clone
- Overrides:
clone
in classChainBBAdapter
-