Class BaseCoverageProcessingNode
- All Implemented Interfaces:
CoverageProcessingNode
- Direct Known Subclasses:
ZeroImageNode
CoverageProcessingNode .
This implementation provides convenient methods for managing sinks and source for a CoverageProcessingNode
. The getOutput() is used to get the output of this CoverageProcessingNode (a
CoverageProcessingException is thrown in case something bad happens while processing
Implementors must implement the abstract method execute() which is guaranteed to run in a critical
section where the sources and sinks for this CoverageProcessingNode will not be touched.
- Author:
- Simone Giannecchini, GeoSolutions.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseCoverageProcessingNode(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
Modifier and TypeMethodDescriptionvoidAdds 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.TheGridCoverageFactorywe will internally use for build intermediate and outputGridCoverage2D.Retrieves the description for thisCoverageProcessingNodegetHints()Getter forHints.intretrieves the maximum number of sources we are allowed to set for thisCoverageProcessingNodegetName()Retrieves the name for thisCoverageProcessingNodeintReturns the number of sinks for thisCoverageProcessingNode.intReturns the number of sources for thisCoverageProcessingNode.This method is responsible for triggering the execution of thisCoverageProcessingNodeand also of all its sources.getSink(int index) getSinks()Retrieves theListof sinks for thisCoverageProcessingNode.getSource(int index) Retrieves theListof source for thisCoverageProcessingNode.booleanTells me whether or not the node has been already disposed.booleanTells me whether or not the node has been already executed.removeSink(int index) Removes a sinkCoverageProcessingNodefrom the list of sinks for thisCoverageProcessingNode.booleanRemoves a sinkCoverageProcessingNodefrom the list of sinks for thisCoverageProcessingNode.removeSource(int index) Removes a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.booleanremoveSource(CoverageProcessingNode source) Removes a sourceCoverageProcessingNodeto the list of sources for thisCoverageProcessingNode.toString()Provides a descriptive description for thisCoverageProcessingNode.
-
Constructor Details
-
BaseCoverageProcessingNode
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 Details
-
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
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
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
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
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
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
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
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
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
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
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
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
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
Description copied from interface:CoverageProcessingNodeRetrieves the description for thisCoverageProcessingNode- Specified by:
getDescriptionin interfaceCoverageProcessingNode- Returns:
- the description for this
CoverageProcessingNode - UML property:
- name="description"
-
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
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
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
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
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"
-