• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ValueSpecification类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.uml2.uml.ValueSpecification的典型用法代码示例。如果您正苦于以下问题:Java ValueSpecification类的具体用法?Java ValueSpecification怎么用?Java ValueSpecification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValueSpecification类属于org.eclipse.uml2.uml包,在下文中一共展示了ValueSpecification类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
	}
}
 
开发者ID:ZhengshuaiPENG,项目名称:org.lovian.eaxmireader,代码行数:18,代码来源:EAEObjInfoManager.java


示例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();
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:25,代码来源:GuardExporter.java


示例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;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:21,代码来源:ActivityNodeResolver.java


示例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;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:21,代码来源:ActivityNodeResolver.java


示例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;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:17,代码来源:SimpleInitializationExpressionProcessor.java


示例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());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:MultiplicityTests.java


示例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());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:MultiplicityTests.java


示例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());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:MultiplicityTests.java


示例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());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:MultiplicityTests.java


示例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());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:MultiplicityTests.java


示例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());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:MultiplicityTests.java


示例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));
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:24,代码来源:ClassifierTests.java


示例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);
            }
        });
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:38,代码来源:TypeOfAttributeGeneralSection.java


示例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;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:31,代码来源:UML2ModelConverter.java


示例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;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:29,代码来源:PropertyRenderer.java


示例16: parseValueSpecification

import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
protected ValueSpecification parseValueSpecification(PLiteralOrIdentifier node, final Type expectedType) {
    if (node instanceof ALiteralLiteralOrIdentifier) {
        ValueSpecification asLiteralValue = LiteralValueParser.parseLiteralValue(node,
                currentNamespace.getNearestPackage(), problemBuilder);
        return asLiteralValue;
    }
    if (expectedType instanceof Enumeration)
        return parseEnumerationLiteral(node, expectedType);
    problemBuilder.addError("Enumeration or data type literal expected ", node);
    throw new AbortedStatementCompilationException();
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:12,代码来源:SimpleInitializationExpressionProcessor.java


示例17: process

import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void process(final PTypeIdentifier typeIdentifierNode, final TypedElement typedElement,
        final PLiteralOrIdentifier initializationExpression) {
    String typeIdentifier = TextUMLCore.getSourceMiner().getQualifiedIdentifier(typeIdentifierNode);

    referenceTracker.add(new DeferredReference<Type>(typeIdentifier, Literals.TYPE, currentNamespace) {

        @Override
        protected void onBind(Type element) {
            if (element == null) {
                problemBuilder.addProblem(new UnknownType(getSymbolName()), typeIdentifierNode);
                return;
            }
            typedElement.setType(element);
            final ValueSpecification valueSpec = parseValueSpecification(initializationExpression,
                    typedElement.getType());
            if (valueSpec != null) {
                if (typedElement.getType() != valueSpec.getType())
                    problemBuilder.addProblem(new TypeMismatch(typedElement.getType().getQualifiedName(), valueSpec
                            .getType().getQualifiedName()), typeIdentifierNode);
                else {
                    if (typedElement instanceof Parameter)
                        ((Parameter) typedElement).setDefaultValue(valueSpec);
                    else if (typedElement instanceof Property)
                        ((Property) typedElement).setDefaultValue(valueSpec);
                    else
                        throw new IllegalArgumentException(typedElement.getQualifiedName() + " - "
                                + typedElement.eClass().getName());
                }
            }
        }
    }, IReferenceTracker.Step.GENERAL_RESOLUTION);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:33,代码来源:SimpleInitializationExpressionProcessor.java


示例18: process

import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
public void process(final TypedElement initializableElement,
        final AComplexInitializationExpression initializationExpression) {
    sourceContext.getNamespaceTracker().enterNamespace(currentClass);
    try {
        Activity activity = (Activity) currentClass.createOwnedBehavior(null, IRepository.PACKAGE.getActivity());
        activity.setIsReadOnly(true);
        activity.setName("defaultValue_" + initializableElement.getName());
        Parameter activityReturn = activity.createOwnedParameter(null, null);
        activityReturn.setDirection(ParameterDirectionKind.RETURN_LITERAL);
        TypeUtils.copyType(initializableElement, activityReturn);
        BehaviorGenerator behaviorGenerator = new BehaviorGenerator(sourceContext);
        behaviorGenerator.createBody(initializationExpression.getExpressionBlock(), activity);
        ValueSpecification reference = ActivityUtils.buildBehaviorReference(currentClass.getNearestPackage(),
                activity, null);

        MDDExtensionUtils.makeDerivation(initializableElement, activity);
        if (initializableElement instanceof Property)
            ((Property) initializableElement).setDefaultValue(reference);
        else if (initializableElement instanceof Parameter)
            ((Parameter) initializableElement).setDefaultValue(reference);
        else
            problemBuilder.addError("Element is not initializable: " + initializableElement.getName() + " : "
                    + initializableElement.eClass().getName(), initializationExpression);
    } finally {
        sourceContext.getNamespaceTracker().leaveNamespace();
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:28,代码来源:ComplexInitializationExpressionProcessor.java


示例19: buildValueSpecificationAction

import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
private ValueSpecificationAction buildValueSpecificationAction(ValueSpecification valueSpec, Node node) {
    ValueSpecificationAction action = (ValueSpecificationAction) builder.createAction(IRepository.PACKAGE
            .getValueSpecificationAction());
    try {
        action.setValue(valueSpec);
        builder.registerOutput(action.createResult(null, valueSpec.getType()));
        fillDebugInfo(action, node);
    } finally {
        builder.closeAction();
    }
    checkIncomings(action, node, getBoundElement());
    return action;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:14,代码来源:BehaviorGenerator.java


示例20: caseAClassAttributeIdentifierExpression

import org.eclipse.uml2.uml.ValueSpecification; //导入依赖的package包/类
@Override
public void caseAClassAttributeIdentifierExpression(AClassAttributeIdentifierExpression node) {
    String typeIdentifier = TextUMLCore.getSourceMiner().getQualifiedIdentifier(node.getMinimalTypeIdentifier());
    Classifier targetClassifier = (Classifier) getRepository().findNamedElement(typeIdentifier,
            IRepository.PACKAGE.getClassifier(), namespaceTracker.currentNamespace(null));
    if (targetClassifier == null) {
        problemBuilder.addError("Class reference expected: '" + typeIdentifier + "'",
                node.getMinimalTypeIdentifier());
        throw new AbortedStatementCompilationException();
    }
    String attributeIdentifier = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
    Property attribute = FeatureUtils.findAttribute(targetClassifier, attributeIdentifier, false, true);
    if (attribute != null) {
        buildReadStaticStructuralFeature(targetClassifier, attribute, node);
        return;
    }
    if (targetClassifier instanceof Enumeration) {
        EnumerationLiteral enumerationValue = ((Enumeration) targetClassifier).getOwnedLiteral(attributeIdentifier);
        if (enumerationValue != null) {
            InstanceValue valueSpec = (InstanceValue) namespaceTracker.currentPackage().createPackagedElement(null,
                    IRepository.PACKAGE.getInstanceValue());
            valueSpec.setInstance(enumerationValue);
            valueSpec.setType(targetClassifier);
            buildValueSpecificationAction(valueSpec, node);
            return;
        }
    }
    if (targetClassifier instanceof StateMachine) {
        Vertex state = StateMachineUtils.getState((StateMachine) targetClassifier, attributeIdentifier);
        if (state != null) {
            ValueSpecification stateReference = MDDExtensionUtils.buildVertexLiteral(
                    namespaceTracker.currentPackage(), state);
            buildValueSpecificationAction(stateReference, node);
            return;
        }
    }
    problemBuilder.addProblem(new UnknownAttribute(targetClassifier.getName(), attributeIdentifier, true),
            node.getIdentifier());
    throw new AbortedStatementCompilationException();
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:41,代码来源:BehaviorGenerator.java



注:本文中的org.eclipse.uml2.uml.ValueSpecification类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChromeSigninController类代码示例发布时间:2022-05-23
下一篇:
Java IScheduledTickHandler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap