Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jason.bb
Class DefaultBeliefBase

    java.lang.Object
      jason.bb.DefaultBeliefBase

All Implemented Interfaces:
  BeliefBase, java.lang.Cloneable, java.lang.Iterable<Literal>

    public class DefaultBeliefBase

extends java.lang.Object
implements BeliefBase

Default implementation of Jason BB.

Field Summary
`protected java.util.Set<Literal>` | `percepts` set of beliefs with percept annot, used to improve performance of buf

Fields inherited from interface jason.bb.BeliefBase
`APercept, ASelf, TPercept, TSelf`

Constructor Summary
`DefaultBeliefBase()`

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.
`protected boolean` | `add(Literal l, boolean addInEnd)`
`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
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### percepts

    protected java.util.Set<Literal> percepts

  set of beliefs with percept annot, used to improve performance of buf

Constructor Detail

### DefaultBeliefBase

    public DefaultBeliefBase()

Method Detail

### 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`

### stop

    public void stop()

  Description copied from interface: `BeliefBase`
  Called just before the end of MAS execution

  Specified by:
    `stop` in interface `BeliefBase`

### size

    public int size()

  Description copied from interface: `BeliefBase`
  Returns the number of beliefs in BB

  Specified by:
    `size` in interface `BeliefBase`

### getPercepts

    public java.util.Iterator<Literal> getPercepts()

  Description copied from interface: `BeliefBase`
  Returns all beliefs that have "percept" as source

  Specified by:
    `getPercepts` in interface `BeliefBase`

### add

    public boolean add(Literal l)

  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`

### add

    public boolean add(int index,
                       Literal l)

  Description copied from interface: `BeliefBase`
  Adds a belief in the BB at index position, returns true if succeed

  Specified by:
    `add` in interface `BeliefBase`

### add

    protected boolean add(Literal l,
                          boolean addInEnd)

### remove

    public boolean remove(Literal l)

  Description copied from interface: `BeliefBase`
  Removes a literal from BB, returns true if succeed

  Specified by:
    `remove` in interface `BeliefBase`

### iterator

    public java.util.Iterator<Literal> iterator()

  Description copied from interface: `BeliefBase`
  Returns an iterator for all beliefs.

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

### getAll

    public java.util.Iterator<Literal> getAll()

  Deprecated. use iterator() instead of getAll

  Specified by:
    `getAll` in interface `BeliefBase`

### abolish

    public boolean abolish(PredicateIndicator pi)

  Description copied from interface: `BeliefBase`
  Removes all believes with some functor/arity

  Specified by:
    `abolish` in interface `BeliefBase`

### contains

    public Literal contains(Literal l)

  Description copied from interface: `BeliefBase`
  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].

  Specified by:
    `contains` in interface `BeliefBase`

### getCandidateBeliefs

    public java.util.Iterator<Literal> getCandidateBeliefs(PredicateIndicator pi)

  Description copied from interface: `BeliefBase`
  Returns an iterator for all literals in BB that match the functor/arity of the parameter.

  Specified by:
    `getCandidateBeliefs` in interface `BeliefBase`

### getCandidateBeliefs

    public java.util.Iterator<Literal> getCandidateBeliefs(Literal l,
                                                           Unifier u)

  Description copied from interface: `BeliefBase`
  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)}.

  Specified by:
    `getCandidateBeliefs` in interface `BeliefBase`

### getRelevant

    public java.util.Iterator<Literal> getRelevant(Literal l)

  Deprecated. use getCandidateBeliefs(l,null) instead

  Specified by:
    `getRelevant` in interface `BeliefBase`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### clone

    public BeliefBase clone()

  Specified by:
    `clone` in interface `BeliefBase`
  Overrides:
    `clone` in class `java.lang.Object`

### getAsDOM

    public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)

  Description copied from interface: `BeliefBase`
  Gets the BB as XML

  Specified by:
    `getAsDOM` in interface `BeliefBase`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD