Пример #1
0
        public void testPrimitiveType()
        {
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("Boolean"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("Integer"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("Real"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("String"));

            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("integer"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("int"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("Int"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("Long"));
            Assert.IsTrue(OclTypesDefinition.isOclPrimitiveType("long"));

            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Integer"), OclTypesDefinition.getOclPrimitiveType("int"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Integer"), OclTypesDefinition.getOclPrimitiveType("integer"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Integer"), OclTypesDefinition.getOclPrimitiveType("long"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Integer"), OclTypesDefinition.getOclPrimitiveType("Byte"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Real"), OclTypesDefinition.getOclPrimitiveType("Double"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Real"), OclTypesDefinition.getOclPrimitiveType("float"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("String"), OclTypesDefinition.getOclPrimitiveType("string"));
            Assert.AreEqual(OclTypesDefinition.getOclPrimitiveType("Boolean"), OclTypesDefinition.getOclPrimitiveType("bool"));
        }
Пример #2
0
 protected void addElementToEnvironment(
     String name,
     CoreModelElement wrapper,
     Environment environment)
 {
     try {
         environment.addElement(name, wrapper, false);
     } catch (NameClashException e) {
         Object element = environment.lookupLocal(name);
         try {
             if (element is CoreClassifierImpl &&
                 wrapper is CoreClassifierImpl &&
                 !OclTypesDefinition.isOclPrimitiveType(wrapper.getName()))
             {
                 environment.removeElement(name);
                 CoreClassifier cls = (CoreClassifier)element;
                 environment.addElement(cls.getFullPathName(), cls, false);
                 environment.addElement(((CoreClassifier)wrapper).getFullPathName(), cls, false);
             }
         } catch (NameClashException e2) {
         }
     }
 }