本文整理汇总了Java中org.eclipse.ocl.expressions.Variable类的典型用法代码示例。如果您正苦于以下问题:Java Variable类的具体用法?Java Variable怎么用?Java Variable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Variable类属于org.eclipse.ocl.expressions包,在下文中一共展示了Variable类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitIteratorExp
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
@Override
public String visitIteratorExp(IteratorExp<EClassifier, EParameter> callExp) {
List<String> variableResults;
EList<Variable<EClassifier, EParameter>> variables = callExp.getIterator();
if (variables.isEmpty()) {
variableResults = Collections.emptyList();
}
else {
variableResults = new java.util.ArrayList<String>(variables.size());
}
Iterator<Variable<EClassifier, EParameter>> it = variables.iterator();
return processIterators(callExp, it, variableResults);
}
示例2: visitVariableExp
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
public Variable<EClassifier, EParameter> visitVariableExp(VariableExp<EClassifier, EParameter> v) {
Variable<EClassifier, EParameter> referredVar = v.getReferredVariable();
if ("self".equals(referredVar.getName())) {
result = referredVar;
}
return result;
}
示例3: insertQuantificationForSelf
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
/**
* Add quantification for self variable if required.
* @param helper
* @param contextCls The context of this expression (i.e., the type of "self")
* @param oclExpression The OCL expression to be extended
* @throws ParserException
*/
@SuppressWarnings("rawtypes")
private void insertQuantificationForSelf(OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper,
EClass contextCls, ExpressionInOCL oclExpression) throws ParserException {
/* TODO: This method inserts the quantification for "self" only if this variable
* occurs. This is working and practical.
* However, the precise semantics of OCL would require that self is always quantified.
* In the long term, a switch for EMFtoCSP should be added.
*/
OCLExpression bodyExp = oclExpression.getBodyExpression();
LookupSelfVariableVisitor lookupVisitor = new LookupSelfVariableVisitor();
bodyExp.accept(lookupVisitor);
Variable<EClassifier, EParameter> selfDecl = lookupVisitor.getResult();
if (selfDecl != null) {
System.err.println("Adding required self variable quantification");
EcorePackage oclPackage = (EcorePackage) oclExpression.eClass().getEPackage();
EcoreFactory oclFactory = (EcoreFactory) oclPackage.getEFactoryInstance();
IteratorExp forAllExp = oclFactory.createIteratorExp();
forAllExp.setName("forAll");
forAllExp.setType((EClassifier) bodyExp.getType());
selfDecl.setName("self");
selfDecl.setType(contextCls);
forAllExp.getIterator().add(selfDecl);
forAllExp.setBody(bodyExp);
helper.setContext(contextCls);
OCLExpression<EClassifier> allInstancesExp = helper.createQuery(contextCls.getName() + ".allInstances()");
forAllExp.setSource(allInstancesExp);
oclExpression.setBodyExpression(forAllExp);
}
}
示例4: createVar
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
/**
* @generated
*/
private static Variable createVar(Environment ecoreEnv, String name,
EClassifier type) {
Variable var = EcoreFactory.eINSTANCE.createVariable();
var.setName(name);
var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
return var;
}
示例5: transform
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
private VariableDeclaration transform(
Variable<EClassifier, EParameter> variable) {
System.err.println("Not done yet");
return null;
}
示例6: bind
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
public void bind(Variable<EClassifier, EParameter> v1, VariableDeclaration tgt) {
vars.put(v1, tgt);
}
示例7: get
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
public VariableDeclaration get(Variable<EClassifier, EParameter> v1) {
if ( ! vars.containsKey(v1))
throw new IllegalStateException("No var: " + v1);
return vars.get(v1);
}
示例8: handleVariable
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
@Override
protected String handleVariable(Variable<EClassifier, EParameter> variable, String initResult) {
return "";
}
示例9: getResult
import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
/**
* If the "self" variable was referenced, this method return the declaration of the variable,
* otherwise the method return null.
*/
public Variable<EClassifier, EParameter> getResult() {
return result;
}