Class BaseCoverageProcessingNode
- Object
-
- BaseCoverageProcessingNode
-
- All Implemented Interfaces:
CoverageProcessingNode
- Direct Known Subclasses:
ZeroImageNode
public abstract class BaseCoverageProcessingNode extends Object implements CoverageProcessingNode
Base implementation of aCoverageProcessingNode.This implementation provides convenient methods for managing sinks and source for a
CoverageProcessingNode. ThegetOutput()is used to get the output of thisCoverageProcessingNode(aCoverageProcessingExceptionis thrown in case something bad happens while processingImplementors must implement the abstract method
execute()which is guaranteed to run in a critical section where the sources and sinks for thisCoverageProcessingNodewill not be touched.- Author:
- Simone Giannecchini, GeoSolutions.
-
-
Constructor Summary
Constructors Constructor Description BaseCoverageProcessingNode(int maxSources, InternationalString name, InternationalString description)Default constructor that gives users the possibilityBaseCoverageProcessingNode(int maxSources, Hints hints, InternationalString name, InternationalString description)Default constructor that gives users the possibilityBaseCoverageProcessingNode(InternationalString name, InternationalString description)Default constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddSink(CoverageProcessingNode sink)Adds a sinkCoverageProcessingNodeto the list of sinks for thisCoverageProcessingNode.booleanaddSource(CoverageProcessingNode source)Adds a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.voiddispose(boolean force)Disposes thisCoverageProcessingNodealong with all the resources it might have allocatedprotected static voidensureNotNull(Object source, String name)Checks whether the provided object is null or not.protected static voidensureSourceNotNull(Object source, String name)Checks whether the provided source object is null or not.protected abstract GridCoverageexecute()Subclasses MUST override this method in order to do the actual processing.GridCoverageFactorygetCoverageFactory()TheGridCoverageFactorywe will internally use for build intermediate and outputGridCoverage2D.InternationalStringgetDescription()Retrieves the description for thisCoverageProcessingNodeHintsgetHints()Getter forHints.intgetMaximumNumberOfSources()retrieves the maximum number of sources we are allowed to set for thisCoverageProcessingNodeInternationalStringgetName()Retrieves the name for thisCoverageProcessingNodeintgetNumberOfSinks()Returns the number of sinks for thisCoverageProcessingNode.intgetNumberOfSources()Returns the number of sources for thisCoverageProcessingNode.GridCoverage2DgetOutput()This method is responsible for triggering the execution of thisCoverageProcessingNodeand also of all its sources.CoverageProcessingNodegetSink(int index)List<CoverageProcessingNode>getSinks()Retrieves theListof sinks for thisCoverageProcessingNode.CoverageProcessingNodegetSource(int index)List<CoverageProcessingNode>getSources()Retrieves theListof source for thisCoverageProcessingNode.booleanisDisposed()Tells me whether or not the node has been already disposed.booleanisExecuted()Tells me whether or not the node has been already executed.CoverageProcessingNoderemoveSink(int index)Removes a sinkCoverageProcessingNodefrom the list of sinks for thisCoverageProcessingNode.booleanremoveSink(CoverageProcessingNode sink)Removes a sinkCoverageProcessingNodefrom the list of sinks for thisCoverageProcessingNode.CoverageProcessingNoderemoveSource(int index)Removes a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.booleanremoveSource(CoverageProcessingNode source)Removes a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.StringtoString()Provides a descriptive description for thisCoverageProcessingNode.
-
-
-
Constructor Detail
-
BaseCoverageProcessingNode
public BaseCoverageProcessingNode(InternationalString name, InternationalString description)
Default constructor
-
BaseCoverageProcessingNode
public BaseCoverageProcessingNode(int maxSources, InternationalString name, InternationalString description)Default constructor that gives users the possibility- Parameters:
maxSources- maximum number of sources allowed for this node.
-
BaseCoverageProcessingNode
public BaseCoverageProcessingNode(int maxSources, Hints hints, InternationalString name, InternationalString description)Default constructor that gives users the possibility- Parameters:
maxSources- maximum number of sources allowed for this node.hints- instance ofHintsclass to control creation of internal factories. It can benull.
-
-
Method Detail
-
execute
protected abstract GridCoverage execute()
Subclasses MUST override this method in order to do the actual processing.Note that this method is invoked through this framework hence it is run within a critical section. Be careful with what you do within this method since it is essentially an "alien" method running within a synch section, hence all sort of bad things can happen.
- Returns:
- a
GridCoverage2Dwhich is the result of the processing.
-
dispose
public void dispose(boolean force)
Disposes thisCoverageProcessingNodealong with all the resources it might have allocatedThe result for this
CoverageProcessingNodeis also disposed.- Specified by:
disposein interfaceCoverageProcessingNode- Parameters:
force- force the disposition of this node.
-
getOutput
public GridCoverage2D getOutput() throws CoverageProcessingException
This method is responsible for triggering the execution of thisCoverageProcessingNodeand also of all its sources.In case something bad happens a
CoverageProcessingExceptionis thrown.- Specified by:
getOutputin interfaceCoverageProcessingNode- Returns:
- the
Coveragewhich represents the output for thisCoverageProcessingNode. - Throws:
CoverageProcessingException- UML property:
- name="output"
-
addSink
public void addSink(CoverageProcessingNode sink)
Description copied from interface:CoverageProcessingNodeAdds a sinkCoverageProcessingNodeto the list of sinks for thisCoverageProcessingNode.- Specified by:
addSinkin interfaceCoverageProcessingNode- Parameters:
sink- theCoverageProcessingNodeto add to theListof sinks for thisCoverageProcessingNode.
-
addSource
public boolean addSource(CoverageProcessingNode source)
Description copied from interface:CoverageProcessingNodeAdds a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.- Specified by:
addSourcein interfaceCoverageProcessingNode- Parameters:
source- theCoverageProcessingNodeto add to theListof sources for thisCoverageProcessingNode.- Returns:
trueif everything goes fine,falseotherwise.
-
getSink
public CoverageProcessingNode getSink(int index)
Description copied from interface:CoverageProcessingNode- Specified by:
getSinkin interfaceCoverageProcessingNode- Parameters:
index- is the zero-based index for the source we want to access.- Returns:
- the
CoverageProcessingNodewhich represents the source at indexindexfor thisCoverageProcessingNode.
-
getSinks
public List<CoverageProcessingNode> getSinks()
Description copied from interface:CoverageProcessingNodeRetrieves theListof sinks for thisCoverageProcessingNode. Each sink MUST be aCoverageProcessingNode.- Specified by:
getSinksin interfaceCoverageProcessingNode- Returns:
- a
ListofCoverageProcessingNodewhich represents the sinks for thisCoverageProcessingNode. - UML property:
- name="sinks"
-
getSource
public CoverageProcessingNode getSource(int index)
Description copied from interface:CoverageProcessingNode- Specified by:
getSourcein interfaceCoverageProcessingNode- Parameters:
index- is the zero-based index for the sink we want to get.- Returns:
- the
CoverageProcessingNodewhich represents the sink at indexindexfor thisCoverageProcessingNode.
-
getSources
public List<CoverageProcessingNode> getSources()
Description copied from interface:CoverageProcessingNodeRetrieves theListof source for thisCoverageProcessingNode. Each source MUST be aCoverageProcessingNode.- Specified by:
getSourcesin interfaceCoverageProcessingNode- Returns:
- a
ListofCoverageProcessingNodewhich represents the sources for thisCoverageProcessingNode. - UML property:
- name="sources"
-
removeSink
public boolean removeSink(CoverageProcessingNode sink)
Description copied from interface:CoverageProcessingNodeRemoves a sinkCoverageProcessingNodefrom the list of sinks for thisCoverageProcessingNode.- Specified by:
removeSinkin interfaceCoverageProcessingNode- Parameters:
sink- theCoverageProcessingNodeto remove from theListof sinks for thisCoverageProcessingNode.- Returns:
truein case we remove something,falseotherwise.
-
removeSink
public CoverageProcessingNode removeSink(int index)
Description copied from interface:CoverageProcessingNodeRemoves a sinkCoverageProcessingNodefrom the list of sinks for thisCoverageProcessingNode.- Specified by:
removeSinkin interfaceCoverageProcessingNode- Parameters:
index- the index at which we want to remove a sink from theListof sinks for thisCoverageProcessingNode.- Returns:
- the
CoverageProcessingNodewe actually remove from the sinks list.
-
removeSource
public boolean removeSource(CoverageProcessingNode source)
Description copied from interface:CoverageProcessingNodeRemoves a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.- Specified by:
removeSourcein interfaceCoverageProcessingNode- Parameters:
source- theCoverageProcessingNodeto remove from theListof sources for thisCoverageProcessingNode.- Returns:
truein case we remove something,falseotherwise.
-
getHints
public Hints getHints()
Getter forHints.- Specified by:
getHintsin interfaceCoverageProcessingNode- Returns:
Hintsprovided at construction time to controlGridCoverageFactorycreation.- UML property:
- name="hints"
-
getMaximumNumberOfSources
public int getMaximumNumberOfSources()
retrieves the maximum number of sources we are allowed to set for thisCoverageProcessingNode- Returns:
- the maximum number of sources we are allowed to set for this
CoverageProcessingNode - UML property:
- name="maximumNumberOfSources"
-
getCoverageFactory
public GridCoverageFactory getCoverageFactory()
TheGridCoverageFactorywe will internally use for build intermediate and outputGridCoverage2D.- Specified by:
getCoverageFactoryin interfaceCoverageProcessingNode- Returns:
- a
GridCoverageFactorywe will internally use for build intermediate and outputGridCoverage2D. - UML property:
- name="coverageFactory"
-
getNumberOfSinks
public int getNumberOfSinks()
Description copied from interface:CoverageProcessingNodeReturns the number of sinks for thisCoverageProcessingNode.- Specified by:
getNumberOfSinksin interfaceCoverageProcessingNode- Returns:
- the number of sinks for this
CoverageProcessingNode.
-
getNumberOfSources
public int getNumberOfSources()
Description copied from interface:CoverageProcessingNodeReturns the number of sources for thisCoverageProcessingNode.- Specified by:
getNumberOfSourcesin interfaceCoverageProcessingNode- Returns:
- the number of sources for this
CoverageProcessingNode.
-
getDescription
public InternationalString getDescription()
Description copied from interface:CoverageProcessingNodeRetrieves the description for thisCoverageProcessingNode- Specified by:
getDescriptionin interfaceCoverageProcessingNode- Returns:
- the description for this
CoverageProcessingNode - UML property:
- name="description"
-
getName
public InternationalString getName()
Description copied from interface:CoverageProcessingNodeRetrieves the name for thisCoverageProcessingNode- Specified by:
getNamein interfaceCoverageProcessingNode- Returns:
- the name for this
CoverageProcessingNode - UML property:
- name="name"
-
ensureSourceNotNull
protected static void ensureSourceNotNull(Object source, String name)
Checks whether the provided source object is null or not. If it is null it throws anIllegalArgumentExceptionexception.- Parameters:
source- the object to check.name- the operation we are trying to run.
-
ensureNotNull
protected static void ensureNotNull(Object source, String name)
Checks whether the provided object is null or not. If it is null it throws anIllegalArgumentExceptionexception.- Parameters:
source- the object to check.name- the operation we are trying to run.
-
removeSource
public CoverageProcessingNode removeSource(int index) throws IndexOutOfBoundsException
Description copied from interface:CoverageProcessingNodeRemoves a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.- Specified by:
removeSourcein interfaceCoverageProcessingNode- Parameters:
index- the index at which we want to remove a source from theListof sources for thisCoverageProcessingNode.- Returns:
- the
CoverageProcessingNodewe actually remove from the sources list. - Throws:
IndexOutOfBoundsException
-
toString
public String toString()
Description copied from interface:CoverageProcessingNodeProvides a descriptive description for thisCoverageProcessingNode.- Specified by:
toStringin interfaceCoverageProcessingNode- Overrides:
toStringin classObject- Returns:
- a descriptive description for this
CoverageProcessingNode
-
isDisposed
public boolean isDisposed()
Tells me whether or not the node has been already disposed.- Returns:
trueif the node has been already disposed,falseotherwise.- UML property:
- name="disposed"
-
isExecuted
public boolean isExecuted()
Tells me whether or not the node has been already executed.- Returns:
trueif the node has been already executed,falseotherwise.- UML property:
- name="executed"
-
-