Document
Class Image

java.lang.Object
  extended by Document.Image
Direct Known Subclasses:
WindsurfImage

public abstract class Image
extends java.lang.Object

Abstract class representing an image as a list of regions


Field Summary
protected  ImageID ID
          The ID of this image
protected  java.util.AbstractList<Region> regions
          The list of regions of the image
protected  int size
          The number of pixels in this image
 
Constructor Summary
Image(ImageID id)
          Creates an image with a particular ID.
 
Method Summary
 void deleteRegionAt(int num)
          Removes the num-th region of an image.
 void deleteRegionID(ImageID num)
          Removes an image region having a particular ID.
abstract  double distance(Image i)
          Abstract method for computing the distance to another image.
 ImageID getID()
          Returns the image ID.
 int getNumRegions()
          Returns the number of regions in this image.
 Region getRegionAt(int num)
          Returns the num-th region of an image.
 Region getRegionID(ImageID id)
          Retrieves the image region with a particular ID.
 int getSize()
          Returns the size of the image (i.e., its total number of pixels).
protected  void setSize(int s)
          Modifies the size of the image (i.e., its total number of pixels).
 java.lang.String toString()
          Returns an array of Strings representing features of image regions together with other image information.
abstract  java.lang.String[] toStrings()
          Returns an array of Strings representing features of image regions together with other image information.
protected  void updateSize()
          Updates the size of the image as the sum of sizes of its regions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

protected ImageID ID
The ID of this image


regions

protected java.util.AbstractList<Region> regions
The list of regions of the image


size

protected int size
The number of pixels in this image

Constructor Detail

Image

public Image(ImageID id)
Creates an image with a particular ID.

Parameters:
id - ID of the image.
Method Detail

getRegionID

public Region getRegionID(ImageID id)
Retrieves the image region with a particular ID.

Parameters:
id - ID of the region to be returned.
Returns:
the requested region (null if no such region exists).

getRegionAt

public Region getRegionAt(int num)
Returns the num-th region of an image.

Parameters:
num - The position of the region to be returned.
Returns:
the requested region (null if no such region exists).

getID

public ImageID getID()
Returns the image ID.

Returns:
ID of the image.

getNumRegions

public int getNumRegions()
Returns the number of regions in this image.

Returns:
the number of regions in this image.

getSize

public int getSize()
Returns the size of the image (i.e., its total number of pixels).

Returns:
the size of the image.

setSize

protected void setSize(int s)
Modifies the size of the image (i.e., its total number of pixels).

Parameters:
s - the size of the image.

updateSize

protected void updateSize()
Updates the size of the image as the sum of sizes of its regions.


deleteRegionAt

public void deleteRegionAt(int num)
Removes the num-th region of an image.

Parameters:
num - the position of the region to be removed.
Throws:
java.lang.IndexOutOfBoundsException - if num is out of range.

deleteRegionID

public void deleteRegionID(ImageID num)
Removes an image region having a particular ID.

Parameters:
num - ID of the region to be removed.

toStrings

public abstract java.lang.String[] toStrings()
Returns an array of Strings representing features of image regions together with other image information.

Returns:
The dscription array of strings.

toString

public java.lang.String toString()
Returns an array of Strings representing features of image regions together with other image information.

Overrides:
toString in class java.lang.Object
Returns:
The dscription array of strings.

distance

public abstract double distance(Image i)
Abstract method for computing the distance to another image.

Parameters:
i - Image to be compared.
Returns:
The distance between the two images.