mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
Removed the redundant methods from the 'ICDIFloatingPointValue' interface.
This commit is contained in:
parent
80e0614c06
commit
8efde68c59
6 changed files with 48 additions and 50 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-06-05 Mikhail Khodjaiants
|
||||||
|
Removed the redundant methods from the 'ICDIFloatingPointValue' interface.
|
||||||
|
* ICDIFloatingPointValue.java
|
||||||
|
* CValue.java
|
||||||
|
* CVariable.java
|
||||||
|
|
||||||
2003-06-04 Mikhail Khodjaiants
|
2003-06-04 Mikhail Khodjaiants
|
||||||
Implementing the core support of the detail panel.
|
Implementing the core support of the detail panel.
|
||||||
* ICValue.java
|
* ICValue.java
|
||||||
|
|
|
@ -20,10 +20,4 @@ public interface ICDIFloatingPointValue extends ICDIValue {
|
||||||
float floatValue() throws CDIException;
|
float floatValue() throws CDIException;
|
||||||
|
|
||||||
double doubleValue() throws CDIException;
|
double doubleValue() throws CDIException;
|
||||||
|
|
||||||
long longValue() throws CDIException;
|
|
||||||
|
|
||||||
boolean isNaN();
|
|
||||||
|
|
||||||
boolean isInfinite();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,10 +417,11 @@ public class CValue extends CDebugElement implements ICValue
|
||||||
|
|
||||||
private String getFloatValueString( ICDIFloatValue value ) throws CDIException
|
private String getFloatValueString( ICDIFloatValue value ) throws CDIException
|
||||||
{
|
{
|
||||||
if ( value.isNaN() )
|
|
||||||
return "";
|
|
||||||
float floatValue = value.floatValue();
|
float floatValue = value.floatValue();
|
||||||
long longValue = value.longValue();
|
Float flt = new Float( floatValue );
|
||||||
|
if ( flt.isNaN() || flt.isInfinite() )
|
||||||
|
return "";
|
||||||
|
long longValue = flt.longValue();
|
||||||
switch( getParentVariable().getFormat() )
|
switch( getParentVariable().getFormat() )
|
||||||
{
|
{
|
||||||
case ICDIFormat.NATURAL:
|
case ICDIFormat.NATURAL:
|
||||||
|
@ -440,14 +441,15 @@ public class CValue extends CDebugElement implements ICValue
|
||||||
|
|
||||||
private String getDoubleValueString( ICDIDoubleValue value ) throws CDIException
|
private String getDoubleValueString( ICDIDoubleValue value ) throws CDIException
|
||||||
{
|
{
|
||||||
if ( value.isNaN() )
|
|
||||||
return "";
|
|
||||||
double doubleValue = value.doubleValue();
|
double doubleValue = value.doubleValue();
|
||||||
long longValue = value.longValue();
|
Double dbl = new Double( doubleValue );
|
||||||
|
if ( dbl.isNaN() || dbl.isInfinite() )
|
||||||
|
return "";
|
||||||
|
long longValue = dbl.longValue();
|
||||||
switch( getParentVariable().getFormat() )
|
switch( getParentVariable().getFormat() )
|
||||||
{
|
{
|
||||||
case ICDIFormat.NATURAL:
|
case ICDIFormat.NATURAL:
|
||||||
return Double.toString( doubleValue );
|
return dbl.toString();
|
||||||
case ICDIFormat.DECIMAL:
|
case ICDIFormat.DECIMAL:
|
||||||
return Long.toString( longValue );
|
return Long.toString( longValue );
|
||||||
case ICDIFormat.HEXADECIMAL:
|
case ICDIFormat.HEXADECIMAL:
|
||||||
|
|
|
@ -20,8 +20,9 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDICharType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedType;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleValue;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructType;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIType;
|
||||||
|
@ -676,8 +677,15 @@ public abstract class CVariable extends CDebugElement
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ( getCDIVariable().getValue() instanceof ICDIFloatingPointValue ) ?
|
ICDIValue value = getCDIVariable().getValue();
|
||||||
((ICDIFloatingPointValue)getCDIVariable().getValue()).isNaN() : false;
|
if ( value instanceof ICDIDoubleValue )
|
||||||
|
{
|
||||||
|
return Double.isNaN( ((ICDIDoubleValue)value).doubleValue() );
|
||||||
|
}
|
||||||
|
if ( value instanceof ICDIFloatValue )
|
||||||
|
{
|
||||||
|
return Float.isNaN( ((ICDIFloatValue)value).floatValue() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( CDIException e )
|
catch( CDIException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2003-06-05 Mikhail Khodjaiants
|
||||||
|
Removed the redundant methods from the 'ICDIFloatingPointValue' interface.
|
||||||
|
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FloatingPointValue.java
|
||||||
|
|
||||||
2003-06-04 Mikhail Khodjaiants
|
2003-06-04 Mikhail Khodjaiants
|
||||||
Correction in the parsing of reference value.
|
Correction in the parsing of reference value.
|
||||||
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java
|
* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java
|
||||||
|
|
|
@ -26,10 +26,14 @@ public abstract class FloatingPointValue extends Value implements ICDIFloatingPo
|
||||||
*/
|
*/
|
||||||
public double doubleValue() throws CDIException {
|
public double doubleValue() throws CDIException {
|
||||||
double result = 0;
|
double result = 0;
|
||||||
try {
|
if ( isNaN() )
|
||||||
result = Double.parseDouble( getValueString() );
|
result = Double.NaN;
|
||||||
}
|
else {
|
||||||
catch (NumberFormatException e) {
|
try {
|
||||||
|
result = Double.parseDouble( getValueString() );
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -39,40 +43,20 @@ public abstract class FloatingPointValue extends Value implements ICDIFloatingPo
|
||||||
*/
|
*/
|
||||||
public float floatValue() throws CDIException {
|
public float floatValue() throws CDIException {
|
||||||
float result = 0;
|
float result = 0;
|
||||||
try {
|
if ( isNaN() )
|
||||||
result = Float.parseFloat( getValueString() );
|
result = Float.NaN;
|
||||||
}
|
else {
|
||||||
catch (NumberFormatException e) {
|
try {
|
||||||
|
result = Float.parseFloat( getValueString() );
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
private boolean isNaN() throws CDIException {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#longValue()
|
String valueString = getValueString();
|
||||||
*/
|
|
||||||
public long longValue() throws CDIException {
|
|
||||||
Double dbl = new Double( doubleValue() );
|
|
||||||
return dbl.longValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#isInfinite()
|
|
||||||
*/
|
|
||||||
public boolean isInfinite() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#isNaN()
|
|
||||||
*/
|
|
||||||
public boolean isNaN() {
|
|
||||||
String valueString = null;
|
|
||||||
try {
|
|
||||||
valueString = getValueString();
|
|
||||||
}
|
|
||||||
catch (CDIException e) {
|
|
||||||
}
|
|
||||||
return ( valueString != null ) ? valueString.indexOf( "nan" ) != -1 : false;
|
return ( valueString != null ) ? valueString.indexOf( "nan" ) != -1 : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue