javax.media.jai
Class AttributedImageCollection

java.lang.Object
  |
  +--javax.media.jai.CollectionImage
        |
        +--javax.media.jai.AttributedImageCollection
All Implemented Interfaces:
Collection, ImageJAI, PropertyChangeEmitter, PropertySource, WritablePropertySource

public class AttributedImageCollection
extends CollectionImage

Class representing a CollectionImage wherein all image elements are AttributedImage instances. All Collection methods will be overridden such that contained images are forced to be AttributedImages.

Note that the methods getAll(attribute) and removeAll(attribute) use the equals() method of the attribute parameter rather that that of the AttributedImages in the Collection. This permits "filtering" if the attribute of the AttributedImages contains more than one type of value. For example, if the attribute contained both position and time, then the parameter attribute could be an instance of a class which compared only the position if it were desired to obtain or remove all images at a given position irrespective of the time stamp.

Since:
JAI 1.1

Fields inherited from class javax.media.jai.CollectionImage
eventManager, imageCollection, imageFactory, properties, sinks
 
Constructor Summary
protected AttributedImageCollection()
           
  AttributedImageCollection(Collection images)
          Constructs an AttributedImageCollection with contents set to the contents of the supplied Collection.
 
Method Summary
 boolean add(Object o)
          Adds the specified object to this Collection.
 boolean addAll(Collection c)
          Adds to this Collection all elements in the specified Collection which are AttributedImages.
 Set getAll(Object attribute)
          Returns a Set of all AttributedImages the attribute of which is equal to the parameter object according to the equals() method of the parameter object.
 Set getAll(PlanarImage image)
          Returns a Set of all AttributedImages the image of which is equal to the parameter image.
 AttributedImage getAttributedImage(Object attribute)
          Returns the first attributed image found in the collection that contains the attribute.
 AttributedImage getAttributedImage(PlanarImage image)
          Returns the first attributed image found in the collection that contains the planar image argument.
 Set removeAll(Object attribute)
          Removes all AttributedImages the attribute of which is equal to the parameter object according to the equals() method of the parameter object.
 Set removeAll(PlanarImage image)
          Removes all AttributedImages the image of which is equal to the parameter image.
 
Methods inherited from class javax.media.jai.CollectionImage
addPropertyChangeListener, addPropertyChangeListener, addSink, clear, contains, containsAll, get, getImageFactory, getProperty, getProperty, getPropertyClass, getPropertyNames, getPropertyNames, getSinks, isEmpty, iterator, remove, removeAll, removeProperty, removePropertyChangeListener, removePropertyChangeListener, removeSink, removeSinks, retainAll, setImageFactory, setProperty, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

AttributedImageCollection

protected AttributedImageCollection()

AttributedImageCollection

public AttributedImageCollection(Collection images)
Constructs an AttributedImageCollection with contents set to the contents of the supplied Collection. Only elements in the Collection which are instances of AttributedImage will be added.
Throws:
IllegalArgumentException - if images is null
Method Detail

getAll

public Set getAll(Object attribute)
Returns a Set of all AttributedImages the attribute of which is equal to the parameter object according to the equals() method of the parameter object. If no match is found null will be returned. If the parameter is null a Set view of all AttributedImages in the Collection will be returned.

getAll

public Set getAll(PlanarImage image)
Returns a Set of all AttributedImages the image of which is equal to the parameter image. If no match is found null will be returned. If the parameter is null a Set view of all AttributedImages in the Collection will be returned.

removeAll

public Set removeAll(Object attribute)
Removes all AttributedImages the attribute of which is equal to the parameter object according to the equals() method of the parameter object. The returned value contains all AttributedImages which were removed from the underlying Collection or null if no match was found. If the parameter is null, null will be returned.

removeAll

public Set removeAll(PlanarImage image)
Removes all AttributedImages the image of which is equal to the parameter image. The returned value contains all AttributedImages which were removed from the underlying Collection or null if no match was found. If the parameter is null, null will be returned.

add

public boolean add(Object o)
Adds the specified object to this Collection. This method overrides the superclass method in order to perform a type check on the object being added.
Overrides:
add in class CollectionImage
Returns:
true if and only if the parameter is added to the Collection.
Throws:
IllegalArgumentException - if o is null or is not an AttributedImage.

addAll

public boolean addAll(Collection c)
Adds to this Collection all elements in the specified Collection which are AttributedImages.
Overrides:
addAll in class CollectionImage
Returns:
true if this Collection changed as a result of the call.

getAttributedImage

public AttributedImage getAttributedImage(PlanarImage image)
Returns the first attributed image found in the collection that contains the planar image argument. If the parameter is null, null will be returned.

getAttributedImage

public AttributedImage getAttributedImage(Object attribute)
Returns the first attributed image found in the collection that contains the attribute. If the parameter is null, null will be returned.