@Override public String apply(Variable variable) { return variable.getName(); } });
@Override public String apply(final Variable it) { return it.getName(); } };
public String apply(final Variable var) { return var.getName(); } });
@Override public boolean apply(final Variable var) { return valNames.contains(var.getName()); } });
@Override public boolean apply(Variable variable) { return name.equals(variable.getName()); } }, null);
public String positionConstant(final Variable variable) { String _name = null; if (variable!=null) { _name=variable.getName(); } String _upperCase = null; if (_name!=null) { _upperCase=_name.toUpperCase(); } return ("POSITION_" + _upperCase); }
/** * @return true if the variable is an unnamed single-use variable */ public boolean isUnnamedSingleUseVariable(Variable variable) { String name = variable.getName(); return name != null && name.startsWith("_") && name.contains("<"); }
@Override public Boolean apply(final Variable it) { String _name = it.getName(); return Boolean.valueOf(valNames.contains(_name)); } };
private boolean isEqualVariables(Variable variable, VariableReference variableReference) { if (variable != null && variableReference != null) { final Variable variableReferenceVariable = variableReference.getVariable(); if (equal(variable, variableReferenceVariable) || equal(variable.getName(), variableReferenceVariable.getName())) { return true; } } return false; }
/** Compiles a map for name-based lookup of symbolic parameter positions. */ public static Map<String, Integer> getParameterPositionsByName(Pattern pattern) { EList<Variable> parameters = pattern.getParameters(); Map<String, Integer> posMapping = new HashMap<String, Integer>(); int parameterPosition = 0; for (Variable parameter : parameters) { posMapping.put(parameter.getName(), parameterPosition++); } return posMapping; }
/** * Returns field name for Variable */ public String fieldName(final Variable variable) { String _name = null; if (variable!=null) { _name=variable.getName(); } String _firstUpper = StringExtensions.toFirstUpper(_name); return ("f" + _firstUpper); }
/** * @return a human readable string input formatted based on the underlying unions/sets */ public String getCurrentPartitionsFormatted() { String result = ""; for (Set<Variable> unionSet : getPartitions()) { result = result.concat("["); for (Variable variable : unionSet) { result = result.concat(variable.getName() + " "); } result = result.concat("]"); } return result; }
@Check public void checkParametersNamed(Pattern pattern) { for (Variable var : pattern.getParameters()) { if (var.getName() != null && var.getName().startsWith("_")) { error("Parameter name must not start with _", var, PatternLanguagePackage.Literals.VARIABLE__NAME, EMFIssueCodes.SINGLEUSE_PARAMETER); } } }
@Override public String acceptVariable(Variable variable) { return pBody.getOrCreateVariableByName(variable.getName()).getName(); }
private String getVariableName(Variable variable, PatternModelAcceptor<?> acceptor) { if (variable instanceof ParameterRef) // handle referenced parameter variables return getVariableName(((ParameterRef) variable).getReferredParam(), acceptor); // assumed to be non-null else { return variable.getName(); } }
/** * @param var * @return */ private static ParameterRef initializeParameterRef(Variable var) { ParameterRef refVar = PatternLanguageFactory.eINSTANCE.createParameterRef(); refVar.setName(var.getName()); // refVar.setType(var.getType()); refVar.setReferredParam(var); return refVar; }
@Override public PParameter apply(Variable var) { if (var == null) { return new PParameter("", ""); } else { IEMFTypeProvider typeProvider = XtextInjectorProvider.INSTANCE.getInjector().getInstance(IEMFTypeProvider.class); JvmTypeReference ref = typeProvider.getVariableType(var); // bug 411866: JvmUnknownTypeReference.getType() returns null in Xtext 2.4 String clazz = (ref == null || ref instanceof JvmUnknownTypeReference) ? "" : ref.getType() .getQualifiedName(); return new PParameter(var.getName(), clazz); } }
private void checkForWrongVariablesInXExpressionsInternal(final XExpression expression) { for (Variable variable : CorePatternLanguageHelper.getReferencedPatternVariablesOfXExpression(expression, associations)) { EClassifier classifier = emfTypeProvider.getClassifierForVariable(variable); if (classifier != null && !(classifier instanceof EDataType)) {// null-check needed, otherwise code throws // NPE for classifier.getName() error("Only simple EDataTypes are allowed in check() and eval() expressions. The variable " + variable.getName() + " has a type of " + classifier.getName() + ".", expression.eContainer(), null, EMFIssueCodes.CHECK_CONSTRAINT_SCALAR_VARIABLE_ERROR); } } }
private void preprocessParameters(final PatternBody body, PatternModelAcceptor<?> acceptor) { EList<Variable> parameters = pattern.getParameters(); for (Variable variable : parameters) { if (variable.getType() != null && variable.getType() instanceof ClassType) { EClassifier classifier = ((ClassType) variable.getType()).getClassname(); IInputKey inputKey = classifierToInputKey(classifier); acceptor.acceptTypeConstraint(ImmutableList.of(variable.getName()), inputKey); } } acceptor.acceptExportedParameters(parameters); }
public CharSequence javadocGetAllValuesOfMethod(final Variable parameter) { StringConcatenation _builder = new StringConcatenation(); _builder.append("Retrieve the set of values that occur in matches for "); String _name = parameter.getName(); _builder.append(_name, ""); _builder.append("."); _builder.newLineIfNotEmpty(); _builder.append("@return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches"); _builder.newLine(); return _builder; }