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 Type
    Method
    Description
    bounded(String channel, int minimumValue, int maximumValue)
    Creates a channel with a bounded inclusive range and clamping normalization.
    Returns the lower-case channel identifier.
    default int
    Returns the largest value advertised by this definition.
    default int
    Returns the smallest value advertised by this definition.
    default boolean
    isValueValid(int value)
    Checks whether a value is already valid without normalization.
    default int
    normalizeValue(int value)
    Converts a stored value to the value used by the structure definition.
    unbounded(String channel)
    Creates a channel accepting every positive integer.
  • Method Details

    • bounded

      static IChannelDefinition bounded(String channel, int minimumValue, int maximumValue)
      Creates a channel with a bounded inclusive range and clamping normalization.
      Parameters:
      channel - channel identifier
      minimumValue - inclusive minimum value
      maximumValue - inclusive maximum value
      Returns:
      bounded channel definition
    • unbounded

      static IChannelDefinition unbounded(String channel)
      Creates a channel accepting every positive integer.
      Parameters:
      channel - channel identifier
      Returns:
      unbounded channel definition
    • getChannel

      String getChannel()
      Returns the lower-case channel identifier.
      Returns:
      channel identifier
    • getMinimumValue

      default int getMinimumValue()
      Returns the smallest value advertised by this definition. The default is 1.
      Returns:
      minimum value
    • getMaximumValue

      default int getMaximumValue()
      Returns the largest value advertised by this definition. The default is Integer.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