wrappers
Class MyDouble
java.lang.Object
|
+--wrappers.MyDouble
- public class MyDouble
- extends java.lang.Object
- implements Operable, Zero, CloneableObject
Constructor Summary |
MyDouble()
MyDouble initialized to 0 |
MyDouble(double theValue)
MyDouble initialized to theValue |
MyDouble(java.lang.String s)
MyDouble initialized to s |
Methods inherited from class java.lang.Object |
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
MyDouble
public MyDouble(double theValue)
- MyDouble initialized to theValue
MyDouble
public MyDouble()
- MyDouble initialized to 0
MyDouble
public MyDouble(java.lang.String s)
throws java.lang.NumberFormatException
- MyDouble initialized to s
getValue
public double getValue()
- Returns:
- value of the double
doubleValue
public double doubleValue()
setValue
public void setValue(double theValue)
- set value to theValue
toString
public java.lang.String toString()
- Returns:
- integer in String format
- Overrides:
- toString in class java.lang.Object
input
public static MyDouble input(MyInputStream stream)
- input from the given input stream
clone
public java.lang.Object clone()
- make a clone
- Specified by:
- clone in interface CloneableObject
- Overrides:
- clone in class java.lang.Object
add
public java.lang.Object add(java.lang.Object x)
- Returns:
- this + x
subtract
public java.lang.Object subtract(java.lang.Object x)
- Returns:
- this - x
multiply
public java.lang.Object multiply(java.lang.Object x)
- Returns:
- this * x
divide
public java.lang.Object divide(java.lang.Object x)
- Returns:
- this / x
mod
public java.lang.Object mod(java.lang.Object x)
- Returns:
- remainder of this / x
increment
public java.lang.Object increment(java.lang.Object x)
- Returns:
- this incremented by x
decrement
public java.lang.Object decrement(java.lang.Object x)
- Returns:
- this decremented by x
zero
public java.lang.Object zero()
- Specified by:
- zero in interface Zero
- Returns:
- a new copy of 0
equalsZero
public boolean equalsZero()
- Specified by:
- equalsZero in interface Zero
- Returns:
- true iff value == 0
identity
public java.lang.Object identity()
- Returns:
- a new copy of 1
compareTo
public int compareTo(java.lang.Object x)
- Returns:
- -1 if this < x,
0 if this == x,
1 if this > x
equals
public boolean equals(java.lang.Object x)
- Returns:
- true iff this == x
- Overrides:
- equals in class java.lang.Object
main
public static void main(java.lang.String[] args)
- test program