Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2005, 2006 Borland Software Corporation
   * 
   * 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: 
  *    Radek Dvorak (Borland) - initial API and implementation
  */
 package org.eclipse.gmf.internal.validate.expressions;
 
This interface replesents a general expression resulting in a value when it gets evaluated.

The evaluation logic is expressed by the body defined in the language recognized by this expression. The expression is parased in the context of specified EClass. The way how the context instance is references is expression provider specific and should be described by the provider.

 
 public interface IModelExpression {

Gets the body representing the evaluation logic of this expression.

Returns:
the body text, never null
 
 	public String getBody();

Gets the context class which was used for parsing of this expression.

Returns:
the context class, never null
 
 	public EClassifier getContext();

Gets the status of this expression.

Returns:
The status with severity of IStatus.OK if this expression has been succesfully parsed and is ready for evaluation. Other severity levels indicate problems and this expression is not evaluated.
 
 	public IStatus getStatus();

Evaluates this expression in the given context.

Parameters:
context The contextual instance for evaluation. It must be the same or sub-class of the context class used for parsing of this expression
Throws:
java.lang.IllegalArgumentException if the context object is invalid for this expression
java.lang.IllegalArgumentException if either the context object or the extended environment is invalid for this expression
See also:
getContext()
evaluate(java.lang.Object,org.eclipse.gmf.internal.validate.expressions.IEvaluationEnvironment)
Result:
the object resulting from evaluation
 
 	public Object evaluate(Object context);

Evaluates this expression in extended context.

Parameters:
context The contextual instance for evaluation. It must be the same or sub-class of the context class used for parsing of this expression
extendedEnv environment with custom variables
Throws:
java.lang.IllegalArgumentException if either the context object or the extended environment is invalid for this expression
See also:
evaluate(java.lang.Object)
Result:
the object resulting from evaluation or null in case this expression is not in OK status.
 
 	public Object evaluate(Object contextIEvaluationEnvironment extendedEnv);

Gets the type of the object which would be the result of this expression evaluation

Returns:
the type classifier
 
Indicates whether this expression is loosely typed. Loosely typed means the parsed expression result type java.lang.Object. More concrete types can only be detected from the evaluation result.

Returns:
true in case is loosely typed; otherwise false
	public boolean isLooselyTyped();

Checks whether the given ecore type is compatible for the asssignment to the given type.

Parameters:
ecoreType ecore type
	public boolean isAssignableTo(EClassifier ecoreType);

Checks whether the given ecore type is compatible for the asssignment to the given typed element.

This type check takes into account multiplicities.

Parameters:
ecoreType ecore type
Returns:
true if any result of this expression evaluation can be assigned to feature represented by the given element type.
	public boolean isAssignableToElement(ETypedElement typedElement);

Gets the identifier of the language in which this expression is defined.

Returns:
string representing the language identifier.
See also:
ExpressionProviderRegistry.getProvider(java.lang.String)
	public String getLanguage();
New to GrepCode? Check out our FAQ X