Package me.datafox.dfxengine.values
Class StaticValue
java.lang.Object
me.datafox.dfxengine.values.StaticValue
- All Implemented Interfaces:
Comparable<Handled>,Dependency,Dependent,Handled,Value
- Direct Known Subclasses:
MappingOperationModifier.SpecialValue
A numeric value backed with a
Numeral. A static value is immutable, unmodifiable and not identified by a
Handle. More specifically, getHandle() return null, any calls to set(Numeral) and all
apply(...) methods throw UnsupportedOperationException, and all Modifier-related methods return
false with no other action. Static values are primarily meant to be used as immutable parameters for
Modifier implementations in this module (AbstractModifier, OperationModifier and
MappingOperationModifier).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDependent(Dependent dependent) This implementation will always returnfalse.booleanaddDependents(Collection<? extends Dependent> dependencies) This implementation will always returnfalse.booleanaddModifier(Modifier modifier) This implementation will always returnfalse.booleanaddModifiers(Collection<? extends Modifier> modifiers) This implementation will always returnfalse.voidapply(DualParameterOperation operation, MathContext context, Numeral parameter1, Numeral parameter2) This implementation will always throwUnsupportedOperationException.voidapply(Operation operation, MathContext context, Numeral... parameters) This implementation will always throwUnsupportedOperationException.voidapply(SingleParameterOperation operation, MathContext context, Numeral parameter) This implementation will always throwUnsupportedOperationException.voidapply(SourceOperation operation, MathContext context) This implementation will always throwUnsupportedOperationException.booleancanConvert(NumeralType type) This implementation will always returnfalse.booleancompare(Comparison comparison, ComparisonContext context, Numeral other) booleancontainsDependent(Dependent dependent) This implementation will always returnfalse.booleancontainsDependentRecursive(Dependent dependent) This implementation will always returnfalse.booleancontainsDependents(Collection<? extends Dependent> dependents) This implementation will always returnfalse.booleancontainsDependentsRecursive(Collection<? extends Dependent> dependents) This implementation will always returnfalse.booleancontainsModifier(Modifier modifier) This implementation will always returnfalse.booleancontainsModifiers(Collection<? extends Modifier> modifiers) This implementation will always returnfalse.booleanconvert(NumeralType type) This implementation always throwsUnsupportedOperationException.booleanconvertIfAllowed(NumeralType type) This implementation will always returnfalse.This implementation will always return an emptyStream.getBase()This implementation will always return an empty collection.This implementation always returnsnullThis implementation will always return an empty collection.getValue()voidStatic values do not need to be invalidated.voidStatic values do not need to be invalidated.booleanThis implementation always returnstrue.booleanisStatic()This implementation always returnstrue.This implementation will always return an emptyStream.booleanremoveDependent(Dependent dependent) This implementation will always returnfalse.booleanremoveDependents(Collection<? extends Dependent> dependents) This implementation will always returnfalse.booleanremoveModifier(Modifier modifier) This implementation will always returnfalse.booleanremoveModifiers(Collection<? extends Modifier> modifiers) This implementation will always returnfalse.voidThis implementation will always throwUnsupportedOperationException.booleanThis implementation will always throwUnsupportedOperationException.booleanThis implementation will always throwUnsupportedOperationException.booleanThis implementation will always returnfalse.toString()
-
Constructor Details
-
StaticValue
- Parameters:
value-Numeralto initialize this value with
-
-
Method Details
-
getHandle
This implementation always returnsnull -
getBase
-
getValue
-
isStatic
public boolean isStatic()This implementation always returnstrue. -
isImmutable
public boolean isImmutable()This implementation always returnstrue.- Specified by:
isImmutablein interfaceValue- Returns:
trueif this value is static
-
canConvert
This implementation will always returnfalse.- Specified by:
canConvertin interfaceValue- Parameters:
type- ignored parameter- Returns:
false
-
convert
This implementation always throwsUnsupportedOperationException.- Specified by:
convertin interfaceValue- Parameters:
type- ignored parameter- Returns:
- nothing
- Throws:
UnsupportedOperationException- when called
-
convertIfAllowed
This implementation will always returnfalse.- Specified by:
convertIfAllowedin interfaceValue- Parameters:
type- ignored parameter- Returns:
false
-
toInteger
public boolean toInteger()This implementation will always throwUnsupportedOperationException.- Specified by:
toIntegerin interfaceValue- Returns:
- nothing
- Throws:
UnsupportedOperationException- when called
-
toDecimal
public boolean toDecimal()This implementation will always throwUnsupportedOperationException.- Specified by:
toDecimalin interfaceValue- Returns:
- nothing
- Throws:
UnsupportedOperationException- when called
-
toSmallestType
public boolean toSmallestType()This implementation will always returnfalse.- Specified by:
toSmallestTypein interfaceValue- Returns:
false
-
set
This implementation will always throwUnsupportedOperationException.- Specified by:
setin interfaceValue- Parameters:
value- ignored parameter- Throws:
UnsupportedOperationException- when called
-
apply
This implementation will always throwUnsupportedOperationException.- Specified by:
applyin interfaceValue- Parameters:
operation- ignored parametercontext- ignored parameter- Throws:
UnsupportedOperationException- when called
-
apply
This implementation will always throwUnsupportedOperationException.- Specified by:
applyin interfaceValue- Parameters:
operation- ignored parametercontext- ignored parameterparameter- ignored parameter- Throws:
UnsupportedOperationException- when called
-
apply
public void apply(DualParameterOperation operation, MathContext context, Numeral parameter1, Numeral parameter2) This implementation will always throwUnsupportedOperationException.- Specified by:
applyin interfaceValue- Parameters:
operation- ignored parametercontext- ignored parameterparameter1- ignored parameterparameter2- ignored parameter- Throws:
UnsupportedOperationException- when called
-
apply
This implementation will always throwUnsupportedOperationException.- Specified by:
applyin interfaceValue- Parameters:
operation- ignored parametercontext- ignored parameterparameters- ignored parameter- Throws:
UnsupportedOperationException- when called
-
compare
- Specified by:
comparein interfaceValue- Parameters:
comparison-Comparisonto be usedcontext-ComparisonContextfor the comparisonother-Numeralto be compared with- Returns:
trueif the specifiedComparisonreturnstrue
-
getModifiers
This implementation will always return an empty collection.- Specified by:
getModifiersin interfaceValue- Returns:
Set.of()
-
addModifier
This implementation will always returnfalse.- Specified by:
addModifierin interfaceValue- Parameters:
modifier- ignored parameter- Returns:
false
-
addModifiers
This implementation will always returnfalse.- Specified by:
addModifiersin interfaceValue- Parameters:
modifiers- ignored parameter- Returns:
false
-
removeModifier
This implementation will always returnfalse.- Specified by:
removeModifierin interfaceValue- Parameters:
modifier- ignored parameter- Returns:
false
-
removeModifiers
This implementation will always returnfalse.- Specified by:
removeModifiersin interfaceValue- Parameters:
modifiers- ignored parameter- Returns:
false
-
containsModifier
This implementation will always returnfalse.- Specified by:
containsModifierin interfaceValue- Parameters:
modifier- ignored parameter- Returns:
false
-
containsModifiers
This implementation will always returnfalse.- Specified by:
containsModifiersin interfaceValue- Parameters:
modifiers- ignored parameter- Returns:
false
-
invalidate
public void invalidate()Static values do not need to be invalidated.- Specified by:
invalidatein interfaceDependent
-
getDependents
This implementation will always return an empty collection.- Specified by:
getDependentsin interfaceDependency- Returns:
Set.of()
-
invalidateDependents
public void invalidateDependents()Static values do not need to be invalidated.- Specified by:
invalidateDependentsin interfaceDependency
-
addDependent
This implementation will always returnfalse.- Specified by:
addDependentin interfaceDependency- Parameters:
dependent- ignored parameter- Returns:
false
-
addDependents
This implementation will always returnfalse.- Specified by:
addDependentsin interfaceDependency- Parameters:
dependencies- ignored parameter- Returns:
false
-
removeDependent
This implementation will always returnfalse.- Specified by:
removeDependentin interfaceDependency- Parameters:
dependent- ignored parameter- Returns:
false
-
removeDependents
This implementation will always returnfalse.- Specified by:
removeDependentsin interfaceDependency- Parameters:
dependents- ignored parameter- Returns:
false
-
containsDependent
This implementation will always returnfalse.- Specified by:
containsDependentin interfaceDependency- Parameters:
dependent- ignored parameter- Returns:
false
-
containsDependents
This implementation will always returnfalse.- Specified by:
containsDependentsin interfaceDependency- Parameters:
dependents- ignored parameter- Returns:
false
-
containsDependentRecursive
This implementation will always returnfalse.- Specified by:
containsDependentRecursivein interfaceDependency- Parameters:
dependent- ignored parameter- Returns:
false
-
containsDependentsRecursive
This implementation will always returnfalse.- Specified by:
containsDependentsRecursivein interfaceDependency- Parameters:
dependents- ignored parameter- Returns:
false
-
dependentStream
This implementation will always return an emptyStream.- Specified by:
dependentStreamin interfaceDependency- Returns:
Stream.empty()
-
recursiveDependentStream
This implementation will always return an emptyStream.- Specified by:
recursiveDependentStreamin interfaceDependency- Returns:
Stream.empty()
-
toString
-