當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。