Class VOIVector

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<VOI>, java.util.Collection<VOI>, java.util.List<VOI>, java.util.RandomAccess

    public class VOIVector
    extends ViewVOIVector
    Class extends ViewVOIVector to finish cleaning up access syntax to the volumes of interest vector.

    In addition, it contains a listener, and permits interested parties to request to be notified when list of Volumes of Interest change. That could be when:

    • a VOI is added
    • a VOI is removed
    • et cetera
    Those wishing to add more to notify on a VOI change should add the appropriate fireVOI..method and the appropriate corresponding method in VOIVectorListener to enforce that listeners handle that change.

    Notice none of the methods using java.util.Collection are implemented here.

    Version:
    Aug 2002
    Author:
    David Parsons
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.swing.event.EventListenerList listenerList
      holds all interfaces listening to this vector.
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private VOIVectorEvent voiUpdate
      an instnace of the VOI update event.
      • Fields inherited from class java.util.Vector

        capacityIncrement, elementCount, elementData
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      VOIVector()
      Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.
      VOIVector​(int initialsize)
      Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero.
      VOIVector​(VOIVector voiVector)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(VOI o)
      Override the Vector method to ensure that object is a voi, and that the new voi's name is unique.
      void addElement​(VOI o)
      Override the Vector method to ensure that object is a voi, and that the new voi's name is unique.
      void addVectorListener​(VOIVectorListener listener)
      adds the update listener.
      boolean addVOI​(VOI voi)
      Adds voi to the voi vector
      protected void fireVOIadded​(VOI voi)
      Fires a VOI event based on the VOI. calls the listener's addedVOI() method.
      protected void fireVOIremoved​(VOI voi)
      Fires a VOI event based on the VOI. calls the listener's removedVOI() method.
      void insertElementAt​(VOI o, int index)
      Override the Vector method to ensure that object is a voi, and that the new voi's name is unique.
      VOI remove​(int index)
      Overides Vector.remove().
      void removeAllElements()
      DOCUMENT ME!
      void removeAllVectorListeners()  
      void removeElementAt​(int index)
      Overides Vector.remove().
      void removeRange​(int first, int last)
      Overides Vector.removeRange().
      void removeVectorListener​(VOIVectorListener listener)
      removes the update listener.
      • Methods inherited from class java.util.Vector

        add, addAll, addAll, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeAll, removeElement, removeIf, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • listenerList

        private javax.swing.event.EventListenerList listenerList
        holds all interfaces listening to this vector.
      • voiUpdate

        private VOIVectorEvent voiUpdate
        an instnace of the VOI update event.
    • Constructor Detail

      • VOIVector

        public VOIVector()
        Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.

        Copied from the definition of java.util.Vector

      • VOIVector

        public VOIVector​(int initialsize)
        Constructs an empty vector with the specified initial capacity and with its capacity increment equal to zero.
        Parameters:
        initialsize - initial capacity of the vector
      • VOIVector

        public VOIVector​(VOIVector voiVector)
    • Method Detail

      • add

        public boolean add​(VOI o)
        Override the Vector method to ensure that object is a voi, and that the new voi's name is unique.
        Specified by:
        add in interface java.util.Collection<VOI>
        Specified by:
        add in interface java.util.List<VOI>
        Overrides:
        add in class java.util.Vector<VOI>
        Parameters:
        o - index of the VOI
        Returns:
        the VOI at the index
        Throws:
        java.lang.IllegalArgumentException - for any argument o which is not an instance of gov.nih.mipav.model.structures.VOI
      • addElement

        public void addElement​(VOI o)
        Override the Vector method to ensure that object is a voi, and that the new voi's name is unique.
        Overrides:
        addElement in class ViewVOIVector
        Parameters:
        o - index of the VOI
      • addVectorListener

        public void addVectorListener​(VOIVectorListener listener)
        adds the update listener.
        Parameters:
        listener - DOCUMENT ME!
        Throws:
        java.lang.IllegalArgumentException - DOCUMENT ME!
      • addVOI

        public boolean addVOI​(VOI voi)
        Adds voi to the voi vector
        Parameters:
        voi - DOCUMENT ME!
        Returns:
        true if successful, false if not
      • insertElementAt

        public void insertElementAt​(VOI o,
                                    int index)
        Override the Vector method to ensure that object is a voi, and that the new voi's name is unique.
        Overrides:
        insertElementAt in class java.util.Vector<VOI>
        Parameters:
        o - index of the VOI
        index - DOCUMENT ME!
        Throws:
        java.lang.IllegalArgumentException - for any argument o which is not an instance of gov.nih.mipav.model.structures.VOI
      • remove

        public VOI remove​(int index)
        Overides Vector.remove().

        successful removal of the element results in the VOI listeners being notified.

        Specified by:
        remove in interface java.util.List<VOI>
        Overrides:
        remove in class java.util.Vector<VOI>
        Parameters:
        index - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • removeAllElements

        public void removeAllElements()
        DOCUMENT ME!
        Overrides:
        removeAllElements in class java.util.Vector<VOI>
      • removeAllVectorListeners

        public void removeAllVectorListeners()
      • removeElementAt

        public void removeElementAt​(int index)
        Overides Vector.remove().

        successful removal of the element results in the VOI listeners being notified.

        Overrides:
        removeElementAt in class java.util.Vector<VOI>
        Parameters:
        index - DOCUMENT ME!
      • removeRange

        public void removeRange​(int first,
                                int last)
        Overides Vector.removeRange().

        successfull removal of the range of elements results in the VOI listeners being notified.

        Overrides:
        removeRange in class java.util.Vector<VOI>
        Parameters:
        first - DOCUMENT ME!
        last - DOCUMENT ME!
      • removeVectorListener

        public void removeVectorListener​(VOIVectorListener listener)
        removes the update listener.
        Parameters:
        listener - DOCUMENT ME!
        Throws:
        java.lang.IllegalArgumentException - DOCUMENT ME!
      • fireVOIadded

        protected void fireVOIadded​(VOI voi)
        Fires a VOI event based on the VOI. calls the listener's addedVOI() method.
        Parameters:
        voi - DOCUMENT ME!
      • fireVOIremoved

        protected void fireVOIremoved​(VOI voi)
        Fires a VOI event based on the VOI. calls the listener's removedVOI() method.
        Parameters:
        voi - DOCUMENT ME!