public class MutableInteger extends java.lang.Number implements CloneableSerializable, java.lang.Comparable<MutableInteger>, EuclideanRing<MutableInteger>, Vectorizable
Modifier and Type | Field and Description |
---|---|
int |
value
The value.
|
Constructor and Description |
---|
MutableInteger()
Creates an
MutableInteger with an initial value of zero. |
MutableInteger(int value)
Creates an
MutableInteger with the given value. |
MutableInteger(MutableInteger other)
Creates a copy of a
MutableInteger . |
Modifier and Type | Method and Description |
---|---|
MutableInteger |
clone()
Creates a new clone (shallow copy) of this object.
|
int |
compareTo(MutableInteger other) |
void |
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters.
|
Vector1 |
convertToVector()
Converts the object to a vector.
|
MutableInteger |
divide(MutableInteger other)
Divides
this value by the other value, returning the
result of the division as a new value. |
void |
divideEquals(MutableInteger other)
Inline divises
this value by the other value, storing
the result inside this . |
MutableInteger |
dotTimes(MutableInteger other)
Element-wise multiplication of
this and other |
void |
dotTimesEquals(MutableInteger other)
Inline element-wise multiplication of
this and
other |
double |
doubleValue() |
boolean |
equals(int other)
Determines if this MutableInteger's value is equal to a given integer.
|
boolean |
equals(MutableInteger other)
Determines if this MutableInteger is equal to another MutableInteger.
|
boolean |
equals(MutableInteger other,
double effectiveZero)
Determines if two RingType objects are effectively equal
|
boolean |
equals(java.lang.Object other)
Determines if two RingType objects are equal
|
float |
floatValue() |
int |
getValue()
Gets the value stored in the object.
|
int |
hashCode() |
int |
intValue() |
boolean |
isZero()
Determines if this ring is equal to zero.
|
boolean |
isZero(double effectiveZero)
Determines if this ring is equal to zero using the element-wise effective
zero value.
|
long |
longValue() |
MutableInteger |
minus(MutableInteger other)
Arithmetic subtraction of
other from this |
void |
minusEquals(MutableInteger other)
Inline arithmetic subtraction of
other from
this |
MutableInteger |
negative()
Returns the element-wise negation of
this , such that
this.plus( this.negative() ) has only zero elements. |
void |
negativeEquals()
Inline element-wise negation of
this |
MutableInteger |
plus(MutableInteger other)
Arithmetic addition of
this and other |
void |
plusEquals(MutableInteger other)
Inline arithmetic addition of
this and other |
MutableInteger |
scale(double scaleFactor)
Element-wise scaling of
this by scaleFactor |
MutableInteger |
scaledMinus(double scaleFactor,
MutableInteger other)
Arithmetic subtraction
other after element-wise scaling of
other by scaleFactor from this . |
void |
scaledMinusEquals(double scaleFactor,
MutableInteger other)
Inline arithmetic subtraction of
other after element-wise
scaling of other by scaleFactor from this . |
MutableInteger |
scaledPlus(double scaleFactor,
MutableInteger other)
Arithmetic addition of
this and other after
element-wise scaling of other by scaleFactor . |
void |
scaledPlusEquals(double scaleFactor,
MutableInteger other)
Inline arithmetic addition of
this and other after
element-wise scaling of other by scaleFactor . |
void |
scaleEquals(double scaleFactor)
Inline element-wise scaling of
this by
scaleFactor |
void |
setValue(int value)
Sets the value stored in the object.
|
MutableInteger |
times(MutableInteger other)
Multiplies
this value by the other value, returning the
result of the multiplication as a new value. |
void |
timesEquals(MutableInteger other)
Inline multiplies
this value by the other value,
storing the result inside this . |
java.lang.String |
toString() |
void |
zero()
Zeros out all elements of
this , so that the following are
equivalent
r1.scaleEquals( 0.0 );
and
r1.zero();
Furthermore,
r1.zero(); anything.dotTimes( r1 ).equals( r1 ); |
public int value
public MutableInteger()
MutableInteger
with an initial value of zero.public MutableInteger(int value)
MutableInteger
with the given value.value
- The value to store in the object.public MutableInteger(MutableInteger other)
MutableInteger
.other
- The other value.public MutableInteger clone()
CloneableSerializable
clone
in interface Vectorizable
clone
in interface Ring<MutableInteger>
clone
in interface CloneableSerializable
clone
in class java.lang.Object
public boolean equals(java.lang.Object other)
Ring
equals
in interface Ring<MutableInteger>
equals
in class java.lang.Object
other
- RingType to compare against this
public boolean equals(MutableInteger other)
other
- The other value.public boolean equals(int other)
other
- An integer.public int compareTo(MutableInteger other)
compareTo
in interface java.lang.Comparable<MutableInteger>
public int hashCode()
hashCode
in class java.lang.Object
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number
public int getValue()
public void setValue(int value)
value
- The value.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(MutableInteger other, double effectiveZero)
Ring
equals
in interface Ring<MutableInteger>
other
- RingType to compare against this
effectiveZero
- tolerance threshold for element-wise equalitypublic MutableInteger plus(MutableInteger other)
Ring
this
and other
plus
in interface Ring<MutableInteger>
other
- object to add to this
this
and other
public void plusEquals(MutableInteger other)
Ring
this
and other
plusEquals
in interface Ring<MutableInteger>
other
- object to add to this
public MutableInteger minus(MutableInteger other)
Ring
other
from this
minus
in interface Ring<MutableInteger>
other
- object to subtract from this
this
and other
public void minusEquals(MutableInteger other)
Ring
other
from
this
minusEquals
in interface Ring<MutableInteger>
other
- object to subtract from this
public MutableInteger times(MutableInteger other)
EuclideanRing
this
value by the other
value, returning the
result of the multiplication as a new value.times
in interface EuclideanRing<MutableInteger>
other
- The other value.public void timesEquals(MutableInteger other)
EuclideanRing
this
value by the other
value,
storing the result inside this
.timesEquals
in interface EuclideanRing<MutableInteger>
other
- The other value.public MutableInteger divide(MutableInteger other)
EuclideanRing
this
value by the other
value, returning the
result of the division as a new value.divide
in interface EuclideanRing<MutableInteger>
other
- The other value.public void divideEquals(MutableInteger other)
EuclideanRing
this
value by the other
value, storing
the result inside this
.divideEquals
in interface EuclideanRing<MutableInteger>
other
- The other value.public MutableInteger dotTimes(MutableInteger other)
Ring
this
and other
dotTimes
in interface Ring<MutableInteger>
other
- elements of other will be multiplied to the corresponding
elements of this
this
and
other
public void dotTimesEquals(MutableInteger other)
Ring
this
and
other
dotTimesEquals
in interface Ring<MutableInteger>
other
- elements of other will be multiplied to the corresponding
elements of this
public MutableInteger scale(double scaleFactor)
Ring
this
by scaleFactor
scale
in interface Ring<MutableInteger>
scaleFactor
- amount to scale the elements of this
this
public void scaleEquals(double scaleFactor)
Ring
this
by
scaleFactor
scaleEquals
in interface Ring<MutableInteger>
scaleFactor
- amount to scale the elements of this
public MutableInteger scaledPlus(double scaleFactor, MutableInteger other)
Ring
this
and other
after
element-wise scaling of other
by scaleFactor
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x + a * y. It is typically a more efficient way of doing
this.plus(other.scale(scaleFactor))
since it can avoid
intermediate object creation.scaledPlus
in interface Ring<MutableInteger>
scaleFactor
- The scale factor to multiply by the elements of other before
adding to the elements of this.other
- Object to scale and then add to this.public void scaledPlusEquals(double scaleFactor, MutableInteger other)
Ring
this
and other
after
element-wise scaling of other
by scaleFactor
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x += a * y. It is typically a more efficient way of doing
this.plusEquals(other.scale(scaleFactor))
since it can avoid
intermediate object creation.scaledPlusEquals
in interface Ring<MutableInteger>
scaleFactor
- The scale factor to multiply by the elements of other before
adding to the elements of this.other
- Object to scale and then add to this.public MutableInteger scaledMinus(double scaleFactor, MutableInteger other)
Ring
other
after element-wise scaling of
other
by scaleFactor
from this
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x - a * y. It is typically a more efficient way of doing
this.minus(other.scale(scaleFactor))
since it can avoid
intermediate object creation.scaledMinus
in interface Ring<MutableInteger>
scaleFactor
- The scale factor to multiply by the elements of other before
subtracting from the elements of this.other
- Object to scale and then subtract from this.public void scaledMinusEquals(double scaleFactor, MutableInteger other)
Ring
other
after element-wise
scaling of other
by scaleFactor
from this
.
If this is x, other is y, and scaleFactor is a, then this method is
equivalent to x -= a * y. It is typically a more efficient way of doing
this.minusEquals(other.scale(scaleFactor))
since it can avoid
intermediate object creation.scaledMinusEquals
in interface Ring<MutableInteger>
scaleFactor
- The scale factor to multiply by the elements of other before
adding to the elements of this.other
- Object to scale and then add to this.public MutableInteger negative()
Ring
this
, such that
this.plus( this.negative() )
has only zero elements.negative
in interface Ring<MutableInteger>
this
public void negativeEquals()
Ring
this
negativeEquals
in interface Ring<MutableInteger>
public void zero()
Ring
this
, so that the following are
equivalent
r1.scaleEquals( 0.0 );
and
r1.zero();
Furthermore,
r1.zero(); anything.dotTimes( r1 ).equals( r1 );zero
in interface Ring<MutableInteger>
public boolean isZero()
Ring
isZero
in interface Ring<MutableInteger>
public boolean isZero(double effectiveZero)
Ring
isZero
in interface Ring<MutableInteger>
effectiveZero
- Tolerance threshold for element-wise equalitypublic Vector1 convertToVector()
Vectorizable
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
Vectorizable
convertFromVector
in interface Vectorizable
parameters
- The parameters to incorporate.