本文整理汇总了Java中org.eclipse.uml2.uml.ValueSpecification类的典型用法代码示例。如果您正苦于以下问题:Java ValueSpecification类的具体用法?Java ValueSpecification怎么用?Java ValueSpecification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueSpecification类属于org.eclipse.uml2.uml包,在下文中一共展示了ValueSpecification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPortProperty
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public PortProperty getPortProperty(EObject ePort) {
PortProperty portProperty = null;
if (ePort instanceof PortImpl) {
ValueSpecification lowerValSpc = ((PortImpl) ePort).getLowerValue();
ValueSpecification upperValSpc = ((PortImpl) ePort).getUpperValue();
if (lowerValSpc != null || upperValSpc != null) {
String lowerVal = lowerValSpc.stringValue();
String upperVal = upperValSpc.stringValue();
portProperty = new PortProperty(lowerVal, upperVal);
}
return portProperty;
} else {
return null;
}
}
示例2: defnieGuardFunctions
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public String defnieGuardFunctions(String className) {
StringBuilder source = new StringBuilder("");
for (Entry<Constraint, String> guardEntry : getGuards().entrySet()) {
ValueSpecification guard = guardEntry.getKey().getSpecification();
ActivityExportResult activityResult = new ActivityExportResult();
if (guard != null) {
if (guard.eClass().equals(UMLPackage.Literals.OPAQUE_EXPRESSION)) {
OpaqueExpression expression = (OpaqueExpression) guard;
activityResult = createFunctionBody(expression.getBehavior());
source.append(StateMachineTemplates.guardDefinition(guardEntry.getValue(), activityResult.getActivitySource(), className,
activityResult.sourceHasSignalReference()));
} else {
source.append(StateMachineTemplates.guardDefinition(guardEntry.getValue(), "UNKNOWN_GUARD_TYPE", className, false));
}
}
}
return source.toString();
}
示例3: getTargetFromInputPin
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public String getTargetFromInputPin(InputPin node, Boolean recursive) {
String source = "UNKNOWN_TYPE_FROM_VALUEPIN";
if (node.eClass().equals(UMLPackage.Literals.INPUT_PIN)) {
if (node.getIncomings().size() > 0) {
source = getTargetFromActivityNode(node.getIncomings().get(0).getSource());
}
} else if (node.eClass().equals(UMLPackage.Literals.VALUE_PIN)) {
ValueSpecification valueSpec = ((ValuePin) node).getValue();
if (valueSpec != null) {
source = getValueFromValueSpecification(valueSpec);
} else if (node.getIncomings().size() > 0) {
source = getTargetFromActivityNode(node.getIncomings().get(0).getSource());
}
}
return source;
}
示例4: getValueFromValueSpecification
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
private String getValueFromValueSpecification(ValueSpecification valueSpec) {
String source = "";
if (valueSpec.eClass().equals(UMLPackage.Literals.LITERAL_INTEGER)) {
source = ((Integer) ((LiteralInteger) valueSpec).getValue()).toString();
} else if(valueSpec.eClass().equals(UMLPackage.Literals.LITERAL_REAL)) {
source = ((Double) ((LiteralReal) valueSpec).getValue()).toString();
}
else if (valueSpec.eClass().equals(UMLPackage.Literals.LITERAL_BOOLEAN)) {
source = ((Boolean) ((LiteralBoolean) valueSpec).isValue()).toString();
} else if (valueSpec.eClass().equals(UMLPackage.Literals.LITERAL_STRING)) {
source = "\"" + ((LiteralString) valueSpec).getValue() + "\"";
} else if(valueSpec.eClass().equals(UMLPackage.Literals.LITERAL_NULL)) {
source = ActivityTemplates.NullPtrLiteral;
}
else {
source = "UNHANDLED_VALUEPIN_VALUETYPE";
}
return source;
}
示例5: parseEnumerationLiteral
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
protected ValueSpecification parseEnumerationLiteral(PLiteralOrIdentifier node, final Type expectedType) {
TIdentifier identifier = ((AIdentifierLiteralOrIdentifier) node).getIdentifier();
String literalName = identifier.getText().trim();
Enumeration targetEnumeration = (Enumeration) expectedType;
EnumerationLiteral enumerationValue = ((Enumeration) targetEnumeration).getOwnedLiteral(literalName);
if (enumerationValue == null) {
problemBuilder.addError(
"Unknown enumeration literal '" + literalName + "' in '" + targetEnumeration.getName() + "'", node);
throw new AbortedScopeCompilationException();
}
InstanceValue valueSpec = (InstanceValue) currentNamespace.getNearestPackage().createPackagedElement(null,
IRepository.PACKAGE.getInstanceValue());
valueSpec.setInstance(enumerationValue);
valueSpec.setType(targetEnumeration);
return valueSpec;
}
示例6: testFrom0To1
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testFrom0To1() throws CoreException {
String source = "";
source += "model simple;\n";
source += "import base;\n";
source += "class Class1\n";
source += " attribute attr1 : Integer[0,1];\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Class class1 = getRepository().findNamedElement("simple::Class1", UMLPackage.Literals.CLASS, null);
assertNotNull(class1);
Property attr1 = class1.getAttribute("attr1", null);
assertNotNull(attr1);
assertEquals(0, attr1.getLower());
assertEquals(1, attr1.getUpper());
ValueSpecification lowerValue = attr1.getLowerValue();
assertNotNull(lowerValue);
assertTrue(lowerValue instanceof LiteralInteger);
assertEquals(0, lowerValue.integerValue());
ValueSpecification upperValue = attr1.getUpperValue();
assertNotNull(upperValue);
assertTrue(upperValue instanceof LiteralUnlimitedNatural);
assertEquals(1, ((LiteralUnlimitedNatural) upperValue).unlimitedValue());
}
示例7: testFrom1To1ShortForm
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testFrom1To1ShortForm() throws CoreException {
String source = "";
source += "model simple;\n";
source += "import base;\n";
source += "class Class1\n";
source += " attribute attr1 : Integer[1];\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Class class1 = getRepository().findNamedElement("simple::Class1", UMLPackage.Literals.CLASS, null);
assertNotNull(class1);
Property attr1 = class1.getAttribute("attr1", null);
assertNotNull(attr1);
assertEquals(1, attr1.getLower());
assertEquals(1, attr1.getUpper());
ValueSpecification lowerValue = attr1.getLowerValue();
assertNotNull(lowerValue);
assertTrue(lowerValue instanceof LiteralInteger);
assertEquals(1, lowerValue.integerValue());
ValueSpecification upperValue = attr1.getUpperValue();
assertNotNull(upperValue);
assertTrue(upperValue instanceof LiteralUnlimitedNatural);
assertEquals(1, ((LiteralUnlimitedNatural) upperValue).unlimitedValue());
}
示例8: testFrom0ToUnlimitedShortForm
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testFrom0ToUnlimitedShortForm() throws CoreException {
String source = "";
source += "model simple;\n";
source += "import base;\n";
source += "class Class1\n";
source += " attribute attr1 : Integer[*];\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Class class1 = getRepository().findNamedElement("simple::Class1", UMLPackage.Literals.CLASS, null);
assertNotNull(class1);
Property attr1 = class1.getAttribute("attr1", null);
assertNotNull(attr1);
assertEquals(0, attr1.getLower());
assertEquals(LiteralUnlimitedNatural.UNLIMITED, attr1.getUpper());
ValueSpecification lowerValue = attr1.getLowerValue();
assertNotNull(lowerValue);
assertTrue(lowerValue instanceof LiteralInteger);
assertEquals(0, lowerValue.integerValue());
ValueSpecification upperValue = attr1.getUpperValue();
assertNotNull(upperValue);
assertTrue(upperValue instanceof LiteralUnlimitedNatural);
assertEquals(LiteralUnlimitedNatural.UNLIMITED, ((LiteralUnlimitedNatural) upperValue).unlimitedValue());
}
示例9: testFrom1To1
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testFrom1To1() throws CoreException {
String source = "";
source += "model simple;\n";
source += "import base;\n";
source += "class Class1\n";
source += " attribute attr1 : Integer[1,1];\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Class class1 = getRepository().findNamedElement("simple::Class1", UMLPackage.Literals.CLASS, null);
assertNotNull(class1);
Property attr1 = class1.getAttribute("attr1", null);
assertNotNull(attr1);
assertEquals(1, attr1.getLower());
assertEquals(1, attr1.getUpper());
ValueSpecification lowerValue = attr1.getLowerValue();
assertNotNull(lowerValue);
assertTrue(lowerValue instanceof LiteralInteger);
assertEquals(1, lowerValue.integerValue());
ValueSpecification upperValue = attr1.getUpperValue();
assertNotNull(upperValue);
assertTrue(upperValue instanceof LiteralUnlimitedNatural);
assertEquals(1, ((LiteralUnlimitedNatural) upperValue).unlimitedValue());
}
示例10: testFrom1ToUnlimited
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testFrom1ToUnlimited() throws CoreException {
String source = "";
source += "model simple;\n";
source += "import base;\n";
source += "class Class1\n";
source += " attribute attr1 : Integer[1,*];\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Class class1 = getRepository().findNamedElement("simple::Class1", UMLPackage.Literals.CLASS, null);
assertNotNull(class1);
Property attr1 = class1.getAttribute("attr1", null);
assertNotNull(attr1);
assertEquals(1, attr1.getLower());
assertEquals(LiteralUnlimitedNatural.UNLIMITED, attr1.getUpper());
ValueSpecification lowerValue = attr1.getLowerValue();
assertNotNull(lowerValue);
assertTrue(lowerValue instanceof LiteralInteger);
assertEquals(1, lowerValue.integerValue());
ValueSpecification upperValue = attr1.getUpperValue();
assertNotNull(upperValue);
assertTrue(upperValue instanceof LiteralUnlimitedNatural);
assertEquals(LiteralUnlimitedNatural.UNLIMITED, ((LiteralUnlimitedNatural) upperValue).unlimitedValue());
}
示例11: testFrom0ToUnlimited
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testFrom0ToUnlimited() throws CoreException {
String source = "";
source += "model simple;\n";
source += "import base;\n";
source += "class Class1\n";
source += " attribute attr1 : Integer[0,*];\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Class class1 = getRepository().findNamedElement("simple::Class1", UMLPackage.Literals.CLASS, null);
assertNotNull(class1);
Property attr1 = class1.getAttribute("attr1", null);
assertNotNull(attr1);
assertEquals(0, attr1.getLower());
assertEquals(LiteralUnlimitedNatural.UNLIMITED, attr1.getUpper());
ValueSpecification lowerValue = attr1.getLowerValue();
assertNotNull(lowerValue);
assertTrue(lowerValue instanceof LiteralInteger);
assertEquals(0, lowerValue.integerValue());
ValueSpecification upperValue = attr1.getUpperValue();
assertNotNull(upperValue);
assertTrue(upperValue instanceof LiteralUnlimitedNatural);
assertEquals(LiteralUnlimitedNatural.UNLIMITED, ((LiteralUnlimitedNatural) upperValue).unlimitedValue());
}
示例12: testConstants
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void testConstants() throws CoreException {
String source = "";
source += "model someModel;\n";
source += "import base;\n";
source += "class SomeClass\n";
source += "static readonly attribute CONST1 : Integer := 10;\n";
source += "end;\n";
source += "end.";
parseAndCheck(source);
Type integerType = (Type) getRepository()
.findNamedElement("base::Integer", IRepository.PACKAGE.getType(), null);
assertNotNull(integerType);
Class class_ = (Class) getRepository().findNamedElement("someModel::SomeClass",
IRepository.PACKAGE.getClass_(), null);
assertNotNull(class_);
Property property = class_.getAttribute("CONST1", integerType);
assertNotNull(property);
assertTrue(property.isReadOnly());
ValueSpecification defaultValue = property.getDefaultValue();
assertNotNull(defaultValue);
assertTrue(MDDExtensionUtils.isBasicValue(defaultValue));
assertEquals(10L, MDDExtensionUtils.getBasicValue(defaultValue));
}
示例13: widgetSelected
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
/**
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
TypeSelectDialog typeSelectDialog = new TypeSelectDialog(selectTypeButton.getShell(),
TypeSelectDialogType.PROPERTY, getData());
int dlgReturn = typeSelectDialog.open();
if (dlgReturn == TypeSelectDialog.OK) {
if (typeSelectDialog.getResult() != null) {
final Element selectedElement = (Element) typeSelectDialog.getFirstResult();
DomainUtil.run(new TransactionalAction() {
/**
* @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
*/
@Override
public void doExecute() {
getData().setType((Type) selectedElement);
getData().setDefaultValue((ValueSpecification) null);
getData().setDefault("");
}
});
settingTypeToLabelOfType();
}
} else if (dlgReturn == IDialogConstants.FINISH_ID) {
DomainUtil.run(new TransactionalAction() {
/**
* @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
*/
@Override
public void doExecute() {
getData().setType((Type) null);
getData().setDefaultValue((ValueSpecification) null);
}
});
}
}
示例14: createAttributeModel
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
private Attribute createAttributeModel(Property property) {
String name = property.getName();
LOG.debug("Attribute: " + name);
// Attribute type.
Type type = property.getType();
String typeName = type.getName();
FHIMInformationModel.Type typeModel = getTypeModel(typeName);
Attribute attributeModel = new Attribute(name, typeModel);
// Default value.
ValueSpecification valueSpec = property.getDefaultValue();
String defaultValue = (valueSpec != null ? valueSpec.stringValue() : null);
if (defaultValue != null) {
attributeModel.setDefaultValue(defaultValue);
}
// Multiplicity.
int lower = property.getLower();
int upper = property.getUpper();
Multiplicity multiplicity = new Multiplicity(lower, upper);
attributeModel.setMultiplicity(multiplicity);
// Visibility.
VisibilityKind visibility = property.getVisibility();
attributeModel.setVisibility(visibility);
return attributeModel;
}
示例15: renderObject
import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public boolean renderObject(Property property, IndentedPrintWriter writer, IRenderingSession context) {
if (property.getAssociation() instanceof Extension)
// association of a stereotype with an extended metaclass
return false;
RenderingUtils.renderAll(context, ElementUtils.getComments(property));
TextUMLRenderingUtils.renderStereotypeApplications(writer, property);
writer.print(TextUMLRenderingUtils.renderVisibility(property.getVisibility()));
if (property.isReadOnly())
writer.print("readonly ");
else {
if (property.isStatic())
writer.print("static ");
if (property.getOwner() instanceof Stereotype)
writer.print("property ");
else
writer.print("attribute ");
}
writer.print(name(property));
writer.print(" : ");
writer.print(TextUMLRenderingUtils.getQualifiedNameIfNeeded(property));
ValueSpecification defaultValue = property.getDefaultValue();
if (defaultValue != null) {
writer.print(" := ");
context.render(defaultValue);
}
writer.println(";");
return true;
}