Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 156100 Details for
Bug 290605
[evaluator] Inadequate support for large integers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Use of BigDecimal and BigInteger internally
Bug290605d.patch (text/plain), 217.04 KB, created by
Ed Willink
on 2010-01-14 09:45:13 EST
(
hide
)
Description:
Use of BigDecimal and BigInteger internally
Filename:
MIME Type:
Creator:
Ed Willink
Created:
2010-01-14 09:45:13 EST
Size:
217.04 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ocl >Index: model/OCL.ecore >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/model/OCL.ecore,v >retrieving revision 1.9 >diff -u -r1.9 OCL.ecore >--- model/OCL.ecore 6 Dec 2009 18:10:38 -0000 1.9 >+++ model/OCL.ecore 14 Jan 2010 14:39:36 -0000 >@@ -1119,7 +1119,10 @@ > </eGenericType> > </eParameters> > </eOperations> >- <eStructuralFeatures xsi:type="ecore:EAttribute" name="integerSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> >+ <eOperations name="setIntegerSymbol" ordered="false" lowerBound="1"> >+ <eParameters name="value" ordered="false" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EIntegerObject"/> >+ </eOperations> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="integerSymbol" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"/> > <eGenericSuperTypes eClassifier="#//expressions/NumericLiteralExp"> > <eTypeArguments eTypeParameter="#//expressions/IntegerLiteralExp/C"/> > </eGenericSuperTypes> >@@ -1151,7 +1154,18 @@ > </eGenericType> > </eParameters> > </eOperations> >- <eStructuralFeatures xsi:type="ecore:EAttribute" name="integerSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> >+ <eOperations name="setIntegerSymbol" ordered="false" lowerBound="1"> >+ <eParameters name="value" ordered="false" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EIntegerObject"/> >+ </eOperations> >+ <eOperations name="setUnlimitedNaturalSymbol" ordered="false" lowerBound="1"> >+ <eParameters name="value" ordered="false" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EIntegerObject"/> >+ </eOperations> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="unlimitedNaturalSymbol" >+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"> >+ <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> >+ <details key="name" value=""/> >+ </eAnnotations> >+ </eStructuralFeatures> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="unlimited" lowerBound="1" > eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" > changeable="false" volatile="true" transient="true" derived="true"/> >@@ -1703,7 +1717,10 @@ > </eGenericType> > </eParameters> > </eOperations> >- <eStructuralFeatures xsi:type="ecore:EAttribute" name="realSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDoubleObject"/> >+ <eOperations name="setRealSymbol" ordered="false" lowerBound="1"> >+ <eParameters name="value" ordered="false" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDoubleObject"/> >+ </eOperations> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="realSymbol" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal"/> > <eGenericSuperTypes eClassifier="#//expressions/NumericLiteralExp"> > <eTypeArguments eTypeParameter="#//expressions/RealLiteralExp/C"/> > </eGenericSuperTypes> >Index: model/OCL.genmodel >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/model/OCL.genmodel,v >retrieving revision 1.10 >diff -u -r1.10 OCL.genmodel >--- model/OCL.genmodel 6 Dec 2009 18:10:38 -0000 1.10 >+++ model/OCL.genmodel 14 Jan 2010 14:39:37 -0000 >@@ -10,6 +10,7 @@ > featureMapWrapperInternalInterface="" featureMapWrapperClass="" codeFormatting="true" > testSuiteClass="org.eclipse.ocl.tests.AllTests" booleanFlagsField="eFlags" booleanFlagsReservedBits="8" > importerID="org.eclipse.uml2.uml.ecore.importer" complianceLevel="5.0" copyrightFields="false" >+ usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore" > invariantPrefix="check"> > <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/importer/org.eclipse.uml2.uml.ecore.importer"> > <details key="DUPLICATE_FEATURE_INHERITANCE" value="PROCESS"/> >@@ -414,19 +415,28 @@ > <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/IntegerLiteralExp/integer_type/diagnostics"/> > <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/IntegerLiteralExp/integer_type/context"/> > </genOperations> >+ <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="OCL.ecore#//expressions/IntegerLiteralExp/setIntegerSymbol"> >+ <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/IntegerLiteralExp/setIntegerSymbol/value"/> >+ </genOperations> > </genClasses> > <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCL.ecore#//expressions/NumericLiteralExp"> > <genTypeParameters ecoreTypeParameter="OCL.ecore#//expressions/NumericLiteralExp/C"/> > </genClasses> > <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp"> > <genTypeParameters ecoreTypeParameter="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/C"/> >- <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/integerSymbol"/> >+ <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/unlimitedNaturalSymbol"/> > <genFeatures xsi:type="genmodel:GenFeature" property="Readonly" createChild="false" > ecoreFeature="ecore:EAttribute OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/unlimited"/> > <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/natural_type"> > <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/natural_type/diagnostics"/> > <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/natural_type/context"/> > </genOperations> >+ <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/setIntegerSymbol"> >+ <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/setIntegerSymbol/value"/> >+ </genOperations> >+ <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/setUnlimitedNaturalSymbol"> >+ <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/UnlimitedNaturalLiteralExp/setUnlimitedNaturalSymbol/value"/> >+ </genOperations> > </genClasses> > <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCL.ecore#//expressions/InvalidLiteralExp"> > <genTypeParameters ecoreTypeParameter="OCL.ecore#//expressions/InvalidLiteralExp/C"/> >@@ -583,6 +593,9 @@ > <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/RealLiteralExp/real_type/diagnostics"/> > <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/RealLiteralExp/real_type/context"/> > </genOperations> >+ <genOperations xsi:type="genmodel:GenOperation" ecoreOperation="OCL.ecore#//expressions/RealLiteralExp/setRealSymbol"> >+ <genParameters xsi:type="genmodel:GenParameter" ecoreParameter="OCL.ecore#//expressions/RealLiteralExp/setRealSymbol/value"/> >+ </genOperations> > </genClasses> > <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCL.ecore#//expressions/StateExp"> > <genTypeParameters ecoreTypeParameter="OCL.ecore#//expressions/StateExp/C"/> >Index: model/OCL.uml >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/model/OCL.uml,v >retrieving revision 1.9 >diff -u -r1.9 OCL.uml >--- model/OCL.uml 6 Dec 2009 18:10:56 -0000 1.9 >+++ model/OCL.uml 14 Jan 2010 14:39:41 -0000 >@@ -714,7 +714,7 @@ > </ownedTemplateSignature> > <generalization xmi:id="_unvVyNppEdu-d8Dv4wLx9Q" general="_unvVy9ppEdu-d8Dv4wLx9Q"/> > <ownedAttribute xmi:id="_unvVydppEdu-d8Dv4wLx9Q" name="integerSymbol" visibility="public" isOrdered="true"> >- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EIntegerObject"/> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EBigInteger"/> > <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_unvVytppEdu-d8Dv4wLx9Q"/> > </ownedAttribute> > <nestedClassifier xmi:type="uml:Class" xmi:id="_unvVy9ppEdu-d8Dv4wLx9Q" name="NumericLiteralExp_C"> >@@ -722,6 +722,11 @@ > <parameterSubstitution xmi:id="_unvVzdppEdu-d8Dv4wLx9Q" formal="_unvV0NppEdu-d8Dv4wLx9Q" actual="_unvVx9ppEdu-d8Dv4wLx9Q"/> > </templateBinding> > </nestedClassifier> >+ <ownedOperation xmi:id="_-fBR4AA0Ed-7_agdSFnrQQ" name="setIntegerSymbol"> >+ <ownedParameter xmi:id="_BpWf4AA1Ed-7_agdSFnrQQ" name="value"> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EIntegerObject"/> >+ </ownedParameter> >+ </ownedOperation> > </packagedElement> > <packagedElement xmi:type="uml:Class" xmi:id="_unvVztppEdu-d8Dv4wLx9Q" name="NumericLiteralExp" isAbstract="true"> > <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_unvVz9ppEdu-d8Dv4wLx9Q" parameter="_unvV0NppEdu-d8Dv4wLx9Q"> >@@ -749,8 +754,8 @@ > </ownedParameter> > </ownedTemplateSignature> > <generalization xmi:id="_unvV2tppEdu-d8Dv4wLx9Q" general="_unvV3tppEdu-d8Dv4wLx9Q"/> >- <ownedAttribute xmi:id="_unvV29ppEdu-d8Dv4wLx9Q" name="integerSymbol" visibility="public" isOrdered="true"> >- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EIntegerObject"/> >+ <ownedAttribute xmi:id="_unvV29ppEdu-d8Dv4wLx9Q" name="unlimitedNaturalSymbol" visibility="public" isOrdered="true"> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EBigInteger"/> > <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_unvV3NppEdu-d8Dv4wLx9Q"/> > </ownedAttribute> > <ownedAttribute xmi:id="_unvV3dppEdu-d8Dv4wLx9Q" name="unlimited" visibility="public" isOrdered="true" isReadOnly="true" isDerived="true"> >@@ -761,6 +766,16 @@ > <parameterSubstitution xmi:id="_unvV4NppEdu-d8Dv4wLx9Q" formal="_unvV0NppEdu-d8Dv4wLx9Q" actual="_unvV2dppEdu-d8Dv4wLx9Q"/> > </templateBinding> > </nestedClassifier> >+ <ownedOperation xmi:id="_4u-wcAA1Ed-7_agdSFnrQQ" name="setIntegerSymbol"> >+ <ownedParameter xmi:id="_4u-wcQA1Ed-7_agdSFnrQQ" name="value"> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EIntegerObject"/> >+ </ownedParameter> >+ </ownedOperation> >+ <ownedOperation xmi:id="_6MG1wAA1Ed-7_agdSFnrQQ" name="setUnlimitedNaturalSymbol"> >+ <ownedParameter xmi:id="_6MG1wQA1Ed-7_agdSFnrQQ" name="value"> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EIntegerObject"/> >+ </ownedParameter> >+ </ownedOperation> > </packagedElement> > <packagedElement xmi:type="uml:Class" xmi:id="_unvV4dppEdu-d8Dv4wLx9Q" name="InvalidLiteralExp"> > <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_unvV4tppEdu-d8Dv4wLx9Q" parameter="_unvV49ppEdu-d8Dv4wLx9Q"> >@@ -1183,7 +1198,7 @@ > </ownedTemplateSignature> > <generalization xmi:id="_un1aYNppEdu-d8Dv4wLx9Q" general="_un1aY9ppEdu-d8Dv4wLx9Q"/> > <ownedAttribute xmi:id="_un1aYdppEdu-d8Dv4wLx9Q" name="realSymbol" visibility="public" isOrdered="true"> >- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EDoubleObject"/> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EBigDecimal"/> > <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_un1aYtppEdu-d8Dv4wLx9Q"/> > </ownedAttribute> > <nestedClassifier xmi:type="uml:Class" xmi:id="_un1aY9ppEdu-d8Dv4wLx9Q" name="NumericLiteralExp_C"> >@@ -1191,6 +1206,11 @@ > <parameterSubstitution xmi:id="_un1aZdppEdu-d8Dv4wLx9Q" formal="_unvV0NppEdu-d8Dv4wLx9Q" actual="_un1aX9ppEdu-d8Dv4wLx9Q"/> > </templateBinding> > </nestedClassifier> >+ <ownedOperation xmi:id="_QCQfIAA1Ed-7_agdSFnrQQ" name="setRealSymbol"> >+ <ownedParameter xmi:id="_QCQfIQA1Ed-7_agdSFnrQQ" name="value"> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EDoubleObject"/> >+ </ownedParameter> >+ </ownedOperation> > </packagedElement> > <packagedElement xmi:type="uml:Class" xmi:id="_un1aZtppEdu-d8Dv4wLx9Q" name="StateExp"> > <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_un1aZ9ppEdu-d8Dv4wLx9Q" parameter="_un1aaNppEdu-d8Dv4wLx9Q _un1aatppEdu-d8Dv4wLx9Q"> >@@ -2194,7 +2214,7 @@ > <Ecore:EGenericType xmi:id="_up2L8NppEdu-d8Dv4wLx9Q" base_Class="_unvV09ppEdu-d8Dv4wLx9Q"/> > <Ecore:EClass xmi:id="_up2L8dppEdu-d8Dv4wLx9Q" base_Class="_unvV1tppEdu-d8Dv4wLx9Q"/> > <Ecore:ETypeParameter xmi:id="_up2L8tppEdu-d8Dv4wLx9Q" base_TemplateParameter="_unvV2NppEdu-d8Dv4wLx9Q"/> >- <Ecore:EAttribute xmi:id="_up2L89ppEdu-d8Dv4wLx9Q" base_Property="_unvV29ppEdu-d8Dv4wLx9Q"/> >+ <Ecore:EAttribute xmi:id="_up2L89ppEdu-d8Dv4wLx9Q" xmlName="" base_Property="_unvV29ppEdu-d8Dv4wLx9Q"/> > <Ecore:EAttribute xmi:id="_up2L9NppEdu-d8Dv4wLx9Q" isTransient="true" isVolatile="true" base_Property="_unvV3dppEdu-d8Dv4wLx9Q"/> > <Ecore:EGenericType xmi:id="_up2L9dppEdu-d8Dv4wLx9Q" base_Class="_unvV3tppEdu-d8Dv4wLx9Q"/> > <Ecore:EClass xmi:id="_up2L9tppEdu-d8Dv4wLx9Q" base_Class="_unvV4dppEdu-d8Dv4wLx9Q"/> >@@ -2302,4 +2322,7 @@ > <Ecore:EParameter xmi:id="_SCfO4N1nEduZ74nG8yJaxg" base_Parameter="_FcnTgN1nEduZ74nG8yJaxg"/> > <Ecore_1:EClass xmi:id="_1lMzkNXZEd6ci-srLwOkAQ" base_Class="_-PCtwNLlEd6hmvYFRJXZTA"/> > <Ecore:EReference xmi:id="_82aXYNXZEd6ci-srLwOkAQ" base_Property="_ykFGANLmEd6hmvYFRJXZTA"/> >+ <Ecore:EDataType xmi:id="_t-sakP9tEd67_agdSFnrQQ" instanceClassName="java.lang.Number"/> >+ <Ecore:EOperation xmi:id="_HzTgsAA1Ed-7_agdSFnrQQ" base_Operation="_-fBR4AA0Ed-7_agdSFnrQQ"/> >+ <Ecore:EParameter xmi:id="_JKevAAA1Ed-7_agdSFnrQQ" base_Parameter="_BpWf4AA1Ed-7_agdSFnrQQ"/> > </xmi:XMI> >Index: model/OCLCST.ecore >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/model/OCLCST.ecore,v >retrieving revision 1.15 >diff -u -r1.15 OCLCST.ecore >--- model/OCLCST.ecore 27 Dec 2009 15:49:52 -0000 1.15 >+++ model/OCLCST.ecore 14 Jan 2010 14:39:42 -0000 >@@ -240,13 +240,14 @@ > <eStructuralFeatures xsi:type="ecore:EAttribute" name="symbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> > </eClassifiers> > <eClassifiers xsi:type="ecore:EClass" name="IntegerLiteralExpCS" eSuperTypes="#//cst/PrimitiveLiteralExpCS"> >- <eStructuralFeatures xsi:type="ecore:EAttribute" name="integerSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="integerSymbol" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"/> > </eClassifiers> > <eClassifiers xsi:type="ecore:EClass" name="UnlimitedNaturalLiteralExpCS" eSuperTypes="#//cst/PrimitiveLiteralExpCS"> >- <eStructuralFeatures xsi:type="ecore:EAttribute" name="integerSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="unlimitedNaturalSymbol" >+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBigInteger"/> > </eClassifiers> > <eClassifiers xsi:type="ecore:EClass" name="RealLiteralExpCS" eSuperTypes="#//cst/PrimitiveLiteralExpCS"> >- <eStructuralFeatures xsi:type="ecore:EAttribute" name="realSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDoubleObject"/> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="realSymbol" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBigDecimal"/> > </eClassifiers> > <eClassifiers xsi:type="ecore:EClass" name="StringLiteralExpCS" eSuperTypes="#//cst/PrimitiveLiteralExpCS"> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="stringSymbol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> >Index: model/OCLCST.genmodel >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/model/OCLCST.genmodel,v >retrieving revision 1.14 >diff -u -r1.14 OCLCST.genmodel >--- model/OCLCST.genmodel 15 Oct 2009 19:37:32 -0000 1.14 >+++ model/OCLCST.genmodel 14 Jan 2010 14:39:43 -0000 >@@ -9,7 +9,8 @@ > rootImplementsInterface="" featureMapWrapperInterface="" featureMapWrapperInternalInterface="" > featureMapWrapperClass="" codeFormatting="true" testSuiteClass="org.eclipse.ocl.tests.OCLAllTests" > booleanFlagsField="eFlags" booleanFlagsReservedBits="8" importerID="org.eclipse.uml2.uml.ecore.importer" >- complianceLevel="5.0" copyrightFields="false" binaryCompatibleReflectiveMethods="true"> >+ complianceLevel="5.0" copyrightFields="false" binaryCompatibleReflectiveMethods="true" >+ usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore"> > <genAnnotations source="http://www.eclipse.org/emf/2002/GenModel/importer/org.eclipse.uml2.uml.ecore.importer"> > <details key="DUPLICATE_FEATURE_INHERITANCE" value="DISCARD"/> > <details key="DUPLICATE_OPERATIONS" value="DISCARD"/> >@@ -240,7 +241,7 @@ > <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/IntegerLiteralExpCS/integerSymbol"/> > </genClasses> > <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCLCST.ecore#//cst/UnlimitedNaturalLiteralExpCS"> >- <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/UnlimitedNaturalLiteralExpCS/integerSymbol"/> >+ <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/UnlimitedNaturalLiteralExpCS/unlimitedNaturalSymbol"/> > </genClasses> > <genClasses xsi:type="genmodel:GenClass" ecoreClass="OCLCST.ecore#//cst/RealLiteralExpCS"> > <genFeatures xsi:type="genmodel:GenFeature" createChild="false" ecoreFeature="ecore:EAttribute OCLCST.ecore#//cst/RealLiteralExpCS/realSymbol"/> >Index: model/OCLCST.uml >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/model/OCLCST.uml,v >retrieving revision 1.12 >diff -u -r1.12 OCLCST.uml >--- model/OCLCST.uml 27 Dec 2009 15:49:52 -0000 1.12 >+++ model/OCLCST.uml 14 Jan 2010 14:39:44 -0000 >@@ -509,21 +509,21 @@ > <packagedElement xmi:type="uml:Class" xmi:id="_qdx-A_8fEduhWtVvKtiQ7w" name="IntegerLiteralExpCS"> > <generalization xmi:id="_qdx-BP8fEduhWtVvKtiQ7w" general="_qdx9__8fEduhWtVvKtiQ7w"/> > <ownedAttribute xmi:id="_qdx-Bf8fEduhWtVvKtiQ7w" name="integerSymbol" visibility="public" isOrdered="true"> >- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EIntegerObject"/> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EBigInteger"/> > <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_qdx-Bv8fEduhWtVvKtiQ7w"/> > </ownedAttribute> > </packagedElement> > <packagedElement xmi:type="uml:Class" xmi:id="_qdx-B_8fEduhWtVvKtiQ7w" name="UnlimitedNaturalLiteralExpCS"> > <generalization xmi:id="_qdx-CP8fEduhWtVvKtiQ7w" general="_qdx9__8fEduhWtVvKtiQ7w"/> >- <ownedAttribute xmi:id="_qdx-Cf8fEduhWtVvKtiQ7w" name="integerSymbol" visibility="public" isOrdered="true"> >- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EIntegerObject"/> >+ <ownedAttribute xmi:id="_qdx-Cf8fEduhWtVvKtiQ7w" name="unlimitedNaturalSymbol" visibility="public" isOrdered="true"> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EBigInteger"/> > <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_qdx-Cv8fEduhWtVvKtiQ7w"/> > </ownedAttribute> > </packagedElement> > <packagedElement xmi:type="uml:Class" xmi:id="_qdx-C_8fEduhWtVvKtiQ7w" name="RealLiteralExpCS"> > <generalization xmi:id="_qdx-DP8fEduhWtVvKtiQ7w" general="_qdx9__8fEduhWtVvKtiQ7w"/> > <ownedAttribute xmi:id="_qdx-Df8fEduhWtVvKtiQ7w" name="realSymbol" visibility="public" isOrdered="true"> >- <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/EcorePrimitiveTypes.library.uml#EDoubleObject"/> >+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/Ecore.metamodel.uml#EBigDecimal"/> > <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_qdx-Dv8fEduhWtVvKtiQ7w"/> > </ownedAttribute> > </packagedElement> >@@ -856,4 +856,6 @@ > <Ecore:EClass xmi:id="_u2txsL8sEd2tbsirxV4pLA" base_Class="_WuZt4L8sEd2tbsirxV4pLA"/> > <Ecore:EReference xmi:id="_xEai4L8tEd2tbsirxV4pLA" base_Property="_woRO4L8sEd2tbsirxV4pLA"/> > <Ecore:EAttribute xmi:id="_K42H8AKSEd6O0MANVU0HEw" base_Property="_HPVqoAKSEd6O0MANVU0HEw"/> >+ <Ecore:EAttribute xmi:id="_GDcw4P9qEd67_agdSFnrQQ"/> >+ <Ecore:EDataType xmi:id="__GNnEP9rEd67_agdSFnrQQ" instanceClassName="java.lang.Number"/> > </xmi:XMI> >Index: src/org/eclipse/ocl/AbstractEvaluationVisitor.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/AbstractEvaluationVisitor.java,v >retrieving revision 1.11 >diff -u -r1.11 AbstractEvaluationVisitor.java >--- src/org/eclipse/ocl/AbstractEvaluationVisitor.java 1 Sep 2009 20:11:23 -0000 1.11 >+++ src/org/eclipse/ocl/AbstractEvaluationVisitor.java 14 Jan 2010 14:39:44 -0000 >@@ -526,6 +526,7 @@ > * @return the coerced number, or the original number, in case of overflow > * > * @since 1.2 >+ * @deprecated use ObjectUtil.normalize > */ > protected Number higherPrecisionNumber(Number number) { > return NumberUtil.higherPrecisionNumber(number); >Index: src/org/eclipse/ocl/EvaluationVisitorImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/EvaluationVisitorImpl.java,v >retrieving revision 1.5 >diff -u -r1.5 EvaluationVisitorImpl.java >--- src/org/eclipse/ocl/EvaluationVisitorImpl.java 11 Jan 2010 22:28:16 -0000 1.5 >+++ src/org/eclipse/ocl/EvaluationVisitorImpl.java 14 Jan 2010 14:39:46 -0000 >@@ -20,6 +20,9 @@ > > package org.eclipse.ocl; > >+import java.math.BigDecimal; >+import java.math.BigInteger; >+import java.math.RoundingMode; > import java.util.AbstractList; > import java.util.ArrayList; > import java.util.Collection; >@@ -257,15 +260,9 @@ > OCLExpression<C> arg = args.get(0); > Object argVal = arg.accept(getVisitor()); > >- if (sourceVal instanceof Number) { >- // coerce to Long or Double, if possible, for comparison >- sourceVal = higherPrecisionNumber((Number) sourceVal); >- } >- >- if (argVal instanceof Number) { >- // coerce to Long or Double, if possible, for comparison >- argVal = higherPrecisionNumber((Number) argVal); >- } >+ // normalise to BigInteger or BigDecimal for comparison >+ sourceVal = ObjectUtil.normalise(sourceVal); >+ argVal = ObjectUtil.normalise(argVal); > > return Boolean.valueOf(ObjectUtil.equal(sourceVal, argVal)); > } >@@ -277,15 +274,9 @@ > OCLExpression<C> arg = args.get(0); > Object argVal = arg.accept(getVisitor()); > >- if (sourceVal instanceof Number) { >- // coerce to Long or Double, if possible, for comparison >- sourceVal = higherPrecisionNumber((Number) sourceVal); >- } >- >- if (argVal instanceof Number) { >- // coerce to Long or Double, if possible, for comparison >- argVal = higherPrecisionNumber((Number) argVal); >- } >+ // normalise to BigInteger or BigDecimal for comparison >+ sourceVal = ObjectUtil.normalise(sourceVal); >+ argVal = ObjectUtil.normalise(argVal); > > return Boolean.valueOf(!ObjectUtil.equal(sourceVal, argVal)); > } >@@ -309,83 +300,60 @@ > return getInvalid(); > } > >+ // normalise to BigInteger or BigDecimal >+ sourceVal = ObjectUtil.normalise(sourceVal); > // evaluate this operation > switch (opCode) { > > case PredefinedType.MINUS: >- // Integer::minus() >- if (sourceVal instanceof Integer) { >- return - (Integer) sourceVal; >- } else if (sourceVal instanceof Long) { >- return - (Long) sourceVal; >+ if (sourceVal instanceof UnlimitedNaturalLiteralExp<?>) { >+ // the unlimited value has no negative >+ return getInvalid(); > } >- >- // Double::minus() >- return - (Double) sourceVal; >+ if (sourceVal instanceof BigInteger) { >+ // Integer::minus() >+ return ((BigInteger) sourceVal).negate(); >+ } >+ else { >+ // Double::minus() >+ return ((BigDecimal) sourceVal).negate(); >+ } > > case PredefinedType.ABS: >- if (sourceVal instanceof Integer) { >- int sourceInt = (Integer) sourceVal; >- >- if (sourceType == getUnlimitedNatural()) { >- // the unlimited value has no absolute >- if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >- return getInvalid(); >- } >- } >- >- // Integer::abs() >- return Math.abs(sourceInt); >- } else if (sourceVal instanceof Long) { >- long sourceInt = (Long) sourceVal; >- >- if (sourceType == getUnlimitedNatural()) { >- // the unlimited value has no absolute >- if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >- return getInvalid(); >- } >- } >- >+ if (sourceVal instanceof UnlimitedNaturalLiteralExp<?>) { >+ // the unlimited value has no absolute >+ return getInvalid(); >+ } >+ if (sourceVal instanceof BigInteger) { > // Integer::abs() >- return Math.abs(sourceInt); >+ return ((BigInteger)sourceVal).abs(); > } >- >- // Real::abs() >- return Math.abs((Double) sourceVal); >+ else { >+ // Real::abs() >+ return ((BigDecimal)sourceVal).abs(); >+ } > > case PredefinedType.FLOOR: >- if (sourceVal instanceof Double) { >+ // the unlimited value has no floor >+ if (sourceVal instanceof UnlimitedNaturalLiteralExp<?>) { >+ return getInvalid(); >+ } >+ if (sourceVal instanceof BigDecimal) { > // Real::floor() >- return (int) Math.floor((Double) sourceVal); >+ return ((BigDecimal)sourceVal).divideToIntegralValue(BigDecimal.ONE).toBigInteger(); > } >- >- if (sourceType == getUnlimitedNatural()) { >- long sourceInt = (Long) higherPrecisionNumber((Number) sourceVal); >- >- // the unlimited value has no floor >- if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >- return getInvalid(); >- } >- } >- > // Integer::floor() > return sourceVal; > > case PredefinedType.ROUND: >- if (sourceVal instanceof Double) { >+ // the unlimited value can't be rounded >+ if (sourceVal instanceof UnlimitedNaturalLiteralExp<?>) { >+ return getInvalid(); >+ } >+ if (sourceVal instanceof BigDecimal) { > // Real::round() >- return (int) Math.round((Double) sourceVal); >+ return ((BigDecimal)sourceVal).add(new BigDecimal(0.5)).divideToIntegralValue(BigDecimal.ONE).toBigInteger(); > } >- >- if (sourceType == getUnlimitedNatural()) { >- long sourceInt = (Long) higherPrecisionNumber((Number) sourceVal); >- >- // the unlimited value can't be rounded >- if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >- return getInvalid(); >- } >- } >- > // Integer::round() > return sourceVal; > >@@ -524,6 +492,7 @@ > // Integer > // and back (necessary since in OCL Integers extend > // Reals but this is not true of the java primtives). >+ argType = ((TypeExp<C>)arg).getReferredType(); > > // if the source is undefined or the conversion to > // OclVoid so is the result >@@ -534,22 +503,24 @@ > return getInvalid(); > } > >- if (sourceVal instanceof Double >+ if (sourceVal instanceof BigDecimal > && (argType == getInteger())) { >- return new Integer(((Double) sourceVal).intValue()); >- } else if (sourceVal instanceof Integer >+ BigInteger bigInteger = ((BigDecimal) sourceVal).toBigInteger(); >+ BigDecimal delta = ((BigDecimal) sourceVal).subtract(new BigDecimal(bigInteger)); >+ return delta.signum() == 0 ? bigInteger : getInvalid(); >+ } else if (sourceVal instanceof BigInteger > && (argType == getReal())) { > >- if (sourceType == getUnlimitedNatural()) { >+/* if (sourceType == getUnlimitedNatural()) { > int sourceInt = (Integer) sourceVal; > > // the unlimited value is positive infinity >- if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >+ if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED.intValue()) { > return Double.POSITIVE_INFINITY; > } >- } >+ } */ > >- return new Double(((Integer) sourceVal).doubleValue()); >+ return new BigDecimal((BigInteger) sourceVal); > } > > return sourceVal; >@@ -561,113 +532,101 @@ > argVal = arg.accept(getVisitor()); > } > >- if (sourceVal instanceof Number) { >- // we have a numeric operation. Promote to high precision >- sourceVal = higherPrecisionNumber((Number) sourceVal); >- >- if (argVal instanceof Number) { >- argVal = higherPrecisionNumber((Number) argVal); >- } >- } >+ // we have a numeric operation. Promote to high precision >+ sourceVal = ObjectUtil.normalise(sourceVal); >+ argVal = ObjectUtil.normalise(argVal); > >- if (sourceVal instanceof Long && argVal instanceof Long) { >- // >- // source and single arg are both integers >- // >- >- long sourceInt = (Long) sourceVal; >- long argInt = (Long) argVal; >- >- boolean sourceUnlimited = >- sourceType == getUnlimitedNatural() >- && sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED; >- boolean argUnlimited = >- argType == getUnlimitedNatural() >- && argInt == UnlimitedNaturalLiteralExp.UNLIMITED; >- >- if (sourceUnlimited && argUnlimited) { >- switch (opCode) { >- case PredefinedType.LESS_THAN: >- case PredefinedType.LESS_THAN_EQUAL: >- case PredefinedType.GREATER_THAN: >- case PredefinedType.GREATER_THAN_EQUAL: >- // two inifinte values cannot be compared. We >- // allow = and <> only to test for unbounded >- // multiplicities >- return Boolean.FALSE; >- default: >- // cannot do arithmetic on the unlimited value >- return getInvalid(); >- } >- } else if (sourceUnlimited || argUnlimited) { >- switch (opCode) { >+ boolean sourceUnlimited = sourceVal instanceof UnlimitedNaturalLiteralExp<?>; >+ boolean argUnlimited = argVal instanceof UnlimitedNaturalLiteralExp<?>; >+ if (sourceUnlimited && argUnlimited) { >+ switch (opCode) { > case PredefinedType.LESS_THAN: > case PredefinedType.LESS_THAN_EQUAL: >- return argUnlimited; > case PredefinedType.GREATER_THAN: > case PredefinedType.GREATER_THAN_EQUAL: >- return sourceUnlimited; >+ // two inifinte values cannot be compared. We >+ // allow = and <> only to test for unbounded >+ // multiplicities >+ return Boolean.FALSE; > default: > // cannot do arithmetic on the unlimited value > return getInvalid(); > } >+ } else if (sourceUnlimited || argUnlimited) { >+ switch (opCode) { >+ case PredefinedType.LESS_THAN: >+ case PredefinedType.LESS_THAN_EQUAL: >+ return argUnlimited; >+ case PredefinedType.GREATER_THAN: >+ case PredefinedType.GREATER_THAN_EQUAL: >+ return sourceUnlimited; >+ default: >+ // cannot do arithmetic on the unlimited value >+ return getInvalid(); > } >+ } else if (sourceVal instanceof BigInteger && argVal instanceof BigInteger) { >+ // >+ // source and single arg are both integers >+ // >+ >+// long sourceInt = (Long) sourceVal; >+// long argInt = (Long) argVal; >+ > > switch (opCode) { > > // Integer::plus(Integer) > case PredefinedType.PLUS: >- return coerceNumber(sourceInt + argInt); >+ return ((BigInteger)sourceVal).add((BigInteger)argVal); > > // Integer::minus(Integer) > case PredefinedType.MINUS: >- return coerceNumber(sourceInt - argInt); >+ return ((BigInteger)sourceVal).subtract((BigInteger)argVal); > > // Integer::times(Integer) > case PredefinedType.TIMES: >- return coerceNumber(sourceInt * argInt); >+ return ((BigInteger)sourceVal).multiply((BigInteger)argVal); > > // Integer::divide(Integer) > case PredefinedType.DIVIDE: { > // denominator of 0 means undefined >- double num = sourceInt; >- double denom = argInt; >- return (denom == 0.0) ? getInvalid() : num / denom; >+ return (((BigInteger)argVal).signum() == 0) ? getInvalid() : >+ new BigDecimal((BigInteger)sourceVal).divide(new BigDecimal((BigInteger)argVal), RoundingMode.HALF_EVEN); > } > > // Integer::div(Integer) > case PredefinedType.DIV: > // denominator of 0 means undefined >- return (argInt == 0) ? getInvalid() : >- coerceNumber(sourceInt / argInt); >+ return (((BigInteger)argVal).signum() == 0) ? getInvalid() : >+ ((BigInteger)sourceVal).divide((BigInteger)argVal); > > // Integer::mod(Integer) > case PredefinedType.MOD: >- return coerceNumber(sourceInt % argInt); >+ return ((BigInteger)sourceVal).mod((BigInteger)argVal); > > // Integer::max(Integer) > case PredefinedType.MAX: >- return coerceNumber(Math.max(sourceInt, argInt)); >+ return ((BigInteger)sourceVal).max((BigInteger)argVal); > > // Integer::min(Integer) > case PredefinedType.MIN: >- return coerceNumber(Math.min(sourceInt, argInt)); >+ return ((BigInteger)sourceVal).min((BigInteger)argVal); > > // Integer::lessThan(Integer) > case PredefinedType.LESS_THAN: >- return sourceInt < argInt; >+ return ((BigInteger)sourceVal).compareTo((BigInteger)argVal) < 0; > > // Integer::greaterThan(Integer) > case PredefinedType.GREATER_THAN: >- return sourceInt > argInt; >+ return ((BigInteger)sourceVal).compareTo((BigInteger)argVal) > 0; > > // Integer::lessThanEqual(Integer) > case PredefinedType.LESS_THAN_EQUAL: >- return sourceInt <= argInt; >+ return ((BigInteger)sourceVal).compareTo((BigInteger)argVal) <= 0; > > // Integer::greaterThanEqual(Integer) > case PredefinedType.GREATER_THAN_EQUAL: >- return sourceInt >= argInt; >+ return ((BigInteger)sourceVal).compareTo((BigInteger)argVal) >= 0; > > default: { > String message = OCLMessages.bind( >@@ -679,181 +638,14 @@ > throw error; > } > } >- } else if (sourceVal instanceof Long >- && argVal instanceof Double) { >- >- // >- // source is an integer and single arg is a real >- // >- >- long sourceInt = (Long) sourceVal; >- double argReal = (Double) argVal; >- >- if (sourceType == getUnlimitedNatural()) { >- if (sourceInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >- switch (opCode) { >- case PredefinedType.LESS_THAN: >- // unlimited is not less than or equal to >- // any Real value >- return Boolean.FALSE; >- case PredefinedType.GREATER_THAN: >- case PredefinedType.GREATER_THAN_EQUAL: >- // unlimited is greater than >- // every Real value >- return Boolean.TRUE; >- default: >- // cannot do arithmetic on the unlimited value >- return getInvalid(); >- } >- } >- } >- >- switch (opCode) { >- >- // Integer::plus(Real) >- case PredefinedType.PLUS: >- return coerceNumber(sourceInt + argReal); >- >- // Integer::minus(Real) >- case PredefinedType.MINUS: >- return coerceNumber(sourceInt - argReal); >- >- // Integer::times(Real) >- case PredefinedType.TIMES: >- return coerceNumber(sourceInt * argReal); >- >- // Integer::divide(Real) >- case PredefinedType.DIVIDE: >- // denominator of 0 results in undefined >- return (argReal == 0.0) ? getInvalid() : sourceInt / argReal; >- >- // Integer::max(Real) >- case PredefinedType.MAX: >- return coerceNumber(Math.max(sourceInt, argReal)); >- >- // Integer::min(Real) >- case PredefinedType.MIN: >- return coerceNumber(Math.min(sourceInt, argReal)); >- >- // Integer::lessThan(Real) >- case PredefinedType.LESS_THAN: >- return sourceInt < argReal; >- >- // Integer::greaterThan(Real) >- case PredefinedType.GREATER_THAN: >- return sourceInt > argReal; >- >- // Integer::lessThanEqual(Real) >- case PredefinedType.LESS_THAN_EQUAL: >- return sourceInt <= argReal; >- >- // Integer::greaterThanEqual(Real) >- case PredefinedType.GREATER_THAN_EQUAL: >- return sourceInt >= argReal; >- >- default: { >- String message = OCLMessages.bind( >- OCLMessages.UnknownOperation_ERROR_, >- getName(oper)); >- RuntimeException error = new RuntimeException(message); >- OCLPlugin.throwing(getClass(), >- "visitOperationCallExp", error);//$NON-NLS-1$ >- throw error; >- } >+ } else if (sourceVal instanceof Number >+ && argVal instanceof Number) { >+ if (sourceVal instanceof BigInteger) { >+ sourceVal = new BigDecimal((BigInteger) sourceVal); > } >- } >- >- else if (sourceVal instanceof Double >- && argVal instanceof Long) { >- >- double sourceReal = (Double) sourceVal; >- long argInt = (Long) argVal; >- >- // >- // source is a real and single arg is an integer >- // >- >- if (argType == getUnlimitedNatural()) { >- if (argInt == UnlimitedNaturalLiteralExp.UNLIMITED) { >- switch (opCode) { >- case PredefinedType.LESS_THAN: >- // unlimited is greater than >- // every Real value >- return Boolean.TRUE; >- case PredefinedType.GREATER_THAN: >- case PredefinedType.GREATER_THAN_EQUAL: >- // unlimited is not less than or equal to >- // any Real value >- return Boolean.FALSE; >- default: >- // cannot do arithmetic on the unlimited value >- return getInvalid(); >- } >- } >- } >- >- // for these arithmetic operations, don't need to coerce >- // the result to any other precision because OCL Reals are >- // represented as Doubles, anyway >- switch (opCode) { >- >- // Real::plus(Integer) >- case PredefinedType.PLUS: >- return sourceReal + argInt; >- >- // Real::minus(Integer) >- case PredefinedType.MINUS: >- return sourceReal - argInt; >- >- // Real::times(Integer) >- case PredefinedType.TIMES: >- return sourceReal * argInt; >- >- // Real::divide(Integer) >- case PredefinedType.DIVIDE: >- // denominator of 0 results in undefined >- return (argInt == 0) ? getInvalid() : sourceReal / argInt; >- >- // Real::max(Integer) >- case PredefinedType.MAX: >- return Math.max(sourceReal, argInt); >- >- // Real::min(Integer) >- case PredefinedType.MIN: >- return Math.min(sourceReal, argInt); >- >- // Real::lessThan(Integer) >- case PredefinedType.LESS_THAN: >- return sourceReal < argInt; >- >- // Real::greaterThan(Integer) >- case PredefinedType.GREATER_THAN: >- return sourceReal > argInt; >- >- // Real::lessThanEqual(Integer) >- case PredefinedType.LESS_THAN_EQUAL: >- return sourceReal <= argInt; >- >- // Real::greaterThanEqual(Integer) >- case PredefinedType.GREATER_THAN_EQUAL: >- return sourceReal >= argInt; >- >- default: { >- String message = OCLMessages.bind( >- OCLMessages.UnknownOperation_ERROR_, >- getName(oper)); >- RuntimeException error = new RuntimeException(message); >- OCLPlugin.throwing(getClass(), >- "visitOperationCallExp", error);//$NON-NLS-1$ >- throw error; >- } >+ if (argVal instanceof BigInteger) { >+ argVal = new BigDecimal((BigInteger) argVal); > } >- } else if (sourceVal instanceof Double >- && argVal instanceof Double) { >- >- double sourceReal = (Double) sourceVal; >- double argReal = (Double) argVal; >- > // > // source is a real and single arg is a real > // >@@ -862,44 +654,45 @@ > > // Real::plus(Real) > case PredefinedType.PLUS: >- return sourceReal + argReal; >+ return ((BigDecimal)sourceVal).add((BigDecimal)argVal); > > // Real::minus(Real) > case PredefinedType.MINUS: >- return sourceReal - argReal; >+ return ((BigDecimal)sourceVal).subtract((BigDecimal)argVal); > > // Real::times(Real) > case PredefinedType.TIMES: >- return sourceReal * argReal; >+ return ((BigDecimal)sourceVal).multiply((BigDecimal)argVal); > > // Real::divide(Real) > case PredefinedType.DIVIDE: > // denominator of 0 results in undefined >- return (argReal == 0.0) ? getInvalid() : sourceReal / argReal; >+ return (((BigDecimal)argVal).signum() == 0) ? getInvalid() : >+ ((BigDecimal)sourceVal).divide((BigDecimal)argVal); > > // Real::max(Real) > case PredefinedType.MAX: >- return Math.max(sourceReal, argReal); >+ return ((BigDecimal)sourceVal).max((BigDecimal)argVal); > > // Real::min(Real) > case PredefinedType.MIN: >- return Math.min(sourceReal, argReal); >+ return ((BigDecimal)sourceVal).min((BigDecimal)argVal); > > // Real::lessThan(Real) > case PredefinedType.LESS_THAN: >- return sourceReal < argReal; >+ return ((BigDecimal)sourceVal).compareTo((BigDecimal)argVal) < 0; > > // Real::greaterThan(Real) > case PredefinedType.GREATER_THAN: >- return sourceReal > argReal; >+ return ((BigDecimal)sourceVal).compareTo((BigDecimal)argVal) > 0; > > // Real::lessThanEqual(Real) > case PredefinedType.LESS_THAN_EQUAL: >- return sourceReal <= argReal; >+ return ((BigDecimal)sourceVal).compareTo((BigDecimal)argVal) <= 0; > > // Real::greaterThanEqual(Real) > case PredefinedType.GREATER_THAN_EQUAL: >- return sourceReal >= argReal; >+ return ((BigDecimal)sourceVal).compareTo((BigDecimal)argVal) >= 0; > > default: { > String message = OCLMessages.bind( >@@ -1101,7 +894,7 @@ > > case PredefinedType.AT: { > // OrderedSet, Sequence::at(Integer) >- int indexVal = ((Integer) argVal).intValue(); >+ int indexVal = ((Number) argVal).intValue(); > return CollectionUtil.at(sourceColl, indexVal); > } > >@@ -1170,27 +963,27 @@ > // just one ternary string operation > // String::substring(Integer, Integer) > // index orgin 1 for OCL >- int lower = ((Integer) arg1).intValue() - 1; >- int upper = ((Integer) arg2).intValue(); >+ int lower = ((Number) arg1).intValue() - 1; >+ int upper = ((Number) arg2).intValue(); > return ((String) sourceVal).substring(lower, upper); > } else if (sourceVal instanceof Collection<?>) { > @SuppressWarnings("unchecked") > Collection<Object> sourceColl = (Collection<Object>) sourceVal; > if (opCode == PredefinedType.INSERT_AT) { > // OrderedSet, Sequence::insertAt(Integer, T) >- int index = ((Integer) arg1).intValue(); >+ int index = ((Number) arg1).intValue(); > return CollectionUtil.insertAt(sourceColl, index, > arg2); > } else if (opCode == PredefinedType.SUB_ORDERED_SET) { > // OrderedSet, Sequence::subOrderedSet(Integer, Integer) >- int lower = ((Integer) arg1).intValue(); >- int upper = ((Integer) arg2).intValue(); >+ int lower = ((Number) arg1).intValue(); >+ int upper = ((Number) arg2).intValue(); > return CollectionUtil.subOrderedSet(sourceColl, > lower, upper); > } else if (opCode == PredefinedType.SUB_SEQUENCE) { > // Sequence::subSequence(Integer, Integer) >- int lower = ((Integer) arg1).intValue(); >- int upper = ((Integer) arg2).intValue(); >+ int lower = ((Number) arg1).intValue(); >+ int upper = ((Number) arg2).intValue(); > return CollectionUtil.subSequence(sourceColl, > lower, upper); > } >@@ -2044,7 +1837,7 @@ > @Override > public Object visitUnlimitedNaturalLiteralExp( > UnlimitedNaturalLiteralExp<C> literalExp) { >- return literalExp.getIntegerSymbol(); >+ return literalExp.isUnlimited() ? literalExp : literalExp.getUnlimitedNaturalSymbol(); > } > > /** >@@ -2129,13 +1922,13 @@ > OCLExpression<C> last = collRange.getLast(); > > // evaluate first value >- Integer firstVal = (Integer) first.accept(getVisitor()); >+ Number firstVal = (Number) first.accept(getVisitor()); > if (firstVal == null) { > result.add(null); > return result; > } > // evaluate last value >- Integer lastVal = (Integer) last.accept(getVisitor()); >+ Number lastVal = (Number) last.accept(getVisitor()); > if (lastVal == null) { > result.add(null); > return result; >@@ -2168,15 +1961,15 @@ > OCLExpression<C> last = range.getLast(); > > // evaluate first value >- Integer firstVal = (Integer) first.accept(getVisitor()); >- Integer lastVal = (Integer) last.accept(getVisitor()); >+ Number firstVal = (Number) first.accept(getVisitor()); >+ Number lastVal = (Number) last.accept(getVisitor()); > if (!((firstVal == null) || (lastVal == null))) { > // TODO: enhance IntegerRangeList to support multiple ranges > // add values between first and last inclusive > int firstInt = firstVal.intValue(); > int lastInt = lastVal.intValue(); > for (int i = firstInt; i <= lastInt; i++) { >- result.add(new Integer(i)); >+ result.add(BigInteger.valueOf(i)); > } > } > } // end of collection range >@@ -2190,7 +1983,7 @@ > > // private static inner class for lazy lists over an integer range > private static final class IntegerRangeList >- extends AbstractList<Integer> { >+ extends AbstractList<BigInteger> { > > // public IntegerRangeList() { > // super(); >@@ -2216,7 +2009,7 @@ > } > > @Override >- public Integer get(int index) { >+ public BigInteger get(int index) { > if (index < 0 || index >= size()) { > String message = OCLMessages.bind( > OCLMessages.IndexOutOfRange_ERROR_, >@@ -2229,29 +2022,29 @@ > OCLPlugin.throwing(getClass(), "get", error);//$NON-NLS-1$ > throw error; > } >- return new Integer(first + index); >+ return BigInteger.valueOf(first + index); > } > > @Override >- public Iterator<Integer> iterator() { >+ public Iterator<BigInteger> iterator() { > // local iterator class that provides > // hasNext() and next() methods appropriate > // for this range set > class IntegerRangeIterator >- implements Iterator<Integer> { >+ implements Iterator<BigInteger> { > > public IntegerRangeIterator() { > curr = first; > initialized = false; > } > >- public Integer next() { >+ public BigInteger next() { > if (!initialized) { > curr = first - 1; > initialized = true; > } > if (hasNext()) { >- return new Integer(++curr); >+ return BigInteger.valueOf(++curr); > } > throw new NoSuchElementException(); > } >Index: src/org/eclipse/ocl/OCL.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/OCL.java,v >retrieving revision 1.13 >diff -u -r1.13 OCL.java >--- src/org/eclipse/ocl/OCL.java 4 Jan 2010 23:22:46 -0000 1.13 >+++ src/org/eclipse/ocl/OCL.java 14 Jan 2010 14:39:46 -0000 >@@ -31,6 +31,7 @@ > import org.eclipse.ocl.helper.OCLHelper; > import org.eclipse.ocl.internal.OCLDebugOptions; > import org.eclipse.ocl.internal.OCLPlugin; >+import org.eclipse.ocl.internal.evaluation.NumberUtil; > import org.eclipse.ocl.internal.evaluation.QueryImpl; > import org.eclipse.ocl.internal.helper.HelperUtil; > import org.eclipse.ocl.lpg.ProblemHandler; >@@ -418,20 +419,55 @@ > * Evaluates a query expression on a context object (which is bound to the > * <tt>self</tt> variable). Clients should use the > * {@link #isInvalid(Object)} method to check whether the evaluation result >- * is <tt>OclInvalid</tt>. >+ * is <tt>invalid</tt>. >+ * <p>Any BigDecimal or BigInteger result is converted to the smallest of Double, or Long or >+ * Integer when possible. Use {@link #rawEvaluate(Object, Object)} to retain the internal precision.</p> > * > * @param context > * the context (self) object > * @param expression > * the OCL expression to evaluate > * >- * @return the value of the expression, or <tt>OclInvalid</tt> if the >+ * @return the value of the expression, or <tt>invalid</tt> if the > * evaluation fails for reasons other than a run-time exception > * > * @see #isInvalid(Object) >+ * @see #rawEvaluate(Object, Object) > * @see #check(Object, Object) > */ > public Object evaluate(Object context, OCLExpression<C> expression) { >+ Object result = rawEvaluate(context, expression); >+ if (result instanceof Number) { >+ result = NumberUtil.coerceNumber((Number) result); >+ } >+ return result; >+ } >+ >+ /** >+ * Evaluates a query expression on a context object (which is bound to the >+ * <tt>self</tt> variable). Clients should use the >+ * {@link #isInvalid(Object)} method to check whether the evaluation result >+ * is <tt>invalid</tt>. >+ * <br>Any Real result is represented by a BigDecimal object. >+ * <br>Any Integer result is represented by a BigInteger object. >+ * <br>Any (limited) UnlimitedNatural result is represented by a BigInteger object. >+ * <br>The unlimited UnlimitedNatural result is represented by an UnlimitedNaturalLiteralExp object >+ * whose value is UnlimitedNaturalLiteralExp.UNLIMITED. >+ * >+ * @param context >+ * the context (self) object >+ * @param expression >+ * the OCL expression to evaluate >+ * >+ * @return the value of the expression, or <tt>invalid</tt> if the >+ * evaluation fails for reasons other than a run-time exception >+ * >+ * @see #isInvalid(Object) >+ * @see #check(Object, Object) >+ * @see #evaluate(Object, Object) >+ * @since 3.0 >+ */ >+ public Object rawEvaluate(Object context, OCLExpression<C> expression) { > evaluationProblems = null; > > // can determine a more appropriate context from the context >Index: src/org/eclipse/ocl/cst/CSTPackage.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/CSTPackage.java,v >retrieving revision 1.14 >diff -u -r1.14 CSTPackage.java >--- src/org/eclipse/ocl/cst/CSTPackage.java 27 Dec 2009 15:49:51 -0000 1.14 >+++ src/org/eclipse/ocl/cst/CSTPackage.java 14 Jan 2010 14:39:52 -0000 >@@ -3568,15 +3568,14 @@ > int UNLIMITED_NATURAL_LITERAL_EXP_CS__SYMBOL = PRIMITIVE_LITERAL_EXP_CS__SYMBOL; > > /** >- * The feature id for the '<em><b>Integer Symbol</b></em>' attribute. >+ * The feature id for the '<em><b>Unlimited Natural Symbol</b></em>' attribute. > * <!-- begin-user-doc --> >- * This value may change when the model code is regenerated. >- * It is subject to change without notice. >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > * @ordered > */ >- int UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL = PRIMITIVE_LITERAL_EXP_CS_FEATURE_COUNT + 0; >+ int UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL = PRIMITIVE_LITERAL_EXP_CS_FEATURE_COUNT + 0; > > /** > * The number of structural features of the '<em>Unlimited Natural Literal Exp CS</em>' class. >@@ -3668,8 +3667,6 @@ > /** > * The feature id for the '<em><b>Real Symbol</b></em>' attribute. > * <!-- begin-user-doc --> >- * This value may change when the model code is regenerated. >- * It is subject to change without notice. > * <!-- end-user-doc --> > * @generated > * @ordered >@@ -6243,15 +6240,16 @@ > EClass getUnlimitedNaturalLiteralExpCS(); > > /** >- * Returns the meta object for the attribute '{@link org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getIntegerSymbol <em>Integer Symbol</em>}'. >+ * Returns the meta object for the attribute '{@link org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}'. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @return the meta object for the attribute '<em>Integer Symbol</em>'. >- * @see org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getIntegerSymbol() >+ * @return the meta object for the attribute '<em>Unlimited Natural Symbol</em>'. >+ * @see org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getUnlimitedNaturalSymbol() > * @see #getUnlimitedNaturalLiteralExpCS() > * @generated > */ >- EAttribute getUnlimitedNaturalLiteralExpCS_IntegerSymbol(); >+ EAttribute getUnlimitedNaturalLiteralExpCS_UnlimitedNaturalSymbol(); > > /** > * Returns the meta object for class '{@link org.eclipse.ocl.cst.RealLiteralExpCS <em>Real Literal Exp CS</em>}'. >@@ -7560,13 +7558,14 @@ > .getUnlimitedNaturalLiteralExpCS(); > > /** >- * The meta object literal for the '<em><b>Integer Symbol</b></em>' attribute feature. >+ * The meta object literal for the '<em><b>Unlimited Natural Symbol</b></em>' attribute feature. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- EAttribute UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL = eINSTANCE >- .getUnlimitedNaturalLiteralExpCS_IntegerSymbol(); >+ EAttribute UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL = eINSTANCE >+ .getUnlimitedNaturalLiteralExpCS_UnlimitedNaturalSymbol(); > > /** > * The meta object literal for the '{@link org.eclipse.ocl.cst.impl.RealLiteralExpCSImpl <em>Real Literal Exp CS</em>}' class. >Index: src/org/eclipse/ocl/cst/IntegerLiteralExpCS.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/IntegerLiteralExpCS.java,v >retrieving revision 1.4 >diff -u -r1.4 IntegerLiteralExpCS.java >--- src/org/eclipse/ocl/cst/IntegerLiteralExpCS.java 22 Dec 2009 18:42:30 -0000 1.4 >+++ src/org/eclipse/ocl/cst/IntegerLiteralExpCS.java 14 Jan 2010 14:39:52 -0000 >@@ -17,6 +17,8 @@ > */ > package org.eclipse.ocl.cst; > >+import java.math.BigInteger; >+ > /** > * <!-- begin-user-doc --> > * A representation of the model object '<em><b>Integer Literal Exp CS</b></em>'. >@@ -43,23 +45,25 @@ > * If the meaning of the '<em>Integer Symbol</em>' attribute isn't clear, > * there really should be more of a description here... > * </p> >+ * @since 3.0 > * <!-- end-user-doc --> > * @return the value of the '<em>Integer Symbol</em>' attribute. >- * @see #setIntegerSymbol(Integer) >+ * @see #setIntegerSymbol(BigInteger) > * @see org.eclipse.ocl.cst.CSTPackage#getIntegerLiteralExpCS_IntegerSymbol() > * @model > * @generated > */ >- Integer getIntegerSymbol(); >+ BigInteger getIntegerSymbol(); > > /** > * Sets the value of the '{@link org.eclipse.ocl.cst.IntegerLiteralExpCS#getIntegerSymbol <em>Integer Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @param value the new value of the '<em>Integer Symbol</em>' attribute. > * @see #getIntegerSymbol() > * @generated > */ >- void setIntegerSymbol(Integer value); >+ void setIntegerSymbol(BigInteger value); > > } // IntegerLiteralExpCS >Index: src/org/eclipse/ocl/cst/RealLiteralExpCS.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/RealLiteralExpCS.java,v >retrieving revision 1.4 >diff -u -r1.4 RealLiteralExpCS.java >--- src/org/eclipse/ocl/cst/RealLiteralExpCS.java 22 Dec 2009 18:42:30 -0000 1.4 >+++ src/org/eclipse/ocl/cst/RealLiteralExpCS.java 14 Jan 2010 14:39:52 -0000 >@@ -17,6 +17,8 @@ > */ > package org.eclipse.ocl.cst; > >+import java.math.BigDecimal; >+ > /** > * <!-- begin-user-doc --> > * A representation of the model object '<em><b>Real Literal Exp CS</b></em>'. >@@ -43,23 +45,25 @@ > * If the meaning of the '<em>Real Symbol</em>' attribute isn't clear, > * there really should be more of a description here... > * </p> >+ * @since 3.0 > * <!-- end-user-doc --> > * @return the value of the '<em>Real Symbol</em>' attribute. >- * @see #setRealSymbol(Double) >+ * @see #setRealSymbol(BigDecimal) > * @see org.eclipse.ocl.cst.CSTPackage#getRealLiteralExpCS_RealSymbol() > * @model > * @generated > */ >- Double getRealSymbol(); >+ BigDecimal getRealSymbol(); > > /** > * Sets the value of the '{@link org.eclipse.ocl.cst.RealLiteralExpCS#getRealSymbol <em>Real Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @param value the new value of the '<em>Real Symbol</em>' attribute. > * @see #getRealSymbol() > * @generated > */ >- void setRealSymbol(Double value); >+ void setRealSymbol(BigDecimal value); > > } // RealLiteralExpCS >Index: src/org/eclipse/ocl/cst/UnlimitedNaturalLiteralExpCS.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/UnlimitedNaturalLiteralExpCS.java,v >retrieving revision 1.4 >diff -u -r1.4 UnlimitedNaturalLiteralExpCS.java >--- src/org/eclipse/ocl/cst/UnlimitedNaturalLiteralExpCS.java 22 Dec 2009 18:42:30 -0000 1.4 >+++ src/org/eclipse/ocl/cst/UnlimitedNaturalLiteralExpCS.java 14 Jan 2010 14:39:52 -0000 >@@ -17,6 +17,8 @@ > */ > package org.eclipse.ocl.cst; > >+import java.math.BigInteger; >+ > /** > * <!-- begin-user-doc --> > * A representation of the model object '<em><b>Unlimited Natural Literal Exp CS</b></em>'. >@@ -25,7 +27,7 @@ > * <p> > * The following features are supported: > * <ul> >- * <li>{@link org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getIntegerSymbol <em>Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}</li> > * </ul> > * </p> > * >@@ -37,29 +39,31 @@ > extends PrimitiveLiteralExpCS { > > /** >- * Returns the value of the '<em><b>Integer Symbol</b></em>' attribute. >+ * Returns the value of the '<em><b>Unlimited Natural Symbol</b></em>' attribute. > * <!-- begin-user-doc --> > * <p> >- * If the meaning of the '<em>Integer Symbol</em>' attribute isn't clear, >+ * If the meaning of the '<em>Unlimited Natural Symbol</em>' attribute isn't clear, > * there really should be more of a description here... > * </p> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @return the value of the '<em>Integer Symbol</em>' attribute. >- * @see #setIntegerSymbol(Integer) >- * @see org.eclipse.ocl.cst.CSTPackage#getUnlimitedNaturalLiteralExpCS_IntegerSymbol() >+ * @return the value of the '<em>Unlimited Natural Symbol</em>' attribute. >+ * @see #setUnlimitedNaturalSymbol(BigInteger) >+ * @see org.eclipse.ocl.cst.CSTPackage#getUnlimitedNaturalLiteralExpCS_UnlimitedNaturalSymbol() > * @model > * @generated > */ >- Integer getIntegerSymbol(); >+ BigInteger getUnlimitedNaturalSymbol(); > > /** >- * Sets the value of the '{@link org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getIntegerSymbol <em>Integer Symbol</em>}' attribute. >+ * Sets the value of the '{@link org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @param value the new value of the '<em>Integer Symbol</em>' attribute. >- * @see #getIntegerSymbol() >+ * @param value the new value of the '<em>Unlimited Natural Symbol</em>' attribute. >+ * @see #getUnlimitedNaturalSymbol() > * @generated > */ >- void setIntegerSymbol(Integer value); >+ void setUnlimitedNaturalSymbol(BigInteger value); > > } // UnlimitedNaturalLiteralExpCS >Index: src/org/eclipse/ocl/cst/impl/CSTFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/impl/CSTFactoryImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 CSTFactoryImpl.java >--- src/org/eclipse/ocl/cst/impl/CSTFactoryImpl.java 27 Dec 2009 15:49:51 -0000 1.9 >+++ src/org/eclipse/ocl/cst/impl/CSTFactoryImpl.java 14 Jan 2010 14:39:52 -0000 >@@ -74,6 +74,7 @@ > import org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS; > import org.eclipse.ocl.cst.VariableCS; > import org.eclipse.ocl.cst.VariableExpCS; >+import org.eclipse.ocl.util.ObjectUtil; > > /** > * <!-- begin-user-doc --> >@@ -818,6 +819,28 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public Number createNumberFromString(EDataType eDataType, >+ String initialValue) { >+ return ObjectUtil.createNumber(initialValue); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public String convertNumberToString(EDataType eDataType, >+ Object instanceValue) { >+ return instanceValue.toString(); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ >Index: src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java,v >retrieving revision 1.14 >diff -u -r1.14 CSTPackageImpl.java >--- src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java 27 Dec 2009 15:49:51 -0000 1.14 >+++ src/org/eclipse/ocl/cst/impl/CSTPackageImpl.java 14 Jan 2010 14:39:54 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.emf.ecore.EEnum; > import org.eclipse.emf.ecore.EPackage; > import org.eclipse.emf.ecore.EReference; >+import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.ecore.impl.EPackageImpl; > import org.eclipse.ocl.cst.BooleanLiteralExpCS; > import org.eclipse.ocl.cst.CSTFactory; >@@ -529,6 +530,9 @@ > > isInited = true; > >+ // Initialize simple dependencies >+ EcorePackage.eINSTANCE.eClass(); >+ > // Create package meta-data objects > theCSTPackage.createPackageContents(); > >@@ -1296,10 +1300,11 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public EAttribute getUnlimitedNaturalLiteralExpCS_IntegerSymbol() { >+ public EAttribute getUnlimitedNaturalLiteralExpCS_UnlimitedNaturalSymbol() { > return (EAttribute) unlimitedNaturalLiteralExpCSEClass > .getEStructuralFeatures().get(0); > } >@@ -1978,7 +1983,7 @@ > > unlimitedNaturalLiteralExpCSEClass = createEClass(UNLIMITED_NATURAL_LITERAL_EXP_CS); > createEAttribute(unlimitedNaturalLiteralExpCSEClass, >- UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL); >+ UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL); > > realLiteralExpCSEClass = createEClass(REAL_LITERAL_EXP_CS); > createEAttribute(realLiteralExpCSEClass, >@@ -2066,6 +2071,10 @@ > setNsPrefix(eNS_PREFIX); > setNsURI(eNS_URI); > >+ // Obtain other dependent packages >+ EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE >+ .getEPackage(EcorePackage.eNS_URI); >+ > // Create type parameters > > // Set bounds for type parameters >@@ -2589,7 +2598,7 @@ > "IntegerLiteralExpCS", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ > initEAttribute( > getIntegerLiteralExpCS_IntegerSymbol(), >- ecorePackage.getEIntegerObject(), >+ theEcorePackage.getEBigInteger(), > "integerSymbol", null, 0, 1, IntegerLiteralExpCS.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ > > initEClass( >@@ -2597,9 +2606,9 @@ > UnlimitedNaturalLiteralExpCS.class, > "UnlimitedNaturalLiteralExpCS", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ > initEAttribute( >- getUnlimitedNaturalLiteralExpCS_IntegerSymbol(), >- ecorePackage.getEIntegerObject(), >- "integerSymbol", null, 0, 1, UnlimitedNaturalLiteralExpCS.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ >+ getUnlimitedNaturalLiteralExpCS_UnlimitedNaturalSymbol(), >+ theEcorePackage.getEBigInteger(), >+ "unlimitedNaturalSymbol", null, 0, 1, UnlimitedNaturalLiteralExpCS.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ > > initEClass( > realLiteralExpCSEClass, >@@ -2607,7 +2616,7 @@ > "RealLiteralExpCS", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ > initEAttribute( > getRealLiteralExpCS_RealSymbol(), >- ecorePackage.getEDoubleObject(), >+ theEcorePackage.getEBigDecimal(), > "realSymbol", null, 0, 1, RealLiteralExpCS.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ > > initEClass( >@@ -2803,7 +2812,7 @@ > * @generated > */ > protected void createExtendedMetaDataAnnotations() { >- String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ >+ String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ > addAnnotation(oclExpressionCSEClass, source, new String[]{ > "name", "OclExpressionCS" //$NON-NLS-1$ //$NON-NLS-2$ > }); >Index: src/org/eclipse/ocl/cst/impl/IntegerLiteralExpCSImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/impl/IntegerLiteralExpCSImpl.java,v >retrieving revision 1.3 >diff -u -r1.3 IntegerLiteralExpCSImpl.java >--- src/org/eclipse/ocl/cst/impl/IntegerLiteralExpCSImpl.java 30 Nov 2008 22:11:37 -0000 1.3 >+++ src/org/eclipse/ocl/cst/impl/IntegerLiteralExpCSImpl.java 14 Jan 2010 14:39:54 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.cst.impl; > >+import java.math.BigInteger; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.impl.ENotificationImpl; >@@ -48,7 +49,7 @@ > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger INTEGER_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >@@ -58,7 +59,7 @@ > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger integerSymbol = INTEGER_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -81,20 +82,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >+ public BigInteger getIntegerSymbol() { > return integerSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >+ public void setIntegerSymbol(BigInteger newIntegerSymbol) { >+ BigInteger oldIntegerSymbol = integerSymbol; > integerSymbol = newIntegerSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -125,7 +128,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case CSTPackage.INTEGER_LITERAL_EXP_CS__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ setIntegerSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/cst/impl/RealLiteralExpCSImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/impl/RealLiteralExpCSImpl.java,v >retrieving revision 1.3 >diff -u -r1.3 RealLiteralExpCSImpl.java >--- src/org/eclipse/ocl/cst/impl/RealLiteralExpCSImpl.java 30 Nov 2008 22:11:37 -0000 1.3 >+++ src/org/eclipse/ocl/cst/impl/RealLiteralExpCSImpl.java 14 Jan 2010 14:39:54 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.cst.impl; > >+import java.math.BigDecimal; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.impl.ENotificationImpl; >@@ -48,7 +49,7 @@ > * @generated > * @ordered > */ >- protected static final Double REAL_SYMBOL_EDEFAULT = null; >+ protected static final BigDecimal REAL_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getRealSymbol() <em>Real Symbol</em>}' attribute. >@@ -58,7 +59,7 @@ > * @generated > * @ordered > */ >- protected Double realSymbol = REAL_SYMBOL_EDEFAULT; >+ protected BigDecimal realSymbol = REAL_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -81,20 +82,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Double getRealSymbol() { >+ public BigDecimal getRealSymbol() { > return realSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setRealSymbol(Double newRealSymbol) { >- Double oldRealSymbol = realSymbol; >+ public void setRealSymbol(BigDecimal newRealSymbol) { >+ BigDecimal oldRealSymbol = realSymbol; > realSymbol = newRealSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -125,7 +128,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case CSTPackage.REAL_LITERAL_EXP_CS__REAL_SYMBOL : >- setRealSymbol((Double) newValue); >+ setRealSymbol((BigDecimal) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/cst/impl/UnlimitedNaturalLiteralExpCSImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/cst/impl/UnlimitedNaturalLiteralExpCSImpl.java,v >retrieving revision 1.3 >diff -u -r1.3 UnlimitedNaturalLiteralExpCSImpl.java >--- src/org/eclipse/ocl/cst/impl/UnlimitedNaturalLiteralExpCSImpl.java 30 Nov 2008 22:11:37 -0000 1.3 >+++ src/org/eclipse/ocl/cst/impl/UnlimitedNaturalLiteralExpCSImpl.java 14 Jan 2010 14:39:54 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.cst.impl; > >+import java.math.BigInteger; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.impl.ENotificationImpl; >@@ -30,7 +31,7 @@ > * <p> > * The following features are implemented: > * <ul> >- * <li>{@link org.eclipse.ocl.cst.impl.UnlimitedNaturalLiteralExpCSImpl#getIntegerSymbol <em>Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.cst.impl.UnlimitedNaturalLiteralExpCSImpl#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}</li> > * </ul> > * </p> > * >@@ -41,24 +42,26 @@ > implements UnlimitedNaturalLiteralExpCS { > > /** >- * The default value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The default value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger UNLIMITED_NATURAL_SYMBOL_EDEFAULT = null; > > /** >- * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The cached value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger unlimitedNaturalSymbol = UNLIMITED_NATURAL_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -81,25 +84,29 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >- return integerSymbol; >+ public BigInteger getUnlimitedNaturalSymbol() { >+ return unlimitedNaturalSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >- integerSymbol = newIntegerSymbol; >+ public void setUnlimitedNaturalSymbol(BigInteger newUnlimitedNaturalSymbol) { >+ BigInteger oldUnlimitedNaturalSymbol = unlimitedNaturalSymbol; >+ unlimitedNaturalSymbol = newUnlimitedNaturalSymbol; > if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, >- CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL, >- oldIntegerSymbol, integerSymbol)); >+ eNotify(new ENotificationImpl( >+ this, >+ Notification.SET, >+ CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL, >+ oldUnlimitedNaturalSymbol, unlimitedNaturalSymbol)); > } > > /** >@@ -110,8 +117,8 @@ > @Override > public Object eGet(int featureID, boolean resolve, boolean coreType) { > switch (featureID) { >- case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL : >- return getIntegerSymbol(); >+ case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL : >+ return getUnlimitedNaturalSymbol(); > } > return super.eGet(featureID, resolve, coreType); > } >@@ -124,8 +131,8 @@ > @Override > public void eSet(int featureID, Object newValue) { > switch (featureID) { >- case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >@@ -139,8 +146,8 @@ > @Override > public void eUnset(int featureID) { > switch (featureID) { >- case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL : >- setIntegerSymbol(INTEGER_SYMBOL_EDEFAULT); >+ case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol(UNLIMITED_NATURAL_SYMBOL_EDEFAULT); > return; > } > super.eUnset(featureID); >@@ -154,10 +161,11 @@ > @Override > public boolean eIsSet(int featureID) { > switch (featureID) { >- case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__INTEGER_SYMBOL : >- return INTEGER_SYMBOL_EDEFAULT == null >- ? integerSymbol != null >- : !INTEGER_SYMBOL_EDEFAULT.equals(integerSymbol); >+ case CSTPackage.UNLIMITED_NATURAL_LITERAL_EXP_CS__UNLIMITED_NATURAL_SYMBOL : >+ return UNLIMITED_NATURAL_SYMBOL_EDEFAULT == null >+ ? unlimitedNaturalSymbol != null >+ : !UNLIMITED_NATURAL_SYMBOL_EDEFAULT >+ .equals(unlimitedNaturalSymbol); > } > return super.eIsSet(featureID); > } >@@ -173,8 +181,8 @@ > return super.toString(); > > StringBuffer result = new StringBuffer(super.toString()); >- result.append(" (integerSymbol: "); //$NON-NLS-1$ >- result.append(integerSymbol); >+ result.append(" (unlimitedNaturalSymbol: "); //$NON-NLS-1$ >+ result.append(unlimitedNaturalSymbol); > result.append(')'); > return result.toString(); > } >Index: src/org/eclipse/ocl/expressions/ExpressionsPackage.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/ExpressionsPackage.java,v >retrieving revision 1.11 >diff -u -r1.11 ExpressionsPackage.java >--- src/org/eclipse/ocl/expressions/ExpressionsPackage.java 22 Dec 2009 18:53:30 -0000 1.11 >+++ src/org/eclipse/ocl/expressions/ExpressionsPackage.java 14 Jan 2010 14:39:58 -0000 >@@ -1125,15 +1125,14 @@ > int UNLIMITED_NATURAL_LITERAL_EXP__END_POSITION = NUMERIC_LITERAL_EXP__END_POSITION; > > /** >- * The feature id for the '<em><b>Integer Symbol</b></em>' attribute. >+ * The feature id for the '<em><b>Unlimited Natural Symbol</b></em>' attribute. > * <!-- begin-user-doc --> >- * This value may change when the model code is regenerated. >- * It is subject to change without notice. >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > * @ordered > */ >- int UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL = NUMERIC_LITERAL_EXP_FEATURE_COUNT + 0; >+ int UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL = NUMERIC_LITERAL_EXP_FEATURE_COUNT + 0; > > /** > * The feature id for the '<em><b>Unlimited</b></em>' attribute. >@@ -2859,15 +2858,16 @@ > EClass getUnlimitedNaturalLiteralExp(); > > /** >- * Returns the meta object for the attribute '{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getIntegerSymbol <em>Integer Symbol</em>}'. >+ * Returns the meta object for the attribute '{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}'. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @return the meta object for the attribute '<em>Integer Symbol</em>'. >- * @see org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getIntegerSymbol() >+ * @return the meta object for the attribute '<em>Unlimited Natural Symbol</em>'. >+ * @see org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getUnlimitedNaturalSymbol() > * @see #getUnlimitedNaturalLiteralExp() > * @generated > */ >- EAttribute getUnlimitedNaturalLiteralExp_IntegerSymbol(); >+ EAttribute getUnlimitedNaturalLiteralExp_UnlimitedNaturalSymbol(); > > /** > * Returns the meta object for the attribute '{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#isUnlimited <em>Unlimited</em>}'. >@@ -3674,13 +3674,14 @@ > .getUnlimitedNaturalLiteralExp(); > > /** >- * The meta object literal for the '<em><b>Integer Symbol</b></em>' attribute feature. >+ * The meta object literal for the '<em><b>Unlimited Natural Symbol</b></em>' attribute feature. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- EAttribute UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL = eINSTANCE >- .getUnlimitedNaturalLiteralExp_IntegerSymbol(); >+ EAttribute UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL = eINSTANCE >+ .getUnlimitedNaturalLiteralExp_UnlimitedNaturalSymbol(); > > /** > * The meta object literal for the '<em><b>Unlimited</b></em>' attribute feature. >Index: src/org/eclipse/ocl/expressions/IntegerLiteralExp.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/IntegerLiteralExp.java,v >retrieving revision 1.7 >diff -u -r1.7 IntegerLiteralExp.java >--- src/org/eclipse/ocl/expressions/IntegerLiteralExp.java 22 Dec 2009 18:53:30 -0000 1.7 >+++ src/org/eclipse/ocl/expressions/IntegerLiteralExp.java 14 Jan 2010 14:39:58 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.expressions; > >+import java.math.BigInteger; > import java.util.Map; > import org.eclipse.emf.common.util.DiagnosticChain; > >@@ -46,24 +47,26 @@ > * If the meaning of the '<em>Integer Symbol</em>' attribute isn't clear, > * there really should be more of a description here... > * </p> >+ * @since 3.0 > * <!-- end-user-doc --> > * @return the value of the '<em>Integer Symbol</em>' attribute. >- * @see #setIntegerSymbol(Integer) >+ * @see #setIntegerSymbol(BigInteger) > * @see org.eclipse.ocl.expressions.ExpressionsPackage#getIntegerLiteralExp_IntegerSymbol() > * @model > * @generated > */ >- Integer getIntegerSymbol(); >+ BigInteger getIntegerSymbol(); > > /** > * Sets the value of the '{@link org.eclipse.ocl.expressions.IntegerLiteralExp#getIntegerSymbol <em>Integer Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @param value the new value of the '<em>Integer Symbol</em>' attribute. > * @see #getIntegerSymbol() > * @generated > */ >- void setIntegerSymbol(Integer value); >+ void setIntegerSymbol(BigInteger value); > > /** > * <!-- begin-user-doc --> >@@ -79,4 +82,12 @@ > boolean checkIntegerType(DiagnosticChain diagnostics, > Map<Object, Object> context); > >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @model valueRequired="true" valueOrdered="false" >+ * @generated >+ */ >+ void setIntegerSymbol(Integer value); >+ > } // IntegerLiteralExp >Index: src/org/eclipse/ocl/expressions/RealLiteralExp.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/RealLiteralExp.java,v >retrieving revision 1.7 >diff -u -r1.7 RealLiteralExp.java >--- src/org/eclipse/ocl/expressions/RealLiteralExp.java 22 Dec 2009 18:53:30 -0000 1.7 >+++ src/org/eclipse/ocl/expressions/RealLiteralExp.java 14 Jan 2010 14:39:58 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.expressions; > >+import java.math.BigDecimal; > import java.util.Map; > import org.eclipse.emf.common.util.DiagnosticChain; > >@@ -46,24 +47,26 @@ > * If the meaning of the '<em>Real Symbol</em>' attribute isn't clear, > * there really should be more of a description here... > * </p> >+ * @since 3.0 > * <!-- end-user-doc --> > * @return the value of the '<em>Real Symbol</em>' attribute. >- * @see #setRealSymbol(Double) >+ * @see #setRealSymbol(BigDecimal) > * @see org.eclipse.ocl.expressions.ExpressionsPackage#getRealLiteralExp_RealSymbol() > * @model > * @generated > */ >- Double getRealSymbol(); >+ BigDecimal getRealSymbol(); > > /** > * Sets the value of the '{@link org.eclipse.ocl.expressions.RealLiteralExp#getRealSymbol <em>Real Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @param value the new value of the '<em>Real Symbol</em>' attribute. > * @see #getRealSymbol() > * @generated > */ >- void setRealSymbol(Double value); >+ void setRealSymbol(BigDecimal value); > > /** > * <!-- begin-user-doc --> >@@ -79,4 +82,12 @@ > boolean checkRealType(DiagnosticChain diagnostics, > Map<Object, Object> context); > >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @model valueRequired="true" valueOrdered="false" >+ * @generated >+ */ >+ void setRealSymbol(Double value); >+ > } // RealLiteralExp >Index: src/org/eclipse/ocl/expressions/UnlimitedNaturalLiteralExp.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/UnlimitedNaturalLiteralExp.java,v >retrieving revision 1.8 >diff -u -r1.8 UnlimitedNaturalLiteralExp.java >--- src/org/eclipse/ocl/expressions/UnlimitedNaturalLiteralExp.java 22 Dec 2009 18:53:30 -0000 1.8 >+++ src/org/eclipse/ocl/expressions/UnlimitedNaturalLiteralExp.java 14 Jan 2010 14:39:58 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.expressions; > >+import java.math.BigInteger; > import java.util.Map; > import org.eclipse.emf.common.util.DiagnosticChain; > >@@ -28,7 +29,7 @@ > * <p> > * The following features are supported: > * <ul> >- * <li>{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getIntegerSymbol <em>Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}</li> > * <li>{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#isUnlimited <em>Unlimited</em>}</li> > * </ul> > * </p> >@@ -40,34 +41,36 @@ > public interface UnlimitedNaturalLiteralExp<C> > extends NumericLiteralExp<C> { > >- /** Java value denoting the OCL unlimited value. */ >- int UNLIMITED = -1; >- > /** >- * Returns the value of the '<em><b>Integer Symbol</b></em>' attribute. >+ * Returns the value of the '<em><b>Unlimited Natural Symbol</b></em>' attribute. > * <!-- begin-user-doc --> > * <p> >- * If the meaning of the '<em>Integer Symbol</em>' attribute isn't clear, >+ * If the meaning of the '<em>Unlimited Natural Symbol</em>' attribute isn't clear, > * there really should be more of a description here... > * </p> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @return the value of the '<em>Integer Symbol</em>' attribute. >- * @see #setIntegerSymbol(Integer) >- * @see org.eclipse.ocl.expressions.ExpressionsPackage#getUnlimitedNaturalLiteralExp_IntegerSymbol() >- * @model >+ * @return the value of the '<em>Unlimited Natural Symbol</em>' attribute. >+ * @see #setUnlimitedNaturalSymbol(BigInteger) >+ * @see org.eclipse.ocl.expressions.ExpressionsPackage#getUnlimitedNaturalLiteralExp_UnlimitedNaturalSymbol() >+ * @model extendedMetaData="name=''" > * @generated > */ >- Integer getIntegerSymbol(); >+ BigInteger getUnlimitedNaturalSymbol(); > > /** >- * Sets the value of the '{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getIntegerSymbol <em>Integer Symbol</em>}' attribute. >+ * Sets the value of the '{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @param value the new value of the '<em>Integer Symbol</em>' attribute. >- * @see #getIntegerSymbol() >+ * @param value the new value of the '<em>Unlimited Natural Symbol</em>' attribute. >+ * @see #getUnlimitedNaturalSymbol() > * @generated > */ >- void setIntegerSymbol(Integer value); >+ void setUnlimitedNaturalSymbol(BigInteger value); >+ >+ /** Java value denoting the OCL unlimited value. */ >+ BigInteger UNLIMITED = BigInteger.valueOf(-1); > > /** > * Returns the value of the '<em><b>Unlimited</b></em>' attribute. >@@ -98,4 +101,22 @@ > boolean checkNaturalType(DiagnosticChain diagnostics, > Map<Object, Object> context); > >+ /** >+ * <!-- begin-user-doc --> >+ * @deprecated use setUnlimitedNaturalSymbol >+ * <!-- end-user-doc --> >+ * @model valueRequired="true" valueOrdered="false" >+ * @generated >+ */ >+ void setIntegerSymbol(Integer value); >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @model valueRequired="true" valueOrdered="false" >+ * @generated >+ */ >+ void setUnlimitedNaturalSymbol(Integer value); >+ > } // UnlimitedNaturalLiteralExp >Index: src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 ExpressionsPackageImpl.java >--- src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java 14 Jan 2010 12:44:33 -0000 1.12 >+++ src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java 14 Jan 2010 14:40:00 -0000 >@@ -13,7 +13,7 @@ > * > * </copyright> > * >- * $Id: ExpressionsPackageImpl.java,v 1.12 2010/01/14 12:44:33 ewillink Exp $ >+ * $Id: ExpressionsPackageImpl.java,v 1.11 2009/05/26 20:06:35 aigdalov Exp $ > */ > package org.eclipse.ocl.expressions.impl; > >@@ -26,6 +26,7 @@ > import org.eclipse.emf.ecore.EReference; > import org.eclipse.emf.ecore.ETypeParameter; > import org.eclipse.emf.ecore.EValidator; >+import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.ecore.impl.EPackageImpl; > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.ocl.Environment; >@@ -413,6 +414,9 @@ > > isInited = true; > >+ // Initialize simple dependencies >+ EcorePackage.eINSTANCE.eClass(); >+ > // Obtain or create and register interdependencies > TypesPackageImpl theTypesPackage = (TypesPackageImpl) (EPackage.Registry.INSTANCE > .getEPackage(TypesPackage.eNS_URI) instanceof TypesPackageImpl >@@ -710,7 +714,7 @@ > * <!-- end-user-doc --> > * @generated > */ >- public EAttribute getUnlimitedNaturalLiteralExp_IntegerSymbol() { >+ public EAttribute getUnlimitedNaturalLiteralExp_UnlimitedNaturalSymbol() { > return (EAttribute) unlimitedNaturalLiteralExpEClass > .getEStructuralFeatures().get(0); > } >@@ -1266,7 +1270,7 @@ > > unlimitedNaturalLiteralExpEClass = createEClass(UNLIMITED_NATURAL_LITERAL_EXP); > createEAttribute(unlimitedNaturalLiteralExpEClass, >- UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL); >+ UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL); > createEAttribute(unlimitedNaturalLiteralExpEClass, > UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED); > >@@ -1383,6 +1387,8 @@ > // Obtain other dependent packages > UtilitiesPackage theUtilitiesPackage = (UtilitiesPackage) EPackage.Registry.INSTANCE > .getEPackage(UtilitiesPackage.eNS_URI); >+ EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE >+ .getEPackage(EcorePackage.eNS_URI); > > // Create type parameters > ETypeParameter associationClassCallExpEClass_C = addETypeParameter( >@@ -1951,7 +1957,7 @@ > "IntegerLiteralExp", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ > initEAttribute( > getIntegerLiteralExp_IntegerSymbol(), >- ecorePackage.getEIntegerObject(), >+ theEcorePackage.getEBigInteger(), > "integerSymbol", null, 0, 1, IntegerLiteralExp.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ > > op = addEOperation(integerLiteralExpEClass, ecorePackage.getEBoolean(), >@@ -1965,6 +1971,11 @@ > g1.getETypeArguments().add(g2); > addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ > >+ op = addEOperation(integerLiteralExpEClass, null, >+ "setIntegerSymbol", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ addEParameter(op, theEcorePackage.getEIntegerObject(), >+ "value", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ > initEClass( > numericLiteralExpEClass, > NumericLiteralExp.class, >@@ -1975,9 +1986,9 @@ > UnlimitedNaturalLiteralExp.class, > "UnlimitedNaturalLiteralExp", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ > initEAttribute( >- getUnlimitedNaturalLiteralExp_IntegerSymbol(), >- ecorePackage.getEIntegerObject(), >- "integerSymbol", null, 0, 1, UnlimitedNaturalLiteralExp.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ >+ getUnlimitedNaturalLiteralExp_UnlimitedNaturalSymbol(), >+ theEcorePackage.getEBigInteger(), >+ "unlimitedNaturalSymbol", null, 0, 1, UnlimitedNaturalLiteralExp.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ > initEAttribute( > getUnlimitedNaturalLiteralExp_Unlimited(), > ecorePackage.getEBoolean(), >@@ -1994,6 +2005,16 @@ > g1.getETypeArguments().add(g2); > addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ > >+ op = addEOperation(unlimitedNaturalLiteralExpEClass, null, >+ "setIntegerSymbol", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ addEParameter(op, theEcorePackage.getEIntegerObject(), >+ "value", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ >+ op = addEOperation(unlimitedNaturalLiteralExpEClass, null, >+ "setUnlimitedNaturalSymbol", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ addEParameter(op, theEcorePackage.getEIntegerObject(), >+ "value", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ > initEClass( > invalidLiteralExpEClass, > InvalidLiteralExp.class, >@@ -2378,7 +2399,7 @@ > "RealLiteralExp", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ > initEAttribute( > getRealLiteralExp_RealSymbol(), >- ecorePackage.getEDoubleObject(), >+ theEcorePackage.getEBigDecimal(), > "realSymbol", null, 0, 1, RealLiteralExp.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ > > op = addEOperation(realLiteralExpEClass, ecorePackage.getEBoolean(), >@@ -2392,6 +2413,11 @@ > g1.getETypeArguments().add(g2); > addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ > >+ op = addEOperation(realLiteralExpEClass, null, >+ "setRealSymbol", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ addEParameter(op, theEcorePackage.getEDoubleObject(), >+ "value", 1, 1, IS_UNIQUE, !IS_ORDERED); //$NON-NLS-1$ >+ > initEClass( > stateExpEClass, > StateExp.class, >@@ -2557,6 +2583,9 @@ > addAnnotation(oclExpressionEClass, source, new String[]{ > "name", "OclExpression" //$NON-NLS-1$ //$NON-NLS-2$ > }); >+ addAnnotation(getUnlimitedNaturalLiteralExp_UnlimitedNaturalSymbol(), >+ source, new String[]{"name", "" //$NON-NLS-1$ //$NON-NLS-2$ >+ }); > } > > } //ExpressionsPackageImpl >Index: src/org/eclipse/ocl/expressions/impl/IntegerLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/IntegerLiteralExpImpl.java,v >retrieving revision 1.7 >diff -u -r1.7 IntegerLiteralExpImpl.java >--- src/org/eclipse/ocl/expressions/impl/IntegerLiteralExpImpl.java 23 Jan 2009 17:16:04 -0000 1.7 >+++ src/org/eclipse/ocl/expressions/impl/IntegerLiteralExpImpl.java 14 Jan 2010 14:40:00 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.expressions.impl; > >+import java.math.BigInteger; > import java.util.Map; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.util.DiagnosticChain; >@@ -52,7 +53,7 @@ > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger INTEGER_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >@@ -62,7 +63,7 @@ > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger integerSymbol = INTEGER_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -85,20 +86,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >+ public BigInteger getIntegerSymbol() { > return integerSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >+ public void setIntegerSymbol(BigInteger newIntegerSymbol) { >+ BigInteger oldIntegerSymbol = integerSymbol; > integerSymbol = newIntegerSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -109,6 +112,15 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setIntegerSymbol(Integer value) { >+ setIntegerSymbol(BigInteger.valueOf(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > public boolean checkIntegerType(DiagnosticChain diagnostics, >@@ -140,7 +152,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case ExpressionsPackage.INTEGER_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ setIntegerSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/expressions/impl/RealLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/RealLiteralExpImpl.java,v >retrieving revision 1.7 >diff -u -r1.7 RealLiteralExpImpl.java >--- src/org/eclipse/ocl/expressions/impl/RealLiteralExpImpl.java 23 Jan 2009 17:16:03 -0000 1.7 >+++ src/org/eclipse/ocl/expressions/impl/RealLiteralExpImpl.java 14 Jan 2010 14:40:00 -0000 >@@ -17,7 +17,9 @@ > */ > package org.eclipse.ocl.expressions.impl; > >+import java.math.BigDecimal; > import java.util.Map; >+ > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.util.DiagnosticChain; > import org.eclipse.emf.ecore.EClass; >@@ -52,7 +54,7 @@ > * @generated > * @ordered > */ >- protected static final Double REAL_SYMBOL_EDEFAULT = null; >+ protected static final BigDecimal REAL_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getRealSymbol() <em>Real Symbol</em>}' attribute. >@@ -62,7 +64,7 @@ > * @generated > * @ordered > */ >- protected Double realSymbol = REAL_SYMBOL_EDEFAULT; >+ protected BigDecimal realSymbol = REAL_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -85,20 +87,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Double getRealSymbol() { >+ public BigDecimal getRealSymbol() { > return realSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setRealSymbol(Double newRealSymbol) { >- Double oldRealSymbol = realSymbol; >+ public void setRealSymbol(BigDecimal newRealSymbol) { >+ BigDecimal oldRealSymbol = realSymbol; > realSymbol = newRealSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -120,6 +124,15 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setRealSymbol(Double value) { >+ setRealSymbol(new BigDecimal(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > @Override >@@ -140,7 +153,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case ExpressionsPackage.REAL_LITERAL_EXP__REAL_SYMBOL : >- setRealSymbol((Double) newValue); >+ setRealSymbol((BigDecimal) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/expressions/impl/UnlimitedNaturalLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/UnlimitedNaturalLiteralExpImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 UnlimitedNaturalLiteralExpImpl.java >--- src/org/eclipse/ocl/expressions/impl/UnlimitedNaturalLiteralExpImpl.java 23 Jan 2009 17:16:04 -0000 1.8 >+++ src/org/eclipse/ocl/expressions/impl/UnlimitedNaturalLiteralExpImpl.java 14 Jan 2010 14:40:00 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.expressions.impl; > >+import java.math.BigInteger; > import java.util.Map; > import org.eclipse.emf.common.notify.Notification; > >@@ -37,7 +38,7 @@ > * <p> > * The following features are implemented: > * <ul> >- * <li>{@link org.eclipse.ocl.expressions.impl.UnlimitedNaturalLiteralExpImpl#getIntegerSymbol <em>Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.expressions.impl.UnlimitedNaturalLiteralExpImpl#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}</li> > * <li>{@link org.eclipse.ocl.expressions.impl.UnlimitedNaturalLiteralExpImpl#isUnlimited <em>Unlimited</em>}</li> > * </ul> > * </p> >@@ -49,24 +50,26 @@ > implements UnlimitedNaturalLiteralExp<C> { > > /** >- * The default value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The default value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger UNLIMITED_NATURAL_SYMBOL_EDEFAULT = null; > > /** >- * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The cached value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger unlimitedNaturalSymbol = UNLIMITED_NATURAL_SYMBOL_EDEFAULT; > > /** > * The default value of the '{@link #isUnlimited() <em>Unlimited</em>}' attribute. >@@ -99,27 +102,29 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >- return integerSymbol; >+ public BigInteger getUnlimitedNaturalSymbol() { >+ return unlimitedNaturalSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >- integerSymbol = newIntegerSymbol; >+ public void setUnlimitedNaturalSymbol(BigInteger newUnlimitedNaturalSymbol) { >+ BigInteger oldUnlimitedNaturalSymbol = unlimitedNaturalSymbol; >+ unlimitedNaturalSymbol = newUnlimitedNaturalSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl( > this, > Notification.SET, >- ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL, >- oldIntegerSymbol, integerSymbol)); >+ ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL, >+ oldUnlimitedNaturalSymbol, unlimitedNaturalSymbol)); > } > > /** >@@ -128,7 +133,8 @@ > * @generated NOT > */ > public boolean isUnlimited() { >- return getIntegerSymbol() == UNLIMITED; >+ return (unlimitedNaturalSymbol == null) >+ || (unlimitedNaturalSymbol == UNLIMITED); > } > > /** >@@ -144,14 +150,34 @@ > > /** > * <!-- begin-user-doc --> >+ * @deprecated use setUnlimitedNaturalSymbol >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setIntegerSymbol(Integer value) { >+ setUnlimitedNaturalSymbol(value); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setUnlimitedNaturalSymbol(Integer value) { >+ setUnlimitedNaturalSymbol(BigInteger.valueOf(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ > @Override > public Object eGet(int featureID, boolean resolve, boolean coreType) { > switch (featureID) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return getIntegerSymbol(); >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return getUnlimitedNaturalSymbol(); > case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return isUnlimited(); > } >@@ -166,8 +192,8 @@ > @Override > public void eSet(int featureID, Object newValue) { > switch (featureID) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >@@ -181,8 +207,8 @@ > @Override > public void eUnset(int featureID) { > switch (featureID) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol(INTEGER_SYMBOL_EDEFAULT); >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol(UNLIMITED_NATURAL_SYMBOL_EDEFAULT); > return; > } > super.eUnset(featureID); >@@ -196,10 +222,11 @@ > @Override > public boolean eIsSet(int featureID) { > switch (featureID) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return INTEGER_SYMBOL_EDEFAULT == null >- ? integerSymbol != null >- : !INTEGER_SYMBOL_EDEFAULT.equals(integerSymbol); >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return UNLIMITED_NATURAL_SYMBOL_EDEFAULT == null >+ ? unlimitedNaturalSymbol != null >+ : !UNLIMITED_NATURAL_SYMBOL_EDEFAULT >+ .equals(unlimitedNaturalSymbol); > case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return isUnlimited() != UNLIMITED_EDEFAULT; > } >Index: src/org/eclipse/ocl/expressions/operations/IntegerLiteralExpOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/operations/IntegerLiteralExpOperations.java,v >retrieving revision 1.3 >diff -u -r1.3 IntegerLiteralExpOperations.java >--- src/org/eclipse/ocl/expressions/operations/IntegerLiteralExpOperations.java 12 Oct 2008 01:09:49 -0000 1.3 >+++ src/org/eclipse/ocl/expressions/operations/IntegerLiteralExpOperations.java 14 Jan 2010 14:40:00 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.expressions.operations; > >+import java.math.BigInteger; > import java.util.Map; > > import org.eclipse.emf.common.util.BasicDiagnostic; >@@ -39,6 +40,7 @@ > * The following operations are supported: > * <ul> > * <li>{@link org.eclipse.ocl.expressions.IntegerLiteralExp#checkIntegerType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Check Integer Type</em>}</li> >+ * <li>{@link org.eclipse.ocl.expressions.IntegerLiteralExp#setIntegerSymbol(java.lang.Integer) <em>Set Integer Symbol</em>}</li> > * </ul> > * </p> > * >@@ -94,4 +96,15 @@ > return result; > } > >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public static <C> void setIntegerSymbol( >+ IntegerLiteralExp<C> integerLiteralExp, Integer value) { >+ integerLiteralExp.setIntegerSymbol(BigInteger.valueOf(value)); >+ } >+ > } // IntegerLiteralExpOperations >\ No newline at end of file >Index: src/org/eclipse/ocl/expressions/operations/RealLiteralExpOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/operations/RealLiteralExpOperations.java,v >retrieving revision 1.3 >diff -u -r1.3 RealLiteralExpOperations.java >--- src/org/eclipse/ocl/expressions/operations/RealLiteralExpOperations.java 12 Oct 2008 01:09:49 -0000 1.3 >+++ src/org/eclipse/ocl/expressions/operations/RealLiteralExpOperations.java 14 Jan 2010 14:40:00 -0000 >@@ -17,15 +17,14 @@ > */ > package org.eclipse.ocl.expressions.operations; > >+import java.math.BigDecimal; > import java.util.Map; > > import org.eclipse.emf.common.util.BasicDiagnostic; > import org.eclipse.emf.common.util.Diagnostic; > import org.eclipse.emf.common.util.DiagnosticChain; >- > import org.eclipse.ocl.Environment; > import org.eclipse.ocl.expressions.RealLiteralExp; >- > import org.eclipse.ocl.expressions.util.ExpressionsValidator; > import org.eclipse.ocl.internal.l10n.OCLMessages; > import org.eclipse.ocl.util.OCLUtil; >@@ -39,6 +38,7 @@ > * The following operations are supported: > * <ul> > * <li>{@link org.eclipse.ocl.expressions.RealLiteralExp#checkRealType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Check Real Type</em>}</li> >+ * <li>{@link org.eclipse.ocl.expressions.RealLiteralExp#setRealSymbol(java.lang.Double) <em>Set Real Symbol</em>}</li> > * </ul> > * </p> > * >@@ -93,4 +93,15 @@ > return result; > } > >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public static <C> void setRealSymbol(RealLiteralExp<C> realLiteralExp, >+ Double value) { >+ realLiteralExp.setRealSymbol(new BigDecimal(value)); >+ } >+ > } // RealLiteralExpOperations >\ No newline at end of file >Index: src/org/eclipse/ocl/expressions/operations/UnlimitedNaturalLiteralExpOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/operations/UnlimitedNaturalLiteralExpOperations.java,v >retrieving revision 1.4 >diff -u -r1.4 UnlimitedNaturalLiteralExpOperations.java >--- src/org/eclipse/ocl/expressions/operations/UnlimitedNaturalLiteralExpOperations.java 12 Oct 2008 01:09:49 -0000 1.4 >+++ src/org/eclipse/ocl/expressions/operations/UnlimitedNaturalLiteralExpOperations.java 14 Jan 2010 14:40:00 -0000 >@@ -39,6 +39,8 @@ > * The following operations are supported: > * <ul> > * <li>{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#checkNaturalType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Check Natural Type</em>}</li> >+ * <li>{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#setIntegerSymbol(java.lang.Integer) <em>Set Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp#setUnlimitedNaturalSymbol(java.lang.Integer) <em>Set Unlimited Natural Symbol</em>}</li> > * </ul> > * </p> > * >@@ -96,4 +98,29 @@ > return result; > } > >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public static <C> void setIntegerSymbol( >+ UnlimitedNaturalLiteralExp<C> unlimitedNaturalLiteralExp, >+ Integer value) { >+ unlimitedNaturalLiteralExp.setUnlimitedNaturalSymbol(value); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public static <C> void setUnlimitedNaturalSymbol( >+ UnlimitedNaturalLiteralExp<C> unlimitedNaturalLiteralExp, >+ Integer setUnlimitedNaturalSymbol) { >+ unlimitedNaturalLiteralExp >+ .setUnlimitedNaturalSymbol(setUnlimitedNaturalSymbol); >+ } >+ > } // UnlimitedNaturalLiteralExpOperations >\ No newline at end of file >Index: src/org/eclipse/ocl/internal/evaluation/NumberUtil.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/internal/evaluation/NumberUtil.java,v >retrieving revision 1.2 >diff -u -r1.2 NumberUtil.java >--- src/org/eclipse/ocl/internal/evaluation/NumberUtil.java 10 Sep 2008 18:44:18 -0000 1.2 >+++ src/org/eclipse/ocl/internal/evaluation/NumberUtil.java 14 Jan 2010 14:40:00 -0000 >@@ -63,8 +63,10 @@ > result = number; > } > } else if (number instanceof BigInteger) { >- if (isInteger((BigInteger) number)) { >+ if (isInteger((BigInteger) number)) { > result = number.intValue(); >+ } else if (isLong((BigInteger) number)) { >+ result = number.longValue(); > } else { > // do nothing, NFE will occur > result = number; >@@ -103,7 +105,7 @@ > private static boolean isLong(BigInteger number) { > long i = number.longValue(); > BigInteger b = new BigInteger(String.valueOf(i)); >- >+ > return number.equals(b); > } > >@@ -123,36 +125,20 @@ > * > * @param number a number to coerce to <tt>Long</tt> or <tt>Double</tt> > * @return the coerced number, or the original number, in case of overflow >+ * >+ * @deprecated use ObjectUtil.normalize > */ > public static Number higherPrecisionNumber(Number number) { >- Number result; >- >- if ((number instanceof Integer) || (number instanceof Byte) || >- (number instanceof Short)) { >- result = number.longValue(); >- } else if (number instanceof Long) { >- result = number; >- } else if (number instanceof BigInteger) { >- if (isLong((BigInteger) number)) { >- result = number.longValue(); >- } else { >- // do nothing, NFE will occur >- result = number; >- } >- } else if (number instanceof Float) { >- result = number.doubleValue(); >- } else if (number instanceof BigDecimal) { >- if (isDouble((BigDecimal) number)) { >- result = number.doubleValue(); >- } else { >- // do nothing, NFE will occur >- result = number; >- } >+ if ((number instanceof BigInteger) || (number instanceof BigDecimal)) { >+ return number; >+ } else if ((number instanceof Integer) || (number instanceof Byte) || >+ (number instanceof Short) || (number instanceof Long)) { >+ return BigInteger.valueOf(number.longValue()); >+ } else if ((number instanceof Double) || (number instanceof Float)) { >+ return new BigDecimal(number.doubleValue()); > } else { > // some odd-ball number we've never heard of. NFE will occur >- result = number; >+ return number; > } >- >- return result; > } > } >Index: src/org/eclipse/ocl/parser/AbstractOCLAnalyzer.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/parser/AbstractOCLAnalyzer.java,v >retrieving revision 1.40 >diff -u -r1.40 AbstractOCLAnalyzer.java >--- src/org/eclipse/ocl/parser/AbstractOCLAnalyzer.java 11 Jan 2010 22:28:15 -0000 1.40 >+++ src/org/eclipse/ocl/parser/AbstractOCLAnalyzer.java 14 Jan 2010 14:40:04 -0000 >@@ -2937,8 +2937,8 @@ > UnlimitedNaturalLiteralExp<C> astNode = oclFactory > .createUnlimitedNaturalLiteralExp(); > initASTMapping(env, astNode, unlimitedNaturalLiteralExpCS); >- astNode.setIntegerSymbol(unlimitedNaturalLiteralExpCS >- .getIntegerSymbol()); >+ astNode.setUnlimitedNaturalSymbol(unlimitedNaturalLiteralExpCS >+ .getUnlimitedNaturalSymbol()); > astNode.setType(env.getOCLStandardLibrary().getUnlimitedNatural()); > TRACE( > "unlimitedNaturalLiteralExpCS", "UnlimitedNatural: " + unlimitedNaturalLiteralExpCS.getSymbol());//$NON-NLS-2$//$NON-NLS-1$ >Index: src/org/eclipse/ocl/parser/AbstractOCLParser.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/parser/AbstractOCLParser.java,v >retrieving revision 1.12 >diff -u -r1.12 AbstractOCLParser.java >--- src/org/eclipse/ocl/parser/AbstractOCLParser.java 27 Dec 2009 15:49:44 -0000 1.12 >+++ src/org/eclipse/ocl/parser/AbstractOCLParser.java 14 Jan 2010 14:40:04 -0000 >@@ -20,6 +20,7 @@ > */ > package org.eclipse.ocl.parser; > >+import java.math.BigDecimal; > import java.util.HashSet; > import java.util.Set; > >@@ -80,12 +81,14 @@ > import org.eclipse.ocl.cst.UnlimitedNaturalLiteralExpCS; > import org.eclipse.ocl.cst.VariableCS; > import org.eclipse.ocl.cst.VariableExpCS; >+import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp; > import org.eclipse.ocl.internal.l10n.OCLMessages; > import org.eclipse.ocl.lpg.AbstractLexer; > import org.eclipse.ocl.lpg.AbstractParser; > import org.eclipse.ocl.lpg.BasicEnvironment; > import org.eclipse.ocl.lpg.ProblemHandler; > import org.eclipse.ocl.options.ProblemOption; >+import org.eclipse.ocl.util.ObjectUtil; > > public abstract class AbstractOCLParser > extends AbstractParser { >@@ -491,7 +494,7 @@ > IntegerLiteralExpCS result = CSTFactory.eINSTANCE > .createIntegerLiteralExpCS(); > result.setSymbol(string); >- result.setIntegerSymbol(Integer.valueOf(string)); >+ result.setIntegerSymbol(ObjectUtil.createBigInteger(string)); > return result; > } > >@@ -502,9 +505,9 @@ > .createUnlimitedNaturalLiteralExpCS(); > result.setSymbol(string); > if ("*".equals(string)) { >- result.setIntegerSymbol(-1); >+ result.setUnlimitedNaturalSymbol(UnlimitedNaturalLiteralExp.UNLIMITED); > } else { >- result.setIntegerSymbol(Integer.valueOf(string)); >+ result.setUnlimitedNaturalSymbol(ObjectUtil.createBigInteger(string)); > } > return result; > } >@@ -512,7 +515,7 @@ > protected RealLiteralExpCS createRealLiteralExpCS(String string) { > RealLiteralExpCS result = CSTFactory.eINSTANCE.createRealLiteralExpCS(); > result.setSymbol(string); >- result.setRealSymbol(Double.valueOf(string)); >+ result.setRealSymbol(new BigDecimal(string)); > return result; > } > >Index: src/org/eclipse/ocl/types/impl/TypesPackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/types/impl/TypesPackageImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 TypesPackageImpl.java >--- src/org/eclipse/ocl/types/impl/TypesPackageImpl.java 14 Jan 2010 12:44:33 -0000 1.12 >+++ src/org/eclipse/ocl/types/impl/TypesPackageImpl.java 14 Jan 2010 14:40:04 -0000 >@@ -13,7 +13,7 @@ > * > * </copyright> > * >- * $Id: TypesPackageImpl.java,v 1.12 2010/01/14 12:44:33 ewillink Exp $ >+ * $Id: TypesPackageImpl.java,v 1.11 2009/12/06 18:12:59 ewillink Exp $ > */ > package org.eclipse.ocl.types.impl; > >@@ -25,6 +25,7 @@ > import org.eclipse.emf.ecore.EReference; > import org.eclipse.emf.ecore.ETypeParameter; > import org.eclipse.emf.ecore.EValidator; >+import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.ecore.impl.EPackageImpl; > import org.eclipse.ocl.expressions.ExpressionsPackage; > import org.eclipse.ocl.expressions.impl.ExpressionsPackageImpl; >@@ -207,6 +208,9 @@ > > isInited = true; > >+ // Initialize simple dependencies >+ EcorePackage.eINSTANCE.eClass(); >+ > // Obtain or create and register interdependencies > UtilitiesPackageImpl theUtilitiesPackage = (UtilitiesPackageImpl) (EPackage.Registry.INSTANCE > .getEPackage(UtilitiesPackage.eNS_URI) instanceof UtilitiesPackageImpl >Index: src/org/eclipse/ocl/util/CollectionUtil.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/CollectionUtil.java,v >retrieving revision 1.9 >diff -u -r1.9 CollectionUtil.java >--- src/org/eclipse/ocl/util/CollectionUtil.java 18 Dec 2009 06:26:04 -0000 1.9 >+++ src/org/eclipse/ocl/util/CollectionUtil.java 14 Jan 2010 14:40:06 -0000 >@@ -17,6 +17,8 @@ > */ > package org.eclipse.ocl.util; > >+import java.math.BigDecimal; >+import java.math.BigInteger; > import java.util.ArrayList; > import java.util.Collection; > import java.util.Collections; >@@ -182,12 +184,24 @@ > currVal += ((Integer) it.next()).intValue(); > } > return new Integer(currVal); >+ } else if (object instanceof BigInteger) { >+ BigInteger currVal = BigInteger.valueOf(0); >+ for (it = self.iterator(); it.hasNext();) { >+ currVal = currVal.add((BigInteger) it.next()); >+ } >+ return currVal; > } else if (object instanceof Double) { > double currVal = 0.0; > for (it = self.iterator(); it.hasNext();) { > currVal += ((Double) it.next()).doubleValue(); > } > return new Double(currVal); >+ } else if (object instanceof BigDecimal) { >+ BigDecimal currVal = BigDecimal.ZERO; >+ for (it = self.iterator(); it.hasNext();) { >+ currVal = currVal.add((BigDecimal) it.next()); >+ } >+ return currVal; > } else { > IllegalArgumentException error = new IllegalArgumentException( > OCLMessages.SumOperator_ERROR_); >Index: src/org/eclipse/ocl/util/ObjectUtil.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/ObjectUtil.java,v >retrieving revision 1.5 >diff -u -r1.5 ObjectUtil.java >--- src/org/eclipse/ocl/util/ObjectUtil.java 25 Jun 2009 19:23:52 -0000 1.5 >+++ src/org/eclipse/ocl/util/ObjectUtil.java 14 Jan 2010 14:40:06 -0000 >@@ -16,6 +16,8 @@ > */ > package org.eclipse.ocl.util; > >+import java.math.BigDecimal; >+import java.math.BigInteger; > import java.util.Collection; > import java.util.Iterator; > >@@ -23,7 +25,7 @@ > import org.eclipse.emf.ecore.EEnumLiteral; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.util.EcoreUtil; >-import org.eclipse.ocl.internal.evaluation.NumberUtil; >+import org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp; > > /** > * Certain generic utility operations on objects. >@@ -32,6 +34,9 @@ > */ > public class ObjectUtil { > >+ private static final String maxLongValue = Long.toString(Long.MAX_VALUE); >+ private static final int maxLongSize = maxLongValue.length(); >+ > /** > * Computes the equivalence of two objects, accounting for primitive numeric > * values that OCL considers equal but Java does not. This is also safe >@@ -51,22 +56,23 @@ > > // primitive types > if (isPrimitive(anObject) || isPrimitive(anotherObject)) { >- if (anObject instanceof Integer) { >- anObject = NumberUtil.higherPrecisionNumber((Integer) anObject); >- } >- if (anotherObject instanceof Integer) { >- anotherObject = NumberUtil.higherPrecisionNumber((Integer) anotherObject); >- } >- >- if (anObject instanceof Long && anotherObject instanceof Long) { >- return ((Long) anObject).longValue() == ((Long) anotherObject).longValue(); >- } else if (anObject instanceof Long && anotherObject instanceof Double) { >- return ((Long) anObject).doubleValue() == ((Double) anotherObject).doubleValue(); >- } else if (anObject instanceof Double && anotherObject instanceof Long) { >- return ((Double) anObject).doubleValue() == ((Long) anotherObject).doubleValue(); >- } else if (anObject instanceof Double && anotherObject instanceof Double) { >- return ((Double) anObject).doubleValue() == ((Double) anotherObject).doubleValue(); >- } else if (anObject instanceof String && anotherObject instanceof String) { >+ if (anObject instanceof Number && anotherObject instanceof Number) { >+ anObject = ObjectUtil.normalise(anObject); >+ anotherObject = ObjectUtil.normalise(anotherObject); >+ if (anObject instanceof BigInteger) { >+ if (anotherObject instanceof BigInteger) { >+ return anObject.equals(anotherObject); >+ } >+ anObject = new BigDecimal((BigInteger) anObject); >+ } >+ else if (anotherObject instanceof BigInteger) { >+ anotherObject = new BigDecimal((BigInteger) anotherObject); >+ } >+ BigDecimal delta = ((BigDecimal) anObject).subtract((BigDecimal) anotherObject); >+ return delta.signum() == 0; >+ } else if (anObject instanceof UnlimitedNaturalLiteralExp<?> && anotherObject instanceof UnlimitedNaturalLiteralExp<?>) { >+ return ((UnlimitedNaturalLiteralExp<?>)anObject).isUnlimited() && ((UnlimitedNaturalLiteralExp<?>)anotherObject).isUnlimited(); >+ } else if (anObject instanceof String && anotherObject instanceof String) { > return anObject.equals(anotherObject); > } else if (anObject instanceof Boolean && anotherObject instanceof Boolean) { > return ((Boolean) anObject).booleanValue() == ((Boolean) anotherObject).booleanValue(); >@@ -109,6 +115,10 @@ > return 37 * ((Long) anObject).intValue(); > } else if (anObject instanceof Double) { > return 37 * ((Double) anObject).intValue(); >+ } else if (anObject instanceof BigDecimal) { >+ return 37 * ((BigDecimal) anObject).intValue(); >+ } else if (anObject instanceof BigInteger) { >+ return 37 * ((BigInteger) anObject).intValue(); > } else if (anObject instanceof String) { > return anObject.hashCode(); > } else if (anObject instanceof Boolean) { >@@ -133,8 +143,42 @@ > * @return whether it is an OCL primitive value > */ > public static boolean isPrimitive(Object o) { >- return o instanceof Integer || o instanceof Long || o instanceof String >- || o instanceof Boolean || o instanceof Double; >+ return o instanceof Integer || o instanceof Long || o instanceof BigInteger >+ || o instanceof String || o instanceof Boolean >+ || o instanceof Double || o instanceof BigDecimal || o instanceof UnlimitedNaturalLiteralExp<?>; >+ } >+ >+ /** >+ * Creates a BigInteger representation for aValue. >+ * @param aValue the string representation of a (non-negative) integer number >+ * @return the numeric representation >+ * @throws NumberFormatException if representation cannot be created >+ * @since 3.0 >+ */ >+ public static BigInteger createBigInteger(String aValue) { >+ int len = aValue.length(); >+ if ((len < maxLongSize) || ((len == maxLongSize) && (maxLongValue.compareTo(aValue) >= 0))) { >+ return BigInteger.valueOf(Long.parseLong(aValue)); >+ } >+ else { >+ return new BigInteger(aValue); >+ } >+ } >+ >+ /** >+ * Creates a BigInteger or BigDecimal representation for aValue. >+ * @param aValue the string representation of a (non-negative) integer number >+ * @return the numeric representation >+ * @throws NumberFormatException if representation cannot be created >+ * @since 3.0 >+ */ >+ @SuppressWarnings("nls") >+ public static Number createNumber(String aValue) { >+ if (aValue.contains(".") || aValue.contains("e") || aValue.contains("E")) { >+ return new BigDecimal(aValue); >+ } else { >+ return ObjectUtil.createBigInteger(aValue); >+ } > } > > /** >@@ -161,4 +205,28 @@ > } > } > } >+ >+ /** >+ * <p> >+ * Normalises the given object converting numbers to either <tt>BigDecimal</tt> or <tt>BigInteger</tt> precision. >+ * </p> >+ * >+ * @param object to normalise >+ * @return the normalised object >+ * >+ * @since 3.0 >+ */ >+ public static Object normalise(Object object) { >+ if (object instanceof Number) { >+ if ((object instanceof BigInteger) || (object instanceof BigDecimal)) { >+ return object; >+ } else if ((object instanceof Byte) || (object instanceof Short) || >+ (object instanceof Integer) || (object instanceof Long)) { >+ return BigInteger.valueOf(((Number)object).longValue()); >+ } else if ((object instanceof Float) || (object instanceof Double)) { >+ return new BigDecimal(((Number)object).doubleValue()); >+ } >+ } >+ return object; >+ } > } >Index: src/org/eclipse/ocl/util/ToStringVisitor.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/util/ToStringVisitor.java,v >retrieving revision 1.10 >diff -u -r1.10 ToStringVisitor.java >--- src/org/eclipse/ocl/util/ToStringVisitor.java 4 Sep 2009 10:19:33 -0000 1.10 >+++ src/org/eclipse/ocl/util/ToStringVisitor.java 14 Jan 2010 14:40:06 -0000 >@@ -372,8 +372,8 @@ > return "*"; //$NON-NLS-1$ > } > >- return (unl.getIntegerSymbol() == null)? NULL_PLACEHOLDER >- : unl.getIntegerSymbol().toString(); >+ return (unl.getUnlimitedNaturalSymbol() == null)? NULL_PLACEHOLDER >+ : unl.getUnlimitedNaturalSymbol().toString(); > } > > >Index: src/org/eclipse/ocl/utilities/impl/UtilitiesFactoryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/utilities/impl/UtilitiesFactoryImpl.java,v >retrieving revision 1.6 >diff -u -r1.6 UtilitiesFactoryImpl.java >--- src/org/eclipse/ocl/utilities/impl/UtilitiesFactoryImpl.java 23 Jan 2009 17:16:04 -0000 1.6 >+++ src/org/eclipse/ocl/utilities/impl/UtilitiesFactoryImpl.java 14 Jan 2010 14:40:06 -0000 >@@ -16,12 +16,12 @@ > package org.eclipse.ocl.utilities.impl; > > import org.eclipse.emf.ecore.EClass; >+import org.eclipse.emf.ecore.EDataType; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EPackage; > import org.eclipse.emf.ecore.impl.EFactoryImpl; > import org.eclipse.emf.ecore.plugin.EcorePlugin; >- >-//import org.eclipse.ocl.utilities.*; >+import org.eclipse.ocl.util.ObjectUtil; > import org.eclipse.ocl.utilities.UtilitiesFactory; > import org.eclipse.ocl.utilities.UtilitiesPackage; > >@@ -80,6 +80,28 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public Number createNumberFromString(EDataType eDataType, >+ String initialValue) { >+ return ObjectUtil.createNumber(initialValue); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public String convertNumberToString(EDataType eDataType, >+ Object instanceValue) { >+ return instanceValue.toString(); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ >Index: src/org/eclipse/ocl/utilities/impl/UtilitiesPackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl/src/org/eclipse/ocl/utilities/impl/UtilitiesPackageImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 UtilitiesPackageImpl.java >--- src/org/eclipse/ocl/utilities/impl/UtilitiesPackageImpl.java 14 Jan 2010 12:44:33 -0000 1.12 >+++ src/org/eclipse/ocl/utilities/impl/UtilitiesPackageImpl.java 14 Jan 2010 14:40:07 -0000 >@@ -12,7 +12,7 @@ > * > * </copyright> > * >- * $Id: UtilitiesPackageImpl.java,v 1.12 2010/01/14 12:44:33 ewillink Exp $ >+ * $Id: UtilitiesPackageImpl.java,v 1.11 2009/12/06 18:13:35 ewillink Exp $ > */ > package org.eclipse.ocl.utilities.impl; > >@@ -23,6 +23,7 @@ > import org.eclipse.emf.ecore.EPackage; > import org.eclipse.emf.ecore.EReference; > import org.eclipse.emf.ecore.ETypeParameter; >+import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.ecore.impl.EPackageImpl; > import org.eclipse.ocl.expressions.ExpressionsPackage; > import org.eclipse.ocl.expressions.impl.ExpressionsPackageImpl; >@@ -156,6 +157,9 @@ > > isInited = true; > >+ // Initialize simple dependencies >+ EcorePackage.eINSTANCE.eClass(); >+ > // Obtain or create and register interdependencies > TypesPackageImpl theTypesPackage = (TypesPackageImpl) (EPackage.Registry.INSTANCE > .getEPackage(TypesPackage.eNS_URI) instanceof TypesPackageImpl >#P org.eclipse.ocl.ecore >Index: model/oclstdlib.ecore >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/model/oclstdlib.ecore,v >retrieving revision 1.4 >diff -u -r1.4 oclstdlib.ecore >--- model/oclstdlib.ecore 11 May 2008 05:37:13 -0000 1.4 >+++ model/oclstdlib.ecore 14 Jan 2010 14:40:12 -0000 >@@ -153,7 +153,7 @@ > <eParameters name="b" eType="#/0/Boolean"/> > </eOperations> > </eClassifiers> >- <eClassifiers xsi:type="ocl.ecore:PrimitiveType" name="Integer" instanceClassName="java.lang.Integer"/> >+ <eClassifiers xsi:type="ocl.ecore:PrimitiveType" name="Integer" instanceClassName="java.math.BigInteger"/> > <eClassifiers xsi:type="ecore:EClass" name="Integer_Class"> > <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL" references="#/0/Integer"/> > <eOperations name="=" eType="#/0/Boolean"> >@@ -307,7 +307,7 @@ > <eParameters name="n" eType="#/0/UnlimitedNatural"/> > </eOperations> > </eClassifiers> >- <eClassifiers xsi:type="ocl.ecore:PrimitiveType" name="Real" instanceClassName="java.lang.Double"/> >+ <eClassifiers xsi:type="ocl.ecore:PrimitiveType" name="Real" instanceClassName="java.math.BigDecimal"/> > <eClassifiers xsi:type="ecore:EClass" name="Real_Class"> > <eAnnotations source="http://www.eclipse.org/ocl/1.1.0/OCL" references="#/0/Real"/> > <eOperations name="=" eType="#/0/Boolean"> >Index: src/org/eclipse/ocl/ecore/EcorePackage.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/EcorePackage.java,v >retrieving revision 1.12 >diff -u -r1.12 EcorePackage.java >--- src/org/eclipse/ocl/ecore/EcorePackage.java 22 Dec 2009 18:57:14 -0000 1.12 >+++ src/org/eclipse/ocl/ecore/EcorePackage.java 14 Jan 2010 14:40:18 -0000 >@@ -5765,15 +5765,14 @@ > int UNLIMITED_NATURAL_LITERAL_EXP__END_POSITION = NUMERIC_LITERAL_EXP__END_POSITION; > > /** >- * The feature id for the '<em><b>Integer Symbol</b></em>' attribute. >+ * The feature id for the '<em><b>Unlimited Natural Symbol</b></em>' attribute. > * <!-- begin-user-doc --> >- * This value may change when the model code is regenerated. >- * It is subject to change without notice. >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > * @ordered > */ >- int UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL = NUMERIC_LITERAL_EXP_FEATURE_COUNT + 0; >+ int UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL = NUMERIC_LITERAL_EXP_FEATURE_COUNT + 0; > > /** > * The feature id for the '<em><b>Unlimited</b></em>' attribute. >Index: src/org/eclipse/ocl/ecore/impl/EcorePackageImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/impl/EcorePackageImpl.java,v >retrieving revision 1.13 >diff -u -r1.13 EcorePackageImpl.java >--- src/org/eclipse/ocl/ecore/impl/EcorePackageImpl.java 6 Dec 2009 18:15:39 -0000 1.13 >+++ src/org/eclipse/ocl/ecore/impl/EcorePackageImpl.java 14 Jan 2010 14:40:20 -0000 >@@ -517,7 +517,6 @@ > isInited = true; > > // Initialize simple dependencies >- org.eclipse.emf.ecore.EcorePackage.eINSTANCE.eClass(); > TypesPackage.eINSTANCE.eClass(); > UtilitiesPackage.eINSTANCE.eClass(); > ExpressionsPackage.eINSTANCE.eClass(); >Index: src/org/eclipse/ocl/ecore/impl/IntegerLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/impl/IntegerLiteralExpImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 IntegerLiteralExpImpl.java >--- src/org/eclipse/ocl/ecore/impl/IntegerLiteralExpImpl.java 23 Jan 2009 17:16:23 -0000 1.9 >+++ src/org/eclipse/ocl/ecore/impl/IntegerLiteralExpImpl.java 14 Jan 2010 14:40:20 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.ecore.impl; > >+import java.math.BigInteger; > import java.util.Map; > > import org.eclipse.emf.common.notify.Notification; >@@ -63,7 +64,7 @@ > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger INTEGER_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >@@ -73,7 +74,7 @@ > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger integerSymbol = INTEGER_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -96,20 +97,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >+ public BigInteger getIntegerSymbol() { > return integerSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >+ public void setIntegerSymbol(BigInteger newIntegerSymbol) { >+ BigInteger oldIntegerSymbol = integerSymbol; > integerSymbol = newIntegerSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -131,6 +134,15 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setIntegerSymbol(Integer value) { >+ setIntegerSymbol(BigInteger.valueOf(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > @Override >@@ -151,7 +163,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case EcorePackage.INTEGER_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ setIntegerSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/ecore/impl/RealLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/impl/RealLiteralExpImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 RealLiteralExpImpl.java >--- src/org/eclipse/ocl/ecore/impl/RealLiteralExpImpl.java 23 Jan 2009 17:16:23 -0000 1.8 >+++ src/org/eclipse/ocl/ecore/impl/RealLiteralExpImpl.java 14 Jan 2010 14:40:20 -0000 >@@ -17,24 +17,17 @@ > */ > package org.eclipse.ocl.ecore.impl; > >+import java.math.BigDecimal; > import java.util.Map; > > import org.eclipse.emf.common.notify.Notification; >- >-//import org.eclipse.emf.common.util.BasicDiagnostic; >-//import org.eclipse.emf.common.util.Diagnostic; > import org.eclipse.emf.common.util.DiagnosticChain; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.EClassifier; > import org.eclipse.emf.ecore.impl.ENotificationImpl; >- >-//import org.eclipse.emf.ecore.plugin.EcorePlugin; >-//import org.eclipse.emf.ecore.util.EObjectValidator; > import org.eclipse.ocl.ecore.EcorePackage; > import org.eclipse.ocl.ecore.RealLiteralExp; > import org.eclipse.ocl.expressions.ExpressionsPackage; >- >-//import org.eclipse.ocl.expressions.util.ExpressionsValidator; > import org.eclipse.ocl.expressions.operations.RealLiteralExpOperations; > import org.eclipse.ocl.utilities.Visitor; > >@@ -63,7 +56,7 @@ > * @generated > * @ordered > */ >- protected static final Double REAL_SYMBOL_EDEFAULT = null; >+ protected static final BigDecimal REAL_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getRealSymbol() <em>Real Symbol</em>}' attribute. >@@ -73,7 +66,7 @@ > * @generated > * @ordered > */ >- protected Double realSymbol = REAL_SYMBOL_EDEFAULT; >+ protected BigDecimal realSymbol = REAL_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -106,20 +99,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Double getRealSymbol() { >+ public BigDecimal getRealSymbol() { > return realSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setRealSymbol(Double newRealSymbol) { >- Double oldRealSymbol = realSymbol; >+ public void setRealSymbol(BigDecimal newRealSymbol) { >+ BigDecimal oldRealSymbol = realSymbol; > realSymbol = newRealSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -141,6 +136,15 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setRealSymbol(Double value) { >+ setRealSymbol(new BigDecimal(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > @Override >@@ -161,7 +165,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL : >- setRealSymbol((Double) newValue); >+ setRealSymbol((BigDecimal) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/ecore/impl/UnlimitedNaturalLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/impl/UnlimitedNaturalLiteralExpImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 UnlimitedNaturalLiteralExpImpl.java >--- src/org/eclipse/ocl/ecore/impl/UnlimitedNaturalLiteralExpImpl.java 23 Jan 2009 17:16:21 -0000 1.8 >+++ src/org/eclipse/ocl/ecore/impl/UnlimitedNaturalLiteralExpImpl.java 14 Jan 2010 14:40:20 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.ecore.impl; > >+import java.math.BigInteger; > import java.util.Map; > > import org.eclipse.emf.common.notify.Notification; >@@ -45,7 +46,7 @@ > * <p> > * The following features are implemented: > * <ul> >- * <li>{@link org.eclipse.ocl.ecore.impl.UnlimitedNaturalLiteralExpImpl#getIntegerSymbol <em>Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.ecore.impl.UnlimitedNaturalLiteralExpImpl#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}</li> > * <li>{@link org.eclipse.ocl.ecore.impl.UnlimitedNaturalLiteralExpImpl#isUnlimited <em>Unlimited</em>}</li> > * </ul> > * </p> >@@ -57,24 +58,26 @@ > implements UnlimitedNaturalLiteralExp { > > /** >- * The default value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The default value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger UNLIMITED_NATURAL_SYMBOL_EDEFAULT = null; > > /** >- * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The cached value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger unlimitedNaturalSymbol = UNLIMITED_NATURAL_SYMBOL_EDEFAULT; > > /** > * The default value of the '{@link #isUnlimited() <em>Unlimited</em>}' attribute. >@@ -107,34 +110,40 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >- return integerSymbol; >+ public BigInteger getUnlimitedNaturalSymbol() { >+ return unlimitedNaturalSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >- integerSymbol = newIntegerSymbol; >+ public void setUnlimitedNaturalSymbol(BigInteger newUnlimitedNaturalSymbol) { >+ BigInteger oldUnlimitedNaturalSymbol = unlimitedNaturalSymbol; >+ unlimitedNaturalSymbol = newUnlimitedNaturalSymbol; > if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, >- EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL, >- oldIntegerSymbol, integerSymbol)); >+ eNotify(new ENotificationImpl( >+ this, >+ Notification.SET, >+ EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL, >+ oldUnlimitedNaturalSymbol, unlimitedNaturalSymbol)); > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated NOT > */ > public boolean isUnlimited() { >- return getIntegerSymbol() == UNLIMITED; >+ return (unlimitedNaturalSymbol == null) >+ || (unlimitedNaturalSymbol == UNLIMITED); > } > > /** >@@ -150,14 +159,36 @@ > > /** > * <!-- begin-user-doc --> >+ * @deprecated use setUnlimitedNaturalSymbol >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void setIntegerSymbol(Integer value) { >+ // TODO: implement this method >+ // Ensure that you remove @generated or mark it @generated NOT >+ throw new UnsupportedOperationException(); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setUnlimitedNaturalSymbol(Integer value) { >+ setUnlimitedNaturalSymbol(BigInteger.valueOf(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ > @Override > public Object eGet(int featureID, boolean resolve, boolean coreType) { > switch (featureID) { >- case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return getIntegerSymbol(); >+ case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return getUnlimitedNaturalSymbol(); > case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return isUnlimited(); > } >@@ -172,8 +203,8 @@ > @Override > public void eSet(int featureID, Object newValue) { > switch (featureID) { >- case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >@@ -187,8 +218,8 @@ > @Override > public void eUnset(int featureID) { > switch (featureID) { >- case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol(INTEGER_SYMBOL_EDEFAULT); >+ case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol(UNLIMITED_NATURAL_SYMBOL_EDEFAULT); > return; > } > super.eUnset(featureID); >@@ -202,10 +233,11 @@ > @Override > public boolean eIsSet(int featureID) { > switch (featureID) { >- case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return INTEGER_SYMBOL_EDEFAULT == null >- ? integerSymbol != null >- : !INTEGER_SYMBOL_EDEFAULT.equals(integerSymbol); >+ case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return UNLIMITED_NATURAL_SYMBOL_EDEFAULT == null >+ ? unlimitedNaturalSymbol != null >+ : !UNLIMITED_NATURAL_SYMBOL_EDEFAULT >+ .equals(unlimitedNaturalSymbol); > case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return isUnlimited() != UNLIMITED_EDEFAULT; > } >@@ -221,8 +253,8 @@ > public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { > if (baseClass == org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp.class) { > switch (derivedFeatureID) { >- case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL; >+ case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL; > case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED; > default : >@@ -241,8 +273,8 @@ > public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { > if (baseClass == org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp.class) { > switch (baseFeatureID) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL; >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL; > case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED; > default : >Index: src/org/eclipse/ocl/ecore/internal/OCLStandardLibraryImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/internal/OCLStandardLibraryImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 OCLStandardLibraryImpl.java >--- src/org/eclipse/ocl/ecore/internal/OCLStandardLibraryImpl.java 1 Sep 2009 20:11:57 -0000 1.9 >+++ src/org/eclipse/ocl/ecore/internal/OCLStandardLibraryImpl.java 14 Jan 2010 14:40:20 -0000 >@@ -18,6 +18,8 @@ > > package org.eclipse.ocl.ecore.internal; > >+import java.math.BigDecimal; >+import java.math.BigInteger; > import java.util.Collection; > import java.util.List; > >@@ -321,8 +323,8 @@ > > OCL_BOOLEAN.setInstanceClass(Boolean.class); > OCL_STRING.setInstanceClass(String.class); >- OCL_INTEGER.setInstanceClass(Integer.class); >- OCL_REAL.setInstanceClass(Double.class); >+ OCL_INTEGER.setInstanceClass(BigInteger.class); >+ OCL_REAL.setInstanceClass(BigDecimal.class); > > register(OCL_ANY).getEOperations().addAll( > OCLStandardLibraryUtil.createAnyTypeOperations(env)); >#P org.eclipse.ocl.ecore.edit >Index: src/org/eclipse/ocl/ecore/provider/UnlimitedNaturalLiteralExpItemProvider.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.ecore.edit/src/org/eclipse/ocl/ecore/provider/UnlimitedNaturalLiteralExpItemProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 UnlimitedNaturalLiteralExpItemProvider.java >--- src/org/eclipse/ocl/ecore/provider/UnlimitedNaturalLiteralExpItemProvider.java 14 Jan 2010 12:45:05 -0000 1.2 >+++ src/org/eclipse/ocl/ecore/provider/UnlimitedNaturalLiteralExpItemProvider.java 14 Jan 2010 14:40:23 -0000 >@@ -68,28 +68,28 @@ > if (itemPropertyDescriptors == null) { > super.getPropertyDescriptors(object); > >- addIntegerSymbolPropertyDescriptor(object); >+ addUnlimitedNaturalSymbolPropertyDescriptor(object); > addUnlimitedPropertyDescriptor(object); > } > return itemPropertyDescriptors; > } > > /** >- * This adds a property descriptor for the Integer Symbol feature. >+ * This adds a property descriptor for the Unlimited Natural Symbol feature. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ >- protected void addIntegerSymbolPropertyDescriptor(Object object) { >+ protected void addUnlimitedNaturalSymbolPropertyDescriptor(Object object) { > itemPropertyDescriptors > .add(createItemPropertyDescriptor( > ((ComposeableAdapterFactory) adapterFactory) > .getRootAdapterFactory(), > getResourceLocator(), >- getString("_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature"), //$NON-NLS-1$ >+ getString("_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature"), //$NON-NLS-1$ > getString( >- "_UI_PropertyDescriptor_description", "_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature", "_UI_UnlimitedNaturalLiteralExp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- ExpressionsPackage.Literals.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL, >+ "_UI_PropertyDescriptor_description", "_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature", "_UI_UnlimitedNaturalLiteralExp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ ExpressionsPackage.Literals.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL, > true, false, false, > ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); > } >@@ -161,7 +161,7 @@ > updateChildren(notification); > > switch (notification.getFeatureID(UnlimitedNaturalLiteralExp.class)) { >- case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL: >+ case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL: > case EcorePackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED: > fireNotifyChanged(new ViewerNotification(notification, notification > .getNotifier(), false, true)); >#P org.eclipse.ocl.ecore.tests >Index: src/org/eclipse/ocl/ecore/tests/CollectionsTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.ecore.tests/src/org/eclipse/ocl/ecore/tests/CollectionsTest.java,v >retrieving revision 1.17 >diff -u -r1.17 CollectionsTest.java >--- src/org/eclipse/ocl/ecore/tests/CollectionsTest.java 6 Dec 2009 09:36:52 -0000 1.17 >+++ src/org/eclipse/ocl/ecore/tests/CollectionsTest.java 14 Jan 2010 14:40:25 -0000 >@@ -19,6 +19,7 @@ > > package org.eclipse.ocl.ecore.tests; > >+import java.math.BigInteger; > import java.util.Arrays; > import java.util.Collection; > import java.util.List; >@@ -867,38 +868,38 @@ > > try { > Collection<?> result = (Collection<?>) evaluate(helper, >- new Integer(1), "Sequence{1 .. 10}"); >+ Integer.valueOf(1), "Sequence{1 .. 10}"); > > for (int i = 1; i <= 10; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } > > result = (Collection<?>) evaluate(helper, new Integer(1), > "Sequence{1, (2+1)..(3+4), 10}"); > >- assertTrue(result.contains(new Integer(1))); >+ assertTrue(result.contains(BigInteger.valueOf(1))); > for (int i = 3; i <= 7; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } >- assertTrue(result.contains(new Integer(10))); >+ assertTrue(result.contains(BigInteger.valueOf(10))); > > // try the first expression without spaces (needed a grammar change) >- result = (Collection<?>) evaluate(helper, new Integer(1), >+ result = (Collection<?>) evaluate(helper, Integer.valueOf(1), > "Sequence{1..10}"); > > for (int i = 1; i <= 10; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } > > // and a negation, too (the same grammar change) >- result = (Collection<?>) evaluate(helper, new Integer(1), >+ result = (Collection<?>) evaluate(helper, Integer.valueOf(1), > "Sequence{-20, -10..-1, 1}"); > >- assertTrue(result.contains(new Integer(-20))); >+ assertTrue(result.contains(BigInteger.valueOf(-20))); > for (int i = -10; i <= -1; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } >- assertTrue(result.contains(new Integer(1))); >+ assertTrue(result.contains(BigInteger.valueOf(1))); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >Index: src/org/eclipse/ocl/ecore/tests/ComparisonTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.ecore.tests/src/org/eclipse/ocl/ecore/tests/ComparisonTest.java,v >retrieving revision 1.12 >diff -u -r1.12 ComparisonTest.java >--- src/org/eclipse/ocl/ecore/tests/ComparisonTest.java 28 Nov 2009 17:40:42 -0000 1.12 >+++ src/org/eclipse/ocl/ecore/tests/ComparisonTest.java 14 Jan 2010 14:40:26 -0000 >@@ -382,16 +382,16 @@ > helper.setContext(thingType); > > try { >- assertEquals(new Integer(1), evaluate(helper, thing, "3 - 2")); >- assertEquals(new Integer(3), evaluate(helper, thing, "1 + 2")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "6 / 3")); >- assertEquals(new Integer(6), evaluate(helper, thing, "2 * 3")); >- assertEquals(new Integer(-1), evaluate(helper, thing, "- 1")); >- assertEquals(new Integer(3), evaluate(helper, thing, "(2 - 5).abs()")); >- assertEquals(new Integer(3), evaluate(helper, thing, "3.max(2)")); >- assertEquals(new Integer(2), evaluate(helper, thing, "3.min(2)")); >- assertEquals(new Integer(3), evaluate(helper, thing, "7.div(2)")); >- assertEquals(new Integer(1), evaluate(helper, thing, "7.mod(2)")); >+ assertEquals(1, evaluate(helper, thing, "3 - 2")); >+ assertEquals(3, evaluate(helper, thing, "1 + 2")); >+ assertEquals(2.0, evaluate(helper, thing, "6 / 3")); >+ assertEquals(6, evaluate(helper, thing, "2 * 3")); >+ assertEquals(-1, evaluate(helper, thing, "- 1")); >+ assertEquals(3, evaluate(helper, thing, "(2 - 5).abs()")); >+ assertEquals(3, evaluate(helper, thing, "3.max(2)")); >+ assertEquals(2, evaluate(helper, thing, "3.min(2)")); >+ assertEquals(3, evaluate(helper, thing, "7.div(2)")); >+ assertEquals(1, evaluate(helper, thing, "7.mod(2)")); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >@@ -404,14 +404,14 @@ > helper.setContext(thingType); > > try { >- assertEquals(new Double(1.0), evaluate(helper, thing, "3.0 - 2.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "1.0 + 2.0")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "6.0 / 3.0")); >- assertEquals(new Double(6.0), evaluate(helper, thing, "2.0 * 3.0")); >- assertEquals(new Double(-1.0), evaluate(helper, thing, "- 1.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "(2.0 - 5.0).abs()")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "3.0.max(2.0)")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "3.0.min(2.0)")); >+ assertEquals(1.0, evaluate(helper, thing, "3.0 - 2.0")); >+ assertEquals(3.0, evaluate(helper, thing, "1.0 + 2.0")); >+ assertEquals(2.0, evaluate(helper, thing, "6.0 / 3.0")); >+ assertEquals(6.0, evaluate(helper, thing, "2.0 * 3.0")); >+ assertEquals(-1.0, evaluate(helper, thing, "- 1.0")); >+ assertEquals(3.0, evaluate(helper, thing, "(2.0 - 5.0).abs()")); >+ assertEquals(3.0, evaluate(helper, thing, "3.0.max(2.0)")); >+ assertEquals(2.0, evaluate(helper, thing, "3.0.min(2.0)")); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >@@ -425,12 +425,17 @@ > helper.setContext(thingType); > > try { >- assertEquals(new Double(1.0), evaluate(helper, thing, "3 - 2.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "1 + 2.0")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "6 / 3.0")); >- assertEquals(new Double(6.0), evaluate(helper, thing, "2 * 3.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "3.max(2.0)")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "3.min(2.0)")); >+ assertEquals(1.0, evaluate(helper, thing, "3 - 2.0")); >+ assertEquals(3.0, evaluate(helper, thing, "1 + 2.0")); >+ assertEquals(2.0, evaluate(helper, thing, "6 / 3.0")); >+ assertEquals(6.0, evaluate(helper, thing, "2 * 3.0")); >+ assertEquals(3.0, evaluate(helper, thing, "3.max(2.0)")); >+ assertEquals(2.0, evaluate(helper, thing, "3.min(2.0)")); >+ assertEquals(2, evaluate(helper, thing, "2.oclAsType(Integer)")); >+ assertEquals(2, evaluate(helper, thing, "2.0.oclAsType(Integer)")); >+ assertInvalid(evaluate(helper, thing, "2.5.oclAsType(Integer)")); >+ assertEquals(3.0, evaluate(helper, thing, "3.oclAsType(Real)")); >+ assertEquals(3.0, evaluate(helper, thing, "3.0.oclAsType(Real)")); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >Index: src/org/eclipse/ocl/ecore/tests/ExpressionsValidatorTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.ecore.tests/src/org/eclipse/ocl/ecore/tests/ExpressionsValidatorTest.java,v >retrieving revision 1.7 >diff -u -r1.7 ExpressionsValidatorTest.java >--- src/org/eclipse/ocl/ecore/tests/ExpressionsValidatorTest.java 28 Nov 2009 17:47:10 -0000 1.7 >+++ src/org/eclipse/ocl/ecore/tests/ExpressionsValidatorTest.java 14 Jan 2010 14:40:26 -0000 >@@ -880,7 +880,7 @@ > > public void test_UnlimitedNaturalLiteralExp_checkNaturalType() { > UnlimitedNaturalLiteralExp ul = factory.createUnlimitedNaturalLiteralExp(); >- ul.setIntegerSymbol(42); >+ ul.setUnlimitedNaturalSymbol(42); > ul.setType(apple); > > assertProblem(ul, ExpressionsValidator.UNLIMITED_NATURAL_LITERAL_EXP__NATURAL_TYPE); >Index: src/org/eclipse/ocl/ecore/tests/PrimitiveTypesTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.ecore.tests/src/org/eclipse/ocl/ecore/tests/PrimitiveTypesTest.java,v >retrieving revision 1.7 >diff -u -r1.7 PrimitiveTypesTest.java >--- src/org/eclipse/ocl/ecore/tests/PrimitiveTypesTest.java 28 Nov 2009 17:48:50 -0000 1.7 >+++ src/org/eclipse/ocl/ecore/tests/PrimitiveTypesTest.java 14 Jan 2010 14:40:26 -0000 >@@ -65,7 +65,7 @@ > .getUnlimitedNatural(), expression.getType()); > > Object result = evaluate(expression); >- assertEquals(UnlimitedNaturalLiteralExp.UNLIMITED, result); >+ assertTrue(((UnlimitedNaturalLiteralExp<?>)result).isUnlimited()); > } > > /** >@@ -149,6 +149,7 @@ > helper.setContext(getOCLStandardLibrary().getUnlimitedNatural()); > > try { >+ assertInvalid(evaluate(helper, 1, "-*")); > assertInvalid(evaluate(helper, 1, "*.round()")); > assertInvalid(evaluate(helper, 1, "*.floor()")); > assertInvalid(evaluate(helper, 1, "*.abs()")); >Index: src/org/eclipse/ocl/ecore/tests/RegressionTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.ecore.tests/src/org/eclipse/ocl/ecore/tests/RegressionTest.java,v >retrieving revision 1.18 >diff -u -r1.18 RegressionTest.java >--- src/org/eclipse/ocl/ecore/tests/RegressionTest.java 18 Dec 2009 06:36:36 -0000 1.18 >+++ src/org/eclipse/ocl/ecore/tests/RegressionTest.java 14 Jan 2010 14:40:28 -0000 >@@ -18,6 +18,7 @@ > > package org.eclipse.ocl.ecore.tests; > >+import java.math.BigInteger; > import java.util.Collections; > import java.util.Iterator; > import java.util.List; >@@ -1075,15 +1076,15 @@ > // got as many product tuples as required (2 x 3) > assertEquals(6, product.size()); > >- Map<String, Set<Integer>> expectedTuples = >- new java.util.HashMap<String, Set<Integer>>(); >- Set<Integer> values = new java.util.HashSet<Integer>(); >- values.add(1); >- values.add(2); >- values.add(3); >+ Map<String, Set<BigInteger>> expectedTuples = >+ new java.util.HashMap<String, Set<BigInteger>>(); >+ Set<BigInteger> values = new java.util.HashSet<BigInteger>(); >+ values.add(BigInteger.valueOf(1)); >+ values.add(BigInteger.valueOf(2)); >+ values.add(BigInteger.valueOf(3)); > >- expectedTuples.put("foo", new java.util.HashSet<Integer>(values)); >- expectedTuples.put("bar", new java.util.HashSet<Integer>(values)); >+ expectedTuples.put("foo", new java.util.HashSet<BigInteger>(values)); >+ expectedTuples.put("bar", new java.util.HashSet<BigInteger>(values)); > > for (Tuple<EOperation, EStructuralFeature> tuple : product) { > values = expectedTuples.get(tuple.getValue("first")); >Index: src/org/eclipse/ocl/ecore/tests/SerializationTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.ecore.tests/src/org/eclipse/ocl/ecore/tests/SerializationTest.java,v >retrieving revision 1.11 >diff -u -r1.11 SerializationTest.java >--- src/org/eclipse/ocl/ecore/tests/SerializationTest.java 28 Nov 2009 17:47:59 -0000 1.11 >+++ src/org/eclipse/ocl/ecore/tests/SerializationTest.java 14 Jan 2010 14:40:28 -0000 >@@ -20,6 +20,7 @@ > > import java.io.ByteArrayInputStream; > import java.io.ByteArrayOutputStream; >+import java.math.BigInteger; > import java.util.Collections; > import java.util.Iterator; > import java.util.List; >@@ -94,6 +95,38 @@ > } > > /** >+ * Tests the serialization of an expression that uses OCL integer values. >+ */ >+ public void test_integerTypeSerialization() { >+ OCLExpression<EClassifier> expr = parseExpression( >+ EcorePackage.Literals.EPACKAGE, >+ BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(1)) + " > " + Long.MAX_VALUE + " - " + Integer.MAX_VALUE); >+ >+ String toStringForm = expr.toString(); >+ String serialForm = serialize(expr); >+ >+ expr = loadExpression(serialForm); >+ validate(expr); // ensure that it is structurally valid >+ assertEquals(toStringForm, expr.toString()); // should "look" the same >+ } >+ >+ /** >+ * Tests the serialization of an expression that uses OCL real values. >+ */ >+ public void test_realTypeSerialization() { >+ OCLExpression<EClassifier> expr = parseExpression( >+ EcorePackage.Literals.EPACKAGE, >+ "12345678901234567890.123456789e44 > 1.234"); >+ >+ String toStringForm = expr.toString(); >+ String serialForm = serialize(expr); >+ >+ expr = loadExpression(serialForm); >+ validate(expr); // ensure that it is structurally valid >+ assertEquals(toStringForm, expr.toString()); // should "look" the same >+ } >+ >+ /** > * Tests the serialization of an expression that uses collections of > * primitive types. > */ >#P org.eclipse.ocl.edit >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.edit/plugin.properties,v >retrieving revision 1.2 >diff -u -r1.2 plugin.properties >--- plugin.properties 6 Dec 2009 18:27:20 -0000 1.2 >+++ plugin.properties 14 Jan 2010 14:40:30 -0000 >@@ -116,7 +116,7 @@ > _UI_IfExp_thenExpression_feature = Then Expression > _UI_IfExp_elseExpression_feature = Else Expression > _UI_IntegerLiteralExp_integerSymbol_feature = Integer Symbol >-_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature = Integer Symbol >+_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature = Unlimited Natural Symbol > _UI_UnlimitedNaturalLiteralExp_unlimited_feature = Unlimited > _UI_IterateExp_result_feature = Result > _UI_LoopExp_body_feature = Body >Index: src/org/eclipse/ocl/edit/OCLEditPlugin.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.edit/src/org/eclipse/ocl/edit/OCLEditPlugin.java,v >retrieving revision 1.1 >diff -u -r1.1 OCLEditPlugin.java >--- src/org/eclipse/ocl/edit/OCLEditPlugin.java 30 Oct 2009 18:48:04 -0000 1.1 >+++ src/org/eclipse/ocl/edit/OCLEditPlugin.java 14 Jan 2010 14:40:30 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.emf.common.EMFPlugin; > > import org.eclipse.emf.common.util.ResourceLocator; >+import org.eclipse.emf.ecore.provider.EcoreEditPlugin; > > /** > * This is the central singleton for the OCL edit plugin. >@@ -50,7 +51,7 @@ > * @generated > */ > public OCLEditPlugin() { >- super(new ResourceLocator[] {}); >+ super(new ResourceLocator[] { EcoreEditPlugin.INSTANCE, }); > } > > /** >Index: src/org/eclipse/ocl/expressions/provider/MessageExpItemProvider.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.edit/src/org/eclipse/ocl/expressions/provider/MessageExpItemProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 MessageExpItemProvider.java >--- src/org/eclipse/ocl/expressions/provider/MessageExpItemProvider.java 14 Jan 2010 12:44:24 -0000 1.3 >+++ src/org/eclipse/ocl/expressions/provider/MessageExpItemProvider.java 14 Jan 2010 14:40:31 -0000 >@@ -24,6 +24,8 @@ > > import org.eclipse.emf.ecore.EStructuralFeature; > >+import org.eclipse.emf.ecore.EcoreFactory; >+import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; > import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; > import org.eclipse.emf.edit.provider.IItemLabelProvider; >@@ -573,6 +575,68 @@ > TypesFactory.eINSTANCE.createVoidType())); > > newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEAttribute())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEAnnotation())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEClass())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEDataType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEEnum())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEEnumLiteral())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEFactory())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEObject())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEOperation())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEPackage())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEParameter())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEReference())); >+ >+ newChildDescriptors >+ .add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE >+ .create(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY))); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createEGenericType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__CALLED_OPERATION, >+ EcoreFactory.eINSTANCE.createETypeParameter())); >+ >+ newChildDescriptors.add(createChildParameter( > ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, > ExpressionsFactory.eINSTANCE.createAssociationClassCallExp())); > >@@ -733,6 +797,68 @@ > newChildDescriptors.add(createChildParameter( > ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, > TypesFactory.eINSTANCE.createVoidType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEAttribute())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEAnnotation())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEClass())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEDataType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEEnum())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEEnumLiteral())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEFactory())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEObject())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEOperation())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEPackage())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEParameter())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEReference())); >+ >+ newChildDescriptors >+ .add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE >+ .create(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY))); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createEGenericType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.MESSAGE_EXP__SENT_SIGNAL, >+ EcoreFactory.eINSTANCE.createETypeParameter())); > } > > /** >Index: src/org/eclipse/ocl/expressions/provider/TupleLiteralPartItemProvider.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.edit/src/org/eclipse/ocl/expressions/provider/TupleLiteralPartItemProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 TupleLiteralPartItemProvider.java >--- src/org/eclipse/ocl/expressions/provider/TupleLiteralPartItemProvider.java 14 Jan 2010 12:44:24 -0000 1.3 >+++ src/org/eclipse/ocl/expressions/provider/TupleLiteralPartItemProvider.java 14 Jan 2010 14:40:31 -0000 >@@ -26,6 +26,8 @@ > > import org.eclipse.emf.ecore.EStructuralFeature; > >+import org.eclipse.emf.ecore.EcoreFactory; >+import org.eclipse.emf.ecore.EcorePackage; > import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; > import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; > import org.eclipse.emf.edit.provider.IItemLabelProvider; >@@ -524,6 +526,68 @@ > newChildDescriptors.add(createChildParameter( > ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, > TypesFactory.eINSTANCE.createVoidType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEAttribute())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEAnnotation())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEClass())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEDataType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEEnum())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEEnumLiteral())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEFactory())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEObject())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEOperation())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEPackage())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEParameter())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEReference())); >+ >+ newChildDescriptors >+ .add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE >+ .create(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY))); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createEGenericType())); >+ >+ newChildDescriptors.add(createChildParameter( >+ ExpressionsPackage.Literals.TUPLE_LITERAL_PART__ATTRIBUTE, >+ EcoreFactory.eINSTANCE.createETypeParameter())); > } > > /** >Index: src/org/eclipse/ocl/expressions/provider/UnlimitedNaturalLiteralExpItemProvider.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.edit/src/org/eclipse/ocl/expressions/provider/UnlimitedNaturalLiteralExpItemProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 UnlimitedNaturalLiteralExpItemProvider.java >--- src/org/eclipse/ocl/expressions/provider/UnlimitedNaturalLiteralExpItemProvider.java 14 Jan 2010 12:44:24 -0000 1.2 >+++ src/org/eclipse/ocl/expressions/provider/UnlimitedNaturalLiteralExpItemProvider.java 14 Jan 2010 14:40:31 -0000 >@@ -66,28 +66,28 @@ > if (itemPropertyDescriptors == null) { > super.getPropertyDescriptors(object); > >- addIntegerSymbolPropertyDescriptor(object); >+ addUnlimitedNaturalSymbolPropertyDescriptor(object); > addUnlimitedPropertyDescriptor(object); > } > return itemPropertyDescriptors; > } > > /** >- * This adds a property descriptor for the Integer Symbol feature. >+ * This adds a property descriptor for the Unlimited Natural Symbol feature. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ >- protected void addIntegerSymbolPropertyDescriptor(Object object) { >+ protected void addUnlimitedNaturalSymbolPropertyDescriptor(Object object) { > itemPropertyDescriptors > .add(createItemPropertyDescriptor( > ((ComposeableAdapterFactory) adapterFactory) > .getRootAdapterFactory(), > getResourceLocator(), >- getString("_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature"), //$NON-NLS-1$ >+ getString("_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature"), //$NON-NLS-1$ > getString( >- "_UI_PropertyDescriptor_description", "_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature", "_UI_UnlimitedNaturalLiteralExp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- ExpressionsPackage.Literals.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL, >+ "_UI_PropertyDescriptor_description", "_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature", "_UI_UnlimitedNaturalLiteralExp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ ExpressionsPackage.Literals.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL, > true, false, false, > ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); > } >@@ -158,7 +158,7 @@ > updateChildren(notification); > > switch (notification.getFeatureID(UnlimitedNaturalLiteralExp.class)) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL: >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL: > case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED: > fireNotifyChanged(new ViewerNotification(notification, notification > .getNotifier(), false, true)); >#P org.eclipse.ocl.tests >Index: src/org/eclipse/ocl/tests/GenericIteratorsTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.tests/src/org/eclipse/ocl/tests/GenericIteratorsTest.java,v >retrieving revision 1.3 >diff -u -r1.3 GenericIteratorsTest.java >--- src/org/eclipse/ocl/tests/GenericIteratorsTest.java 11 Jan 2010 22:28:22 -0000 1.3 >+++ src/org/eclipse/ocl/tests/GenericIteratorsTest.java 14 Jan 2010 14:40:33 -0000 >@@ -18,6 +18,7 @@ > > package org.eclipse.ocl.tests; > >+import java.math.BigInteger; > import java.util.Arrays; > import java.util.Collection; > import java.util.Collections; >@@ -550,9 +551,9 @@ > > // in the case of a null value, null is allowed in a collection, so > // it does not result in invalid >- Set<Integer> e1 = Collections.singleton(new Integer(1)); >- Set<Integer> e2 = null; >- Set<Integer> e3 = Collections.singleton(new Integer(3)); >+ Set<BigInteger> e1 = Collections.singleton(BigInteger.valueOf(1)); >+ Set<BigInteger> e2 = null; >+ Set<BigInteger> e3 = Collections.singleton(BigInteger.valueOf(3)); > @SuppressWarnings("unchecked") > Collection<? extends Object> expected = createBag(e1, e2, e3); > assertQueryEquals(EcorePackage.eINSTANCE, expected, >#P org.eclipse.ocl.uml >Index: src/org/eclipse/ocl/uml/UMLEvaluationEnvironment.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/UMLEvaluationEnvironment.java,v >retrieving revision 1.16 >diff -u -r1.16 UMLEvaluationEnvironment.java >--- src/org/eclipse/ocl/uml/UMLEvaluationEnvironment.java 1 Sep 2009 20:11:00 -0000 1.16 >+++ src/org/eclipse/ocl/uml/UMLEvaluationEnvironment.java 14 Jan 2010 14:40:35 -0000 >@@ -49,6 +49,7 @@ > import org.eclipse.ocl.uml.util.OCLUMLUtil; > import org.eclipse.ocl.util.CollectionUtil; > import org.eclipse.ocl.util.OCLStandardLibraryUtil; >+import org.eclipse.ocl.util.ObjectUtil; > import org.eclipse.ocl.util.Tuple; > import org.eclipse.ocl.utilities.PredefinedType; > import org.eclipse.uml2.common.util.UML2Util; >@@ -787,7 +788,7 @@ > > if (index >= 0) { > Object actualValue = getValue(slot); >- >+ actualValue = ObjectUtil.normalise(actualValue); > if (UML2Util.safeEquals(actualValue, values.get(index))) { > found++; > } >Index: src/org/eclipse/ocl/uml/UMLPackage.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/UMLPackage.java,v >retrieving revision 1.11 >diff -u -r1.11 UMLPackage.java >--- src/org/eclipse/ocl/uml/UMLPackage.java 22 Dec 2009 18:59:37 -0000 1.11 >+++ src/org/eclipse/ocl/uml/UMLPackage.java 14 Jan 2010 14:40:45 -0000 >@@ -9617,15 +9617,14 @@ > int UNLIMITED_NATURAL_LITERAL_EXP__END_POSITION = NUMERIC_LITERAL_EXP__END_POSITION; > > /** >- * The feature id for the '<em><b>Integer Symbol</b></em>' attribute. >+ * The feature id for the '<em><b>Unlimited Natural Symbol</b></em>' attribute. > * <!-- begin-user-doc --> >- * This value may change when the model code is regenerated. >- * It is subject to change without notice. >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > * @ordered > */ >- int UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL = NUMERIC_LITERAL_EXP_FEATURE_COUNT + 0; >+ int UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL = NUMERIC_LITERAL_EXP_FEATURE_COUNT + 0; > > /** > * The feature id for the '<em><b>Unlimited</b></em>' attribute. >Index: src/org/eclipse/ocl/uml/impl/IntegerLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/IntegerLiteralExpImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 IntegerLiteralExpImpl.java >--- src/org/eclipse/ocl/uml/impl/IntegerLiteralExpImpl.java 23 Jan 2009 17:16:12 -0000 1.8 >+++ src/org/eclipse/ocl/uml/impl/IntegerLiteralExpImpl.java 14 Jan 2010 14:40:45 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.uml.impl; > >+import java.math.BigInteger; > import java.util.Map; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.util.DiagnosticChain; >@@ -55,7 +56,7 @@ > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger INTEGER_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >@@ -65,7 +66,7 @@ > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger integerSymbol = INTEGER_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -88,20 +89,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >+ public BigInteger getIntegerSymbol() { > return integerSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >+ public void setIntegerSymbol(BigInteger newIntegerSymbol) { >+ BigInteger oldIntegerSymbol = integerSymbol; > integerSymbol = newIntegerSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -123,6 +126,15 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setIntegerSymbol(Integer value) { >+ setIntegerSymbol(BigInteger.valueOf(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > @Override >@@ -143,7 +155,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case UMLPackage.INTEGER_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ setIntegerSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/uml/impl/RealLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/RealLiteralExpImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 RealLiteralExpImpl.java >--- src/org/eclipse/ocl/uml/impl/RealLiteralExpImpl.java 23 Jan 2009 17:16:12 -0000 1.8 >+++ src/org/eclipse/ocl/uml/impl/RealLiteralExpImpl.java 14 Jan 2010 14:40:45 -0000 >@@ -17,7 +17,9 @@ > */ > package org.eclipse.ocl.uml.impl; > >+import java.math.BigDecimal; > import java.util.Map; >+ > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.util.DiagnosticChain; > import org.eclipse.emf.ecore.EClass; >@@ -55,7 +57,7 @@ > * @generated > * @ordered > */ >- protected static final Double REAL_SYMBOL_EDEFAULT = null; >+ protected static final BigDecimal REAL_SYMBOL_EDEFAULT = null; > > /** > * The cached value of the '{@link #getRealSymbol() <em>Real Symbol</em>}' attribute. >@@ -65,7 +67,7 @@ > * @generated > * @ordered > */ >- protected Double realSymbol = REAL_SYMBOL_EDEFAULT; >+ protected BigDecimal realSymbol = REAL_SYMBOL_EDEFAULT; > > /** > * <!-- begin-user-doc --> >@@ -88,20 +90,22 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Double getRealSymbol() { >+ public BigDecimal getRealSymbol() { > return realSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setRealSymbol(Double newRealSymbol) { >- Double oldRealSymbol = realSymbol; >+ public void setRealSymbol(BigDecimal newRealSymbol) { >+ BigDecimal oldRealSymbol = realSymbol; > realSymbol = newRealSymbol; > if (eNotificationRequired()) > eNotify(new ENotificationImpl(this, Notification.SET, >@@ -123,6 +127,15 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setRealSymbol(Double value) { >+ setRealSymbol(new BigDecimal(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > @Override >@@ -143,7 +156,7 @@ > public void eSet(int featureID, Object newValue) { > switch (featureID) { > case UMLPackage.REAL_LITERAL_EXP__REAL_SYMBOL : >- setRealSymbol((Double) newValue); >+ setRealSymbol((BigDecimal) newValue); > return; > } > super.eSet(featureID, newValue); >Index: src/org/eclipse/ocl/uml/impl/UnlimitedNaturalLiteralExpImpl.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.uml/src/org/eclipse/ocl/uml/impl/UnlimitedNaturalLiteralExpImpl.java,v >retrieving revision 1.8 >diff -u -r1.8 UnlimitedNaturalLiteralExpImpl.java >--- src/org/eclipse/ocl/uml/impl/UnlimitedNaturalLiteralExpImpl.java 23 Jan 2009 17:16:11 -0000 1.8 >+++ src/org/eclipse/ocl/uml/impl/UnlimitedNaturalLiteralExpImpl.java 14 Jan 2010 14:40:45 -0000 >@@ -17,6 +17,7 @@ > */ > package org.eclipse.ocl.uml.impl; > >+import java.math.BigInteger; > import java.util.Map; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.common.util.DiagnosticChain; >@@ -36,7 +37,7 @@ > * <p> > * The following features are implemented: > * <ul> >- * <li>{@link org.eclipse.ocl.uml.impl.UnlimitedNaturalLiteralExpImpl#getIntegerSymbol <em>Integer Symbol</em>}</li> >+ * <li>{@link org.eclipse.ocl.uml.impl.UnlimitedNaturalLiteralExpImpl#getUnlimitedNaturalSymbol <em>Unlimited Natural Symbol</em>}</li> > * <li>{@link org.eclipse.ocl.uml.impl.UnlimitedNaturalLiteralExpImpl#isUnlimited <em>Unlimited</em>}</li> > * </ul> > * </p> >@@ -49,24 +50,26 @@ > implements UnlimitedNaturalLiteralExp { > > /** >- * The default value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The default value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected static final Integer INTEGER_SYMBOL_EDEFAULT = null; >+ protected static final BigInteger UNLIMITED_NATURAL_SYMBOL_EDEFAULT = null; > > /** >- * The cached value of the '{@link #getIntegerSymbol() <em>Integer Symbol</em>}' attribute. >+ * The cached value of the '{@link #getUnlimitedNaturalSymbol() <em>Unlimited Natural Symbol</em>}' attribute. > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> >- * @see #getIntegerSymbol() >+ * @see #getUnlimitedNaturalSymbol() > * @generated > * @ordered > */ >- protected Integer integerSymbol = INTEGER_SYMBOL_EDEFAULT; >+ protected BigInteger unlimitedNaturalSymbol = UNLIMITED_NATURAL_SYMBOL_EDEFAULT; > > /** > * The default value of the '{@link #isUnlimited() <em>Unlimited</em>}' attribute. >@@ -99,34 +102,40 @@ > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public Integer getIntegerSymbol() { >- return integerSymbol; >+ public BigInteger getUnlimitedNaturalSymbol() { >+ return unlimitedNaturalSymbol; > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated > */ >- public void setIntegerSymbol(Integer newIntegerSymbol) { >- Integer oldIntegerSymbol = integerSymbol; >- integerSymbol = newIntegerSymbol; >+ public void setUnlimitedNaturalSymbol(BigInteger newUnlimitedNaturalSymbol) { >+ BigInteger oldUnlimitedNaturalSymbol = unlimitedNaturalSymbol; >+ unlimitedNaturalSymbol = newUnlimitedNaturalSymbol; > if (eNotificationRequired()) >- eNotify(new ENotificationImpl(this, Notification.SET, >- UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL, >- oldIntegerSymbol, integerSymbol)); >+ eNotify(new ENotificationImpl( >+ this, >+ Notification.SET, >+ UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL, >+ oldUnlimitedNaturalSymbol, unlimitedNaturalSymbol)); > } > > /** > * <!-- begin-user-doc --> >+ * @since 3.0 > * <!-- end-user-doc --> > * @generated NOT > */ > public boolean isUnlimited() { >- return getIntegerSymbol() == UNLIMITED; >+ return (unlimitedNaturalSymbol == null) >+ || (unlimitedNaturalSymbol == UNLIMITED); > } > > /** >@@ -143,13 +152,32 @@ > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setIntegerSymbol(Integer value) { >+ setUnlimitedNaturalSymbol(value); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * @since 3.0 >+ * <!-- end-user-doc --> >+ * @generated NOT >+ */ >+ public void setUnlimitedNaturalSymbol(Integer value) { >+ setUnlimitedNaturalSymbol(BigInteger.valueOf(value)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> > * @generated > */ > @Override > public Object eGet(int featureID, boolean resolve, boolean coreType) { > switch (featureID) { >- case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return getIntegerSymbol(); >+ case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return getUnlimitedNaturalSymbol(); > case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return isUnlimited(); > } >@@ -164,8 +192,8 @@ > @Override > public void eSet(int featureID, Object newValue) { > switch (featureID) { >- case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol((Integer) newValue); >+ case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol((BigInteger) newValue); > return; > } > super.eSet(featureID, newValue); >@@ -179,8 +207,8 @@ > @Override > public void eUnset(int featureID) { > switch (featureID) { >- case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- setIntegerSymbol(INTEGER_SYMBOL_EDEFAULT); >+ case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ setUnlimitedNaturalSymbol(UNLIMITED_NATURAL_SYMBOL_EDEFAULT); > return; > } > super.eUnset(featureID); >@@ -194,10 +222,11 @@ > @Override > public boolean eIsSet(int featureID) { > switch (featureID) { >- case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return INTEGER_SYMBOL_EDEFAULT == null >- ? integerSymbol != null >- : !INTEGER_SYMBOL_EDEFAULT.equals(integerSymbol); >+ case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return UNLIMITED_NATURAL_SYMBOL_EDEFAULT == null >+ ? unlimitedNaturalSymbol != null >+ : !UNLIMITED_NATURAL_SYMBOL_EDEFAULT >+ .equals(unlimitedNaturalSymbol); > case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return isUnlimited() != UNLIMITED_EDEFAULT; > } >@@ -213,8 +242,8 @@ > public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { > if (baseClass == org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp.class) { > switch (derivedFeatureID) { >- case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL; >+ case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL; > case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED; > default : >@@ -233,8 +262,8 @@ > public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { > if (baseClass == org.eclipse.ocl.expressions.UnlimitedNaturalLiteralExp.class) { > switch (baseFeatureID) { >- case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL : >- return UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL; >+ case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL : >+ return UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL; > case ExpressionsPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED : > return UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED; > default : >#P org.eclipse.ocl.uml.edit >Index: src/org/eclipse/ocl/uml/provider/UnlimitedNaturalLiteralExpItemProvider.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/plugins/org.eclipse.ocl.uml.edit/src/org/eclipse/ocl/uml/provider/UnlimitedNaturalLiteralExpItemProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 UnlimitedNaturalLiteralExpItemProvider.java >--- src/org/eclipse/ocl/uml/provider/UnlimitedNaturalLiteralExpItemProvider.java 14 Jan 2010 12:44:49 -0000 1.2 >+++ src/org/eclipse/ocl/uml/provider/UnlimitedNaturalLiteralExpItemProvider.java 14 Jan 2010 14:40:48 -0000 >@@ -68,28 +68,28 @@ > if (itemPropertyDescriptors == null) { > super.getPropertyDescriptors(object); > >- addIntegerSymbolPropertyDescriptor(object); >+ addUnlimitedNaturalSymbolPropertyDescriptor(object); > addUnlimitedPropertyDescriptor(object); > } > return itemPropertyDescriptors; > } > > /** >- * This adds a property descriptor for the Integer Symbol feature. >+ * This adds a property descriptor for the Unlimited Natural Symbol feature. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > */ >- protected void addIntegerSymbolPropertyDescriptor(Object object) { >+ protected void addUnlimitedNaturalSymbolPropertyDescriptor(Object object) { > itemPropertyDescriptors > .add(createItemPropertyDescriptor( > ((ComposeableAdapterFactory) adapterFactory) > .getRootAdapterFactory(), > getResourceLocator(), >- getString("_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature"), //$NON-NLS-1$ >+ getString("_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature"), //$NON-NLS-1$ > getString( >- "_UI_PropertyDescriptor_description", "_UI_UnlimitedNaturalLiteralExp_integerSymbol_feature", "_UI_UnlimitedNaturalLiteralExp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- ExpressionsPackage.Literals.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL, >+ "_UI_PropertyDescriptor_description", "_UI_UnlimitedNaturalLiteralExp_unlimitedNaturalSymbol_feature", "_UI_UnlimitedNaturalLiteralExp_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ ExpressionsPackage.Literals.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL, > true, false, false, > ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); > } >@@ -161,7 +161,7 @@ > updateChildren(notification); > > switch (notification.getFeatureID(UnlimitedNaturalLiteralExp.class)) { >- case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__INTEGER_SYMBOL: >+ case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED_NATURAL_SYMBOL: > case UMLPackage.UNLIMITED_NATURAL_LITERAL_EXP__UNLIMITED: > fireNotifyChanged(new ViewerNotification(notification, notification > .getNotifier(), false, true)); >#P org.eclipse.ocl.uml.tests >Index: src/org/eclipse/ocl/uml/tests/CollectionsTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.uml.tests/src/org/eclipse/ocl/uml/tests/CollectionsTest.java,v >retrieving revision 1.10 >diff -u -r1.10 CollectionsTest.java >--- src/org/eclipse/ocl/uml/tests/CollectionsTest.java 28 Nov 2009 18:16:15 -0000 1.10 >+++ src/org/eclipse/ocl/uml/tests/CollectionsTest.java 14 Jan 2010 14:40:49 -0000 >@@ -17,6 +17,7 @@ > > package org.eclipse.ocl.uml.tests; > >+import java.math.BigInteger; > import java.util.Arrays; > import java.util.Collection; > import java.util.Collections; >@@ -686,38 +687,38 @@ > > try { > Collection<?> result = (Collection<?>) evaluate(helper, >- new Integer(1), "Sequence{1 .. 10}"); >+ Integer.valueOf(1), "Sequence{1 .. 10}"); > > for (int i = 1; i <= 10; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } > >- result = (Collection<?>) evaluate(helper, new Integer(1), >+ result = (Collection<?>) evaluate(helper, Integer.valueOf(1), > "Sequence{1, (2+1)..(3+4), 10}"); > >- assertTrue(result.contains(new Integer(1))); >+ assertTrue(result.contains(BigInteger.valueOf(1))); > for (int i = 3; i <= 7; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } >- assertTrue(result.contains(new Integer(10))); >+ assertTrue(result.contains(BigInteger.valueOf(10))); > > // try the first expression without spaces (needed a grammar change) >- result = (Collection<?>) evaluate(helper, new Integer(1), >+ result = (Collection<?>) evaluate(helper, Integer.valueOf(1), > "Sequence{1..10}"); > > for (int i = 1; i <= 10; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } > > // and a negation, too (the same grammar change) >- result = (Collection<?>) evaluate(helper, new Integer(1), >+ result = (Collection<?>) evaluate(helper, Integer.valueOf(1), > "Sequence{-20, -10..-1, 1}"); > >- assertTrue(result.contains(new Integer(-20))); >+ assertTrue(result.contains(BigInteger.valueOf(-20))); > for (int i = -10; i <= -1; i++) { >- assertTrue(result.contains(new Integer(i))); >+ assertTrue(result.contains(BigInteger.valueOf(i))); > } >- assertTrue(result.contains(new Integer(1))); >+ assertTrue(result.contains(BigInteger.valueOf(1))); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >Index: src/org/eclipse/ocl/uml/tests/ComparisonTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.uml.tests/src/org/eclipse/ocl/uml/tests/ComparisonTest.java,v >retrieving revision 1.11 >diff -u -r1.11 ComparisonTest.java >--- src/org/eclipse/ocl/uml/tests/ComparisonTest.java 28 Nov 2009 18:11:00 -0000 1.11 >+++ src/org/eclipse/ocl/uml/tests/ComparisonTest.java 14 Jan 2010 14:40:50 -0000 >@@ -385,16 +385,16 @@ > helper.setContext(thingType); > > try { >- assertEquals(new Integer(1), evaluate(helper, thing, "3 - 2")); >- assertEquals(new Integer(3), evaluate(helper, thing, "1 + 2")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "6 / 3")); >- assertEquals(new Integer(6), evaluate(helper, thing, "2 * 3")); >- assertEquals(new Integer(-1), evaluate(helper, thing, "- 1")); >- assertEquals(new Integer(3), evaluate(helper, thing, "(2 - 5).abs()")); >- assertEquals(new Integer(3), evaluate(helper, thing, "3.max(2)")); >- assertEquals(new Integer(2), evaluate(helper, thing, "3.min(2)")); >- assertEquals(new Integer(3), evaluate(helper, thing, "7.div(2)")); >- assertEquals(new Integer(1), evaluate(helper, thing, "7.mod(2)")); >+ assertEquals(1, evaluate(helper, thing, "3 - 2")); >+ assertEquals(3, evaluate(helper, thing, "1 + 2")); >+ assertEquals(2.0, evaluate(helper, thing, "6 / 3")); >+ assertEquals(6, evaluate(helper, thing, "2 * 3")); >+ assertEquals(-1, evaluate(helper, thing, "- 1")); >+ assertEquals(3, evaluate(helper, thing, "(2 - 5).abs()")); >+ assertEquals(3, evaluate(helper, thing, "3.max(2)")); >+ assertEquals(2, evaluate(helper, thing, "3.min(2)")); >+ assertEquals(3, evaluate(helper, thing, "7.div(2)")); >+ assertEquals(1, evaluate(helper, thing, "7.mod(2)")); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >@@ -407,14 +407,14 @@ > helper.setContext(thingType); > > try { >- assertEquals(new Double(1.0), evaluate(helper, thing, "3.0 - 2.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "1.0 + 2.0")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "6.0 / 3.0")); >- assertEquals(new Double(6.0), evaluate(helper, thing, "2.0 * 3.0")); >- assertEquals(new Double(-1.0), evaluate(helper, thing, "- 1.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "(2.0 - 5.0).abs()")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "3.0.max(2.0)")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "3.0.min(2.0)")); >+ assertEquals(1.0, evaluate(helper, thing, "3.0 - 2.0")); >+ assertEquals(3.0, evaluate(helper, thing, "1.0 + 2.0")); >+ assertEquals(2.0, evaluate(helper, thing, "6.0 / 3.0")); >+ assertEquals(6.0, evaluate(helper, thing, "2.0 * 3.0")); >+ assertEquals(-1.0, evaluate(helper, thing, "- 1.0")); >+ assertEquals(3.0, evaluate(helper, thing, "(2.0 - 5.0).abs()")); >+ assertEquals(3.0, evaluate(helper, thing, "3.0.max(2.0)")); >+ assertEquals(2.0, evaluate(helper, thing, "3.0.min(2.0)")); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >@@ -428,12 +428,17 @@ > helper.setContext(thingType); > > try { >- assertEquals(new Double(1.0), evaluate(helper, thing, "3 - 2.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "1 + 2.0")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "6 / 3.0")); >- assertEquals(new Double(6.0), evaluate(helper, thing, "2 * 3.0")); >- assertEquals(new Double(3.0), evaluate(helper, thing, "3.max(2.0)")); >- assertEquals(new Double(2.0), evaluate(helper, thing, "3.min(2.0)")); >+ assertEquals(1.0, evaluate(helper, thing, "3 - 2.0")); >+ assertEquals(3.0, evaluate(helper, thing, "1 + 2.0")); >+ assertEquals(2.0, evaluate(helper, thing, "6 / 3.0")); >+ assertEquals(6.0, evaluate(helper, thing, "2 * 3.0")); >+ assertEquals(3.0, evaluate(helper, thing, "3.max(2.0)")); >+ assertEquals(2.0, evaluate(helper, thing, "3.min(2.0)")); >+ assertEquals(2, evaluate(helper, thing, "2.oclAsType(Integer)")); >+ assertEquals(2, evaluate(helper, thing, "2.0.oclAsType(Integer)")); >+ assertInvalid(evaluate(helper, thing, "2.5.oclAsType(Integer)")); >+ assertEquals(3.0, evaluate(helper, thing, "3.oclAsType(Real)")); >+ assertEquals(3.0, evaluate(helper, thing, "3.0.oclAsType(Real)")); > } catch (Exception e) { > fail("Failed to parse or evaluate: " + e.getLocalizedMessage()); > } >Index: src/org/eclipse/ocl/uml/tests/ExpressionsValidatorTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.uml.tests/src/org/eclipse/ocl/uml/tests/ExpressionsValidatorTest.java,v >retrieving revision 1.5 >diff -u -r1.5 ExpressionsValidatorTest.java >--- src/org/eclipse/ocl/uml/tests/ExpressionsValidatorTest.java 28 Nov 2009 18:16:05 -0000 1.5 >+++ src/org/eclipse/ocl/uml/tests/ExpressionsValidatorTest.java 14 Jan 2010 14:40:51 -0000 >@@ -849,7 +849,7 @@ > > public void test_UnlimitedNaturalLiteralExp_checkNaturalType() { > UnlimitedNaturalLiteralExp ul = factory.createUnlimitedNaturalLiteralExp(); >- ul.setIntegerSymbol(42); >+ ul.setUnlimitedNaturalSymbol(42); > ul.setType(apple); > > assertProblem(ul, ExpressionsValidator.UNLIMITED_NATURAL_LITERAL_EXP__NATURAL_TYPE); >Index: src/org/eclipse/ocl/uml/tests/PrimitiveTypesTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.uml.tests/src/org/eclipse/ocl/uml/tests/PrimitiveTypesTest.java,v >retrieving revision 1.5 >diff -u -r1.5 PrimitiveTypesTest.java >--- src/org/eclipse/ocl/uml/tests/PrimitiveTypesTest.java 28 Nov 2009 18:09:44 -0000 1.5 >+++ src/org/eclipse/ocl/uml/tests/PrimitiveTypesTest.java 14 Jan 2010 14:40:51 -0000 >@@ -57,7 +57,7 @@ > .getUnlimitedNatural(), expression.getType()); > > Object result = evaluate(expression); >- assertEquals(UnlimitedNaturalLiteralExp.UNLIMITED, result); >+ assertTrue(((UnlimitedNaturalLiteralExp<?>)result).isUnlimited()); > } > > /** >@@ -141,6 +141,7 @@ > helper.setContext(getOCLStandardLibrary().getUnlimitedNatural()); > > try { >+ assertInvalid(evaluate(helper, 1, "-*")); > assertInvalid(evaluate(helper, 1, "*.round()")); > assertInvalid(evaluate(helper, 1, "*.floor()")); > assertInvalid(evaluate(helper, 1, "*.abs()")); >Index: src/org/eclipse/ocl/uml/tests/RegressionTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.uml.tests/src/org/eclipse/ocl/uml/tests/RegressionTest.java,v >retrieving revision 1.13 >diff -u -r1.13 RegressionTest.java >--- src/org/eclipse/ocl/uml/tests/RegressionTest.java 18 Dec 2009 06:32:29 -0000 1.13 >+++ src/org/eclipse/ocl/uml/tests/RegressionTest.java 14 Jan 2010 14:40:52 -0000 >@@ -18,6 +18,7 @@ > > package org.eclipse.ocl.uml.tests; > >+import java.math.BigInteger; > import java.util.Collections; > import java.util.List; > import java.util.Map; >@@ -1015,15 +1016,15 @@ > // got as many product tuples as required (2 x 3) > assertEquals(6, product.size()); > >- Map<String, Set<Integer>> expectedTuples = >- new java.util.HashMap<String, Set<Integer>>(); >- Set<Integer> values = new java.util.HashSet<Integer>(); >- values.add(1); >- values.add(2); >- values.add(3); >+ Map<String, Set<BigInteger>> expectedTuples = >+ new java.util.HashMap<String, Set<BigInteger>>(); >+ Set<BigInteger> values = new java.util.HashSet<BigInteger>(); >+ values.add(BigInteger.valueOf(1)); >+ values.add(BigInteger.valueOf(2)); >+ values.add(BigInteger.valueOf(3)); > >- expectedTuples.put("foo", new java.util.HashSet<Integer>(values)); >- expectedTuples.put("bar", new java.util.HashSet<Integer>(values)); >+ expectedTuples.put("foo", new java.util.HashSet<BigInteger>(values)); >+ expectedTuples.put("bar", new java.util.HashSet<BigInteger>(values)); > > for (Tuple<Operation, Property> tuple : product) { > values = expectedTuples.get(tuple.getValue("first")); >Index: src/org/eclipse/ocl/uml/tests/SerializationTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.ocl/tests/org.eclipse.ocl.uml.tests/src/org/eclipse/ocl/uml/tests/SerializationTest.java,v >retrieving revision 1.11 >diff -u -r1.11 SerializationTest.java >--- src/org/eclipse/ocl/uml/tests/SerializationTest.java 28 Nov 2009 18:10:47 -0000 1.11 >+++ src/org/eclipse/ocl/uml/tests/SerializationTest.java 14 Jan 2010 14:40:52 -0000 >@@ -20,6 +20,7 @@ > > import java.io.ByteArrayInputStream; > import java.io.ByteArrayOutputStream; >+import java.math.BigInteger; > import java.util.Collections; > import java.util.Iterator; > import java.util.List; >@@ -92,6 +93,38 @@ > } > > /** >+ * Tests the serialization of an expression that uses OCL integer values. >+ */ >+ public void test_integerTypeSerialization() { >+ OCLExpression<Classifier> expr = parseExpression( >+ getMetaclass("Package"), >+ BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(1)) + " > " + Long.MAX_VALUE + " - " + Integer.MAX_VALUE); >+ >+ String toStringForm = expr.toString(); >+ String serialForm = serialize(expr); >+ >+ expr = loadExpression(serialForm); >+ validate(expr); // ensure that it is structurally valid >+ assertEquals(toStringForm, expr.toString()); // should "look" the same >+ } >+ >+ /** >+ * Tests the serialization of an expression that uses OCL real values. >+ */ >+ public void test_realTypeSerialization() { >+ OCLExpression<Classifier> expr = parseExpression( >+ getMetaclass("Package"), >+ "12345678901234567890.123456789e44 > 1.234"); >+ >+ String toStringForm = expr.toString(); >+ String serialForm = serialize(expr); >+ >+ expr = loadExpression(serialForm); >+ validate(expr); // ensure that it is structurally valid >+ assertEquals(toStringForm, expr.toString()); // should "look" the same >+ } >+ >+ /** > * Tests the serialization of an expression that uses collections of > * primitive types. > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 290605
:
155901
| 156100