Class Revisions<T>

  • Type Parameters:
    T - the type of object to store the revision numbers with

    public class Revisions<T>
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<T> objects  
      private java.util.List<java.lang.Integer> revisionNumbers  
    • Constructor Summary

      Constructors 
      Constructor Description
      Revisions()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addObject​(T object, int revisionNumber)
      Adds an object with a specified revision number.
      T getObject​(int index)
      Returns the object at the specified position.
      private java.util.List<T> getObjects()  
      int getRevisionNumber​(int index)
      Returns the revision number at the specified position.
      private java.util.List<java.lang.Integer> getRevisionNumbers()  
      protected void setRevisionNumber​(T object, int revisionNumber)
      Sets the revision number of a specified object.
      int size()
      Returns the size.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • objects

        private java.util.List<T> objects
      • revisionNumbers

        private java.util.List<java.lang.Integer> revisionNumbers
    • Constructor Detail

      • Revisions

        public Revisions()
        Constructor.
    • Method Detail

      • getObjects

        private java.util.List<T> getObjects()
      • getRevisionNumbers

        private java.util.List<java.lang.Integer> getRevisionNumbers()
      • getObject

        public T getObject​(int index)
        Returns the object at the specified position.
        Parameters:
        index - the position
        Returns:
        the object
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range
      • getRevisionNumber

        public int getRevisionNumber​(int index)
        Returns the revision number at the specified position.
        Parameters:
        index - the position
        Returns:
        the revision number
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range
      • addObject

        public void addObject​(T object,
                              int revisionNumber)
        Adds an object with a specified revision number.
        Parameters:
        object - the object
        revisionNumber - the revision number
      • setRevisionNumber

        protected void setRevisionNumber​(T object,
                                         int revisionNumber)
        Sets the revision number of a specified object.
        Parameters:
        object - the object
        revisionNumber - the revision number
      • size

        public int size()
        Returns the size.
        Returns:
        the size
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object