MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.util
Class IntDouble

java.lang.Object
  extended by ch.ethz.mxquery.util.IntDouble

public class IntDouble
extends java.lang.Object

Double implementation on an integer.
NaN, Inf, and Exponential representation (e.g. 2e-4) are not supported


Field Summary
static int maxDecimalPlaces
           
 
Constructor Summary
IntDouble(int decimalPlaces)
          Constructor
IntDouble(int init, int decimalPlaces)
          Constructor
IntDouble(java.lang.String str, int decimalPlaces)
          Constructor
 
Method Summary
 IntDouble add(int i)
           
 IntDouble add(IntDouble id)
           
static java.lang.String addStartZerosToComma(java.lang.String str, int commaLength)
          Fills the str with commas at the begining till str.length() == commaLength.
 int compareTo(int i)
           
 int compareTo(IntDouble id)
           
static int countStartZeros(java.lang.String str)
          Counts the prefix zeros.
static java.lang.String deleteEndZeros(java.lang.String str)
          Deletes all zeros at the end of str.
 IntDouble divide(int i)
           
 IntDouble divide(IntDouble id)
           
 boolean equals(IntDouble id)
           
 boolean equals(java.lang.Object o)
           
 boolean equalsZero()
           
 int getIntValue()
           
static int getLastDigit(int value)
          Returns the last digit of the passed value.
 int hashCode()
           
 int idiv(int i)
           
 int idiv(IntDouble id)
           
 IntDouble mod(int i)
           
 IntDouble mod(IntDouble id)
           
 IntDouble multiply(int i)
           
 IntDouble multiply(IntDouble id)
           
 IntDouble negate()
           
 IntDouble subtract(int i)
           
 IntDouble subtract(IntDouble id)
           
 java.lang.String toString()
           
 boolean unequals(IntDouble id)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

maxDecimalPlaces

public static final int maxDecimalPlaces
See Also:
Constant Field Values
Constructor Detail

IntDouble

public IntDouble(int decimalPlaces)
Constructor

Parameters:
decimalPlaces -

IntDouble

public IntDouble(java.lang.String str,
                 int decimalPlaces)
Constructor

Parameters:
str - tries to parse this string
decimalPlaces -

IntDouble

public IntDouble(int init,
                 int decimalPlaces)
Constructor

Parameters:
init - initial value (only integer)
decimalPlaces -
Method Detail

addStartZerosToComma

public static java.lang.String addStartZerosToComma(java.lang.String str,
                                                    int commaLength)
Fills the str with commas at the begining till str.length() == commaLength.

Parameters:
str -
commaLength -
Returns:
the string filled up with zeros

deleteEndZeros

public static java.lang.String deleteEndZeros(java.lang.String str)
Deletes all zeros at the end of str.

Parameters:
str -
Returns:
the string with the zeros removed

countStartZeros

public static int countStartZeros(java.lang.String str)
Counts the prefix zeros.

Parameters:
str -
Returns:
the number of prefix zeros

getLastDigit

public static int getLastDigit(int value)
Returns the last digit of the passed value.

Parameters:
value -
Returns:
the last digit

equalsZero

public boolean equalsZero()

add

public IntDouble add(IntDouble id)

add

public IntDouble add(int i)

subtract

public IntDouble subtract(IntDouble id)

subtract

public IntDouble subtract(int i)

multiply

public IntDouble multiply(IntDouble id)

multiply

public IntDouble multiply(int i)

divide

public IntDouble divide(IntDouble id)
                 throws MXQueryException
Throws:
MXQueryException

divide

public IntDouble divide(int i)

mod

public IntDouble mod(IntDouble id)

mod

public IntDouble mod(int i)

idiv

public int idiv(IntDouble id)
         throws MXQueryException
Throws:
MXQueryException

idiv

public int idiv(int i)

negate

public IntDouble negate()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(IntDouble id)

unequals

public boolean unequals(IntDouble id)

compareTo

public int compareTo(IntDouble id)

compareTo

public int compareTo(int i)

getIntValue

public int getIntValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich