public abstract class Value<S extends Value<S>> extends java.lang.Number implements Multipliable<S,Value<?>>, Subtractable<S,Value<?>>, Negatable<S,S>, Scalable<S>, Incrementable<S>, Self<S>, SelfExpression<S>, Copyable<S>, java.lang.Comparable<Value<?>>, CopyDecouplingExpression<S>
Constructor and Description |
---|
Value() |
Value(java.lang.Number value) |
Value(Value<?> value) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Value<?> other) |
abstract int |
compareToAtSupportedPrecision(Value<?> other) |
abstract S |
divide(Value<?> value) |
abstract double |
doubleValue() |
abstract boolean |
equals(double value) |
abstract boolean |
equals(float value) |
abstract boolean |
equals(int value) |
abstract boolean |
equals(long value) |
abstract boolean |
equals(java.lang.Object that) |
protected abstract boolean |
equals(Value<?> that) |
abstract S |
exponentiate(Value<?> exponential) |
abstract float |
floatValue() |
abstract double |
getDividedPrimitive(double value) |
abstract float |
getDividedPrimitive(float value) |
abstract int |
getDividedPrimitive(int value) |
abstract long |
getDividedPrimitive(long value) |
S |
getExponentiated(Value<?> exponential) |
S |
getModulus() |
S |
getMultiplied(Value<?> value) |
abstract double |
getMultipliedPrimitive(double value) |
abstract float |
getMultipliedPrimitive(float value) |
abstract int |
getMultipliedPrimitive(int value) |
abstract long |
getMultipliedPrimitive(long value) |
S |
getReciprocal() |
S |
getRoot(Value<?> root) |
S |
getSquared() |
S |
getSquareRoot() |
S |
getValue()
This should always return the correct current value for this Expression.
|
abstract int |
intValue() |
Observable<Expression<? extends S>> |
invalidations() |
abstract long |
longValue() |
static <S extends Value<S>> |
maximum(S first,
S second) |
static <S extends Value<S>> |
minimum(S first,
S second) |
abstract S |
modulus() |
abstract S |
multiply(Value<?> value) |
abstract S |
negate() |
protected void |
postUpdate() |
abstract S |
reciprocate() |
abstract S |
root(Value<?> root) |
abstract S |
setValue(java.lang.Number value) |
abstract S |
square() |
abstract S |
squareRoot() |
abstract java.lang.String |
toString() |
abstract S |
unitInTheLastPlaceAbove() |
abstract S |
unitInTheLastPlaceBelow() |
S |
unitInTheLastPlaceLarger() |
S |
unitInTheLastPlaceSmaller() |
protected void |
update() |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSubtracted, subtract
getNegated
divide, divide, divide, divide, getDivided, getDivided, getDivided, getDivided, getDivided, getMultiplied, getMultiplied, getMultiplied, getMultiplied, multiply, multiply, multiply, multiply
decrement, getDecremented, getIncremented, increment
decoupleValue
anonymize, immutable, over, over
public Value()
public Value(java.lang.Number value)
public Value(Value<?> value)
public int compareTo(Value<?> other)
compareTo
in interface java.lang.Comparable<Value<?>>
public abstract S negate()
public abstract S reciprocate()
public S getReciprocal()
public final S getMultiplied(Value<?> value)
getMultiplied
in interface Multipliable<S extends Value<S>,Value<?>>
getMultiplied
in interface Scalable<S extends Value<S>>
public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract S setValue(java.lang.Number value)
public abstract boolean equals(java.lang.Object that)
equals
in class java.lang.Object
protected abstract boolean equals(Value<?> that)
public abstract S unitInTheLastPlaceAbove()
public abstract S unitInTheLastPlaceBelow()
public final S unitInTheLastPlaceLarger()
public final S unitInTheLastPlaceSmaller()
public static <S extends Value<S>> S maximum(S first, S second)
public static <S extends Value<S>> S minimum(S first, S second)
public final S getValue()
Expression
Expression
, i.e. it should be either an immutable class, a const
reference, or a copy of the underlying value. This is important, but
conversely it does not mean that the return value can necessarily be
relied upon not to not mutate when this expression is updated, unless a read
lock is held.
Once a value has been returned, it is up to the implementing Expression as to
whether the value will be reliable such that it will remain the same even if
the conceptual value of this expression subsequently changes, or whether it
will update automatically with the expression. Please only rely on either
behavior if it is explicitly documented, otherwise use
Expression.decoupleValue()
if you need a persistent reference which is safe
to mutate and/or safe from external mutation.
The observers should only ever be notified of an update from the thread which
has the write lock on an Expression
, and Expression
s should
be careful to only notify observers when they are in a state where their
value can be fetched. Immediate fetch is discouraged, though. Expressions
should generally update lazily, not eagerly.
getValue
in interface Expression<S extends Value<S>>
protected final void update()
protected final void postUpdate()
public Observable<Expression<? extends S>> invalidations()
invalidations
in interface Expression<S extends Value<S>>
public abstract boolean equals(double value)
public abstract boolean equals(float value)
public abstract boolean equals(int value)
public abstract boolean equals(long value)
public abstract int compareToAtSupportedPrecision(Value<?> other)
public abstract int getMultipliedPrimitive(int value)
public abstract long getMultipliedPrimitive(long value)
public abstract float getMultipliedPrimitive(float value)
public abstract double getMultipliedPrimitive(double value)
public abstract int getDividedPrimitive(int value)
public abstract long getDividedPrimitive(long value)
public abstract float getDividedPrimitive(float value)
public abstract double getDividedPrimitive(double value)
public abstract int intValue()
intValue
in class java.lang.Number
public abstract long longValue()
longValue
in class java.lang.Number
public abstract float floatValue()
floatValue
in class java.lang.Number
public abstract double doubleValue()
doubleValue
in class java.lang.Number
public abstract S square()
public S getSquared()
public abstract S squareRoot()
public S getSquareRoot()
public abstract S modulus()
public S getModulus()