@Override public Object caseInstanceValue(InstanceValue object) { return object.getInstance(); }
@Override public Object caseInstanceValue(InstanceValue instanceValue) { Type type = instanceValue.getType(); if (type instanceof Enumeration) { instanceValue.setInstance(((Enumeration) type) .getOwnedLiteral(newValue)); } else { InstanceSpecification instance = instanceValue .getInstance(); if (instance != null) { ValueSpecification specification = instance .getSpecification(); if (specification != null) { return doSwitch(specification); } } return null; } return instanceValue; }
} else if (v instanceof InstanceValue) { InstanceValue instanceValue = (InstanceValue) v; return UmlgClassOperations.getPathName(instanceValue.getType()).getTypeName() + "." + instanceValue.getInstance().getName(); } else { throw new RuntimeException(String.format("ValueSpecification %s not supported", v.getClass().getSimpleName()));
/** * Performs a reverse-reference lookup for slots that have * <code>InstanceValue</code>s referencing the specified instance * specification. * * @param instance * an instance specification * @return the slots referencing it (or an empty collection if none) */ private Collection<Slot> getSlotsReferencing(InstanceSpecification instance) { Collection<Slot> result = CollectionUtil.createNewSet(); for (EStructuralFeature.Setting setting : UML2Util .getNonNavigableInverseReferences(instance)) { if (setting.getEStructuralFeature() == UMLPackage.Literals.INSTANCE_VALUE__INSTANCE) { InstanceValue value = (InstanceValue) setting.getEObject(); if (value.getOwner() instanceof Slot) { result.add((Slot) value.getOwner()); } } } return result; }
public Object transform(final Object object) { return UmlUtilities.ELEMENT_TRANSFORMER.transform(((InstanceValue)object).getInstance()); } });
public Object transform(final Object object) { return UmlUtilities.ELEMENT_TRANSFORMER.transform(((InstanceValue)object).getInstance()); } });
@Override public boolean filter(Element e) { if (e instanceof Slot) { Slot slot = (Slot)e; for (ValueSpecification valueSpecification : slot.getValues()) { if (valueSpecification instanceof InstanceValue) { InstanceValue instanceValue = (InstanceValue)valueSpecification; InstanceSpecification instanceSpecification = instanceValue.getInstance(); if (instanceSpecification == enumerationLiteral) { return true; } } } } return false; // return e instanceof Slot && ((Slot) e).getDefiningFeature().getType().equals(enumerationLiteral.getOwner()); } });
/** * <!-- 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); }
&& (value instanceof InstanceValue)) { result.add(((InstanceValue) value) .getInstance());
result = getClassifier(((InstanceValue) context).getInstance()); } else if (context instanceof LiteralBoolean) { result = OCLStandardLibraryImpl.INSTANCE.getBoolean();
if (slot.getDefiningFeature() == definingFeature) { InstanceValue instanceValue = (InstanceValue) slot.getValues().get(0); if (instanceValue.getInstance().equals(literal)) { ojSwitchCase.getBody().addToStatements( "result.add(" + if (valueSpecification instanceof InstanceValue) { InstanceValue instanceValue = (InstanceValue) valueSpecification; literalField.setInitExp(UmlgClassOperations.getPathName(structuralFeature.getType()).getLast() + "." + instanceValue.getInstance().getName()); } else if (valueSpecification instanceof LiteralString) { literalField.setInitExp("\"" + ((LiteralString) valueSpecification).getValue() + "\"");