Class ChangeList<E extends java.lang.Enum & ChangeType,​T>

  • Type Parameters:
    T - the type of the change objects
    All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Iterable<Change<E,​T>>

    public final class ChangeList<E extends java.lang.Enum & ChangeType,​T>
    extends java.lang.Object
    implements java.lang.Iterable<Change<E,​T>>, java.lang.AutoCloseable

    An ordered list of changes to some resource.

    Since:
    3.0
    Version:
    3.0
    Author:
    Michael Grove
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ChangeList<E,​T> append​(Change<E,​T> theChange)
      Add a new Change to the current list of changes
      ChangeList<E,​T> append​(E theType, T theChange)
      Add a new Change to the current list of changes.
      ChangeList<E,​T> appendAll​(java.lang.Iterable<Change<E,​T>> theChange)
      Add all the Changes to the current list of changes
      void clear()
      Clear all changes
      void close()
      Close all the change objects in this list
      static <T,​E extends java.lang.Enum & ChangeType>
      ChangeList<E,​T>
      create()
      Create a new list of Changes
      boolean isEmpty()
      Return whether or not the ChangeList is empty
      java.util.Iterator<Change<E,​T>> iterator()
      int size()
      Return the number of changes in this change set
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • create

        public static <T,​E extends java.lang.Enum & ChangeTypeChangeList<E,​T> create()
        Create a new list of Changes
        Type Parameters:
        T - the type of payload in the changes
        Returns:
        the new ChangeList
      • clear

        public void clear()
        Clear all changes
      • close

        public void close()
                   throws java.lang.Exception
        Close all the change objects in this list
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception
      • append

        public ChangeList<E,​T> append​(Change<E,​T> theChange)
        Add a new Change to the current list of changes
        Parameters:
        theChange - the change to add
        Returns:
        this ChangeList
      • appendAll

        public ChangeList<E,​T> appendAll​(java.lang.Iterable<Change<E,​T>> theChange)
        Add all the Changes to the current list of changes
        Parameters:
        theChange - the change to add
        Returns:
        this ChangeList
      • append

        public ChangeList<E,​T> append​(E theType,
                                            T theChange)
        Add a new Change to the current list of changes.
        Parameters:
        theType - the type of change
        theChange - the change payload
        Returns:
        this ChangeList
      • size

        public int size()
        Return the number of changes in this change set
        Returns:
        the number of changes
      • isEmpty

        public boolean isEmpty()
        Return whether or not the ChangeList is empty
        Returns:
        true if there are no changes in this list, false otherwise
      • iterator

        public java.util.Iterator<Change<E,​T>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<E extends java.lang.Enum & ChangeType>