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