jason.bb
Class IndexedBB
java.lang.Object
jason.bb.ChainBBAdapter
jason.bb.IndexedBB
- All Implemented Interfaces:
- BeliefBase, java.lang.Cloneable, java.lang.Iterable<Literal>
public class IndexedBB
- extends ChainBBAdapter
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.
Method Summary |
boolean |
add(Literal bel)
Adds a belief in the end of the BB, returns true if succeed. |
void |
init(Agent ag,
java.lang.String[] args)
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, clone, contains, getAll, getAsDOM, getCandidateBeliefs, getCandidateBeliefs, getLastBB, getNextAdapter, getPercepts, getRelevant, iterator, remove, setNext, size, stop, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IndexedBB
public IndexedBB()
IndexedBB
public IndexedBB(BeliefBase next)
init
public void init(Agent ag,
java.lang.String[] args)
- Description copied from interface:
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"].
- Specified by:
init
in interface BeliefBase
- Overrides:
init
in class ChainBBAdapter
add
public boolean add(Literal bel)
- Description copied from interface:
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.
- Specified by:
add
in interface BeliefBase
- Overrides:
add
in class ChainBBAdapter