public abstract class BaseCoverageProcessingNode extends Object implements CoverageProcessingNode
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.
Constructor and Description |
---|
BaseCoverageProcessingNode(InternationalString name,
InternationalString description)
Default constructor
|
BaseCoverageProcessingNode(int maxSources,
Hints hints,
InternationalString name,
InternationalString description)
Default constructor that gives users the possibility
|
BaseCoverageProcessingNode(int maxSources,
InternationalString name,
InternationalString description)
Default constructor that gives users the possibility
|
Modifier and Type | Method and Description |
---|---|
void |
addSink(CoverageProcessingNode sink)
Adds a sink
CoverageProcessingNode to the list of sinks for this CoverageProcessingNode . |
boolean |
addSource(CoverageProcessingNode source)
Adds a source
CoverageProcessingNode to the list of sources for this CoverageProcessingNode . |
void |
dispose(boolean force)
Disposes this
CoverageProcessingNode along with all the resources it might have
allocated
The result for this CoverageProcessingNode is also disposed. |
protected static void |
ensureNotNull(Object source,
String name)
Checks whether the provided object is null or not.
|
protected static void |
ensureSourceNotNull(Object source,
String name)
Checks whether the provided source object is null or not.
|
protected abstract GridCoverage |
execute()
Subclasses MUST override this method in order to do the actual processing.
|
GridCoverageFactory |
getCoverageFactory()
The
GridCoverageFactory we will internally use for build intermediate and output
GridCoverage2D . |
InternationalString |
getDescription()
Retrieves the description for this
CoverageProcessingNode |
Hints |
getHints()
Getter for
Hints . |
int |
getMaximumNumberOfSources()
retrieves the maximum number of sources we are allowed to set for this
CoverageProcessingNode |
InternationalString |
getName()
Retrieves the name for this
CoverageProcessingNode |
int |
getNumberOfSinks()
Returns the number of sinks for this
CoverageProcessingNode . |
int |
getNumberOfSources()
Returns the number of sources for this
CoverageProcessingNode . |
GridCoverage2D |
getOutput()
This method is responsible for triggering the execution of this
CoverageProcessingNode and also of all its sources. |
CoverageProcessingNode |
getSink(int index)
|
List<CoverageProcessingNode> |
getSinks()
Retrieves the
List of sinks for this CoverageProcessingNode . |
CoverageProcessingNode |
getSource(int index)
|
List<CoverageProcessingNode> |
getSources()
Retrieves the
List of source for this CoverageProcessingNode . |
boolean |
isDisposed()
Tells me whether or not the node has been already disposed.
|
boolean |
isExecuted()
Tells me whether or not the node has been already executed.
|
boolean |
removeSink(CoverageProcessingNode sink)
Removes a sink
CoverageProcessingNode from the list of sinks for this CoverageProcessingNode . |
CoverageProcessingNode |
removeSink(int index)
Removes a sink
CoverageProcessingNode from the list of sinks for this CoverageProcessingNode . |
boolean |
removeSource(CoverageProcessingNode source)
Removes a source
CoverageProcessingNode to the list of sources for this CoverageProcessingNode . |
CoverageProcessingNode |
removeSource(int index)
Removes a source
CoverageProcessingNode to the list of sources for this CoverageProcessingNode . |
String |
toString()
Provides a descriptive description for this
CoverageProcessingNode . |
public BaseCoverageProcessingNode(InternationalString name, InternationalString description)
public BaseCoverageProcessingNode(int maxSources, InternationalString name, InternationalString description)
maxSources
- maximum number of sources allowed for this node.description
- name
- public BaseCoverageProcessingNode(int maxSources, Hints hints, InternationalString name, InternationalString description)
maxSources
- maximum number of sources allowed for this node.hints
- instance of Hints
class to control creation of internal factories. It
can be null
.description
- name
- protected abstract GridCoverage execute()
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.
GridCoverage2D
which is the result of the processing.public void dispose(boolean force)
CoverageProcessingNode
along with all the resources it might have
allocated
The result for this CoverageProcessingNode
is also disposed.
dispose
in interface CoverageProcessingNode
force
- force the disposition of this node.public GridCoverage2D getOutput() throws CoverageProcessingException
CoverageProcessingNode
and also of all its sources.
In case something bad happens a CoverageProcessingException
is thrown.
getOutput
in interface CoverageProcessingNode
Coverage
which represents the output for this CoverageProcessingNode
.CoverageProcessingException
public void addSink(CoverageProcessingNode sink)
CoverageProcessingNode
CoverageProcessingNode
to the list of sinks for this CoverageProcessingNode
.addSink
in interface CoverageProcessingNode
public boolean addSource(CoverageProcessingNode source)
CoverageProcessingNode
CoverageProcessingNode
to the list of sources for this CoverageProcessingNode
.addSource
in interface CoverageProcessingNode
source
- the CoverageProcessingNode
to add to the List
of sources for
this CoverageProcessingNode
.true
if everything goes fine, false
otherwise.public CoverageProcessingNode getSink(int index)
CoverageProcessingNode
getSink
in interface CoverageProcessingNode
index
- is the zero-based index for the source we want to access.CoverageProcessingNode
which represents the source at index index
for this CoverageProcessingNode
.public List<CoverageProcessingNode> getSinks()
CoverageProcessingNode
List
of sinks for this CoverageProcessingNode
. Each sink
MUST be a CoverageProcessingNode
.getSinks
in interface CoverageProcessingNode
public CoverageProcessingNode getSource(int index)
CoverageProcessingNode
getSource
in interface CoverageProcessingNode
index
- is the zero-based index for the sink we want to get.CoverageProcessingNode
which represents the sink at index index
for this CoverageProcessingNode
.public List<CoverageProcessingNode> getSources()
CoverageProcessingNode
List
of source for this CoverageProcessingNode
. Each source
MUST be a CoverageProcessingNode
.getSources
in interface CoverageProcessingNode
public boolean removeSink(CoverageProcessingNode sink)
CoverageProcessingNode
CoverageProcessingNode
from the list of sinks for this CoverageProcessingNode
.removeSink
in interface CoverageProcessingNode
sink
- the CoverageProcessingNode
to remove from the List
of sinks for
this CoverageProcessingNode
.true
in case we remove something, false
otherwise.public CoverageProcessingNode removeSink(int index)
CoverageProcessingNode
CoverageProcessingNode
from the list of sinks for this CoverageProcessingNode
.removeSink
in interface CoverageProcessingNode
index
- the index at which we want to remove a sink from the List
of sinks for
this CoverageProcessingNode
.CoverageProcessingNode
we actually remove from the sinks list.public boolean removeSource(CoverageProcessingNode source)
CoverageProcessingNode
CoverageProcessingNode
to the list of sources for this CoverageProcessingNode
.removeSource
in interface CoverageProcessingNode
true
in case we remove something, false
otherwise.public Hints getHints()
Hints
.getHints
in interface CoverageProcessingNode
Hints
provided at construction time to control GridCoverageFactory
creation.public int getMaximumNumberOfSources()
CoverageProcessingNode
CoverageProcessingNode
public GridCoverageFactory getCoverageFactory()
GridCoverageFactory
we will internally use for build intermediate and output
GridCoverage2D
.getCoverageFactory
in interface CoverageProcessingNode
GridCoverageFactory
we will internally use for build intermediate and
output GridCoverage2D
.public int getNumberOfSinks()
CoverageProcessingNode
CoverageProcessingNode
.getNumberOfSinks
in interface CoverageProcessingNode
CoverageProcessingNode
.public int getNumberOfSources()
CoverageProcessingNode
CoverageProcessingNode
.getNumberOfSources
in interface CoverageProcessingNode
CoverageProcessingNode
.public InternationalString getDescription()
CoverageProcessingNode
CoverageProcessingNode
getDescription
in interface CoverageProcessingNode
public InternationalString getName()
CoverageProcessingNode
CoverageProcessingNode
getName
in interface CoverageProcessingNode
protected static void ensureSourceNotNull(Object source, String name)
IllegalArgumentException
exception.source
- the object to check.node
- the operation we are trying to run.protected static void ensureNotNull(Object source, String name)
IllegalArgumentException
exception.source
- the object to check.node
- the operation we are trying to run.public CoverageProcessingNode removeSource(int index) throws IndexOutOfBoundsException
CoverageProcessingNode
CoverageProcessingNode
to the list of sources for this CoverageProcessingNode
.removeSource
in interface CoverageProcessingNode
index
- the index at which we want to remove a source from the List
of sources
for this CoverageProcessingNode
.CoverageProcessingNode
we actually remove from the sources list.IndexOutOfBoundsException
public String toString()
CoverageProcessingNode
CoverageProcessingNode
.toString
in interface CoverageProcessingNode
toString
in class Object
CoverageProcessingNode
public boolean isDisposed()
true
if the node has been already disposed, false
otherwise.public boolean isExecuted()
true
if the node has been already executed, false
otherwise.Copyright © 1996–2019 Geotools. All rights reserved.