Package gov.nih.mipav.model.structures
Class VOIVector
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<VOI>
-
- gov.nih.mipav.view.ViewVOIVector
-
- gov.nih.mipav.model.structures.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
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.
-
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 vectorprotected void
fireVOIadded(VOI voi)
Fires a VOI event based on the VOI. calls the listener'saddedVOI()
method.protected void
fireVOIremoved(VOI voi)
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()
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)
OveridesVector.remove().
void
removeAllElements()
DOCUMENT ME!void
removeAllVectorListeners()
void
removeElementAt(int index)
OveridesVector.remove().
void
removeRange(int first, int last)
OveridesVector.removeRange().
void
removeVectorListener(VOIVectorListener listener)
removes the update listener.-
Methods inherited from class gov.nih.mipav.view.ViewVOIVector
buildName, getUniqueID, VOIAt
-
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
-
-
-
-
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 interfacejava.util.Collection<VOI>
- Specified by:
add
in interfacejava.util.List<VOI>
- Overrides:
add
in classjava.util.Vector<VOI>
- Parameters:
o
- index of the VOI- Returns:
- the VOI at the index
- Throws:
java.lang.IllegalArgumentException
- for any argumento
which is not an instance ofgov.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 classViewVOIVector
- 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 classjava.util.Vector<VOI>
- Parameters:
o
- index of the VOIindex
- DOCUMENT ME!- Throws:
java.lang.IllegalArgumentException
- for any argumento
which is not an instance ofgov.nih.mipav.model.structures.VOI
-
remove
public VOI remove(int index)
OveridesVector.remove().
successful removal of the element results in the VOI listeners being notified.
-
removeAllElements
public void removeAllElements()
DOCUMENT ME!- Overrides:
removeAllElements
in classjava.util.Vector<VOI>
-
removeAllVectorListeners
public void removeAllVectorListeners()
-
removeElementAt
public void removeElementAt(int index)
OveridesVector.remove().
successful removal of the element results in the VOI listeners being notified.
- Overrides:
removeElementAt
in classjava.util.Vector<VOI>
- Parameters:
index
- DOCUMENT ME!
-
removeRange
public void removeRange(int first, int last)
OveridesVector.removeRange().
successfull removal of the range of elements results in the VOI listeners being notified.
- Overrides:
removeRange
in classjava.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'saddedVOI()
method.- Parameters:
voi
- DOCUMENT ME!
-
fireVOIremoved
protected void fireVOIremoved(VOI voi)
Fires a VOI event based on the VOI. calls the listener'sremovedVOI()
method.- Parameters:
voi
- DOCUMENT ME!
-
-