|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DataModel<N extends Node,R extends Region,I extends NodeInfo<N,R,I>>
An interface describing Starmapper's Data
Model. The Data Model consists of implementations of three interfaces:
Node, Region and NodeInfo. Implementation of this
interface is a "glue" that sticks relevant parts of Data Model together; it
provides Class instances for concrete implementations of interfaces
mentioned above and serves as a factory for several additional model-specific
objects, such as Regions and Producers to produce
Nodes and NodeInfos.
Producers are used instead of iterators because to implement the iterator's
Iterator.hasNext(), the iterator has to look ahead for
next element to see if it exists and this can block the Starmapper if the
producer has to wait for next reports to arrive. Producers, on the other
hand, signal the end of stream by returning a "poison" value, the
null, and the values can be returned and processed immediately
without waiting to see if the next element exists.
The other responsibility of DataModel is implementation of a double
dispatch for applications. See Application for details. The
startApplication(Application, Config) method is (usually) very
simple and thus is implemented by AbstractDataModel, which
implementations of DataModel are encouraged to extend.
Application,
Node,
Region,
NodeInfo| Method Summary | |
|---|---|
R |
createRegion(int regionNumber)
Creates this Data Model's concrete implementation of Region,
described by the given Config and this region's number
(identifier). |
void |
endSession()
Ends a session with this Data Model. |
Producer<Pair<Integer,List<ReportDescriptor<N,R,I>>>> |
getAvailableReports()
Lists reports available to this Data Model by returning a Producer with reports from the same time grouped in Lists. |
LongRectangle |
getMapBounds()
Returns a LongRectangle discribing dimensions of the "universe"
of current session; Starmapper expects that the map has a fixed size and
it will not change during the session (so that the consecutive images are
using the same reference system). |
List<Converter<?>> |
getModelConverters()
Returns a List of settings accepted by this data model. |
List<Setting> |
getModelSettings()
Returns a List of settings accepted by this data model. |
Class<N> |
getNodeClass()
Returns this Data Model's concrete Node's Class. |
Class<I> |
getNodeInfoClass()
Returns this Data Model's concrete NodeInfo's Class. |
Class<R> |
getRegionClass()
Returns this Data Model's concrete Region's Class. |
boolean |
isInSession()
Tells the caller if this model is in session, i.e. the startSession(Config, URI, String, EventListener) method was
called, but not endSession(). |
void |
startApplication(Application app,
Config settings)
Implements a double dispatch bridge between non-generified and generified application code; see Application for details. |
void |
startSession(Config config,
URI pathBase,
String baseName,
EventListener eventListener)
Starts an application session with this model - the model is allowed (but discouraged) to modify the given Config for the duration of the
session and the model should guarantee that the config will not change
during this time. |
| Method Detail |
|---|
Class<N> getNodeClass()
Node's Class.
Node's Class.Class<R> getRegionClass()
Region's Class.
Region's Class.Class<I> getNodeInfoClass()
NodeInfo's Class.
NodeInfo's Class.List<Setting> getModelSettings()
List of settings accepted by this data model.
List<Converter<?>> getModelConverters()
List of settings accepted by this data model.
void startSession(Config config,
URI pathBase,
String baseName,
EventListener eventListener)
throws ParametersException,
IOException,
ProducerException
Config for the duration of the
session and the model should guarantee that the config will not change
during this time. The data model can send events to a given
EventListener; this listener is installed in the model for the
duration of this session and is removed when endSession() is
called.
config - the Config for the sessionpathBase - a base URI that can be used to resolve relative paths
(see URI.resolve(URI))baseName - the session's "base name" (AKA "signature"), usually used to
name and/or find data fileseventListener - a EventListener to which this model can send events
ParametersException - if the session Config complains about reconfiguration
IOException - if an IO error occurs
ProducerException - on any producer-related errorboolean isInSession()
startSession(Config, URI, String, EventListener) method was
called, but not endSession().
void endSession()
throws ParametersException,
IOException,
ProducerException
ParametersException - if the session Config complains about reconfiguration
IOException - if an IO error occurs
ProducerException - on any producer-related error
LongRectangle getMapBounds()
throws ParametersException,
IOException,
ProducerException
LongRectangle discribing dimensions of the "universe"
of current session; Starmapper expects that the map has a fixed size and
it will not change during the session (so that the consecutive images are
using the same reference system). It is safe to return a mutable object
here, Starmapper will not modify it.
ParametersException - if any of the Config values is invalid
IOException - if an IO error occurs
ProducerException - on any producer-related error
R createRegion(int regionNumber)
throws ParametersException,
IOException,
ProducerException
Region,
described by the given Config and this region's number
(identifier).
regionNumber - the number (identifier) of the region to construct
Region
ParametersException - if any of the Config values is invalid
IOException - if an IO error occurs
ProducerException - on any producer-related error
Producer<Pair<Integer,List<ReportDescriptor<N,R,I>>>> getAvailableReports()
throws ParametersException,
IOException,
ProducerException
Producer with reports from the same time grouped in Lists.
The elements returned are Pairs in which the left component is
the time from which those reorts are and the right component is the list
of reports (the reports' time is duplicated in a separate value, because
it is allowed to return empty list of reports for a given time).
The place where those reports are to be sought is usually specified in
model-specific Config values.
Producer of available reports as
ReportDescriptors grouped by time
ParametersException - if any of the Config values is invalid
IOException - if an IO error occurs
ProducerException - on any producer-related error
void startApplication(Application app,
Config settings)
throws ParametersException,
IOException,
ProducerException
Application for details.
app - the Application to call backsettings - the Config used by the application
ParametersException - if the Config complains about reconfiguration
IOException - if an IO error occurs
ProducerException - on any producer-related errorApplication,
AbstractDataModel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||