Package net.sf.tweety.math
Class ComplexNumber
- java.lang.Object
-
- java.lang.Number
-
- net.sf.tweety.math.ComplexNumber
-
- All Implemented Interfaces:
java.io.Serializable
public class ComplexNumber extends java.lang.Number
A complex number.- Author:
- Matthias Thimm
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private double
imagPart
The imaginary part of this complex number.private double
realPart
The real part of this complex number.private static long
serialVersionUID
For serialization.
-
Constructor Summary
Constructors Constructor Description ComplexNumber(double real, double imag)
Constructs a new complex number with the given real and imaginary parts.
-
Method Summary
Modifier and Type Method Description double
doubleValue()
float
floatValue()
double
getImagPart()
Returns the imaginary part of this complex number.double
getRealPart()
Returns the real part of this complex number.int
intValue()
long
longValue()
java.lang.String
toString()
-
-
-
Field Detail
-
realPart
private double realPart
The real part of this complex number.
-
imagPart
private double imagPart
The imaginary part of this complex number.
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
-
Method Detail
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in classjava.lang.Number
-
floatValue
public float floatValue()
- Specified by:
floatValue
in classjava.lang.Number
-
intValue
public int intValue()
- Specified by:
intValue
in classjava.lang.Number
-
longValue
public long longValue()
- Specified by:
longValue
in classjava.lang.Number
-
getRealPart
public double getRealPart()
Returns the real part of this complex number.- Returns:
- the real part of this complex number.
-
getImagPart
public double getImagPart()
Returns the imaginary part of this complex number.- Returns:
- the imaginary part of this complex number.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-