Skip navigation links
com.toolsverse.util.history

Class HistoryImpl<V>

    • Constructor Summary

      Constructors 
      Constructor and Description
      HistoryImpl()
      Instantiates a new history impl using DEFAULT_MAX_SIZE.
      HistoryImpl(int maxSize)
      Instantiates a new history impl using specific maximum size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean canGoBack(V current)
      Check if it is possible to go back starting from the current element.
      boolean canGoForward(V current)
      Check if it is possible to go forward starting from the current element.
      void clear()
      Clears the history
      boolean contains(V element)
      Checks if history contains the elements.
      List<V> elements()
      Gets the list of elements.
      V goBack(V current)
      Returns element of the history which was visited prior to current.
      V goForward(V current)
      Returns element of the history which was visited after the current.
      void remove(V element)
      Removes the element for the history.
      void setMaxSize(int value)
      Sets the maximum size of the history.
      int size()
      Returns the current size of the history.
      void visit(V element)
      Visits the element.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HistoryImpl

        public HistoryImpl()
        Instantiates a new history impl using DEFAULT_MAX_SIZE.
      • HistoryImpl

        public HistoryImpl(int maxSize)
        Instantiates a new history impl using specific maximum size.
        Parameters:
        maxSize - the max size
    • Method Detail

      • canGoBack

        public boolean canGoBack(V current)
        Description copied from interface: History
        Check if it is possible to go back starting from the current element.
        Specified by:
        canGoBack in interface History<V>
        Parameters:
        current - the current element
        Returns:
        true, if successful
      • canGoForward

        public boolean canGoForward(V current)
        Description copied from interface: History
        Check if it is possible to go forward starting from the current element.
        Specified by:
        canGoForward in interface History<V>
        Parameters:
        current - the current element
        Returns:
        true, if successful
      • clear

        public void clear()
        Description copied from interface: History
        Clears the history
        Specified by:
        clear in interface History<V>
      • contains

        public boolean contains(V element)
        Description copied from interface: History
        Checks if history contains the elements.
        Specified by:
        contains in interface History<V>
        Parameters:
        element - the element to check
        Returns:
        true, if successful
      • elements

        public List<V> elements()
        Description copied from interface: History
        Gets the list of elements.
        Specified by:
        elements in interface History<V>
        Returns:
        the list
      • goBack

        public V goBack(V current)
        Description copied from interface: History
        Returns element of the history which was visited prior to current.
        Specified by:
        goBack in interface History<V>
        Parameters:
        current - the current element
        Returns:
        the element of the history which was visited prior to current
      • goForward

        public V goForward(V current)
        Description copied from interface: History
        Returns element of the history which was visited after the current.
        Specified by:
        goForward in interface History<V>
        Parameters:
        current - the current element
        Returns:
        the element of the history which was visited after the current
      • remove

        public void remove(V element)
        Description copied from interface: History
        Removes the element for the history.
        Specified by:
        remove in interface History<V>
        Parameters:
        element - the element
      • setMaxSize

        public void setMaxSize(int value)
        Description copied from interface: History
        Sets the maximum size of the history.
        Specified by:
        setMaxSize in interface History<V>
        Parameters:
        value - the new max size
      • size

        public int size()
        Description copied from interface: History
        Returns the current size of the history.
        Specified by:
        size in interface History<V>
        Returns:
        the current size of the history
      • visit

        public void visit(V element)
        Description copied from interface: History
        Visits the element.
        Specified by:
        visit in interface History<V>
        Parameters:
        element - the element

Copyright © 2010-2020 Toolsverse. All Rights Reserved.