org.esa.beam.framework.datamodel
Class ProductNodeGroup<T extends ProductNode>

java.lang.Object
  extended by com.bc.ceres.core.ExtensibleObject
      extended by org.esa.beam.framework.datamodel.ProductNode
          extended by org.esa.beam.framework.datamodel.ProductNodeGroup<T>
All Implemented Interfaces:
com.bc.ceres.core.Extensible
Direct Known Subclasses:
PlacemarkGroup

public class ProductNodeGroup<T extends ProductNode>
extends ProductNode

A type-safe container for elements of the type ProductNode.

Author:
Norman Fomferra

Field Summary
 
Fields inherited from class org.esa.beam.framework.datamodel.ProductNode
PROPERTY_NAME_DESCRIPTION, PROPERTY_NAME_NAME
 
Constructor Summary
ProductNodeGroup(ProductNode owner, String name, boolean takingOverNodeOwnership)
          Constructs a node group for the given owner.
ProductNodeGroup(String name)
          Constructs a node group with no owner and which will not take ownership of added children.
 
Method Summary
 void acceptVisitor(ProductVisitor visitor)
          Accepts the given visitor.
 void add(int index, T node)
          Adds the given node to this group.
 boolean add(T node)
          Adds the given node to this group.
 void clearRemovedList()
           
 boolean contains(String name)
          Tests whether a node with the given name is contained in this group.
 boolean contains(T node)
          Tests whether the given product is contained in this list.
 void dispose()
          Releases all of the resources used by this object instance and all of its owned children.
 T get(int index)
           
 T get(String name)
           
 T getByDisplayName(String displayName)
           
 int getNodeCount()
           
 String[] getNodeDisplayNames()
          Returns the display names of all products currently managed.
 String[] getNodeNames()
          Returns the names of all products currently managed.
 long getRawStorageSize(ProductSubsetDef subsetDef)
          Gets an estimated, raw storage size in bytes of this product node.
 Collection<T> getRemovedNodes()
          Gets all removed node nodes.
 int indexOf(String name)
           
 int indexOf(T element)
           
 boolean isTakingOverNodeOwnership()
           
 boolean remove(T node)
          Removes the given node from this group.
 void removeAll()
          Removes all nodes from this group.
 void setModified(boolean modified)
          Sets this node's modified flag.
 ProductNode[] toArray()
          Returns an array of all products currently managed.
 T[] toArray(T[] array)
           
 void updateExpression(String oldExternalName, String newExternalName)
          Asks a product node to replace all occurences of and references to the node name given by oldExternalName with oldExternalName.
 
Methods inherited from class org.esa.beam.framework.datamodel.ProductNode
fireProductNodeChanged, fireProductNodeChanged, getDescription, getDisplayName, getName, getOwner, getProduct, getProductReader, getProductReaderSafe, getProductRefString, getProductSafe, getProductWriter, getProductWriterSafe, getRawStorageSize, isModified, isPartOfSubset, isValidNodeName, removeFromFile, setDescription, setName, setOwner, toString
 
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProductNodeGroup

public ProductNodeGroup(String name)
Constructs a node group with no owner and which will not take ownership of added children.

Parameters:
name - The group name.
Since:
BEAM 4.8

ProductNodeGroup

public ProductNodeGroup(ProductNode owner,
                        String name,
                        boolean takingOverNodeOwnership)
Constructs a node group for the given owner.

Parameters:
owner - The owner of the group.
name - The group name.
takingOverNodeOwnership - If true, child nodes will have this group as owner after adding.
Method Detail

isTakingOverNodeOwnership

public boolean isTakingOverNodeOwnership()
Returns:
true, if child nodes will have this group as owner after adding.

getNodeCount

public int getNodeCount()
Returns:
The number of product nodes in this product group.

get

public T get(int index)
Parameters:
index - The node index.
Returns:
The product node at the given index.

getNodeDisplayNames

public String[] getNodeDisplayNames()
Returns the display names of all products currently managed.

Returns:
an array containing the display names, never null, but the array can have zero length
See Also:
ProductNode.getDisplayName()

getNodeNames

public String[] getNodeNames()
Returns the names of all products currently managed.

Returns:
an array containing the names, never null, but the array can have zero length

toArray

public ProductNode[] toArray()
Returns an array of all products currently managed.

Returns:
an array containing the products, never null, but the array can have zero length

toArray

public T[] toArray(T[] array)
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 product nodes, never null, but the array can have zero length

indexOf

public int indexOf(String name)

indexOf

public int indexOf(T element)

getByDisplayName

public T getByDisplayName(String displayName)
Parameters:
displayName - the display name
Returns:
the product node with the given display name.

get

public T get(String name)
Parameters:
name - the name
Returns:
the product node with the given name.

contains

public boolean contains(String name)
Tests whether a node with the given name is contained in this group.

Parameters:
name - the name
Returns:
true, if so

contains

public boolean contains(T node)
Tests whether the given product is contained in this list.

Parameters:
node - the node
Returns:
true, if so

add

public boolean add(T node)
Adds the given node to this group.

Parameters:
node - the node to be added, ignored if null
Returns:
true, if the node has been added

add

public void add(int index,
                T node)
Adds the given node to this group.

Parameters:
index - the index.
node - the node to be added, ignored if null

remove

public boolean remove(T node)
Removes the given node from this group.

Parameters:
node - the node to be removed
Returns:
true, if the node was removed

removeAll

public void removeAll()
Removes all nodes from this group.


clearRemovedList

public void clearRemovedList()

getRemovedNodes

public Collection<T> getRemovedNodes()
Gets all removed node nodes.

Returns:
a collection of all removed node nodes.

getRawStorageSize

public long getRawStorageSize(ProductSubsetDef subsetDef)
Description copied from class: ProductNode
Gets an estimated, raw storage size in bytes of this product node.

Specified by:
getRawStorageSize in class ProductNode
Parameters:
subsetDef - if not null the subset may limit the size returned
Returns:
the size in bytes.

setModified

public void setModified(boolean modified)
Description copied from class: ProductNode
Sets this node's modified flag.

If the modified flag changes to true and this node has an owner, the owner's modified flag is also set to true.

Overrides:
setModified in class ProductNode
Parameters:
modified - whether or not this node is beeing marked as modified.
See Also:
Product.fireNodeChanged(org.esa.beam.framework.datamodel.ProductNode, java.lang.String, java.lang.Object, java.lang.Object)

acceptVisitor

public void acceptVisitor(ProductVisitor visitor)
Description copied from class: ProductNode
Accepts the given visitor. This method implements the well known 'Visitor' design pattern of the gang-of-four. The visitor pattern allows to define new operations on the product data model without the need to add more code to it. The new operation is implemented by the visitor.

Specified by:
acceptVisitor in class ProductNode
Parameters:
visitor - the visitor

dispose

public void dispose()
Description copied from class: ProductNode
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.

Overrides of this method should always call super.dispose(); after disposing this instance.

Overrides:
dispose in class ProductNode

updateExpression

public void updateExpression(String oldExternalName,
                             String newExternalName)
Description copied from class: ProductNode
Asks a product node to replace all occurences of and references to the node name given by oldExternalName with oldExternalName. Such references most often occur in band arithmetic expressions.

Overrides:
updateExpression in class ProductNode
Parameters:
oldExternalName - The old node name.
newExternalName - The new node name.


Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.