Package me.datafox.dfxengine.values.api
Interface ValueMap
- All Known Implementing Classes:
DelegatedValueMap
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddModifier(Modifier modifier) booleanaddModifiers(Collection<? extends Modifier> modifiers) default voidapply(DualParameterOperation operation, Collection<? extends Handle> handles, Numeral parameter1, Numeral parameter2) default voidapply(DualParameterOperation operation, Numeral parameter1, Numeral parameter2) UsesMathContext.defaults()for context.voidapply(DualParameterOperation operation, MapMathContext context, Collection<? extends Handle> handles, Numeral parameter1, Numeral parameter2) voidapply(DualParameterOperation operation, MathContext context, Numeral parameter1, Numeral parameter2) default voidapply(Operation operation, Collection<? extends Handle> handles, Numeral... parameters) default voiddefault voidUsesMathContext.defaults()for context.voidapply(Operation operation, MapMathContext context, Collection<? extends Handle> handles, Numeral... parameters) voidvoidapply(Operation operation, MathContext context, Numeral... parameters) default voidapply(SingleParameterOperation operation, Collection<? extends Handle> handles, Numeral parameter) default voidapply(SingleParameterOperation operation, Map<? extends Handle, Numeral> parameters) default voidapply(SingleParameterOperation operation, Numeral parameter) UsesMathContext.defaults()for context.voidapply(SingleParameterOperation operation, MapMathContext context, Collection<? extends Handle> handles, Numeral parameter) voidapply(SingleParameterOperation operation, MapMathContext context, Map<? extends Handle, Numeral> parameters) voidapply(SingleParameterOperation operation, MathContext context, Numeral parameter) default voidapply(SourceOperation operation) UsesMathContext.defaults()for context.default voidapply(SourceOperation operation, Collection<? extends Handle> handles) voidapply(SourceOperation operation, MapMathContext context, Collection<? extends Handle> handles) voidapply(SourceOperation operation, MathContext context) default booleancompare(Comparison comparison, Collection<? extends Handle> handles, Numeral other) UsesMapComparisonContext.defaults()for context.default booleancompare(Comparison comparison, Map<? extends Handle, Numeral> others) UsesMapComparisonContext.defaults()for context.default booleancompare(Comparison comparison, Numeral other) UsesComparisonContext.defaults()for context.booleancompare(Comparison comparison, ComparisonContext context, Numeral other) booleancompare(Comparison comparison, MapComparisonContext context, Collection<? extends Handle> handles, Numeral other) booleancompare(Comparison comparison, MapComparisonContext context, Map<? extends Handle, Numeral> others) booleancontainsModifier(Modifier modifier) booleancontainsModifiers(Collection<? extends Modifier> modifiers) voidconvert(Collection<? extends Handle> handles, NumeralType type) voidconvert(Map<? extends Handle, NumeralType> types) voidconvert(NumeralType type) voidconvertAllowed(NumeralType type) Only convertsValuesof this map that can be converted to the specified type.booleanbooleanremoveModifier(Modifier modifier) booleanremoveModifiers(Collection<? extends Modifier> modifiers) default voidset(Collection<? extends Handle> handles, Numeral value) default voidvoidvoidset(MapMathContext context, Collection<? extends Handle> handles, Numeral value) voidset(MapMathContext context, Map<? extends Handle, Numeral> values) voidConverts allValuesto the smallest decimal type that can hold its represented value.voidConverts allValuesto the smallest integer type that can hold its represented value.voidConverts allValuesto the smallest type that can hold its represented value.voidtoSmallestType(Collection<? extends Handle> handles) Converts specifiedValuesto the smallest type that can hold its represented value.Methods inherited from interface me.datafox.dfxengine.handles.api.HandleMap
containsKey, containsKeys, get, getByTag, getByTags, getOrDefault, getSpace, put, putAll, putHandled, putIfAbsent, remove, remove, unmodifiableMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, hashCode, isEmpty, keySet, merge, replace, replace, replaceAll, size, values
-
Method Details
-
isImmutable
boolean isImmutable()- Returns:
trueif this map is for immutableValues
-
convert
- Parameters:
type-NumeralTypefor theValuesto be converted to- Throws:
ExtendedArithmeticException- if any of theValuesin this map cannot be converted to the specified typeNullPointerException- if the specified type isnullIllegalArgumentException- if the specified type is notnull, but it is not recognised as any of the elements ofNumeralType. This should never happenUnsupportedOperationException- if this map is for immutableValues
-
convert
- Parameters:
handles-Handlesof theValuesto be convertedtype-NumeralTypefor theValuesto be converted to- Throws:
ExtendedArithmeticException- if any of the specified values in this map cannot be converted to the specified typeNullPointerException- if the specified type isnullIllegalArgumentException- if the specified type is notnull, but it is not recognised as any of the elements ofNumeralType. This should never happenUnsupportedOperationException- if this map is for immutableValues
-
convert
- Parameters:
types- map ofHandlesandNumeralTypesfor theValuesrepresented by those Handles to be converted to.- Throws:
ExtendedArithmeticException- if any of the specified values in this map cannot be converted to the specified typeNullPointerException- if the specified type isnullIllegalArgumentException- if the specified type is notnull, but it is not recognised as any of the elements ofNumeralType. This should never happenUnsupportedOperationException- if this map is for immutableValues
-
convertAllowed
Only convertsValuesof this map that can be converted to the specified type. In other words, callsNumeral.convertIfAllowed(NumeralType)on every Value of this map.- Parameters:
type-NumeralTypefor theValuesto be converted to- Throws:
NullPointerException- if the specified type isnullIllegalArgumentException- if the specified type is notnull, but it is not recognised as any of the elements ofNumeralType. This should never happen
-
toInteger
void toInteger()Converts allValuesto the smallest integer type that can hold its represented value. Values that are already integers are not converted.- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
toDecimal
void toDecimal()Converts allValuesto the smallest decimal type that can hold its represented value. Values that are already decimals are not converted.- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
toSmallestType
void toSmallestType()Converts allValuesto the smallest type that can hold its represented value. Will not convert between integer and decimal representations. -
toSmallestType
Converts specifiedValuesto the smallest type that can hold its represented value. Will not convert between integer and decimal representations.Handlesthat are not a part of this map's associatedSpaceare ignored.- Parameters:
handles-Handlesof the values to be converted
-
set
- Parameters:
value-Numeralfor allValuesof this map to be set to- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
set
- Parameters:
context-MapMathContextfor this operationhandles-Handlesof the values to be changedvalue-Numeralfor specifiedValuesof this map to be set to- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
set
- Parameters:
context-MapMathContextfor this operationvalues- map ofHandlesto be changed andNumeralsfor the specifiedValuesto be set to- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
- Parameters:
operation-SourceOperationto be applied to allValuesof this mapcontext-MathContextfor the operation- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
- Parameters:
operation-SourceOperationto be applied to specifiedValuesof this mapcontext-MapMathContextfor the operationhandles-Handlesof theValuesto be modified- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
- Parameters:
operation-SingleParameterOperationto be applied to allValuesof this mapcontext-MathContextfor the operationparameter- parameter for the operation- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
void apply(SingleParameterOperation operation, MapMathContext context, Collection<? extends Handle> handles, Numeral parameter) - Parameters:
operation-SingleParameterOperationto be applied to specifiedValuesof this mapcontext-MapMathContextfor the operationhandles-Handlesof theValuesto be modifiedparameter- parameter for the operation- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
void apply(SingleParameterOperation operation, MapMathContext context, Map<? extends Handle, Numeral> parameters) - Parameters:
operation-SingleParameterOperationto be applied to specifiedValuesof this mapcontext-MapMathContextfor the operationparameters- map ofHandlesof theValuesto be modified andNumeralsto be used as parameters for the operation- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
void apply(DualParameterOperation operation, MathContext context, Numeral parameter1, Numeral parameter2) - Parameters:
operation-DualParameterOperationto be applied to allValuesof this mapcontext-MathContextfor the operationparameter1- first parameter for the operationparameter2- second parameter for the operation- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
void apply(DualParameterOperation operation, MapMathContext context, Collection<? extends Handle> handles, Numeral parameter1, Numeral parameter2) - Parameters:
operation-DualParameterOperationto be applied to specifiedValuesof this mapcontext-MapMathContextfor the operationhandles-Handlesof theValuesto be modifiedparameter1- first parameter for the operationparameter2- second parameter for the operation- Throws:
UnsupportedOperationException- if this map is for immutableValues
-
apply
- Parameters:
operation-Operationto be applied to allValuesof this mapcontext-MathContextfor the operationparameters- parameters for the operation- Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()UnsupportedOperationException- if this map is for immutableValues
-
apply
void apply(Operation operation, MapMathContext context, Collection<? extends Handle> handles, Numeral... parameters) - Parameters:
operation-Operationto be applied to allValuesof this mapcontext-MathContextfor the operationhandles-Handlesof theValuesto be modifiedparameters- parameters for the operation- Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()UnsupportedOperationException- if this map is for immutableValues
-
apply
- Parameters:
operation-Operationto be applied to allValuesof this mapcontext-MathContextfor the operationparameters- map ofHandlesof theValuesto be modified andNumeralsto be used as parameters for the operation- Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()UnsupportedOperationException- if this map is for immutableValues
-
compare
- Parameters:
comparison-Comparisonto be usedcontext-ComparisonContextfor the comparisonother-Numeralto be compared to- Returns:
trueif theComparisonreturnstruefor allValuesof this map
-
compare
boolean compare(Comparison comparison, MapComparisonContext context, Collection<? extends Handle> handles, Numeral other) - Parameters:
comparison-Comparisonto be usedcontext-MapComparisonContextfor the comparisonhandles-Handlesof theValuesto be comparedother-Numeralto be compared to- Returns:
trueif theComparisonreturnstruefor allValuesof this map represented by the specified keys
-
compare
boolean compare(Comparison comparison, MapComparisonContext context, Map<? extends Handle, Numeral> others) - Parameters:
comparison-Comparisonto be usedcontext-MapComparisonContextfor the comparisonothers- map ofHandlesof theValuesto be compared andNumeralsto be compared to- Returns:
trueif theComparisonreturnstruefor allValuesof this map represented by the specified keys
-
getBaseNumeralMap
- Returns:
Mapcontaining all entries of this map, but with the return value ofValue.getBase()as the map values. The returned map does not have any state and instead provides a view to this map
-
getValueNumeralMap
- Returns:
Mapcontaining all entries of this map, but with the return value ofValue.getValue()as the map values. The returned map does not have any state and instead provides a view to this map
-
getModifiers
Collection<Modifier> getModifiers()- Returns:
Modifiersassociated with this map
-
addModifier
Modifiersadded to this map will be added to allValuesof this map, including ones that are added to this map after this operation. To add a modifier to a single value, useValue.addModifier(Modifier)instead. -
addModifiers
Modifiersadded to this map will be added to allValuesof this map, including ones that are added to this map after this operation. To add modifiers to a single value, useValue.addModifiers(Collection)} instead. -
removeModifier
-
removeModifiers
-
containsModifier
-
containsModifiers
-
set
Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context. -
set
Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context. -
apply
UsesMathContext.defaults()for context.- Parameters:
operation-SourceOperationto be applied to allValuesof this map
-
apply
Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context.- Parameters:
operation-SourceOperationto be applied to specifiedValuesof this maphandles-Handlesof theValuesto be modified
-
apply
UsesMathContext.defaults()for context.- Parameters:
operation-SingleParameterOperationto be applied to allValuesof this mapparameter- parameter for the operation
-
apply
default void apply(SingleParameterOperation operation, Collection<? extends Handle> handles, Numeral parameter) Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context.- Parameters:
operation-SingleParameterOperationto be applied to specifiedValuesof this maphandles-Handlesof theValuesto be modifiedparameter- parameter for the operation
-
apply
Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context.- Parameters:
operation-SingleParameterOperationto be applied to specifiedValuesof this mapparameters- map ofHandlesof theValuesto be modified andNumeralsto be used as parameters for the operation
-
apply
UsesMathContext.defaults()for context.- Parameters:
operation-DualParameterOperationto be applied to allValuesof this mapparameter1- first parameter for the operationparameter2- second parameter for the operation
-
apply
default void apply(DualParameterOperation operation, Collection<? extends Handle> handles, Numeral parameter1, Numeral parameter2) Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context.- Parameters:
operation-DualParameterOperationto be applied to specifiedValuesof this maphandles-Handlesof theValuesto be modifiedparameter1- first parameter for the operationparameter2- second parameter for the operation
-
apply
UsesMathContext.defaults()for context.- Parameters:
operation-Operationto be applied to allValuesof this mapparameters- parameters for the operation- Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()
-
apply
default void apply(Operation operation, Collection<? extends Handle> handles, Numeral... parameters) Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context.- Parameters:
operation-Operationto be applied to allValuesof this maphandles-Handlesof theValuesto be modifiedparameters- parameters for the operation- Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()
-
apply
Handlesthat are not a part of this map's associatedSpaceare ignored. UsesMapMathContext.defaults()for context.- Parameters:
operation-Operationto be applied to allValuesof this mapparameters- map ofHandlesof theValuesto be modified andNumeralsto be used as parameters for the operation- Throws:
IllegalArgumentException- if the amount of parameters is not equal toOperation.getParameterCount()
-
compare
UsesComparisonContext.defaults()for context.- Parameters:
comparison-Comparisonto be usedother-Numeralto be compared to- Returns:
trueif theComparisonreturnstruefor allValuesof this map
-
compare
UsesMapComparisonContext.defaults()for context.- Parameters:
comparison-Comparisonto be usedhandles-Handlesof theValuesto be comparedother-Numeralto be compared to- Returns:
trueif theComparisonreturnstruefor allValuesof this map represented by the specified keys
-
compare
UsesMapComparisonContext.defaults()for context.- Parameters:
comparison-Comparisonto be usedothers- map ofHandlesof theValuesto be compared andNumeralsto be compared to- Returns:
trueif theComparisonreturnstruefor allValuesof this map represented by the specified keys
-