edu.udo.cs.ie.cowbots.bdi.brf
Class BeliefSet

Package class diagram package BeliefSet
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.bdi.brf.BeliefSet

public class BeliefSet
extends java.lang.Object

This class holds the belief set from the Cowbot-BDI-model. Beside simple set-container functionality, the cowbot belief set allows to search for beliefs that matches a given predicate symbol.


Field Summary
protected  java.util.Set<ELPLiteral> bels
           
protected  IdentTable idents
           
protected  java.util.Map<java.lang.String,java.util.List<ELPLiteral>> indexedBels
           
 
Constructor Summary
BeliefSet(java.util.Set<ELPLiteral> bel, IdentTable ids)
          constructs a new belief set with given beliefs
 
Method Summary
 void addBelief(ELPLiteral l)
          adds a belief to the belief set (doesn't neccessary means that it was added to the belief base before, or it will survive the next revision cycle).
 void deleteBelief(ELPLiteral l)
          removes a literal from the belief set
 java.util.List<ELPLiteral> findAll(java.lang.String functor)
          returns a list of all literals matching a given functor
 ELPLiteral findFirst(java.lang.String functor)
          returns the first predicate found in the belief set starting with a matching functor
 java.util.Set<ELPLiteral> getBeliefs()
           
 java.util.List<ELPLiteral> getBeliefsByPredicate(java.lang.String predicate)
          returns all beliefs that starts with a predicate
 IdentTable getIdentifiers()
          returns an IdentTable lookup instance or null (optional operation).
protected  void indexBeliefs()
          auxiliary function that indexes all beliefs by their predicate symbol
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bels

protected java.util.Set<ELPLiteral> bels

idents

protected IdentTable idents

indexedBels

protected java.util.Map<java.lang.String,java.util.List<ELPLiteral>> indexedBels
Constructor Detail

BeliefSet

public BeliefSet(java.util.Set<ELPLiteral> bel,
                 IdentTable ids)
constructs a new belief set with given beliefs

Parameters:
bel - initial beliefs
Method Detail

indexBeliefs

protected void indexBeliefs()
auxiliary function that indexes all beliefs by their predicate symbol


getBeliefs

public java.util.Set<ELPLiteral> getBeliefs()
Returns:
set of beliefs

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBeliefsByPredicate

public java.util.List<ELPLiteral> getBeliefsByPredicate(java.lang.String predicate)
returns all beliefs that starts with a predicate

Parameters:
predicate - functor name to look for
Returns:
list of all literals matching predicate name

deleteBelief

public void deleteBelief(ELPLiteral l)
removes a literal from the belief set

Parameters:
l - literal to delete

addBelief

public void addBelief(ELPLiteral l)
adds a belief to the belief set (doesn't neccessary means that it was added to the belief base before, or it will survive the next revision cycle).

Parameters:
l - literal to add

getIdentifiers

public IdentTable getIdentifiers()
returns an IdentTable lookup instance or null (optional operation).

Returns:
IdentTable instance (optional or empty)

findFirst

public ELPLiteral findFirst(java.lang.String functor)
returns the first predicate found in the belief set starting with a matching functor

Parameters:
functor - literal with functor name to search for
Returns:
null or first found literal

findAll

public java.util.List<ELPLiteral> findAll(java.lang.String functor)
returns a list of all literals matching a given functor

Parameters:
functor - predicate symbol to look for
Returns:
list of all literals with predicate symbol functor