Class AbstractInoutlet<I,O>

java.lang.Object
swim.streamlet.AbstractInoutlet<I,O>
All Implemented Interfaces:
Inlet<I>, Inoutlet<I,O>, Outlet<O>
Direct Known Subclasses:
MapValueOperator, MemoizeValueCombinator, StreamletInoutlet

public abstract class AbstractInoutlet<I,O> extends Object implements Inoutlet<I,O>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Outlet<? extends I>
     
    protected Inlet<? super O>[]
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bindInput(Outlet<? extends I> input)
    Connects this Inlet to an Outlet from which it will acquire its state.
    void
    bindOutput(Inlet<? super O> output)
    Adds an output to the set of Inlets that depend on the state of this Outlet.
    void
     
    void
    Marks this Outlet—and all outputs that depend on the state of this Outlet—as having decoherent state.
    void
    Marks this Inlet—and the Streamlet to which this Inlet is attached—as having decoherent state.
    protected void
     
    protected void
    didRecohere(int version)
     
    void
    Disconnects all Inlets dominated by this Inoutlet in the dataflow dependency graph.
    void
    Disconnects all Inletss dominated by this Inoutlet in the dataflow graph.
    abstract O
    get()
    Returns the current state of this Outlet.
    Outlet<? extends I>
    Returns the Outlet from which this Inlet acquires its state; returns null if this Inlet is disconnected.
    protected void
     
    protected void
    onRecohere(int version)
     
    Iterator<Inlet<? super O>>
    Returns an Iterator over the set of Inlets that depend on the state of this Outlet.
    void
    recohere(int version)
     
    void
    recohereInput(int version)
    Updates the state of this Outlet to make it consistent with the target version.
    void
    recohereOutput(int version)
    Updates the state of this Inlet to make it consistent with the target version.
    void
    Disconnects this Inlet from its input Outlet, if connected.
    void
    unbindOutput(Inlet<? super O> output)
    Removes an output from the set of Inlets that depend on the state of this Outlet.
    void
    Disconnects all outputs from this Outlet by invoking Inlet.unbindInput() on each Inelt that depends on the state of this Outlet.
    protected void
     
    protected void
    willRecohere(int version)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface swim.streamlet.Outlet

    map, memoize, watch
  • Field Details

    • input

      protected Outlet<? extends I> input
    • outputs

      protected Inlet<? super O>[] outputs
    • version

      protected int version
  • Constructor Details

    • AbstractInoutlet

      public AbstractInoutlet()
  • Method Details

    • get

      public abstract O get()
      Description copied from interface: Outlet
      Returns the current state of this Outlet.
      Specified by:
      get in interface Outlet<I>
    • input

      public Outlet<? extends I> input()
      Description copied from interface: Inlet
      Returns the Outlet from which this Inlet acquires its state; returns null if this Inlet is disconnected.
      Specified by:
      input in interface Inlet<I>
    • bindInput

      public void bindInput(Outlet<? extends I> input)
      Description copied from interface: Inlet
      Connects this Inlet to an Outlet from which it will acquire its state. If this Inlet is already connected, it will first disconnect from its existing input. Then, after updating its input property, the Inlet will invoke Outlet.bindOutput(Inlet) on its new input.
      Specified by:
      bindInput in interface Inlet<I>
    • unbindInput

      public void unbindInput()
      Description copied from interface: Inlet
      Disconnects this Inlet from its input Outlet, if connected. After setting its input property to null, the Inlet will invoke Outlet.unbindOutput(Inlet) on its old input, if defined.
      Specified by:
      unbindInput in interface Inlet<I>
    • disconnectInputs

      public void disconnectInputs()
      Description copied from interface: Inoutlet
      Disconnects all Inlets dominated by this Inoutlet in the dataflow dependency graph. Used to recursively clean up chains of combinators passing through this Inoutlet.
      Specified by:
      disconnectInputs in interface Inlet<I>
      Specified by:
      disconnectInputs in interface Inoutlet<I,O>
      Specified by:
      disconnectInputs in interface Outlet<I>
    • outputIterator

      public Iterator<Inlet<? super O>> outputIterator()
      Description copied from interface: Outlet
      Returns an Iterator over the set of Inlets that depend on the state of this Outlet.
      Specified by:
      outputIterator in interface Outlet<I>
    • bindOutput

      public void bindOutput(Inlet<? super O> output)
      Description copied from interface: Outlet
      Adds an output to the set of Inlets that depend on the state of this Outlet. The output will be decohered when the state of this Outlet is decohered, and recohered when this Outlet is recohered.
      Specified by:
      bindOutput in interface Outlet<I>
    • unbindOutput

      public void unbindOutput(Inlet<? super O> output)
      Description copied from interface: Outlet
      Removes an output from the set of Inlets that depend on the state of this Outlet.
      Specified by:
      unbindOutput in interface Outlet<I>
    • unbindOutputs

      public void unbindOutputs()
      Description copied from interface: Outlet
      Disconnects all outputs from this Outlet by invoking Inlet.unbindInput() on each Inelt that depends on the state of this Outlet.
      Specified by:
      unbindOutputs in interface Outlet<I>
    • disconnectOutputs

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

      public void decohereOutput()
      Description copied from interface: Inlet
      Marks this Inlet—and the Streamlet to which this Inlet is attached—as having decoherent state. Decohering an Inlet will recursively decohere all streamlets that transitively depend on the state of this Inlet. Decohering an Inlet does not cause its state to be recomputed. A subsequent Inlet.recohereOutput(int) call will eventually make the state of the Inlet coherent again.
      Specified by:
      decohereOutput in interface Inlet<I>
    • decohereInput

      public void decohereInput()
      Description copied from interface: Outlet
      Marks this Outlet—and all outputs that depend on the state of this Outlet—as having decoherent state.
      Specified by:
      decohereInput in interface Outlet<I>
    • decohere

      public void decohere()
    • recohereOutput

      public void recohereOutput(int version)
      Description copied from interface: Inlet
      Updates the state of this Inlet to make it consistent with the target version. The Inlet only needs to update if its current version differs from the target version. To update its state, the Inlet first invokes Outlet.recohereInput(int) on its input, to ensure that its input is coherent. It then invokes Streamlet.recohere(int) on the Streamlet to which it's attached, causing the Streamlet to make its own state coherent again.
      Specified by:
      recohereOutput in interface Inlet<I>
    • recohereInput

      public void recohereInput(int version)
      Description copied from interface: Outlet
      Updates the state of this Outlet to make it consistent with the target version. The Outlet only needs to update if its current version differs from the target version. To update its state, the Outlet first invokes Streamlet.recohere(int) on the Streamlet to which it's attached. It then invokes Inlet.recohereOutput(int) on each of its dependent outputs.
      Specified by:
      recohereInput in interface Outlet<I>
    • recohere

      public void recohere(int version)
    • willDecohere

      protected void willDecohere()
    • onDecohere

      protected void onDecohere()
    • didDecohere

      protected void didDecohere()
    • willRecohere

      protected void willRecohere(int version)
    • onRecohere

      protected void onRecohere(int version)
    • didRecohere

      protected void didRecohere(int version)