Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Saving a Double.POSITIVE_INFINITY writes Infinity instead of INF
Saving a Double.POSITIVE_INFINITY writes Infinity instead of INF [message #635309] Tue, 26 October 2010 11:21 Go to next message
Andreas Baumgartner is currently offline Andreas BaumgartnerFriend
Messages: 4
Registered: February 2010
Junior Member
Eclipse (3.5) Build id: 20100218-1602
EMF 2.5.0.v200906151043

I'm trying to save a org.eclipse.emf.ecore.resource.Resource containing a Double.POSITIVE_INFINITY as XML. But instead of writing "INF" EMF writes "Infinity".

Due to W3C Infinity is INF in XML.

Is this a BUG or is it possible to configure this?

[Updated on: Tue, 26 October 2010 11:29]

Report message to a moderator

Re: Saving a Double.POSITIVE_INFINITY writes Infinity instead of INF [message #635406 is a reply to message #635309] Tue, 26 October 2010 16:32 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30541
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060405080209080708030408
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Andreas,

We implement EDouble like this in EcoreFactoryImpl

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Double createEDoubleFromString(EDataType metaObject, String
initialValue)
{
return initialValue == null ? null : Double.valueOf(initialValue);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertEDoubleToString(EDataType metaObject, Object
instanceValue)
{
return instanceValue == null ? null : instanceValue.toString();
}

And Double like this in XMLTypeFactoryImpl:

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public double createDouble(String literal)
{
return literal == null ? 0.0 :
Double.parseDouble(collapseWhiteSpace(literal));
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertDouble(double instanceValue)
{
return Double.toString(instanceValue);
}

I've never given any thought to how infinity, NaN, and other special
things are handled...


Andreas Baumgartner wrote:
> Eclipse (3.5) Build id: 20100218-1602
> EMF 2.5.0.v200906151043
>
> I'm trying to save a org.eclipse.emf.ecore.resource.Resource
> containing a Double.POSITIVE_INFINITY as XML. But instead of writing
> INF EMF writes Infinity.
>
> Due to http://www.w3.org/TR/xmlschema-2/ Infinity is INF in XML.
>
> Is this a BUG or is it possible to configure this? 8o

--------------060405080209080708030408
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Andreas,<br>
<br>
We implement EDouble like this in EcoreFactoryImpl<br>
<blockquote><small>  /**</small><br>
<small>   * &lt;!-- begin-user-doc --&gt;</small><br>
<small>   * &lt;!-- end-user-doc --&gt;</small><br>
<small>   * @generated NOT</small><br>
<small>   */</small><br>
<small>  public Double createEDoubleFromString(EDataType metaObject,
String initialValue) </small><br>
<small>  {</small><br>
<small>    return initialValue == null ? null :
Double.valueOf(initialValue);</small><br>
<small>  }</small><br>
<br>
<small>  /**</small><br>
<small>   * &lt;!-- begin-user-doc --&gt;</small><br>
<small>   * &lt;!-- end-user-doc --&gt;</small><br>
<small>   * @generated NOT</small><br>
<small>   */</small><br>
<small>  public String convertEDoubleToString(EDataType metaObject,
Object instanceValue) </small><br>
<small>  {</small><br>
<small>    return instanceValue == null ? null :
instanceValue.toString();</small><br>
<small>  }</small><br>
</blockquote>
And Double like this in XMLTypeFactoryImpl:<br>
<blockquote><small>  /**</small><br>
<small>   * &lt;!-- begin-user-doc --&gt;</small><br>
<small>   * &lt;!-- end-user-doc --&gt;</small><br>
<small>   * @generated NOT</small><br>
<small>   */</small><br>
<small>  public double createDouble(String literal)</small><br>
<small>  {</small><br>
<small>    return literal == null ? 0.0 :
Double.parseDouble(collapseWhiteSpace(literal));</small><br >
<small>  }</small><br>
<small>  </small><br>
<small>  /**</small><br>
<small>   * &lt;!-- begin-user-doc --&gt;</small><br>
<small>   * &lt;!-- end-user-doc --&gt;</small><br>
<small>   * @generated NOT</small><br>
<small>   */</small><br>
<small>  public String convertDouble(double instanceValue)</small><br>
<small>  {</small><br>
<small>    return Double.toString(instanceValue);</small><br>
<small>  } </small>   <br>
</blockquote>
I've never given any thought to how infinity, NaN, and other special
things are handled...<br>
<br>
<br>
Andreas Baumgartner wrote:
<blockquote cite="mid:ia6ddl$h7d$1@news.eclipse.org" type="cite">Eclipse
(3.5) Build id: 20100218-1602
<br>
EMF 2.5.0.v200906151043
<br>
<br>
I'm trying to save a org.eclipse.emf.ecore.resource.Resource containing
a Double.POSITIVE_INFINITY as XML. But instead of writing INF EMF
writes Infinity.
<br>
<br>
Due to <a class="moz-txt-link-freetext" href="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2/</a> Infinity is INF in XML.
<br>
<br>
Is this a BUG or is it possible to configure this? 8o </blockquote>
</body>
</html>

--------------060405080209080708030408--
Previous Topic:[net4j] JVM connector requirements?
Next Topic:How to display property sheet from explorer based on eobject.
Goto Forum:
  


Current Time: Mon Oct 14 15:59:39 GMT 2019

Powered by FUDForum. Page generated in 0.02124 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top