001    package aima.basic.simplerule;
002    
003    import aima.basic.ObjectWithDynamicAttributes;
004    
005    /**
006     * Implementation of a NOT condition.
007     *
008     */
009    
010    /**
011     * @author Ciaran O'Reilly
012     * 
013     */
014    public class NOTCondition extends Condition {
015            private Condition con;
016    
017            public NOTCondition(Condition aCon) {
018                    assert (null != aCon);
019    
020                    con = aCon;
021            }
022    
023            @Override
024            public boolean evaluate(ObjectWithDynamicAttributes p) {
025                    return (!con.evaluate(p));
026            }
027    
028            @Override
029            public String toString() {
030                    StringBuffer sb = new StringBuffer();
031    
032                    return sb.append("![").append(con).append("]").toString();
033    
034            }
035    }