ucar.visad.display
Class ScalarMapSet

java.lang.Object
  extended by ucar.visad.display.ScalarMapSet
Direct Known Subclasses:
NavigatedDisplay.VerticalMapSet

public class ScalarMapSet
extends Object

Provides support for a set of ScalarMap-s.

Version:
$Revision: 1.17 $
Author:
Steven R. Emmerson

Constructor Summary
ScalarMapSet()
          Constructs from nothing.
ScalarMapSet(Collection col)
          Constructs from a Collection of ScalarMaps.
ScalarMapSet(ScalarMapSet that)
          Constructs from another instance.
 
Method Summary
 void add(Collection col)
          Adds the contents of a Collection to this instance's set of ScalarMaps.
 ScalarMap add(ScalarMap map)
          Adds a ScalarMap to this set.
 void add(ScalarMapSet that)
          Adds the contents of another ScalarMapSet to this instance's set of ScalarMaps.
 void clear()
          Clears the set of ScalarMaps.
static ScalarMapSet combine(ScalarMapSet set1, ScalarMapSet set2)
          Combines the ScalarMaps of two sets.
 boolean equals(Object obj)
          Indicates if this instance equals an object.
 ScalarMap get(ScalarMap template)
          Returns the ScalarMap in this instance that matches a template.
 int hashCode()
          Returns the hash code of this instance.
 Iterator iterator()
          Returns an iterator for this instance.
 boolean remove(ScalarMap map)
          Removes a ScalarMap from this set.
 void remove(ScalarMapSet that)
          Removes the contents of another ScalarMapSet from this instance's set of ScalarMaps.
 void removeAll()
          Removes all ScalarMaps from this instance.
 int size()
          Returns the number of ScalarMaps in this set.
 String toString()
          Returns a string representation of this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScalarMapSet

public ScalarMapSet()
Constructs from nothing.


ScalarMapSet

public ScalarMapSet(ScalarMapSet that)
Constructs from another instance. The ScalarMaps of the other instance are not cloned.

Parameters:
that - The other instance.

ScalarMapSet

public ScalarMapSet(Collection col)
Constructs from a Collection of ScalarMaps. The ScalarMaps of the Collection are not cloned.

Parameters:
col - The collection of ScalarMap-s.
Throws:
ClassCastException - if an element in the collection is not a ScalarMap.
Method Detail

add

public ScalarMap add(ScalarMap map)
Adds a ScalarMap to this set. The previous ScalarMap is returned if it exists; otherwise null is returned.

Parameters:
map - The ScalarMap to be added to this set.
Returns:
The previous ScalarMap or null.

add

public void add(ScalarMapSet that)
Adds the contents of another ScalarMapSet to this instance's set of ScalarMaps.

Parameters:
that - The other set of ScalarMaps.
Throws:
NullPointerException - if the other set is null.

add

public void add(Collection col)
Adds the contents of a Collection to this instance's set of ScalarMaps.

Parameters:
col - The Collection of ScalarMap-s to be added.
Throws:
NullPointerException - if the Collection is null.
ClassCastException - if an element of the Collection isn't a ScalarMap.

get

public ScalarMap get(ScalarMap template)
Returns the ScalarMap in this instance that matches a template. Returns null is no such ScalarMap exists.

Parameters:
template - The template.
Returns:
The ScalarMap in this instance that matches the template or null.

remove

public boolean remove(ScalarMap map)
Removes a ScalarMap from this set.

Parameters:
map - The ScalarMap to be removed.
Returns:
true if and only if the ScalarMap existed.

remove

public void remove(ScalarMapSet that)

Removes the contents of another ScalarMapSet from this instance's set of ScalarMaps.

Parameters:
that - The other set of ScalarMaps.
Throws:
NullPointerException - if the other set is null.

removeAll

public void removeAll()

Removes all ScalarMaps from this instance.


size

public int size()
Returns the number of ScalarMaps in this set.

Returns:
The number of ScalarMaps in this set.

clear

public void clear()
Clears the set of ScalarMaps.


iterator

public Iterator iterator()
Returns an iterator for this instance. Objects returned by the Iterator.next() method have type ScalarMap.

Returns:
An iterator for this instance.

equals

public boolean equals(Object obj)
Indicates if this instance equals an object.

Overrides:
equals in class Object
Parameters:
obj - The object.
Returns:
True if and only if this instance equals the object.

hashCode

public int hashCode()
Returns the hash code of this instance.

Overrides:
hashCode in class Object
Returns:
The hash code of this instance.

toString

public String toString()

Returns a string representation of this instance.

Overrides:
toString in class Object
Returns:
A string representation of this instance.

combine

public static ScalarMapSet combine(ScalarMapSet set1,
                                   ScalarMapSet set2)

Combines the ScalarMaps of two sets. ScalarMaps in the second set override ScalarMaps for the same DisplayRealType in the first set. The input sets are not modified.

Parameters:
set1 - The first set.
set2 - The second set.
Returns:
The union of the two sets.