/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public static String getDefault(Parameter parameter) { ValueSpecification defaultValue = parameter.getDefaultValue(); return defaultValue == null ? null : defaultValue.stringValue(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public static String getDefault(Property property) { ValueSpecification defaultValue = property.getDefaultValue(); return defaultValue == null ? null : defaultValue.stringValue(); }
@Override public boolean matches(EObject otherEObject) { return super.matches(otherEObject) && safeEquals(((ValueSpecification) eObject).stringValue(), ((ValueSpecification) otherEObject).stringValue()); } }
/** * The toString() method isn't suitable to transform the values of tagValue as String. * @param tagValue * @return the tag value as a string. */ static String getTagValueAsString(final Object tagValue) { String valueAsString = null; if (tagValue != null) { valueAsString = tagValue.toString(); if (tagValue instanceof ValueSpecification) { final ValueSpecification literal = (ValueSpecification)tagValue; valueAsString = literal.stringValue(); } else if (tagValue instanceof NamedElement) { final NamedElement instance = (NamedElement)tagValue; valueAsString = instance.getName(); } } return valueAsString; }
/** * The toString() method isn't suitable to transform the values of tagValue as String. * @param tagValue * @return the tag value as a string. */ static String getTagValueAsString(final Object tagValue) { String valueAsString = null; if (tagValue != null) { valueAsString = tagValue.toString(); if (tagValue instanceof ValueSpecification) { final ValueSpecification literal = (ValueSpecification)tagValue; valueAsString = literal.stringValue(); } else if (tagValue instanceof NamedElement) { final NamedElement instance = (NamedElement)tagValue; valueAsString = instance.getName(); } } return valueAsString; }
public String getOclValue() { if (!this.property.isDerived()) { throw new IllegalStateException("getOclValue can only be called on a derived property"); } return this.property.getDefaultValue().stringValue(); }
public static String getAsOcl(Constraint constraint) { Operation oper = (Operation) constraint.getContext(); StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(oper.getNearestPackage()).replace(".", "::")); sb.append("\ncontext "); sb.append(UmlgOperationOperations.asOclSignature(oper)); sb.append("\n"); sb.append("body: "); sb.append(constraint.getSpecification().stringValue()); sb.append("\n"); sb.append("endpackage"); return sb.toString(); }
public String getConstraintOclAsString() { Namespace context = this.constraint.getContext(); ValueSpecification valueSpecification = this.constraint.getSpecification(); StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(context.getNearestPackage()).replace(".", "::")); sb.append("\n context "); sb.append(context.getName()); sb.append(" inv:"); sb.append("\n "); sb.append(valueSpecification.stringValue()); sb.append("\n"); sb.append("endpackage"); return sb.toString(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public static String stringValue(Duration duration) { ValueSpecification expr = duration.getExpr(); return expr == null || expr instanceof Duration ? ValueSpecificationOperations.stringValue(duration) : expr.stringValue(); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public static String stringValue(TimeExpression timeExpression) { ValueSpecification expr = timeExpression.getExpr(); return expr == null || expr instanceof TimeExpression ? ValueSpecificationOperations.stringValue(timeExpression) : expr.stringValue(); }
/** * @see org.andromda.metafacades.uml.ConstraintFacade#getBody() */ @Override protected String handleGetBody() { String body = null; if (this.metaObject.getSpecification() != null) { body = this.metaObject.getSpecification().stringValue(); } return body; }
/** * @see org.andromda.metafacades.uml.GuardFacade#getBody() */ @Override protected String handleGetBody() { String body = null; if (this.metaObject.getSpecification() != null) { body = this.metaObject.getSpecification().stringValue(); } return body; }
/** * @see org.andromda.metafacades.uml.GuardFacade#getBody() */ @Override protected String handleGetBody() { String body = null; if (this.metaObject.getSpecification() != null) { body = this.metaObject.getSpecification().stringValue(); } return body; }
/** * @see org.andromda.metafacades.uml.ConstraintFacade#getBody() */ @Override protected String handleGetBody() { String body = null; if (this.metaObject.getSpecification() != null) { body = this.metaObject.getSpecification().stringValue(); } return body; }
private String getOclDefaultValue(Property p) { PropertyWrapper pWrap = new PropertyWrapper(p); StringBuilder sb = new StringBuilder(); sb.append("package "); sb.append(Namer.nameIncludingModel(pWrap.getOwningType().getNearestPackage()).replace(".", "::")); sb.append("\ncontext "); sb.append(pWrap.getOwningType().getName()); sb.append("::"); sb.append(getName()); sb.append("\n"); sb.append("init: "); sb.append(pWrap.getDefaultValue().stringValue()); sb.append("\n"); sb.append("endpackage"); return sb.toString(); }
protected static StringBuffer stringValue( StringExpression stringExpression, StringBuffer stringValue) { EList<StringExpression> subExpressions = stringExpression .getSubExpressions(); if (!subExpressions.isEmpty()) { for (StringExpression subExpression : subExpressions) { stringValue(subExpression, stringValue); } } else { for (ValueSpecification operand : stringExpression.getOperands()) { stringValue.append(operand.stringValue()); } } return stringValue; }
@Override public Object caseConstraint(Constraint constraint) { Namespace constraintContext = constraint.getContext(); if (constraintContext != null) { EModelElement eModelElement = (EModelElement) doSwitch(constraintContext); if (eModelElement != null) { if (eModelElement instanceof EClassifier && options != null && !OPTION__IGNORE.equals(options .get(OPTION__INVARIANT_CONSTRAINTS))) { eModelElement = processInvariantConstraint( (EClassifier) eModelElement, constraint, options, diagnostics, context); } ValueSpecification specification = constraint .getSpecification(); if (specification != null && !(eModelElement instanceof EOperation && options != null && OPTION__PROCESS .equals(options.get(OPERATION_BODY)))) { addDocumentation(eModelElement, specification .stringValue()); } return eModelElement; } } return super.caseConstraint(constraint); }
public String getDefaultValue(Property property) { ValueSpecification vs = property.getDefaultValue(); if (vs == null) { if (property.getType() instanceof PrimitiveType) { PrimitiveType pt = (PrimitiveType) property.getType(); if (pt.getName().equals("int")) { return "0"; } } return "null"; } else { if (vs.getType() == null) { return vs.stringValue(); } else if (vs.getType().getName().equals("String")) { return vs.stringValue(); } else if (vs.getType().getName().equals("Integer")) { return vs.integerValue() + ""; } else if (vs.getType().getName().equals("Boolean")) { return vs.booleanValue() + ""; } return vs.stringValue(); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public static String stringValue(InstanceValue instanceValue) { InstanceSpecification instance = instanceValue.getInstance(); if (instance instanceof EnumerationLiteral) { return ((EnumerationLiteral) instance).getName(); } else if (instance != null) { ValueSpecification specification = instance.getSpecification(); if (specification != null) { return specification.stringValue(); } } return ValueSpecificationOperations.stringValue(instanceValue); }
@SuppressWarnings("unchecked") void chooseLiteralTypeAndAddToEnumConstantArguments(AST ast, EnumConstantDeclaration ec, Slot slot, Type type) { EList<ValueSpecification> valueSpecifications = slot.getValues(); for (ValueSpecification valueSpecification : valueSpecifications) { if (type.getName().equalsIgnoreCase("Integer")) { NumberLiteral numberLiteral = ast.newNumberLiteral(); numberLiteral.setToken(String.valueOf(valueSpecification .integerValue())); ec.arguments().add(numberLiteral); } else if (type.getName().equalsIgnoreCase("Long")) { NumberLiteral numberLiteral = ast.newNumberLiteral(); numberLiteral.setToken(String.valueOf( valueSpecification.integerValue()).concat("L")); ec.arguments().add(numberLiteral); } else if (type.getName().equalsIgnoreCase("Boolean")) { BooleanLiteral booleanLiteral = ast .newBooleanLiteral(valueSpecification.booleanValue()); ec.arguments().add(booleanLiteral); } else if (type.getName().equalsIgnoreCase("String")) { StringLiteral stringLiteral = ast.newStringLiteral(); stringLiteral.setLiteralValue(valueSpecification.stringValue()); ec.arguments().add(stringLiteral); } } }