Package gov.nasa.worldwind.layers
Class LayerList
- java.lang.Object
-
- java.util.concurrent.CopyOnWriteArrayList<Layer>
-
- gov.nasa.worldwind.layers.LayerList
-
- All Implemented Interfaces:
AVList
,MessageListener
,WWObject
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<Layer>
,java.util.Collection<Layer>
,java.util.EventListener
,java.util.List<Layer>
,java.util.RandomAccess
public class LayerList extends java.util.concurrent.CopyOnWriteArrayList<Layer> implements WWObject
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, Layer layer)
boolean
add(Layer layer)
boolean
addAll(int i, java.util.Collection<? extends Layer> layers)
boolean
addAll(java.util.Collection<? extends Layer> layers)
int
addAllAbsent(java.util.Collection<? extends Layer> layers)
boolean
addIfAbsent(Layer layer)
void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the specified all-property property change listener that will be called for all list changes.void
addPropertyChangeListener(java.lang.String propertyName, java.beans.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 thisAVList
instance: the keys and values themselves are not cloned.void
firePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Calls all registered property change listeners with the specified property change event.void
firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
Calls all property change listeners associated with the specified key.java.lang.String
getDisplayName()
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>
getEntries()
Layer
getLayerByName(java.lang.String name)
static java.util.List<Layer>
getLayersAdded(LayerList oldList, LayerList newList)
java.util.List<Layer>
getLayersByClass(java.lang.Class classToFind)
static java.util.List<Layer>
getLayersRemoved(LayerList oldList, LayerList newList)
static java.util.List<Layer>
getListDifference(LayerList oldList, LayerList newList)
java.lang.String
getStringValue(java.lang.String key)
Returns the value for a specified key.java.lang.Object
getValue(java.lang.String key)
Returns the value for a specified key.java.util.Collection<java.lang.Object>
getValues()
boolean
hasKey(java.lang.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(java.beans.PropertyChangeEvent propertyChangeEvent)
Layer
remove(int index)
void
remove(Layer layer)
boolean
remove(java.lang.Object o)
boolean
removeAll()
boolean
removeAll(java.util.Collection<?> objects)
java.lang.Object
removeKey(java.lang.String key)
Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the specified all-property property change listener.void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Removes a property change listener associated with the specified key.void
replaceAll(java.util.Collection<? extends Layer> layers)
boolean
retainAll(java.util.Collection<?> objects)
Layer
set(int index, Layer layer)
void
setDisplayName(java.lang.String displayName)
java.lang.Object
setValue(java.lang.String key, java.lang.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()
java.lang.String
toString()
-
Methods inherited from class java.util.concurrent.CopyOnWriteArrayList
clear, clone, contains, containsAll, equals, forEach, get, hashCode, indexOf, indexOf, isEmpty, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Method Detail
-
getDisplayName
public java.lang.String getDisplayName()
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
-
getListDifference
public static java.util.List<Layer> getListDifference(LayerList oldList, LayerList newList)
-
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:
java.lang.IllegalArgumentException
- if the layer-lists array is null or empty.
-
getLayersAdded
public static java.util.List<Layer> getLayersAdded(LayerList oldList, LayerList newList)
-
getLayersRemoved
public static java.util.List<Layer> getLayersRemoved(LayerList oldList, LayerList newList)
-
add
public boolean add(Layer layer)
-
add
public void add(int index, Layer layer)
-
remove
public void remove(Layer layer)
-
remove
public Layer remove(int index)
-
moveLower
public boolean moveLower(Layer targetLayer)
-
moveHigher
public boolean moveHigher(Layer targetLayer)
-
remove
public boolean remove(java.lang.Object o)
-
addIfAbsent
public boolean addIfAbsent(Layer layer)
- Overrides:
addIfAbsent
in classjava.util.concurrent.CopyOnWriteArrayList<Layer>
-
removeAll
public boolean removeAll(java.util.Collection<?> objects)
-
removeAll
public boolean removeAll()
-
addAllAbsent
public int addAllAbsent(java.util.Collection<? extends Layer> layers)
- Overrides:
addAllAbsent
in classjava.util.concurrent.CopyOnWriteArrayList<Layer>
-
addAll
public boolean addAll(java.util.Collection<? extends Layer> layers)
-
addAll
public boolean addAll(int i, java.util.Collection<? extends Layer> layers)
-
retainAll
public boolean retainAll(java.util.Collection<?> objects)
-
replaceAll
public void replaceAll(java.util.Collection<? extends Layer> layers)
-
getLayerByName
public Layer getLayerByName(java.lang.String name)
-
getLayersByClass
public java.util.List<Layer> getLayersByClass(java.lang.Class classToFind)
-
getValue
public java.lang.Object getValue(java.lang.String key)
Description copied from interface:AVList
Returns the value for a specified key.
-
getValues
public java.util.Collection<java.lang.Object> getValues()
-
getEntries
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> getEntries()
- Specified by:
getEntries
in interfaceAVList
-
getStringValue
public java.lang.String getStringValue(java.lang.String key)
Description copied from interface:AVList
Returns the value for a specified key. The value must be aString
.- Specified by:
getStringValue
in interfaceAVList
- Parameters:
key
- the attribute name. May not benull
.- Returns:
- the attribute value if one exists in the collection, otherwise
null
.
-
setValue
public java.lang.Object setValue(java.lang.String key, java.lang.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 interfaceAVList
- Parameters:
key
- the attribute name. May not benull
.value
- the attribute value. May benull
, 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.
-
hasKey
public boolean hasKey(java.lang.String key)
Description copied from interface:AVList
Indicates whether a key is in the collection.
-
removeKey
public java.lang.Object removeKey(java.lang.String key)
Description copied from interface:AVList
Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection.
-
copy
public AVList copy()
Description copied from interface:AVList
Returns a shallow copy of thisAVList
instance: the keys and values themselves are not cloned.
-
sort
public LayerList sort()
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Description copied from interface:AVList
Adds a property change listener for the specified key.- Specified by:
addPropertyChangeListener
in interfaceAVList
- Parameters:
propertyName
- the key to associate the listener with.listener
- the listener to associate with the key.- See Also:
PropertyChangeSupport
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Description copied from interface:AVList
Removes a property change listener associated with the specified key.- Specified by:
removePropertyChangeListener
in interfaceAVList
- Parameters:
propertyName
- the key associated with the change listener.listener
- the listener to remove.- See Also:
PropertyChangeSupport
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.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 interfaceAVList
- Parameters:
listener
- the listener to call.- See Also:
PropertyChangeSupport
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:AVList
Removes the specified all-property property change listener.- Specified by:
removePropertyChangeListener
in interfaceAVList
- Parameters:
listener
- the listener to remove.- See Also:
PropertyChangeSupport
-
firePropertyChange
public void firePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Description copied from interface:AVList
Calls all registered property change listeners with the specified property change event.- Specified by:
firePropertyChange
in interfaceAVList
- Parameters:
propertyChangeEvent
- the event- See Also:
PropertyChangeSupport
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
Description copied from interface:AVList
Calls all property change listeners associated with the specified key. No listeners are called ifodValue
andnewValue
are equal and non-null.- Specified by:
firePropertyChange
in interfaceAVList
- Parameters:
propertyName
- the keyoldValue
- the value associated with the key before the even causing the firing.newValue
- the new value associated with the key.- See Also:
PropertyChangeSupport
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
onMessage
public void onMessage(Message message)
Description copied from interface:MessageListener
Invoked when a message is received.- Specified by:
onMessage
in interfaceMessageListener
- Parameters:
message
- The message that was received.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.concurrent.CopyOnWriteArrayList<Layer>
-
-