aima.core.agent.impl.aprog.simplerule.EQUALCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
The newest version!
package aima.core.agent.impl.aprog.simplerule;
import aima.core.agent.impl.ObjectWithDynamicAttributes;
/**
* Implementation of an EQUALity condition.
*
* @author Ciaran O'Reilly
*
*/
public class EQUALCondition extends Condition {
private Object key;
private Object value;
public EQUALCondition(Object key, Object value) {
assert (null != key);
assert (null != value);
this.key = key;
this.value = value;
}
@Override
public boolean evaluate(ObjectWithDynamicAttributes p) {
return value.equals(p.getAttribute(key));
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
return sb.append(key).append("==").append(value).toString();
}
}