001 package aima.basic.simplerule; 002 003 import aima.basic.ObjectWithDynamicAttributes; 004 005 /** 006 * Base abstract class for describing conditions. 007 * 008 */ 009 010 /** 011 * @author Ciaran O'Reilly 012 * 013 */ 014 public abstract class Condition { 015 public abstract boolean evaluate(ObjectWithDynamicAttributes p); 016 017 @Override 018 public boolean equals(Object o) { 019 if (o == null || !(o instanceof Condition)) { 020 return super.equals(o); 021 } 022 return (toString().equals(((Condition) o).toString())); 023 } 024 025 @Override 026 public int hashCode() { 027 return toString().hashCode(); 028 } 029 }