Class VOIVector

All Implemented Interfaces:
Serializable, Cloneable, Iterable<VOI>, Collection<VOI>, List<VOI>, RandomAccess, SequencedCollection<VOI>

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:
  • Field Details

    • serialVersionUID

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

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

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

    • 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 Details

    • 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 Collection<VOI>
      Specified by:
      add in interface List<VOI>
      Overrides:
      add in class Vector<VOI>
      Parameters:
      o - index of the VOI
      Returns:
      the VOI at the index
      Throws:
      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:
      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 Vector<VOI>
      Parameters:
      o - index of the VOI
      index - DOCUMENT ME!
      Throws:
      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 List<VOI>
      Overrides:
      remove in class Vector<VOI>
      Parameters:
      index - DOCUMENT ME!
      Returns:
      DOCUMENT ME!
    • removeAllElements

      public void removeAllElements()
      DOCUMENT ME!
      Overrides:
      removeAllElements in class 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 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 Vector<VOI>
      Parameters:
      first - DOCUMENT ME!
      last - DOCUMENT ME!
    • removeVectorListener

      public void removeVectorListener(VOIVectorListener listener)
      removes the update listener.
      Parameters:
      listener - DOCUMENT ME!
      Throws:
      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!