Class UndefinedDoubleValue
- All Implemented Interfaces:
Cloneable
UndefinedDoubleValue implements the Cloneable interface but returns the same instance when cloned, as all undefined values exhibit the same random behavior.
All arithmetic operations with undefined values result in undefined values, and comparison operations always return false to prevent undefined behavior from appearing as valid comparisons.
- Since:
- 1.0
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionPerforms addition with another value.clone()Returns the same UndefinedDoubleValue instance.booleanequals(int n) Checks if this value equals the specified numeric value.intGets the value interpreted as a signed integer.intGets the value interpreted as an unsigned integer.booleanChecks if this value is in an undefined state.Performs multiplication with another value.set(int n) Sets this value to the specified numeric value.Performs subtraction with another value.
-
Method Details
-
getSigned
public int getSigned()Gets the value interpreted as a signed integer. The sign interpretation depends on the value type and configuration.For UndefinedDoubleValue, returns a random value in the signed range by subtracting ValueMax from the random value to center it around zero.
-
getUnsigned
public int getUnsigned()Gets the value interpreted as an unsigned integer. All negative representations are treated as positive values.For UndefinedDoubleValue, returns a random value in the unsigned range by taking the modulo with ValueMax.
- Specified by:
getUnsignedin classValue- Returns:
- the value as an unsigned integer
-
clone
Returns the same UndefinedDoubleValue instance. Since all undefined values exhibit the same behavior, cloning returns the same instance for efficiency. -
set
Sets this value to the specified numeric value. The behavior depends on the concrete value type - some types may return a new instance while others modify the current instance.For UndefinedDoubleValue, setting a concrete value creates a new SingleValue with that value, effectively "defining" the undefined value as a single-word value.
-
isUndefined
public boolean isUndefined()Checks if this value is in an undefined state. Undefined values represent uninitialized memory or registers.For UndefinedDoubleValue, always returns true since the value is not defined.
- Overrides:
isUndefinedin classValue- Returns:
- true if this value is undefined, false for concrete values
-
add
Performs addition with another value. The operation is performed using the appropriate numeric representation and may handle sign extension or overflow based on the value types involved.For UndefinedDoubleValue, any arithmetic operation results in an undefined value, so returns this instance.
-
sub
Performs subtraction with another value. The operation is performed using the appropriate numeric representation and may handle sign extension or underflow based on the value types involved.For UndefinedDoubleValue, any arithmetic operation results in an undefined value, so returns this instance.
-
mul
Performs multiplication with another value. The operation is performed using the appropriate numeric representation and may handle overflow based on the value types involved.For UndefinedDoubleValue, any arithmetic operation results in an undefined value, so returns this instance.
-
equals
public boolean equals(int n) Checks if this value equals the specified numeric value. The comparison is performed against both signed and unsigned interpretations to handle cases where the same bit pattern can represent different values.For UndefinedDoubleValue, always returns false since equality with an undefined value is undefined and should not be relied upon.
-