|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.math.AbstractNumberOps<Integer>
ch.javasoft.math.IntegerOperations
public class IntegerOperations
Number operations for Integer numbers.
A singleton instance exists for this class.
| Constructor Summary | |
|---|---|
IntegerOperations()
|
|
| Method Summary | |
|---|---|
Integer |
abs(Integer number)
Returns the absolute value of the given number, i.e. |
Integer |
add(Integer numA,
Integer 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(Integer o1,
Integer o2)
|
Integer |
divide(Integer numA,
Integer numB)
Returns the ratio of the two values, i.e. |
Integer |
fromByteArray(byte[] bytes)
Converts the byte array containing binary data into a new number instance. |
static IntegerOperations |
instance()
Returns the singleton instance |
Integer |
invert(Integer number)
Returns the inverted value, i.e. |
boolean |
isOne(Integer number)
Returns true if this value is numerically equal to one, i.e. |
boolean |
isZero(Integer number)
Returns true if this value is numerically equal to zero, i.e. |
Integer |
multiply(Integer numA,
Integer numB)
Returns the product of the two values, i.e. |
Integer |
negate(Integer number)
Returns the negated value, i.e. |
Integer[] |
newArray(int size)
Create a new array of the underlying number type |
Integer[][] |
newArray(int rows,
int cols)
Create a new 2 dimensional array of the underlying number type |
Class<Integer> |
numberClass()
The class representing numbers of this number operations instance |
Integer |
one()
Returns the value representing one |
Integer |
pow(Integer numA,
Integer numB)
Returns the powered value, i.e. |
Integer |
readFrom(DataInput in)
Reads binary data from the given data input. |
Integer |
reduce(Integer number)
Converts the number into some reduced form. |
Integer[] |
reduceVector(boolean cloneOnChange,
Integer... vector)
Converts a vector into some reduced form. |
int |
signum(Integer number)
Returns signum of the value, i.e. |
Integer |
subtract(Integer numA,
Integer numB)
Returns the difference of the two values, i.e. |
byte[] |
toByteArray(Integer number)
Converts this number to binary data and returns it as a byte array. |
Integer |
valueOf(double value)
Create an instance of the underlying number type based on the submitted double value |
Integer |
valueOf(long value)
Create an instance of the underlying number type based on the submitted long integer value |
Integer |
valueOf(Number number)
Create an instance of the underlying number type based on the submitted number |
Integer |
valueOf(String s)
Create an instance of the underlying number type based on the given string representation of the number |
void |
writeTo(Integer number,
DataOutput out)
Converts this number to binary data and writes it to the data output. |
Integer |
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 IntegerOperations()
| Method Detail |
|---|
public static IntegerOperations instance()
public Class<Integer> numberClass()
NumberOperations
public Integer abs(Integer number)
NumberOperations
abs in interface NumberOperations<Integer>abs in class AbstractNumberOps<Integer>
public Integer add(Integer numA,
Integer numB)
NumberOperations
public Integer[] newArray(int size)
NumberOperations
public Integer[][] newArray(int rows,
int cols)
NumberOperations
public Integer valueOf(String s)
NumberOperations
public Integer valueOf(Number number)
NumberOperations
public Integer valueOf(long value)
NumberOperations
public Integer valueOf(double value)
NumberOperations
public Integer divide(Integer numA,
Integer numB)
NumberOperationsFor integer types, an integer division is performed, ignoring possible remainders
public Integer invert(Integer number)
NumberOperations
invert in interface NumberOperations<Integer>invert in class AbstractNumberOps<Integer>public boolean isOne(Integer number)
NumberOperations
isOne in interface NumberOperations<Integer>isOne in class AbstractNumberOps<Integer>public boolean isZero(Integer number)
NumberOperations
isZero in interface NumberOperations<Integer>isZero in class AbstractNumberOps<Integer>
public Integer multiply(Integer numA,
Integer numB)
NumberOperations
public Integer negate(Integer number)
NumberOperations
public Integer reduce(Integer number)
NumberOperations
public Integer[] reduceVector(boolean cloneOnChange,
Integer... 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 Integer one()
NumberOperations
public Integer pow(Integer numA,
Integer numB)
NumberOperations
public int signum(Integer number)
NumberOperations
public Integer subtract(Integer numA,
Integer numB)
NumberOperations
public Integer zero()
NumberOperations
public int compare(Integer o1,
Integer o2)
public byte[] toByteArray(Integer number)
NumberOperationsNumberOperations.fromByteArray(byte[]) method.
public void writeTo(Integer number,
DataOutput out)
throws IOException
NumberOperationsNumberOperations.readFrom(DataInput).
IOExceptionpublic Integer fromByteArray(byte[] bytes)
NumberOperationsNumberOperations.toByteArray(Number) method.
public Integer 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 | |||||||||