package at.oefai.aaa.agent.jam;

import at.oefai.aaa.agent.jam.types.Binding;
import at.oefai.aaa.agent.jam.types.DList;

/**
 * A boolean-evaluable relation.
 * @author Marc Huber
 * @author Jaeho Lee
 */
abstract class RelationCondition implements Condition {

    private Relation relation;
    private WorldModelTable worldModel;

    /** Constructor w/ World Model relation and interpreter (to simplify access to the agent's World Model) as arguments. */
    RelationCondition(Relation pRelation, WorldModelTable pWorldModel) {
        this.relation = pRelation;
        this.worldModel = pWorldModel;
    }

    Relation getRelation() { return this.relation; }

    WorldModelTable getWorldModel() { return this.worldModel; }

    /** Remove from the given binding list the ones not satisfying the fact. */
    public abstract boolean check(DList<Binding> bl);

    /** Confirm whether the binding is still valid against the current WM. */
    public abstract boolean confirm(Binding b);

}

