Class AbstractStreamlet<I,O>

java.lang.Object
swim.streamlet.AbstractStreamlet<I,O>
All Implemented Interfaces:
GenericStreamlet<I,O>, Streamlet<I,O>, StreamletScope<O>

public abstract class AbstractStreamlet<I,O> extends Object implements GenericStreamlet<I,O>
  • Field Details

  • Constructor Details

    • AbstractStreamlet

      public AbstractStreamlet(StreamletScope<? extends O> scope)
    • AbstractStreamlet

      public AbstractStreamlet()
  • Method Details

    • streamletScope

      public StreamletScope<? extends O> streamletScope()
      Description copied from interface: Streamlet
      Returns the lexically scoped parent of this Streamlet. Returns null if this Streamlet has no lexical parent.
      Specified by:
      streamletScope in interface Streamlet<I,O>
      Specified by:
      streamletScope in interface StreamletScope<I>
    • setStreamletScope

      public void setStreamletScope(StreamletScope<? extends O> scope)
      Description copied from interface: Streamlet
      Sets the lexically scoped parent of this Streamlet.
      Specified by:
      setStreamletScope in interface Streamlet<I,O>
    • streamletContext

      public StreamletContext streamletContext()
      Description copied from interface: Streamlet
      Returns the environment in which this Streamlet operates.
      Specified by:
      streamletContext in interface Streamlet<I,O>
      Specified by:
      streamletContext in interface StreamletScope<I>
    • setStreamletContext

      public void setStreamletContext(StreamletContext context)
      Description copied from interface: Streamlet
      Sets the environment in which this Streamlet operates.
      Specified by:
      setStreamletContext in interface Streamlet<I,O>
    • inlet

      public Inlet<I> inlet(String key)
      Description copied from interface: Streamlet
      Returns the Inlet to this Streamlet identified by the given key; returns null if this Streamlet has no such Inlet.
      Specified by:
      inlet in interface Streamlet<I,O>
    • inlet

      protected <I2 extends I> Inlet<I2> inlet()
    • bindInput

      public void bindInput(String key, Outlet<? extends I> input)
      Description copied from interface: Streamlet
      Connects the Inlet of this Streamlet, identified by the given key, to the input from which the Inlet should acquire its state. Delegates to Inlet.bindInput(Outlet) on the identified Inlet.
      Specified by:
      bindInput in interface Streamlet<I,O>
    • unbindInput

      public void unbindInput(String key)
      Description copied from interface: Streamlet
      Disconnects the Inlet of this Streamlet, identified by the given key, from its input Outlet, if connected. Delegates to Inlet.unbindInput() on the identified Inlet.
      Specified by:
      unbindInput in interface Streamlet<I,O>
    • outlet

      public Outlet<O> outlet(String key)
      Description copied from interface: Streamlet
      Returns the Outlet of this Streamlet identified by the given key; returns null if this Streamlet has no such Outlet.
      Specified by:
      outlet in interface Streamlet<I,O>
      Specified by:
      outlet in interface StreamletScope<I>
    • outlet

      protected <O2> Outlet<O2> outlet()
    • inoutlet

      protected <I2 extends I, O2> Inoutlet<I2,O2> inoutlet()
    • decohere

      public void decohere()
      Description copied from interface: Streamlet
      Marks this Streamlet—and all of its outlets—as having inconsistent state. Decohering a Streamlet will recursively decohere all streamlets that transitively depend on the state of this Streamlet. Decohering a Streamlet does not cause its state to be recomputed. A subsequent Streamlet.recohere(int) call will eventually make the state of the Streamlet coherent again.
      Specified by:
      decohere in interface Streamlet<I,O>
    • recohere

      public void recohere(int version)
      Description copied from interface: Streamlet
      Updates the state of this Streamlet to make it consistent with the target version. The Streamlet only needs to update if its current version differs from the target version. To update its state, the Streamlet first invokes Inlet.recohereOutput(int) on each of its inlets, to ensure that its input states are coherent. It then recomputes its own state in an implementation defined manner. Finally, it invokes Outlet.recohereInput(int) on its outlets, causing all transitively dependent streamlets to make their own states coherent again.
      Specified by:
      recohere in interface Streamlet<I,O>
    • getInput

      public <I2 extends I> I2 getInput(Inlet<I2> inlet)
    • getInput

      public <I2 extends I> I2 getInput(String key)
    • getInput

      public <I2 extends I> I2 getInput(Inlet<I2> inlet, I2 orElse)
    • getInput

      public <I2 extends I> I2 getInput(String key, I2 orElse)
    • getOutput

      public O getOutput(Outlet<? super O> outlet)
      Specified by:
      getOutput in interface GenericStreamlet<I,O>
    • getOutput

      public O getOutput(String key)
    • disconnectInputs

      public void disconnectInputs()
      Description copied from interface: Streamlet
      Disconnects all Inlets dominated by this Streamlet in the dataflow dependency graph. Used to recursively clean up chains of combinators terminating at this Streamlet.
      Specified by:
      disconnectInputs in interface Streamlet<I,O>
    • disconnectOutputs

      public void disconnectOutputs()
      Description copied from interface: Streamlet
      Disconnects all Inletss dominated by this Streamlet in the dataflow graph. Used to recursively clean up chains of combinators originating from this Streamlet.
      Specified by:
      disconnectOutputs in interface Streamlet<I,O>
    • willDecohereInlet

      public void willDecohereInlet(Inlet<? extends I> inlet)
      Specified by:
      willDecohereInlet in interface GenericStreamlet<I,O>
    • didDecohereInlet

      public void didDecohereInlet(Inlet<? extends I> inlet)
      Specified by:
      didDecohereInlet in interface GenericStreamlet<I,O>
    • willRecohereInlet

      public void willRecohereInlet(Inlet<? extends I> inlet, int version)
      Specified by:
      willRecohereInlet in interface GenericStreamlet<I,O>
    • didRecohereInlet

      public void didRecohereInlet(Inlet<? extends I> inlet, int version)
      Specified by:
      didRecohereInlet in interface GenericStreamlet<I,O>
    • willDecohereOutlet

      public void willDecohereOutlet(Outlet<? super O> outlet)
      Specified by:
      willDecohereOutlet in interface GenericStreamlet<I,O>
    • didDecohereOutlet

      public void didDecohereOutlet(Outlet<? super O> outlet)
      Specified by:
      didDecohereOutlet in interface GenericStreamlet<I,O>
    • willRecohereOutlet

      public void willRecohereOutlet(Outlet<? super O> outlet, int version)
      Specified by:
      willRecohereOutlet in interface GenericStreamlet<I,O>
    • didRecohereOutlet

      public void didRecohereOutlet(Outlet<? super O> outlet, int version)
      Specified by:
      didRecohereOutlet in interface GenericStreamlet<I,O>
    • willDecohere

      protected void willDecohere()
    • onDecohere

      protected void onDecohere()
    • onDecohereOutlets

      protected void onDecohereOutlets()
    • didDecohere

      protected void didDecohere()
    • willRecohere

      protected void willRecohere(int version)
    • onRecohereInlets

      protected void onRecohereInlets(int version)
    • onRecohere

      protected void onRecohere(int version)
    • onRecohereOutlets

      protected void onRecohereOutlets(int version)
    • didRecohere

      protected void didRecohere(int version)
    • disconnectInputs

      public static <I, O> void disconnectInputs(Streamlet<I,O> streamlet, Class<?> streamletClass)
    • disconnectOutputs

      public static <I, O> void disconnectOutputs(Streamlet<I,O> streamlet, Class<?> streamletClass)
    • decohereOutlets

      public static <I, O> void decohereOutlets(Streamlet<I,O> streamlet, Class<?> streamletClass)
    • recohereInlets

      public static <I, O> void recohereInlets(int version, Streamlet<I,O> streamlet, Class<?> streamletClass)
    • recohereOutlets

      public static <I, O> void recohereOutlets(int version, Streamlet<I,O> streamlet, Class<?> streamletClass)
    • reflectInletCount

      public static <I, O> int reflectInletCount(Class<?> streamletClass)
    • reflectOutletCount

      public static <I, O> int reflectOutletCount(Class<?> streamletClass)
    • reflectInletIndex

      public static <I, O> Map.Entry<String,Inlet<I>> reflectInletIndex(int index, Streamlet<I,O> streamlet, Class<?> streamletClass)
    • reflectOutletIndex

      public static <I, O> Map.Entry<String,Outlet<O>> reflectOutletIndex(int index, Streamlet<I,O> streamlet, Class<?> streamletClass)
    • reflectInletKey

      public static <I, O> Inlet<I> reflectInletKey(String key, Streamlet<I,O> streamlet, Class<?> streamletClass)
    • reflectOutletKey

      public static <I, O> Outlet<O> reflectOutletKey(String key, Streamlet<I,O> streamlet, Class<?> streamletClass)
    • reflectInletField

      public static <I, O> Inlet<I> reflectInletField(Streamlet<I,O> streamlet, Field field)
    • reflectOutletField

      public static <I, O> Outlet<O> reflectOutletField(Streamlet<I,O> streamlet, Field field)
    • reflectInoutletField

      public static <I, O> Inoutlet<I,O> reflectInoutletField(Streamlet<I,O> streamlet, Field field)