Exemple #1
0
  /**
   * Removes all beliefs from the belief-base that have a given predicate.
   *
   * @param predicate the given predicate
   */
  public void removeBeliefs(String predicate) {

    LinkedList<LogicBelief> remove = new LinkedList<LogicBelief>();

    for (LogicBelief b : beliefs) {
      if (b.getPredicate().equals(predicate)) remove.add(b);
    }

    beliefs.removeAll(remove);
  }
Exemple #2
0
  /**
   * Yields all beliefs from the belief base that have a specific predicate.
   *
   * @param predicate the given predicate
   * @return a list of beliefs that have the given predicate
   */
  public LinkedList<LogicBelief> getAllBeliefs(String predicate) {

    LinkedList<LogicBelief> ret = new LinkedList<LogicBelief>();

    for (LogicBelief b : beliefs) {
      if (b.getPredicate().equals(predicate)) ret.add(b);
    }

    return ret;
  }