本文整理汇总了Java中org.eclipse.emf.ecore.EParameter类的典型用法代码示例。如果您正苦于以下问题:Java EParameter类的具体用法?Java EParameter怎么用?Java EParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EParameter类属于org.eclipse.emf.ecore包,在下文中一共展示了EParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertAction
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
/**
* Convert an OCCI action to an Ecore operation.
*
* @param action
* the OCCI action to convert.
* @return the resulting Ecore operation.
*/
protected EOperation convertAction(Action action) {
// Create the Ecore operation.
EOperation eOperation = EcoreFactory.eINSTANCE.createEOperation();
// Set the name of the Ecore operation.
eOperation.setName(ConverterUtils.formatName(action.getTerm()));
// Convert all attributes of the OCCI action.
for (Attribute attribute : action.getAttributes()) {
// Each OCCI attribute of the OCCI action is converted to an Ecore
// parameter of the Ecore operation.
EParameter convertParameter = convertParameter(attribute);
if (convertParameter != null) {
// Add the Ecore parameter to the Ecore operation.
eOperation.getEParameters().add(convertParameter);
}
}
attachInfo(eOperation, action.getTitle());
return eOperation;
}
示例2: convertParameter
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
/**
* Convert an OCCI action's attribute to an Ecore operation parameter.
*
* @param attribute
* the OCCI attribute to convert.
* @return the resulting Ecore operation parameter.
*/
protected EParameter convertParameter(Attribute attribute) {
// Create an Ecore parameter.
EParameter eParam = EcoreFactory.eINSTANCE.createEParameter();
// Set the name of the Ecore parameter.
eParam.setName(Occi2Ecore.convertOcciAttributeName2EcoreAttributeName(attribute.getName()));
// Set the type of the Ecore parameter.
eParam.setEType(getMappedType(attribute.getType()));
// If the OCCI attribute is required then the Ecore parameter is also
// required.
if (attribute.isRequired()) {
eParam.setLowerBound(1);
}
attachInfo(eParam, attribute.getDescription());
return eParam;
}
示例3: visitVariableExp
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
@Override
public String visitVariableExp(VariableExp<EClassifier, EParameter> v) {
++counter;
oclTranslation.append("% Lookup for variable " + v.getName() + "\n");
String predName = "nVariable" + counter + constraintName;
oclTranslation.append(predName);
oclTranslation.append("(_, Vars, Result):-");
oclTranslation.append("\n\t");
oclTranslation.append("ocl_variable(Vars,");
int index = varStack.search(v.getName());
if (index < 0) {
logger.writeErrorMessage(this.getClass().toString(), "Internal error: Variable " + v.getName() + " not found");
}
oclTranslation.append(index);
oclTranslation.append(",Result).\n");
return predName;
}
示例4: isOverrideOf
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isOverrideOf(EOperation someOperation)
{
if (someOperation.getEContainingClass().isSuperTypeOf(getEContainingClass()) && someOperation.getName().equals(getName()))
{
EList<EParameter> parameters = getEParameters();
EList<EParameter> otherParameters = someOperation.getEParameters();
if (parameters.size() == otherParameters.size())
{
for (Iterator<EParameter> i = parameters.iterator(), j = otherParameters.iterator(); i.hasNext(); )
{
EParameter parameter = i.next();
EParameter otherParameter = j.next();
if (!parameter.getEType().getInstanceTypeName().equals(otherParameter.getEType().getInstanceTypeName()))
{
return false;
}
}
return true;
}
}
return false;
}
示例5: text
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
/**
* Text for EOperation.
*
* @param eOperation
* the EOperation
* @return the name and types of all EParameters
*/
protected String text(final EOperation eOperation) {
return eOperation.getName() + "(" + Joiner.on(", ").join(Iterables.transform(eOperation.getEParameters(), new Function<EParameter, String>() {
public String apply(final EParameter input) {
return getText(input.getEType());
}
})) + ") : " + (eOperation.getEType() == null ? "Void" : getText(eOperation.getEType()));
}
示例6: extendWith
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
private void extendWith(EClass c, EOperation op) {
if ( op.getEType() == null ) {
// Operations without return type cannot be invoked in ATL
return;
}
ContextHelper helper = ATLFactory.eINSTANCE.createContextHelper();
helper.getCommentsBefore().add(EOPERATION_TAG);
OclFeatureDefinition fd = OCLFactory.eINSTANCE.createOclFeatureDefinition();
OclContextDefinition ctx = OCLFactory.eINSTANCE.createOclContextDefinition();
Operation oclOp = OCLFactory.eINSTANCE.createOperation();
ctx.setContext_(createType(c, false));
fd.setContext_(ctx);
fd.setFeature(oclOp);
oclOp.setName(op.getName());
oclOp.setReturnType(createType(op.getEType(), op.isMany()));
oclOp.setBody( OCLFactory.eINSTANCE.createJavaBody() );
for(EParameter p : op.getEParameters()) {
Parameter pnew = OCLFactory.eINSTANCE.createParameter();
pnew.setVarName(p.getName());
pnew.setType(createType(p.getEType(), p.isMany()));
oclOp.getParameters().add(pnew);
}
helper.setDefinition(fd);
if ( unit instanceof Module ) {
((Module) unit).getElements().add(helper);
} else if ( unit instanceof Library ) {
((Library) unit).getHelpers().add(helper);
} else {
// Ignore
}
}
示例7: getEParameters
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
@Override
public EList<EParameter> getEParameters() {
List<Parameter> paramList = origOperation.getOwnedParameters();
EList<EParameter> result = new BasicEList<EParameter>();
if (! paramList.isEmpty()){
for (Parameter param : paramList)
if (param.getDirection() != ParameterDirectionKind.RETURN_LITERAL)
result.add(((EResourceUMLAdapter)owningResource).getParamIfNotExists(new EParameterUMLAdapter(param,owningResource)));
}
return result;
}
示例8: getParamIfNotExists
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
public EParameter getParamIfNotExists(EParameter param){
Assert.isNotNull(param);
for (EParameter par : loadedParameters)
if (par.equals(param))
return par;
loadedParameters.add(param);
return param;
}
示例9: visitExpressionInOCL
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
@Override
public String visitExpressionInOCL(ExpressionInOCL<EClassifier, EParameter> expression) {
constraintName = ((Constraint)expression.eContainer()).getName();
oclTranslation = new StringBuilder();
oclTranslation.append("% OCL constraint " + expression.getBodyExpression().toString() + "\n" );
varStack = new Stack<String>();
firstPredicate = "";
counter = 0;
return super.visitExpressionInOCL(expression);
}
示例10: visitIteratorExp
import org.eclipse.emf.ecore.EParameter; //导入依赖的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);
}
示例11: handleIteratorExp
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
@Override
protected String handleIteratorExp(IteratorExp<EClassifier, EParameter> callExp, String sourceResult, List<String> variableResults, String bodyResult) {
String itName = callExp.getName();
//String type = itName.equalsIgnoreCase("forAll") ? "Boolean" : getType(callExp);
++counter;
String predName = "n" + itName + counter + constraintName;
oclTranslation.append(predName);
oclTranslation.append("(Instances, Vars, Result):-");
oclTranslation.append("\n\t");
oclTranslation.append(sourceResult);
oclTranslation.append("(Instances, Vars, Value1),");
oclTranslation.append("\n\t");
oclTranslation.append("ocl_");
if (itName.equals("collect") || itName.equals("select") || itName.equals("reject") || itName.equals("collectNested") || itName.equals("sortedBy")) {
//FIXME: this is a dirty bug fix
oclTranslation.append("bag");
oclTranslation.append("_");
}
else
oclTranslation.append("col_");
oclTranslation.append(itName);
oclTranslation.append("(Instances, Vars, Value1, ");
oclTranslation.append(bodyResult);
oclTranslation.append(", Result).\n");
return predName;
}
示例12: handleExpressionInOCL
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
@Override
protected String handleExpressionInOCL(ExpressionInOCL<EClassifier, EParameter> callExp, String contextResult, String resultResult, List<String> parameterResults, String bodyResult) {
String predName = constraintName.substring(0,1).toLowerCase().concat(constraintName.substring(1, constraintName.length()));
setConstraintFirstPredicate(bodyResult);
oclTranslation.append(predName);
oclTranslation.append("(Instances):-");
oclTranslation.append("\n\t");
oclTranslation.append(bodyResult);
oclTranslation.append("(Instances, [], Result),");
oclTranslation.append("\n\t");
oclTranslation.append("Result #=1.\n");
return oclTranslation.toString();
}
示例13: visitVariableExp
import org.eclipse.emf.ecore.EParameter; //导入依赖的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;
}
示例14: insertQuantificationForSelf
import org.eclipse.emf.ecore.EParameter; //导入依赖的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);
}
}
示例15: getEParameters
import org.eclipse.emf.ecore.EParameter; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<EParameter> getEParameters()
{
if (eParameters == null)
{
eParameters = new EObjectContainmentWithInverseEList<EParameter>(EParameter.class, this, EcorePackage.EOPERATION__EPARAMETERS, EcorePackage.EPARAMETER__EOPERATION);
}
return eParameters;
}