Package jason.bb
Class IndexedBB
java.lang.Object
jason.bb.BeliefBase
jason.bb.ChainBBAdapter
jason.bb.IndexedBB
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.
- Author:
- jomi
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<java.lang.String,Structure>
indexedBels
(package private) Unifier
u
Fields inherited from class jason.bb.ChainBBAdapter
nextBB
-
Constructor Summary
Constructors Constructor Description IndexedBB()
IndexedBB(BeliefBase next)
-
Method Summary
Modifier and Type Method Description boolean
add(Literal bel)
Adds a belief in the end of the BB, returns true if succeed.BeliefBase
clone()
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, clear, contains, getAsDOM, getCandidateBeliefs, getCandidateBeliefs, getLastBB, getNameSpaces, getNextAdapter, getPercepts, iterator, remove, setNext, size, stop, toString
Methods inherited from class jason.bb.BeliefBase
abolish, getLock
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
-
Field Details
-
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
-
clone
- Overrides:
clone
in classChainBBAdapter
-