NASA World Wind

gov.nasa.worldwind.layers
Class LayerList

java.lang.Object
  extended by java.util.concurrent.CopyOnWriteArrayList<Layer>
      extended by gov.nasa.worldwind.layers.LayerList
All Implemented Interfaces:
AVList, MessageListener, WWObject, PropertyChangeListener, Serializable, Cloneable, Iterable<Layer>, Collection<Layer>, EventListener, List<Layer>, RandomAccess

public class LayerList
extends CopyOnWriteArrayList<Layer>
implements WWObject

See Also:
Serialized Form

Constructor Summary
LayerList()
           
LayerList(Layer[] layers)
           
LayerList(LayerList layerList)
           
 
Method Summary
 void add(int index, Layer layer)
           
 boolean add(Layer layer)
           
 boolean addAll(Collection<? extends Layer> layers)
           
 boolean addAll(int i, Collection<? extends Layer> layers)
           
 int addAllAbsent(Collection<? extends Layer> layers)
           
 boolean addIfAbsent(Layer layer)
           
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds the specified all-property property change listener that will be called for all list changes.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Adds a property change listener for the specified key.
 AVList clearList()
           
static LayerList collapseLists(LayerList[] lists)
          Aggregate the contents of a group of layer lists into a single one.
 AVList copy()
          Returns a shallow copy of this AVList instance: the keys and values themselves are not cloned.
 void firePropertyChange(PropertyChangeEvent propertyChangeEvent)
          Calls all registered property change listeners with the specified property change event.
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Calls all property change listeners associated with the specified key.
 String getDisplayName()
           
 Set<Map.Entry<String,Object>> getEntries()
           
 Layer getLayerByName(String name)
           
static List<Layer> getLayersAdded(LayerList oldList, LayerList newList)
           
 List<Layer> getLayersByClass(Class classToFind)
           
static List<Layer> getLayersRemoved(LayerList oldList, LayerList newList)
           
static List<Layer> getListDifference(LayerList oldList, LayerList newList)
           
 String getStringValue(String key)
          Returns the value for a specified key.
 Object getValue(String key)
          Returns the value for a specified key.
 Collection<Object> getValues()
           
 boolean hasKey(String key)
          Indicates whether a key is in the collection.
protected  LayerList makeShallowCopy(LayerList sourceList)
           
 boolean moveHigher(Layer targetLayer)
           
 boolean moveLower(Layer targetLayer)
           
 void onMessage(Message message)
          Invoked when a message is received.
 void propertyChange(PropertyChangeEvent propertyChangeEvent)
           
 Layer remove(int index)
           
 void remove(Layer layer)
           
 boolean remove(Object o)
           
 boolean removeAll()
           
 boolean removeAll(Collection<?> objects)
           
 Object removeKey(String key)
          Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the specified all-property property change listener.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Removes a property change listener associated with the specified key.
 void replaceAll(Collection<? extends Layer> layers)
           
 boolean retainAll(Collection<?> objects)
           
 Layer set(int index, Layer layer)
           
 void setDisplayName(String displayName)
           
 Object setValue(String key, Object value)
          Adds a key/value pair to the list.
 AVList setValues(AVList avList)
          Adds the contents of another attribute-value list to the list.
 LayerList sort()
           
 String toString()
           
 
Methods inherited from class java.util.concurrent.CopyOnWriteArrayList
clear, clone, contains, containsAll, equals, get, hashCode, indexOf, indexOf, isEmpty, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, size, subList, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayerList

public LayerList()

LayerList

public LayerList(Layer[] layers)

LayerList

public LayerList(LayerList layerList)
Method Detail

add

public void add(int index,
                Layer layer)
Specified by:
add in interface List<Layer>
Overrides:
add in class CopyOnWriteArrayList<Layer>

add

public boolean add(Layer layer)
Specified by:
add in interface Collection<Layer>
Specified by:
add in interface List<Layer>
Overrides:
add in class CopyOnWriteArrayList<Layer>

addAll

public boolean addAll(Collection<? extends Layer> layers)
Specified by:
addAll in interface Collection<Layer>
Specified by:
addAll in interface List<Layer>
Overrides:
addAll in class CopyOnWriteArrayList<Layer>

addAll

public boolean addAll(int i,
                      Collection<? extends Layer> layers)
Specified by:
addAll in interface List<Layer>
Overrides:
addAll in class CopyOnWriteArrayList<Layer>

addAllAbsent

public int addAllAbsent(Collection<? extends Layer> layers)
Overrides:
addAllAbsent in class CopyOnWriteArrayList<Layer>

addIfAbsent

public boolean addIfAbsent(Layer layer)
Overrides:
addIfAbsent in class CopyOnWriteArrayList<Layer>

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: AVList
Adds the specified all-property property change listener that will be called for all list changes.

Specified by:
addPropertyChangeListener in interface AVList
Parameters:
listener - the listener to call.
See Also:
PropertyChangeSupport

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Description copied from interface: AVList
Adds a property change listener for the specified key.

Specified by:
addPropertyChangeListener in interface AVList
Parameters:
propertyName - the key to associate the listener with.
listener - the listener to associate with the key.
See Also:
PropertyChangeSupport

clearList

public AVList clearList()
Specified by:
clearList in interface AVList

collapseLists

public static LayerList collapseLists(LayerList[] lists)
Aggregate the contents of a group of layer lists into a single one. All layers are placed in the first designated list and removed from the subsequent lists.

Parameters:
lists - an array containing the lists to aggregate. All members of the second and subsequent lists in the array are added to the first list in the array.
Returns:
the aggregated list.
Throws:
IllegalArgumentException - if the layer-lists array is null or empty.

copy

public AVList copy()
Description copied from interface: AVList
Returns a shallow copy of this AVList instance: the keys and values themselves are not cloned.

Specified by:
copy in interface AVList
Returns:
a shallow copy of this AVList.

firePropertyChange

public void firePropertyChange(PropertyChangeEvent propertyChangeEvent)
Description copied from interface: AVList
Calls all registered property change listeners with the specified property change event.

Specified by:
firePropertyChange in interface AVList
Parameters:
propertyChangeEvent - the event
See Also:
PropertyChangeSupport

firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)
Description copied from interface: AVList
Calls all property change listeners associated with the specified key. No listeners are called if odValue and newValue are equal and non-null.

Specified by:
firePropertyChange in interface AVList
Parameters:
propertyName - the key
oldValue - the value associated with the key before the even causing the firing.
newValue - the new value associated with the key.
See Also:
PropertyChangeSupport

getDisplayName

public String getDisplayName()

getEntries

public Set<Map.Entry<String,Object>> getEntries()
Specified by:
getEntries in interface AVList

getLayerByName

public Layer getLayerByName(String name)

getLayersAdded

public static List<Layer> getLayersAdded(LayerList oldList,
                                         LayerList newList)

getLayersByClass

public List<Layer> getLayersByClass(Class classToFind)

getLayersRemoved

public static List<Layer> getLayersRemoved(LayerList oldList,
                                           LayerList newList)

getListDifference

public static List<Layer> getListDifference(LayerList oldList,
                                            LayerList newList)

getStringValue

public String getStringValue(String key)
Description copied from interface: AVList
Returns the value for a specified key. The value must be a String.

Specified by:
getStringValue in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
the attribute value if one exists in the collection, otherwise null.

getValue

public Object getValue(String key)
Description copied from interface: AVList
Returns the value for a specified key.

Specified by:
getValue in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
the attribute value if one exists in the collection, otherwise null.

getValues

public Collection<Object> getValues()
Specified by:
getValues in interface AVList

hasKey

public boolean hasKey(String key)
Description copied from interface: AVList
Indicates whether a key is in the collection.

Specified by:
hasKey in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
true if the key exists in the collection, otherwise false.

makeShallowCopy

protected LayerList makeShallowCopy(LayerList sourceList)

moveHigher

public boolean moveHigher(Layer targetLayer)

moveLower

public boolean moveLower(Layer targetLayer)

onMessage

public void onMessage(Message message)
Description copied from interface: MessageListener
Invoked when a message is received.

Specified by:
onMessage in interface MessageListener
Parameters:
message - The message that was received.

propertyChange

public void propertyChange(PropertyChangeEvent propertyChangeEvent)
Specified by:
propertyChange in interface PropertyChangeListener

remove

public Layer remove(int index)
Specified by:
remove in interface List<Layer>
Overrides:
remove in class CopyOnWriteArrayList<Layer>

remove

public void remove(Layer layer)

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<Layer>
Specified by:
remove in interface List<Layer>
Overrides:
remove in class CopyOnWriteArrayList<Layer>

removeAll

public boolean removeAll()

removeAll

public boolean removeAll(Collection<?> objects)
Specified by:
removeAll in interface Collection<Layer>
Specified by:
removeAll in interface List<Layer>
Overrides:
removeAll in class CopyOnWriteArrayList<Layer>

removeKey

public Object removeKey(String key)
Description copied from interface: AVList
Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection.

Specified by:
removeKey in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
previous value associated with specified key, or null if there was no mapping for key.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: AVList
Removes the specified all-property property change listener.

Specified by:
removePropertyChangeListener in interface AVList
Parameters:
listener - the listener to remove.
See Also:
PropertyChangeSupport

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Description copied from interface: AVList
Removes a property change listener associated with the specified key.

Specified by:
removePropertyChangeListener in interface AVList
Parameters:
propertyName - the key associated with the change listener.
listener - the listener to remove.
See Also:
PropertyChangeSupport

replaceAll

public void replaceAll(Collection<? extends Layer> layers)

retainAll

public boolean retainAll(Collection<?> objects)
Specified by:
retainAll in interface Collection<Layer>
Specified by:
retainAll in interface List<Layer>
Overrides:
retainAll in class CopyOnWriteArrayList<Layer>

set

public Layer set(int index,
                 Layer layer)
Specified by:
set in interface List<Layer>
Overrides:
set in class CopyOnWriteArrayList<Layer>

setDisplayName

public void setDisplayName(String displayName)

setValue

public Object setValue(String key,
                       Object value)
Description copied from interface: AVList
Adds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.

Specified by:
setValue in interface AVList
Parameters:
key - the attribute name. May not be null.
value - the attribute value. May be null, in which case any existing value for the key is removed from the collection.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.

setValues

public AVList setValues(AVList avList)
Description copied from interface: AVList
Adds the contents of another attribute-value list to the list. Replaces an existing key/value pair if the list already contains the key.

Specified by:
setValues in interface AVList
Parameters:
avList - the list to copy. May not be null.
Returns:
this, a self reference.

sort

public LayerList sort()

toString

public String toString()
Overrides:
toString in class CopyOnWriteArrayList<Layer>

NASA World Wind