当前位置: 首页>>代码示例>>Java>>正文


Java LiteralUnlimitedNatural类代码示例

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


LiteralUnlimitedNatural类属于org.eclipse.uml2.uml包,在下文中一共展示了LiteralUnlimitedNatural类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: widgetSelected

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
/**
 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
 */
public void widgetSelected(final SelectionEvent e) {
    DomainUtil.run(new TransactionalAction() {
        /**
         * @see nexcore.tool.uml.manager.transaction.TransactionalAction#doExecute()
         */
        @Override
        public void doExecute() {
            CCombo combo = (CCombo) e.getSource();
            String comboValue = combo.getText();
            if (comboValue.equals(MultiplicityType.SINGLE_STAR.toString())) {
                property.setLower(0);
                property.setUpper(LiteralUnlimitedNatural.UNLIMITED);
            } else if (comboValue.equals(MultiplicityType.ZERO_TO_UNIQUE.toString())) {
                property.setLower(0);
                property.setUpper(1);
            } else if (comboValue.equals(MultiplicityType.UNIQUE_TO_SINGLE_STAR.toString())) {
                property.setLower(1);
                property.setUpper(LiteralUnlimitedNatural.UNLIMITED);
            } else {
                property.setLower(1);
                property.setUpper(1);
            }
        }
    });
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:29,代码来源:AssociationGeneralSection.java

示例2: setMultiplicityOfPropertyToModel

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
/**
 * 속성 모델에 다중성 값을 세팅
 * 
 * @param combo
 *            void
 */
private void setMultiplicityOfPropertyToModel(CCombo combo) {
    if ((combo.getText()).equals(MultiplicityType.SINGLE_STAR.toString())) {
        // *
        this.getData().setLower(0);
        this.getData().setUpper(LiteralUnlimitedNatural.UNLIMITED);
    } else if ((combo.getText()).equals(MultiplicityType.ZERO_TO_UNIQUE.toString())) {
        // 0.. 1
        this.getData().setLower(0);
        this.getData().setUpper(1);
    } else if ((combo.getText()).equals(MultiplicityType.UNIQUE.toString())) {
        // 1
        this.getData().setLower(1);
        this.getData().setUpper(1);
    } else if ((combo.getText()).equals(MultiplicityType.UNIQUE_TO_SINGLE_STAR.toString())) {
        // 1.. *
        this.getData().setLower(1);
        this.getData().setUpper(LiteralUnlimitedNatural.UNLIMITED);
    } else if ((combo.getText()).equals(MultiplicityType.NONE.toString())) {
        // 1
        this.getData().setLower(1);
        this.getData().setUpper(1);
    } else {
        return;
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:MultiplicityGeneralSection.java

示例3: caseAExtentIdentifierExpression

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
@Override
public void caseAExtentIdentifierExpression(AExtentIdentifierExpression node) {
    String classifierName = TextUMLCore.getSourceMiner().getQualifiedIdentifier(node.getMinimalTypeIdentifier());
    final Classifier classifier = (Classifier) getRepository().findNamedElement(classifierName,
            IRepository.PACKAGE.getClassifier(), namespaceTracker.currentPackage());
    if (classifier == null) {
        problemBuilder.addError("Unknown classifier '" + classifierName + "'", node.getMinimalTypeIdentifier());
        throw new AbortedStatementCompilationException();
    }
    ReadExtentAction action = (ReadExtentAction) builder.createAction(IRepository.PACKAGE.getReadExtentAction());
    try {
        action.setClassifier(classifier);
        final OutputPin result = action.createResult(null, classifier);
        result.setUpperValue(MDDUtil.createLiteralUnlimitedNatural(namespaceTracker.currentPackage(),
                LiteralUnlimitedNatural.UNLIMITED));
        result.setIsUnique(true);
        builder.registerOutput(result);
        fillDebugInfo(action, node);
    } finally {
        builder.closeAction();
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:23,代码来源:BehaviorGenerator.java

示例4: caseAEmptySet

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
@Override
public void caseAEmptySet(AEmptySet node) {
    final ValueSpecificationAction action = (ValueSpecificationAction) builder.createAction(IRepository.PACKAGE
            .getValueSpecificationAction());
    String qualifiedIdentifier = TextUMLCore.getSourceMiner().getQualifiedIdentifier(
            node.getMinimalTypeIdentifier());
    Classifier classifier = (Classifier) getRepository().findNamedElement(qualifiedIdentifier,
            IRepository.PACKAGE.getClassifier(), namespaceTracker.currentPackage());
    if (classifier == null) {
        problemBuilder.addProblem(new UnknownType(qualifiedIdentifier), node.getMinimalTypeIdentifier());
        throw new AbortedStatementCompilationException();
    }
    try {
        action.setValue(MDDUtil.createLiteralNull(namespaceTracker.currentPackage()));
        OutputPin result = action.createResult(null, classifier);
        result.setUpperValue(MDDUtil.createLiteralUnlimitedNatural(namespaceTracker.currentPackage(),
                LiteralUnlimitedNatural.UNLIMITED));
        builder.registerOutput(result);
        fillDebugInfo(action, node);
    } finally {
        builder.closeAction();
    }
    checkIncomings(action, node, getBoundElement());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:25,代码来源:BehaviorGenerator.java

示例5: testFrom0To1

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的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

示例6: testFrom1To1ShortForm

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的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

示例7: testFrom0ToUnlimitedShortForm

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的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

示例8: testFrom1To1

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的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

示例9: testFrom1ToUnlimited

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的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

示例10: testFrom0ToUnlimited

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的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

示例11: testMultipleResult

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
public void testMultipleResult() throws CoreException {
    String source;
    source = "model simple;\n";
    source += "import base;\n";
    source += "class MyClass\n";
    source += "operation op1() : Integer[*];\n";
    source += "begin\n";
    source += "return 1;\n";
    source += "end;\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(source);
    Operation operation = (Operation) getRepository().findNamedElement("simple::MyClass::op1",
            IRepository.PACKAGE.getOperation(), null);
    Activity activity = ActivityUtils.getActivity(operation);
    assertNotNull(activity);
    StructuredActivityNode bodyNode = ActivityUtils.getBodyNode(activity);
    assertNotNull(bodyNode);
    Variable returnValue = ActivityUtils.findVariable(bodyNode, "");
    assertNotNull(returnValue);
    assertEquals("Integer", returnValue.getType().getName());
    assertEquals(0, returnValue.getLower());
    assertEquals(LiteralUnlimitedNatural.UNLIMITED, returnValue.getUpper());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:25,代码来源:ActivityTests.java

示例12: caseAOptionalMultiplicity

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
@Override
public void caseAOptionalMultiplicity(AOptionalMultiplicity node) {
    multiplicities = new LinkedList<Integer>();
    super.caseAOptionalMultiplicity(node);
    if (!(multiplicities.isEmpty() || target instanceof MultiplicityElement)) {
        problemBuilder.addError("Multiplicity specification not allowed here", node.getMultiplicitySpec());
        return;
    }
    Integer lowerBound;
    Integer upperBound;
    if (multiplicities.size() == 1) {
        upperBound = multiplicities.get(0);
        // if upper is unlimited, lower is 0 - otherwise, they are equal
        lowerBound = upperBound == null ? 0 : upperBound;
    } else {
        lowerBound = multiplicities.get(0);
        upperBound = multiplicities.get(1);
        // validate multiplicity
        if (compare(lowerBound, upperBound) > 0) {
            problemBuilder.addError("Upper bound must be greater or equals to lower bound",
                    node.getMultiplicitySpec());
            return;
        }
    }
    // validate zero upper bound
    if (Integer.valueOf(0).equals(upperBound)) {
        problemBuilder.addError("Upper bound must be greater than zero", node.getMultiplicitySpec());
        return;
    }
    MultiplicityElement multiplicityTarget = (MultiplicityElement) target;
    multiplicityTarget.setLower(lowerBound);
    multiplicityTarget.setUpper(upperBound == null ? LiteralUnlimitedNatural.UNLIMITED : upperBound);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:34,代码来源:TypeSetter.java

示例13: createLiteralUnlimitedNatural

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
public static LiteralUnlimitedNatural createLiteralUnlimitedNatural(Package parent, Integer value) {
    LiteralUnlimitedNatural valueSpec = (LiteralUnlimitedNatural) parent.createPackagedElement(null,
            IRepository.PACKAGE.getLiteralUnlimitedNatural());
    valueSpec.setValue(value == null ? LiteralUnlimitedNatural.UNLIMITED : value.intValue());
    valueSpec.setType(BasicTypeUtils.findBuiltInType("Integer"));
    return valueSpec;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:MDDUtil.java

示例14: addMultiplicity

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
protected static void addMultiplicity(StringBuffer name, TypedElement argument) {
    if (argument instanceof MultiplicityElement) {
        MultiplicityElement multiple = (MultiplicityElement) argument;
        if (multiple.isMultivalued()) {
            name.append("[" + multiple.getLower() + ", ");
            name.append(multiple.getUpper() == LiteralUnlimitedNatural.UNLIMITED ? "*" : multiple.getUpper());
            name.append("]");
        }
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:11,代码来源:MDDUtil.java

示例15: enhanceAction

import org.eclipse.uml2.uml.LiteralUnlimitedNatural; //导入依赖的package包/类
@Override
public void enhanceAction() {
    getProduct().setClassifier(this.<Classifier> findNamedElement(classifierName, Literals.CLASSIFIER));
    final OutputPin result = getProduct().createResult(null, getProduct().getClassifier());
    result.setUpperValue(MDDUtil.createLiteralUnlimitedNatural(getProduct().getNearestPackage(),
            LiteralUnlimitedNatural.UNLIMITED));
    result.setIsUnique(true);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:9,代码来源:ReadExtentActionBuilder.java


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