Interface IChannelDefinition
public interface IChannelDefinition
Describes a channel used by one structure definition.
Channel values are integers stored on the constructable trigger item. Implementations may override the default validation and normalization policy when a simple bounded range is not sufficient.
-
Method Summary
Modifier and TypeMethodDescriptionstatic IChannelDefinitionCreates a channel with a bounded inclusive range and clamping normalization.Returns the lower-case channel identifier.default intReturns the largest value advertised by this definition.default intReturns the smallest value advertised by this definition.default booleanisValueValid(int value) Checks whether a value is already valid without normalization.default intnormalizeValue(int value) Converts a stored value to the value used by the structure definition.static IChannelDefinitionCreates a channel accepting every positive integer.
-
Method Details
-
bounded
Creates a channel with a bounded inclusive range and clamping normalization.- Parameters:
channel- channel identifierminimumValue- inclusive minimum valuemaximumValue- inclusive maximum value- Returns:
- bounded channel definition
-
unbounded
Creates a channel accepting every positive integer.- Parameters:
channel- channel identifier- Returns:
- unbounded channel definition
-
getChannel
-
getMinimumValue
default int getMinimumValue()Returns the smallest value advertised by this definition. The default is1.- Returns:
- minimum value
-
getMaximumValue
default int getMaximumValue()Returns the largest value advertised by this definition. The default isInteger.MAX_VALUE.- Returns:
- maximum value
-
isValueValid
default boolean isValueValid(int value) Checks whether a value is already valid without normalization.- Parameters:
value- value to check- Returns:
- true when the value is valid
-
normalizeValue
default int normalizeValue(int value) Converts a stored value to the value used by the structure definition.- Parameters:
value- stored value- Returns:
- normalized value
-