Search in sources :

Example 1 with InstanceofExpression

use of org.eclipse.core.internal.expressions.InstanceofExpression in project eclipse.platform.runtime by eclipse.

the class ExpressionTests method testEnablementExpressionHashCode.

public void testEnablementExpressionHashCode() throws Exception {
    EnablementExpression expression1 = new EnablementExpression((IConfigurationElement) null);
    expression1.add(new InstanceofExpression(// $NON-NLS-1$
    "org.eclipse.core.internal.expressions.tests.Adapter"));
    EnablementExpression expression2 = new EnablementExpression((IConfigurationElement) null);
    expression2.add(new InstanceofExpression(// $NON-NLS-1$
    "org.eclipse.core.internal.expressions.tests.Adapter"));
    assertEquals("Equal expressions should have the same hash code", expression1.hashCode(), expression2.hashCode());
}
Also used : InstanceofExpression(org.eclipse.core.internal.expressions.InstanceofExpression) EnablementExpression(org.eclipse.core.internal.expressions.EnablementExpression)

Example 2 with InstanceofExpression

use of org.eclipse.core.internal.expressions.InstanceofExpression in project eclipse.platform.runtime by eclipse.

the class ExpressionTests method testIterateExpressionNotEqual.

public void testIterateExpressionNotEqual() throws Exception {
    IterateExpression expression1 = new IterateExpression("or");
    expression1.add(new InstanceofExpression(// $NON-NLS-1$
    "org.eclipse.core.internal.expressions.tests.Adapter"));
    IterateExpression expression2 = new IterateExpression("and");
    expression2.add(new InstanceofExpression(// $NON-NLS-1$
    "org.eclipse.core.internal.expressions.tests.Adapter"));
    assertTrue("These iterate expressions should not be equal", !expression1.equals(expression2));
}
Also used : InstanceofExpression(org.eclipse.core.internal.expressions.InstanceofExpression) IterateExpression(org.eclipse.core.internal.expressions.IterateExpression)

Example 3 with InstanceofExpression

use of org.eclipse.core.internal.expressions.InstanceofExpression in project eclipse.platform.runtime by eclipse.

the class ExpressionTests method testNotExpressionNotEqual.

public void testNotExpressionNotEqual() throws Exception {
    NotExpression expression1 = new NotExpression(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.Adapter1"));
    NotExpression expression2 = new NotExpression(new InstanceofExpression("org.eclipse.core.internal.expressions.tests.Adapter2"));
    assertTrue("These not expressions should not be equal", !expression1.equals(expression2));
}
Also used : InstanceofExpression(org.eclipse.core.internal.expressions.InstanceofExpression) NotExpression(org.eclipse.core.internal.expressions.NotExpression)

Example 4 with InstanceofExpression

use of org.eclipse.core.internal.expressions.InstanceofExpression in project eclipse.platform.runtime by eclipse.

the class ExpressionTests method testAndExpressionHashCode.

public void testAndExpressionHashCode() throws Exception {
    AndExpression expression1 = new AndExpression();
    expression1.add(new InstanceofExpression(// $NON-NLS-1$
    "org.eclipse.core.internal.expressions.tests.Adapter"));
    AndExpression expression2 = new AndExpression();
    expression2.add(new InstanceofExpression(// $NON-NLS-1$
    "org.eclipse.core.internal.expressions.tests.Adapter"));
    assertEquals("Equal expressions should have the same hash code", expression1.hashCode(), expression2.hashCode());
}
Also used : AndExpression(org.eclipse.core.internal.expressions.AndExpression) InstanceofExpression(org.eclipse.core.internal.expressions.InstanceofExpression)

Example 5 with InstanceofExpression

use of org.eclipse.core.internal.expressions.InstanceofExpression in project eclipse.platform.runtime by eclipse.

the class ExpressionTests method testInstanceofFalse.

public void testInstanceofFalse() throws Exception {
    A a = new A();
    EvaluationContext context = new EvaluationContext(null, a);
    // $NON-NLS-1$
    InstanceofExpression exp = new InstanceofExpression("org.eclipse.core.internal.expressions.tests.B");
    assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
Also used : InstanceofExpression(org.eclipse.core.internal.expressions.InstanceofExpression) IEvaluationContext(org.eclipse.core.expressions.IEvaluationContext) EvaluationContext(org.eclipse.core.expressions.EvaluationContext)

Aggregations

InstanceofExpression (org.eclipse.core.internal.expressions.InstanceofExpression)24 EvaluationContext (org.eclipse.core.expressions.EvaluationContext)6 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)6 AdaptExpression (org.eclipse.core.internal.expressions.AdaptExpression)5 EvaluationResult (org.eclipse.core.expressions.EvaluationResult)3 IterateExpression (org.eclipse.core.internal.expressions.IterateExpression)3 WithExpression (org.eclipse.core.internal.expressions.WithExpression)3 AndExpression (org.eclipse.core.internal.expressions.AndExpression)2 EnablementExpression (org.eclipse.core.internal.expressions.EnablementExpression)2 NotExpression (org.eclipse.core.internal.expressions.NotExpression)2 OrExpression (org.eclipse.core.internal.expressions.OrExpression)2 ResolveExpression (org.eclipse.core.internal.expressions.ResolveExpression)2 AbstractCollection (java.util.AbstractCollection)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1