Class ZestLoopState<T>

    • Constructor Detail

      • ZestLoopState

        protected ZestLoopState()
        Instantiates a new zest loop state.
      • ZestLoopState

        protected ZestLoopState​(ZestLoopTokenSet<T> initializationTokenSet)
        main construptor.
        Parameters:
        initializationTokenSet - the set of token and the fisrt value to consider inside the loop
    • Method Detail

      • getCurrentToken

        public T getCurrentToken()
        returns the current token considered inside the loop.
        Returns:
        the current token considered inside the loop
      • setCurrentToken

        protected T setCurrentToken​(T newToken)
        Sets the current token.
        Parameters:
        newToken - the new token
        Returns:
        the previous token
      • getCurrentIndex

        public int getCurrentIndex()
        returns the current index of the current token considered inside the loop.
        Returns:
        the index of the current token considered in the loop
      • increaseIndex

        protected void increaseIndex()
        Increase loops indexes.
      • setIndex

        protected void setIndex​(int newIndex)
        Sets the index.
        Parameters:
        newIndex - the new index
      • increase

        protected abstract boolean increase​(ZestLoopTokenSet<T> set)
        this increase the state and goes to the next state.
        Parameters:
        set - the set
      • toLastState

        public void toLastState​(ZestLoopTokenSet<T> set)
        this sets the state to the last state: i.e. the loop has finished
        Parameters:
        set - the set
      • isLastState

        public boolean isLastState​(ZestLoopTokenSet<T> set)
        Checks if is last state.
        Parameters:
        set - the set
        Returns:
        true, if is last state
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object