diff options
Diffstat (limited to 'plugins/infra/emf/expressions/org.eclipse.papyrus.infra.emf.expressions/src/org/eclipse/papyrus/infra/emf/expressions/booleanexpressions/custom/CustomNotExpression.java')
-rwxr-xr-x | plugins/infra/emf/expressions/org.eclipse.papyrus.infra.emf.expressions/src/org/eclipse/papyrus/infra/emf/expressions/booleanexpressions/custom/CustomNotExpression.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/infra/emf/expressions/org.eclipse.papyrus.infra.emf.expressions/src/org/eclipse/papyrus/infra/emf/expressions/booleanexpressions/custom/CustomNotExpression.java b/plugins/infra/emf/expressions/org.eclipse.papyrus.infra.emf.expressions/src/org/eclipse/papyrus/infra/emf/expressions/booleanexpressions/custom/CustomNotExpression.java new file mode 100755 index 00000000000..2a4d97f397d --- /dev/null +++ b/plugins/infra/emf/expressions/org.eclipse.papyrus.infra.emf.expressions/src/org/eclipse/papyrus/infra/emf/expressions/booleanexpressions/custom/CustomNotExpression.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2017 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + */ +package org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.custom; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.emf.expressions.booleanexpressions.impl.NotExpressionImpl; + + +public class CustomNotExpression extends NotExpressionImpl{ + + @Override + public Boolean evaluate(EObject context) { + //1. we evaluate the own expression first + if(null!=ownedExpression) { + return !ownedExpression.evaluate(context); + } + + //2. we evaluate the referenced expression + if(null!=referencedExpression) { + return !referencedExpression.evaluate(context); + } + + //3. we return the default value + return Boolean.FALSE; + } +}
\ No newline at end of file |