mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +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
|
||||
Implementing the core support of the detail panel.
|
||||
* ICValue.java
|
||||
|
|
|
@ -20,10 +20,4 @@ public interface ICDIFloatingPointValue extends ICDIValue {
|
|||
float floatValue() 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
|
||||
{
|
||||
if ( value.isNaN() )
|
||||
return "";
|
||||
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() )
|
||||
{
|
||||
case ICDIFormat.NATURAL:
|
||||
|
@ -440,14 +441,15 @@ public class CValue extends CDebugElement implements ICValue
|
|||
|
||||
private String getDoubleValueString( ICDIDoubleValue value ) throws CDIException
|
||||
{
|
||||
if ( value.isNaN() )
|
||||
return "";
|
||||
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() )
|
||||
{
|
||||
case ICDIFormat.NATURAL:
|
||||
return Double.toString( doubleValue );
|
||||
return dbl.toString();
|
||||
case ICDIFormat.DECIMAL:
|
||||
return Long.toString( longValue );
|
||||
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.ICDICharType;
|
||||
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.ICDIFloatingPointValue;
|
||||
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.ICDIType;
|
||||
|
@ -676,8 +677,15 @@ public abstract class CVariable extends CDebugElement
|
|||
{
|
||||
try
|
||||
{
|
||||
return ( getCDIVariable().getValue() instanceof ICDIFloatingPointValue ) ?
|
||||
((ICDIFloatingPointValue)getCDIVariable().getValue()).isNaN() : false;
|
||||
ICDIValue value = getCDIVariable().getValue();
|
||||
if ( value instanceof ICDIDoubleValue )
|
||||
{
|
||||
return Double.isNaN( ((ICDIDoubleValue)value).doubleValue() );
|
||||
}
|
||||
if ( value instanceof ICDIFloatValue )
|
||||
{
|
||||
return Float.isNaN( ((ICDIFloatValue)value).floatValue() );
|
||||
}
|
||||
}
|
||||
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
|
||||
Correction in the parsing of reference value.
|
||||
* 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 {
|
||||
double result = 0;
|
||||
try {
|
||||
result = Double.parseDouble( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
if ( isNaN() )
|
||||
result = Double.NaN;
|
||||
else {
|
||||
try {
|
||||
result = Double.parseDouble( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -39,40 +43,20 @@ public abstract class FloatingPointValue extends Value implements ICDIFloatingPo
|
|||
*/
|
||||
public float floatValue() throws CDIException {
|
||||
float result = 0;
|
||||
try {
|
||||
result = Float.parseFloat( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
if ( isNaN() )
|
||||
result = Float.NaN;
|
||||
else {
|
||||
try {
|
||||
result = Float.parseFloat( getValueString() );
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue#longValue()
|
||||
*/
|
||||
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) {
|
||||
}
|
||||
private boolean isNaN() throws CDIException {
|
||||
String valueString = getValueString();
|
||||
return ( valueString != null ) ? valueString.indexOf( "nan" ) != -1 : false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue