public static class TestCustomDataTypesHandler.ComplexNumber
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static java.text.DecimalFormat |
IMG_FMT |
static java.text.DecimalFormat |
REAL_FMT |
| Constructor and Description |
|---|
ComplexNumber(double re,
double im) |
| Modifier and Type | Method and Description |
|---|---|
TestCustomDataTypesHandler.ComplexNumber |
add(TestCustomDataTypesHandler.ComplexNumber other)
Addition
|
int |
compare(TestCustomDataTypesHandler.ComplexNumber v)
Compares two complex numbers
True ordering of complex number has no sense,
so we apply lexicographical order.
|
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
double |
mod()
Returns modulus
|
static TestCustomDataTypesHandler.ComplexNumber |
parseComplexNumber(java.lang.String s)
Simple parser for complex numbers.
|
java.lang.String |
toString() |
public static final java.text.DecimalFormat REAL_FMT
public static final java.text.DecimalFormat IMG_FMT
public ComplexNumber(double re,
double im)
re - real partim - imaginary partpublic TestCustomDataTypesHandler.ComplexNumber add(TestCustomDataTypesHandler.ComplexNumber other)
other - value to addpublic double mod()
public int compare(TestCustomDataTypesHandler.ComplexNumber v)
v - number to compare this withpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static TestCustomDataTypesHandler.ComplexNumber parseComplexNumber(java.lang.String s)
s - String.TestCustomDataTypesHandler.ComplexNumber object.