Interface State<S extends State<S>>

    • Method Detail

      • stateProperty

        <T extends java.lang.Comparable<T>> java.util.Optional<T> stateProperty​(StateProperty<T> stateProperty)
        Gets the Comparable value for the specific StateProperty such that if the State does not support the StateProperty, Optional.empty() is returned.
        Type Parameters:
        T - The generic type of state property
        Parameters:
        stateProperty - The state property
        Returns:
        The comparable value, if available and compatible
      • stateProperty

        default <T extends java.lang.Comparable<T>> java.util.Optional<T> stateProperty​(java.util.function.Supplier<? extends StateProperty<T>> stateProperty)
        Gets the Comparable value for the specific StateProperty such that if the State does not support the StateProperty, Optional.empty() is returned.
        Type Parameters:
        T - The generic type of state property
        Parameters:
        stateProperty - The state property
        Returns:
        The comparable value, if available and compatible
      • findStateProperty

        java.util.Optional<StateProperty<?>> findStateProperty​(java.lang.String name)
        Attempts to retrieve the StateProperty instance associated with this States StateContainer by name. If there is no StateProperty available, Optional.empty() is returned.
        Parameters:
        name - The state property name
        Returns:
        The state property, if available
      • withStateProperty

        <T extends java.lang.Comparable<T>,​V extends T> java.util.Optional<S> withStateProperty​(StateProperty<T> stateProperty,
                                                                                                      V value)
        Gets the State with the appropriate value for the given StateProperty. If the StateProperty is not supported, Optional.empty() is returned. If the object is not either an instance contained in StateProperty.possibleValues() or an instance Object.toString(), Optional.empty() may be returned.
        Type Parameters:
        T - The type of cycleable value
        V - The type of extended value
        Parameters:
        stateProperty - The state property
        value - The value
        Returns:
        The state, if the state property and value are supported
      • withStateProperty

        default <T extends java.lang.Comparable<T>,​V extends T> java.util.Optional<S> withStateProperty​(java.util.function.Supplier<? extends StateProperty<T>> stateProperty,
                                                                                                              V value)
        Gets the State with the appropriate value for the given StateProperty. If the StateProperty is not supported, Optional.empty() is returned. If the object is not either an instance contained in StateProperty.possibleValues() or an instance Object.toString(), Optional.empty() may be returned.
        Type Parameters:
        T - The type of cycleable value
        V - The type of extended value
        Parameters:
        stateProperty - The state property
        value - The value
        Returns:
        The state, if the state property and value are supported
      • cycleStateProperty

        <T extends java.lang.Comparable<T>> java.util.Optional<S> cycleStateProperty​(StateProperty<T> stateProperty)
        Cycles to the next possible value of the StateProperty and returns the new State. Returns Optional.empty() if the state property or the value isn't supported.
        Type Parameters:
        T - The type of cycleable value
        Parameters:
        stateProperty - The state property
        Returns:
        The cycled state if successful
      • cycleStateProperty

        default <T extends java.lang.Comparable<T>> java.util.Optional<S> cycleStateProperty​(java.util.function.Supplier<? extends StateProperty<T>> stateProperty)
        Cycles to the next possible value of the StateProperty and returns the new State. Returns Optional.empty() if the state property or the value isn't supported.
        Type Parameters:
        T - The type of cycleable value
        Parameters:
        stateProperty - The state property
        Returns:
        The cycled state if successful
      • cycleValue

        <T extends Cycleable<T>> java.util.Optional<S> cycleValue​(Key<? extends Value<T>> key)
        Cycles to the next possible value of the Key and returns the new State. Returns Optional.empty() if the key or the value isn't supported.
        Type Parameters:
        T - The type of cycleable value
        Parameters:
        key - The key
        Returns:
        The cycled state if successful
      • cycleValue

        default <T extends Cycleable<T>> java.util.Optional<S> cycleValue​(java.util.function.Supplier<? extends Key<? extends Value<T>>> key)
        Cycles to the next possible value of the Key and returns the new State. Returns Optional.empty() if the key or the value isn't supported.
        Type Parameters:
        T - The type of cycleable value
        Parameters:
        key - The key
        Returns:
        The cycled state if successful
      • stateProperties

        java.util.Collection<StateProperty<?>> stateProperties()
        Gets an immutable Collection of all applicable StatePropertys for this State.
        Returns:
        An immutable collection of all applicable state properties
      • statePropertyValues

        java.util.Collection<?> statePropertyValues()
        Gets an immutable Collection of all the values for all StatePropertys for this State.
        Returns:
        An immutable collection of all the values for all applicable properties
      • statePropertyMap

        java.util.Map<StateProperty<?>,​?> statePropertyMap()
        Gets an immutable or unmodifiable Map of the known StatePropertys to their current values for this State.
        Returns:
        The immutable map of state properties to their values representing this state
      • toString

        java.lang.String toString()
        The String representation of this State can be considered to be equal to the representation of this state as a serialized form.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The serialized string