jason.bb
Interface BeliefBase

Package class diagram package BeliefBase
All Superinterfaces:
java.lang.Cloneable, java.lang.Iterable<Literal>
All Known Implementing Classes:
AgentJDBCPersistentBB, ChainBB, ChainBBAdapter, DefaultBeliefBase, IndexedBB, JDBCPersistentBB, TextPersistentBB

public interface BeliefBase
extends java.lang.Iterable<Literal>, java.lang.Cloneable

Common interface for all kinds of Jason Belief bases, even those customised by the user.


Field Summary
static Term APercept
           
static Term ASelf
           
static Term TPercept
          represents the structure 'source(percept)'
static Term TSelf
          represents the structure 'source(self)'
 
Method Summary
 boolean abolish(PredicateIndicator pi)
          Removes all believes with some functor/arity
 boolean add(int index, Literal l)
          Adds a belief in the BB at index position, returns true if succeed
 boolean add(Literal l)
          Adds a belief in the end of the BB, returns true if succeed.
 BeliefBase clone()
           
 Literal contains(Literal l)
          Returns the literal l as it is in BB, this method does not consider annotations in the search.
 java.util.Iterator<Literal> getAll()
          Deprecated. use iterator() instead of getAll
 org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
          Gets the BB as XML
 java.util.Iterator<Literal> getCandidateBeliefs(Literal l, Unifier u)
          Returns 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.
 java.util.Iterator<Literal> getCandidateBeliefs(PredicateIndicator pi)
          Returns an iterator for all literals in BB that match the functor/arity of the parameter.
 java.util.Iterator<Literal> getPercepts()
          Returns all beliefs that have "percept" as source
 java.util.Iterator<Literal> getRelevant(Literal l)
          Deprecated. use getCandidateBeliefs(l,null) instead
 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"].
 java.util.Iterator<Literal> iterator()
          Returns an iterator for all beliefs.
 boolean remove(Literal l)
          Removes a literal from BB, returns true if succeed
 int size()
          Returns the number of beliefs in BB
 void stop()
          Called just before the end of MAS execution
 

Field Detail

ASelf

static final Term ASelf

APercept

static final Term APercept

TPercept

static final Term TPercept
represents the structure 'source(percept)'


TSelf

static final Term TSelf
represents the structure 'source(self)'

Method Detail

init

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"].


stop

void stop()
Called just before the end of MAS execution


add

boolean add(Literal l)
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.


add

boolean add(int index,
            Literal l)
Adds a belief in the BB at index position, returns true if succeed


iterator

java.util.Iterator<Literal> iterator()
Returns an iterator for all beliefs.

Specified by:
iterator in interface java.lang.Iterable<Literal>

getAll

java.util.Iterator<Literal> getAll()
Deprecated. use iterator() instead of getAll


getCandidateBeliefs

java.util.Iterator<Literal> getCandidateBeliefs(PredicateIndicator pi)
Returns an iterator for all literals in BB that match the functor/arity of the parameter.


getCandidateBeliefs

java.util.Iterator<Literal> getCandidateBeliefs(Literal l,
                                                Unifier u)
Returns 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)}, then getCandidateBeliefs(a(5), {}) = {{a(10),a(20)}.
if BB={a(10),a(20)}, then getCandidateBeliefs(X) = {{a(10),a(20)}. The getCandidateBeliefs(a(X), {X -> 5}) should also return {{a(10),a(20)}.


getRelevant

java.util.Iterator<Literal> getRelevant(Literal l)
Deprecated. use getCandidateBeliefs(l,null) instead


contains

Literal contains(Literal l)
Returns 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].


size

int size()
Returns the number of beliefs in BB


getPercepts

java.util.Iterator<Literal> getPercepts()
Returns all beliefs that have "percept" as source


remove

boolean remove(Literal l)
Removes a literal from BB, returns true if succeed


abolish

boolean abolish(PredicateIndicator pi)
Removes all believes with some functor/arity


getAsDOM

org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
Gets the BB as XML


clone

BeliefBase clone()