org.h2.test.jdbc

## Class TestCustomDataTypesHandler.ComplexNumber

- java.lang.Object
- - org.h2.test.jdbc.TestCustomDataTypesHandler.ComplexNumber

All Implemented Interfaces:
  java.io.Serializable

Enclosing class:
  TestCustomDataTypesHandler

    public static class TestCustomDataTypesHandler.ComplexNumber
    extends java.lang.Object
    implements java.io.Serializable

Complex number

See Also:
  Serialized Form

### Field Summary

Fields
`static java.text.DecimalFormat` `IMG_FMT`
`static java.text.DecimalFormat` `REAL_FMT`

### Constructor Summary

Constructors
Constructor and Description
`TestCustomDataTypesHandler.ComplexNumber(double re, double im)`

### Method Summary

Methods
`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()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### REAL_FMT

    public static final java.text.DecimalFormat REAL_FMT

#### IMG_FMT

    public static final java.text.DecimalFormat IMG_FMT

### Constructor Detail

#### TestCustomDataTypesHandler.ComplexNumber

    public TestCustomDataTypesHandler.ComplexNumber(double re,
                                            double im)

Parameters:
  `re` - real part
  `im` - imaginary part

### Method Detail

#### add

    public TestCustomDataTypesHandler.ComplexNumber add(TestCustomDataTypesHandler.ComplexNumber other)

Addition

Parameters:
  `other` - value to add
Returns:
  result

#### mod

    public double mod()

Returns modulus

Returns:
  result

#### compare

    public int compare(TestCustomDataTypesHandler.ComplexNumber v)

Compares two complex numbers True ordering of complex number has no sense, so we apply lexicographical order.

Parameters:
  `v` - number to compare this with
Returns:
  result of comparison

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### equals

    public boolean equals(java.lang.Object other)

Overrides:
  `equals` in class `java.lang.Object`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### parseComplexNumber

    public static TestCustomDataTypesHandler.ComplexNumber parseComplexNumber(java.lang.String s)

Simple parser for complex numbers. Both real and im components must be written in non scientific notation.

Parameters:
  `s` - String.
Returns:
  `TestCustomDataTypesHandler.ComplexNumber` object.