Package ch.grengine

Class Grengine.Builder

java.lang.Object
ch.grengine.Grengine.Builder
Enclosing class:
Grengine

public static class Grengine.Builder extends Object
Builder for instances of Grengine.
Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Field Details

    • DEFAULT_LATENCY_MS

      public static final long DEFAULT_LATENCY_MS
      the default latency (5000ms = five seconds).
      Since:
      1.0
      See Also:
  • Constructor Details

    • Builder

      public Builder()
      constructor.
      Since:
      1.0
  • Method Details

    • setEngine

      public Grengine.Builder setEngine(Engine engine)
      sets the engine, default is a new instance of LayeredEngine with default settings.
      Parameters:
      engine - engine
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setSourceFactory

      public Grengine.Builder setSourceFactory(SourceFactory sourceFactory)
      sets the source factory for creating sources, default is a new instance of DefaultSourceFactory with default settings.
      Parameters:
      sourceFactory - source factory
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setSourcesLayers

      public Grengine.Builder setSourcesLayers(List<Sources> sourcesLayers)
      sets the sources layers, default is no layers.
      Parameters:
      sourcesLayers - sources layers
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setSourcesLayers

      public Grengine.Builder setSourcesLayers(Sources... sourcesLayers)
      sets the sources layers, default is no layers.
      Parameters:
      sourcesLayers - sources layers
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setUpdateExceptionNotifier

      public Grengine.Builder setUpdateExceptionNotifier(UpdateExceptionNotifier updateExceptionNotifier)
      sets the update notification notifier, default none (null).
      Parameters:
      updateExceptionNotifier - update notification notifier
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setLatencyMs

      public Grengine.Builder setLatencyMs(long latencyMs)
      sets the latency in milliseconds for checking if need to recompile sources layers, default is DEFAULT_LATENCY_MS.
      Parameters:
      latencyMs - latency in milliseconds
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • getEngine

      public Engine getEngine()
      gets the engine.
      Returns:
      engine
      Since:
      1.0
    • getSourceFactory

      public SourceFactory getSourceFactory()
      gets the source factory for creating sources.
      Returns:
      source factory
      Since:
      1.0
    • getSourcesLayers

      public List<Sources> getSourcesLayers()
      gets the sources layers.
      Returns:
      sources layers
      Since:
      1.0
    • getUpdateExceptionNotifier

      public UpdateExceptionNotifier getUpdateExceptionNotifier()
      gets the update notification notifier.
      Returns:
      update notification notifier
      Since:
      1.0
    • getLatencyMs

      public long getLatencyMs()
      gets the latency in milliseconds.
      Returns:
      latency in milliseconds
      Since:
      1.0
    • build

      public Grengine build()
      builds a new instance of Grengine.
      Returns:
      new instance
      Since:
      1.0