当前位置: 首页>>代码示例>>Java>>正文


Java Variable类代码示例

本文整理汇总了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);
  
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:16,代码来源:OclToEcl.java

示例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;
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:8,代码来源:LookupSelfVariableVisitor.java

示例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);
	  }
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:38,代码来源:EmfToEclCodeGenerator.java

示例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;
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:11,代码来源:SmcOCLFactory.java

示例5: transform

import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
private VariableDeclaration transform(
		Variable<EClassifier, EParameter> variable) {
	System.err.println("Not done yet");
	return null;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:6,代码来源:OCLtoATL.java

示例6: bind

import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
public void bind(Variable<EClassifier, EParameter> v1, VariableDeclaration tgt) {
	vars.put(v1, tgt);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:4,代码来源:OCLtoATL.java

示例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);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:6,代码来源:OCLtoATL.java

示例8: handleVariable

import org.eclipse.ocl.expressions.Variable; //导入依赖的package包/类
@Override
protected String handleVariable(Variable<EClassifier, EParameter> variable, String initResult) {
  return "";
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:5,代码来源:OclToEcl.java

示例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;
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:8,代码来源:LookupSelfVariableVisitor.java


注:本文中的org.eclipse.ocl.expressions.Variable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。