Package org.esa.snap.core.datamodel
Class ProductNodeList<T extends ProductNode>
java.lang.Object
org.esa.snap.core.datamodel.ProductNodeList<T>
A type-safe list for elements of the type
ProductNode.- Version:
- $Revision$ $Date$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidInserts a new node to this list at the given index.final booleanAdds a new node to this list.voidClears the internal removed product nodes list.final booleanTests if this list contains a node with the given name.final booleanTests if this list contains the given node.final voidCopies the product nodes of this product node list into the specified array.createSubset(ProductNodeFilter<T> filter) Creates a subset of this list using the given filter.final voiddispose()Releases all of the resources used by this object instance and all of its owned children.final TGets the element with the given name.final TgetAt(int index) getByDisplayName(String displayName) Gets the element with the given display name.String[]Gets the display names of all nodes contained in this list.final String[]getNames()Gets the names of all nodes contained in this list.Gets all removed product nodes.final intGets the index of the node with the given name.final intGets the index of the given node.final booleanRemoves the given node from this list.final voidRemoves all nodes from this list.final intsize()final ProductNode[]toArray()Returns the list of named nodes as an array.final T[]Returns the list of named nodes as an array.
-
Constructor Details
-
ProductNodeList
public ProductNodeList()Constructs a new list named nodes.
-
-
Method Details
-
size
public final int size()- Returns:
- the size of this list.
-
getAt
- Parameters:
index- the index, must be in the range zero tosize()- Returns:
- the element at the spcified index.
-
getNames
Gets the names of all nodes contained in this list. If this list is empty a zero-length array is returned.- Returns:
- a string array containing all node names, never
null
-
getDisplayNames
Gets the display names of all nodes contained in this list. If this list is empty a zero-length array is returned.- Returns:
- a string array containing all node display names, never
null - See Also:
-
get
Gets the element with the given name. The method performs a case insensitive search.- Parameters:
name- the name of the node, must not benull- Returns:
- the node with the given name or
nullif a node with the given name is not contained in this list - Throws:
IllegalArgumentException- if the name isnull
-
getByDisplayName
Gets the element with the given display name.- Parameters:
displayName- the display name of the node, must not benull- Returns:
- the node with the given display name or
nullif a node with the given display name is not contained in this list - Throws:
IllegalArgumentException- if the display name isnull- See Also:
-
contains
Tests if this list contains a node with the given name.- Parameters:
name- the name of the node, must not benull- Returns:
- true if this list contains a node with the given name.
- Throws:
IllegalArgumentException- if the name isnull
-
contains
Tests if this list contains the given node.- Parameters:
node- the node- Returns:
- true if this list contains the given node.
- Throws:
IllegalArgumentException- if the node isnull
-
add
Adds a new node to this list. Note thatnullnodes are not added to this list.- Parameters:
node- the node to be added, ignored ifnull- Returns:
- true if the node was added, otherwise false.
-
add
Inserts a new node to this list at the given index. Note thatnullnodes are not added to this list.- Parameters:
index- the insert indexnode- the node to be added, ignored ifnull- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.
-
clearRemovedList
public void clearRemovedList()Clears the internal removed product nodes list. -
getRemovedNodes
Gets all removed product nodes.- Returns:
- a collection of all removed product nodes.
-
remove
Removes the given node from this list. The removed nodes will be added to the internal list of removed product nodes.- Parameters:
node- the node to be removed, ignored ifnull- Returns:
trueif the node is a member of this list and could successfully be removed,falseotherwise
-
removeAll
public final void removeAll()Removes all nodes from this list. -
dispose
public final void dispose()Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to
dispose()are undefined. -
createSubset
Creates a subset of this list using the given filter.- Parameters:
filter- the product node filter to be used, ifnulla clone of this list is created- Returns:
- the subset
-
toArray
Returns the list of named nodes as an array. If this list is empty a zero-length array is returned.- Returns:
- a string array containing all node names, never
null
-
toArray
Returns the list of named nodes as an array. If this list is empty a zero-length array is returned.- Parameters:
array- the array into which the elements of the list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.- Returns:
- an array containing the elements of the list. never
null
-
copyInto
Copies the product nodes of this product node list into the specified array. The array must be big enough to hold all the product nodes in this product node list, else an IndexOutOfBoundsException is thrown.- Parameters:
array- the array into which the product nodes get copied.- Throws:
NullPointerException- if the given array is null.IndexOutOfBoundsException- if the given array is to small.
-
indexOf
Gets the index of the node with the given name. The method performs a case insensitive search.- Parameters:
name- the name of the node, must not benull- Returns:
- the index of the node with the given name or
-1if a node with the given name is not contained in this list - Throws:
IllegalArgumentException- if the name isnull
-
indexOf
Gets the index of the given node.- Parameters:
node- the node to get the index, must not benull- Returns:
- the index of the given node or
-1if the node is not contained in this list - Throws:
IllegalArgumentException- if the node isnull
-