|Re: LiteralUnlimitedNatural.UNLIMITED [message #726479 is a reply to message #726478]
||Sun, 18 September 2011 04:40
Originally posted by: Emil Huseynli|
Interesting, doing System.out.println LiteralUnlimitedNatural.UNLIMITED)
gives 1, but if i do
Property p = myAssociation.getAttribute("theAttribute");
then * is printed. It's pretty ok for me, but still interesting what is
the internal representation of the LiteralUnlimitedNatural.UNLIMITED.
On 18.09.2011 10:23, Emil Huseynli wrote:
> Hi, i wonder why value of LiteralUnlimitedNatural.UNLIMITED is 1? Is it
> normal? Shouldn't it be MAXINT or so?
|Re: LiteralUnlimitedNatural.UNLIMITED [message #735765 is a reply to message #735652]
||Wed, 12 October 2011 12:41
| Ed Willink
Registered: July 2009
Oops. Yes. Not an Enumeration; sure I checked, but no.
The implementation of numbers is implementation-specific; MDT/UML2 opts
for Java's Integer.
The UML specification is genuinely unlimited and the equivalent Integer
implementation for MDT/OCL has attracted bug reports, so that the
traditional code now has some support for a Long range. The new Pivot
model implementation is IntegerValue which has polymorphic
* or UNLIMITED is really a misnomer for plus infinity. It is bigger than
MAXINT. -1 is clearly not bigger than MAXINT, so all code that accesses
an UnlimitedNatural must special case the out of bounds negative value.
On 12/10/2011 14:31, Kenn Hussey wrote:
> Uh, it's not an enumeration literal and the value is -1, not 1.
> Because an unlimited natural is supposed to be a natural number (i.e.,
> 0 or higher), the value of -1 is used as a special indicator to mean
> the maximum possible value. The same is done for upper bounds on Ecore
> features in EMF.
Powered by FUDForum
. Page generated in 0.04638 seconds