DAT
Interface Map


public interface Map

Interface for a Map ADT


Method Summary
 void assign(java.lang.Object d, java.lang.Object c)
          assign an image for a domain object.
 java.lang.Object deassign(java.lang.Object d)
          if an image is defined for the domain object deassign it (that is, remove the pair from the Map) and return the image, otherwise throw an exception.
 java.lang.Object image(java.lang.Object d)
          return the image of a domain object if defined, otherwise throw an exception.
 boolean isDefined(java.lang.Object d)
          check if a codomain image is defined for a domain object
 boolean isEmpty()
          check if the map is empty
 

Method Detail

isEmpty

public boolean isEmpty()
check if the map is empty

Returns:
true if the map contains no assignments, false otherwise

isDefined

public boolean isDefined(java.lang.Object d)
check if a codomain image is defined for a domain object

Parameters:
d - the domain object
Returns:
true if an image is defined, false otherwise

assign

public void assign(java.lang.Object d,
                   java.lang.Object c)
assign an image for a domain object.
If the object already has an image, replace the image with the new image, otherwise add a new object-image pair.

Parameters:
d - the domain object
c - the codomain image

image

public java.lang.Object image(java.lang.Object d)
                       throws ItemNotFound
return the image of a domain object if defined, otherwise throw an exception.

Parameters:
d - the domain object
Returns:
the image
Throws:
ItemNotFound - if no image exists for this object

deassign

public java.lang.Object deassign(java.lang.Object d)
                          throws ItemNotFound
if an image is defined for the domain object deassign it (that is, remove the pair from the Map) and return the image, otherwise throw an exception.

Parameters:
d - the domain object
Returns:
the codomain image
Throws:
ItemNotFound - if the object has no image