1 11 package org.eclipse.core.internal.expressions; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.CoreException; 15 16 import org.eclipse.core.expressions.EvaluationResult; 17 import org.eclipse.core.expressions.Expression; 18 import org.eclipse.core.expressions.ExpressionInfo; 19 import org.eclipse.core.expressions.IEvaluationContext; 20 21 public class NotExpression extends Expression { 22 25 private static final int HASH_INITIAL= NotExpression.class.getName().hashCode(); 26 27 private Expression fExpression; 28 29 public NotExpression(Expression expression) { 30 Assert.isNotNull(expression); 31 fExpression= expression; 32 } 33 34 public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { 35 return fExpression.evaluate(context).not(); 36 } 37 38 public void collectExpressionInfo(ExpressionInfo info) { 39 fExpression.collectExpressionInfo(info); 40 } 41 42 public boolean equals(final Object object) { 43 if (!(object instanceof NotExpression)) 44 return false; 45 46 final NotExpression that= (NotExpression)object; 47 return this.fExpression.equals(that.fExpression); 48 } 49 50 protected int computeHashCode() { 51 return HASH_INITIAL * HASH_FACTOR + fExpression.hashCode(); 52 } 53 } 54 | Popular Tags |