|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.math.AbstractNumberOps<Double>
ch.javasoft.math.DoubleOperations
public class DoubleOperations
Number operations for Double numbers.
A singleton instance exists for this class.
| Constructor Summary | |
|---|---|
DoubleOperations()
|
|
| Method Summary | |
|---|---|
Double |
abs(Double number)
Returns the absolute value of the given number, i.e. |
Double |
add(Double numA,
Double numB)
Returns the sum of the two values, i.e. |
int |
byteLength()
Returns the byte array length if NumberOperations.toByteArray(Number) is used and if
this size is fixed, and -1 if the size may vary depending on the number
instance |
int |
compare(Double o1,
Double o2)
|
Double |
divide(Double numA,
Double numB)
Returns the ratio of the two values, i.e. |
Double |
fromByteArray(byte[] bytes)
Converts the byte array containing binary data into a new number instance. |
static DoubleOperations |
instance()
Returns the singleton instance |
Double |
invert(Double number)
Returns the inverted value, i.e. |
boolean |
isOne(Double number)
Returns true if this value is numerically equal to one, i.e. |
boolean |
isZero(Double number)
Returns true if this value is numerically equal to zero, i.e. |
Double |
multiply(Double numA,
Double numB)
Returns the product of the two values, i.e. |
Double |
negate(Double number)
Returns the negated value, i.e. |
Double[] |
newArray(int size)
Create a new array of the underlying number type |
Double[][] |
newArray(int rows,
int cols)
Create a new 2 dimensional array of the underlying number type |
Class<Double> |
numberClass()
The class representing numbers of this number operations instance |
Double |
one()
Returns the value representing one |
Double |
pow(Double numA,
Double numB)
Returns the powered value, i.e. |
Double |
readFrom(DataInput in)
Reads binary data from the given data input. |
Double |
reduce(Double number)
Converts the number into some reduced form. |
Double[] |
reduceVector(boolean cloneOnChange,
Double... vector)
Converts a vector into some reduced form. |
int |
signum(Double number)
Returns signum of the value, i.e. |
Double |
subtract(Double numA,
Double numB)
Returns the difference of the two values, i.e. |
byte[] |
toByteArray(Double number)
Converts this number to binary data and returns it as a byte array. |
Double |
valueOf(double value)
Create an instance of the underlying number type based on the submitted double value |
Double |
valueOf(long value)
Create an instance of the underlying number type based on the submitted long integer value |
Double |
valueOf(Number number)
Create an instance of the underlying number type based on the submitted number |
Double |
valueOf(String s)
Create an instance of the underlying number type based on the given string representation of the number |
void |
writeTo(Double number,
DataOutput out)
Converts this number to binary data and writes it to the data output. |
Double |
zero()
Returns the value representing zero |
| Methods inherited from class ch.javasoft.math.AbstractNumberOps |
|---|
isNegative, isNonNegative, isNonPositive, isNonZero, isPositive, max, max, min, min |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
|---|
equals |
| Constructor Detail |
|---|
public DoubleOperations()
| Method Detail |
|---|
public static DoubleOperations instance()
public Class<Double> numberClass()
NumberOperations
public Double[] newArray(int size)
NumberOperations
public Double[][] newArray(int rows,
int cols)
NumberOperations
public Double valueOf(String s)
NumberOperations
public Double valueOf(Number number)
NumberOperations
public Double valueOf(long value)
NumberOperations
public Double valueOf(double value)
NumberOperations
public Double abs(Double number)
NumberOperations
abs in interface NumberOperations<Double>abs in class AbstractNumberOps<Double>
public Double add(Double numA,
Double numB)
NumberOperations
public Double divide(Double numA,
Double numB)
NumberOperationsFor integer types, an integer division is performed, ignoring possible remainders
public Double invert(Double number)
NumberOperations
invert in interface NumberOperations<Double>invert in class AbstractNumberOps<Double>public boolean isOne(Double number)
NumberOperations
isOne in interface NumberOperations<Double>isOne in class AbstractNumberOps<Double>public boolean isZero(Double number)
NumberOperations
isZero in interface NumberOperations<Double>isZero in class AbstractNumberOps<Double>
public Double multiply(Double numA,
Double numB)
NumberOperations
public Double negate(Double number)
NumberOperations
public Double reduce(Double number)
NumberOperations
public Double[] reduceVector(boolean cloneOnChange,
Double... vector)
NumberOperations
Note that the vector length might change by this operation. If only
individual components of the vector should be reduced, which is not
affecting the vector's length, reduce each number
separately.
cloneOnChange - if a reduction can be made, the array is cloned
and the original array is not changed. If no
reduction can be made, or if cloneOnChange
is false, the original array will be returned,
unmodified in the former case, and with reduced
values in the latter case.vector - the vector to reducepublic Double one()
NumberOperations
public Double pow(Double numA,
Double numB)
NumberOperations
public int signum(Double number)
NumberOperations
public Double subtract(Double numA,
Double numB)
NumberOperations
public Double zero()
NumberOperations
public int compare(Double o1,
Double o2)
public byte[] toByteArray(Double number)
NumberOperationsNumberOperations.fromByteArray(byte[]) method.
public void writeTo(Double number,
DataOutput out)
throws IOException
NumberOperationsNumberOperations.readFrom(DataInput).
IOExceptionpublic Double fromByteArray(byte[] bytes)
NumberOperationsNumberOperations.toByteArray(Number) method.
public Double readFrom(DataInput in)
throws IOException
NumberOperationsNumberOperations.writeTo(Number, DataOutput)
IOExceptionpublic int byteLength()
NumberOperationsNumberOperations.toByteArray(Number) is used and if
this size is fixed, and -1 if the size may vary depending on the number
instance
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||