public class ImageSet<K> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ImageSet.Element
An
ImageSet element consisting of a RenderedImage
and an associated outside value. |
static class |
ImageSet.Iterator<K> |
| Constructor and Description |
|---|
ImageSet()
Creates a new, empty image set.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(K key,
RenderedImage image,
Number outsideValue)
Adds an image to this set to be associated with the given key.
|
void |
clear()
Removes all key:image pairs from this image set.
|
boolean |
containsImage(RenderedImage image)
Tests if this image set contains the given image.
|
boolean |
containsKey(K key)
Tests if this image set contains the given key.
|
static <K> ImageSet<K> |
copy(ImageSet<K> set)
Creates a new image set which will contain the same keys, images and
outside values as the input set.
|
RenderedImage |
get(K key)
Retrieves an image from this set.
|
Rectangle |
getBounds(K key)
Gets the bounds of the image associated with the given key.
|
Rectangle |
getIntersectionBounds()
Gets the common bounds of images in this set This is the intersection
of the individual iamge bounds.
|
ImageSet.Iterator<K> |
getIterator()
Gets a new iterator based on the bounds of the first image added
to this set or, if that has been removed, the image that has been
in this set for the longest period.
|
ImageSet.Iterator<K> |
getIterator(K referenceImageKey)
Gets a new iterator based on the bounds of the image with the
specified key value.
|
ImageSet.Iterator<K> |
getIterator(Rectangle bounds)
Gets a new iterator based on the bounds of the image with the
specified key value.
|
Number |
getOutsideValue(K key)
Gets the value that an image set iterator will return for the
image associated with the given key when it is positioned
outside the bounds of that image.
|
Rectangle |
getUnionBounds()
Gets the enclosing bounds of all images in this set.
|
boolean |
isEmpty()
Tests if this image set is empty.
|
Set<K> |
keySet()
Retrieves a
Set view of the keys in this image set. |
void |
putAll(ImageSet<? extends K> otherSet)
Copies all key:image pairs from
otherSet into this image set. |
RenderedImage |
remove(K key)
Removes a key:image pair from this set.
|
int |
size()
Gets the number of key:image pairs in this set.
|
Set<RenderedImage> |
values()
Retrieves a
Set view of the keys in this image set. |
public static <K> ImageSet<K> copy(ImageSet<K> set)
null or
empty, an empty image set is created.K - the key typeset - the image set to copypublic void add(K key, RenderedImage image, Number outsideValue)
key - the keyimage - the imageoutsideValue - the value to be returned by iterators when
positions beyond the bounds of this image (may be nullIllegalArgumentException - if either key or image
is nullpublic int size()
public boolean isEmpty()
true if the set is emptypublic boolean containsKey(K key)
key - the key to search fortrue if the key is found; false otherwiseIllegalArgumentException - if key is nullpublic boolean containsImage(RenderedImage image)
image - the image to search fortrue is the image is in this set; false otherwisepublic RenderedImage get(K key)
key - the key associated with the image.null if the key could not be foundpublic RenderedImage remove(K key)
key - the keynull if
the key could not be foundpublic void putAll(ImageSet<? extends K> otherSet)
otherSet into this image set.otherSet - the image set to take contents fromIllegalArgumentException - if otherSet is nullpublic void clear()
public Set<K> keySet()
Set view of the keys in this image set.
Note that unlike Java collection classes, this method returns an
unmodifiable view of the keys.public Set<RenderedImage> values()
Set view of the keys in this image set.
Note that unlike Java collection classes, this method returns an
unmodifiable view of the keys.public ImageSet.Iterator<K> getIterator()
IllegalArgumentException - if this image set is emptypublic ImageSet.Iterator<K> getIterator(K referenceImageKey)
referenceImageKey - the key of the image to use as the reference
for the iteratorIllegalArgumentException - if this image set is empty or if no
image corresponds to the key valuepublic ImageSet.Iterator<K> getIterator(Rectangle bounds)
bounds - iterator boundsIllegalArgumentException - if this image set is empty or if no
image corresponds to the key valuepublic Rectangle getBounds(K key)
key - the image keynull if the key
could not be foundpublic Rectangle getUnionBounds()
Rectangle will be returned.public Rectangle getIntersectionBounds()
Rectangle will be
returned if ths set is empty, or if there is no area over which all
images overlap.public Number getOutsideValue(K key)
key - the keynull)Copyright © 2009–2020. All rights reserved.