1 11 package org.eclipse.ui.internal.expressions; 12 13 import java.util.Iterator ; 14 15 import org.eclipse.core.expressions.EvaluationResult; 16 import org.eclipse.core.expressions.Expression; 17 import org.eclipse.core.expressions.IEvaluationContext; 18 import org.eclipse.core.runtime.CoreException; 19 20 23 public final class AndExpression extends CompositeExpression { 24 25 28 private static final int HASH_INITIAL = AndExpression.class.getName() 29 .hashCode(); 30 31 protected final int computeHashCode() { 32 return HASH_INITIAL * HASH_FACTOR + hashCode(fExpressions); 33 } 34 35 public final boolean equals(final Object object) { 36 if (object instanceof AndExpression) { 37 final AndExpression that = (AndExpression) object; 38 return equals(this.fExpressions, that.fExpressions); 39 } 40 41 return false; 42 } 43 44 public final EvaluationResult evaluate(final IEvaluationContext context) 45 throws CoreException { 46 return evaluateAnd(context); 47 } 48 49 public final String toString() { 50 final StringBuffer buffer = new StringBuffer (); 51 buffer.append("AndExpression("); if (fExpressions != null) { 53 final Iterator itr = fExpressions.iterator(); 54 while (itr.hasNext()) { 55 final Expression expression = (Expression) itr.next(); 56 buffer.append(expression.toString()); 57 if (itr.hasNext()) { 58 buffer.append(','); 59 } 60 } 61 } 62 buffer.append(')'); 63 return buffer.toString(); 64 } 65 } 66 | Popular Tags |