Package swim.dataflow

Class AbstractRecordStreamlet<I extends Value,O extends Value>

All Implemented Interfaces:
Comparable<Item>, Iterable<Item>, Collection<Item>, List<Item>, Debug, Display, GenericStreamlet<I,O>, Streamlet<I,O>, StreamletScope<O>, Builder<Item,Record>, PairBuilder<Value,Value,Record>
Direct Known Subclasses:
DownlinkStreamlet

public abstract class AbstractRecordStreamlet<I extends Value,O extends Value> extends RecordStreamlet<I,O> implements GenericStreamlet<I,O>
  • Field Details

  • Constructor Details

    • AbstractRecordStreamlet

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

      public AbstractRecordStreamlet()
  • 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 extends Value,O extends Value>
      Specified by:
      streamletScope in interface StreamletScope<I extends Value>
    • 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 extends Value,O extends Value>
    • streamletContext

      public StreamletContext streamletContext()
      Description copied from interface: Streamlet
      Returns the environment in which this Streamlet operates.
      Specified by:
      streamletContext in interface Streamlet<I extends Value,O extends Value>
      Specified by:
      streamletContext in interface StreamletScope<I extends Value>
    • 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 extends Value,O extends Value>
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Record
      Returns true if this Record has no members.
      Specified by:
      isEmpty in interface Collection<I extends Value>
      Specified by:
      isEmpty in interface List<I extends Value>
      Specified by:
      isEmpty in class Record
    • size

      public int size()
      Description copied from class: Record
      Returns the number of members contained in this Record.
      Specified by:
      size in interface Collection<I extends Value>
      Specified by:
      size in interface List<I extends Value>
      Specified by:
      size in class Record
    • containsKey

      public boolean containsKey(Value key)
      Description copied from class: Record
      Returns true if this Record has a Field member with a key that is equal to the given key; otherwise returns false if this Record has no Field member with a key equal to the given key.
      Overrides:
      containsKey in class Record
    • containsKey

      public boolean containsKey(String key)
      Description copied from class: Record
      Returns true if this Record has a Field member with a key that is equal to the given key; otherwise returns false if this Record has no Field member with a key equal to the given key. Equivalent to Record.containsKey(Value), but avoids boxing the key string into a Text value.
      Overrides:
      containsKey in class Record
    • get

      public Value get(Value key)
      Description copied from class: Record
      Returns the value of the last Field member of this Record whose key is equal to the given key; returns Absent if this Record has no Field member with a key equal to the given key.
      Overrides:
      get in class Record
    • get

      public Value get(String key)
      Description copied from class: Record
      Returns the value of the last Field member of this Record whose key is equal to the given key; returns Absent if this Record has no Field member with a key equal to the given key. Equivalent to Record.get(Value), but avoids boxing the key string into a Text value.
      Overrides:
      get in class Record
    • getAttr

      public Value getAttr(Text key)
      Description copied from class: Record
      Returns the value of the last Attr member of this Record whose key is equal to the given key; returns Absent if this Record has no Attr member with a key equal to the given key.
      Overrides:
      getAttr in class Record
    • getAttr

      public Value getAttr(String key)
      Description copied from class: Record
      Returns the value of the last Attr member of this Record whose key is equal to the given key; returns Absent if this Record has no Attr member with a key equal to the given key. Equivalent to Record.getAttr(Text), but avoids boxing the key string into a Text value.
      Overrides:
      getAttr in class Record
    • getSlot

      public Value getSlot(Value key)
      Description copied from class: Record
      Returns the value of the last Slot member of this Record whose key is equal to the given key; returns Absent if this Record has no Slot member with a key equal to the given key.
      Overrides:
      getSlot in class Record
    • getSlot

      public Value getSlot(String key)
      Description copied from class: Record
      Returns the value of the last Slot member of this Record whose key is equal to the given key; returns Absent if this Record has no Slot member with a key equal to the given key. Equivalent to Record.getSlot(Value), but avoids boxing the key string into a Text value.
      Overrides:
      getSlot in class Record
    • getField

      public Field getField(Value key)
      Description copied from class: Record
      Returns the last Field member of this Record whose key is equal to the given key; returns null if this Record has no Field member with a key equal to the given key.
      Overrides:
      getField in class Record
    • getField

      public Field getField(String key)
      Description copied from class: Record
      Returns the last Field member of this Record whose key is equal to the given key; returns null if this Record has no Field member with a key equal to the given key. Equivalent to Record.getField(Value), but avoids boxing the key string into a Text value.
      Overrides:
      getField in class Record
    • get

      public Item get(int index)
      Description copied from class: Record
      Returns the member of this Record at the given index, if the index is greater than or equal to zero, and less than the length of this Record.
      Specified by:
      get in interface List<I extends Value>
      Specified by:
      get in class Record
    • getItem

      public Item getItem(int index)
      Description copied from class: Record
      Returns the member of this Record at the given index, if the index is greater than or equal to zero, and less than the length of this Record; otherwise returns Absent if the index is out of bounds.
      Specified by:
      getItem in class Record
    • put

      public Value put(Value key, Value newValue)
      Overrides:
      put in class Record
    • put

      public Value put(String key, Value newValue)
      Overrides:
      put in class Record
    • putAttr

      public Value putAttr(Text key, Value newValue)
      Overrides:
      putAttr in class Record
    • putAttr

      public Value putAttr(String key, Value newValue)
      Overrides:
      putAttr in class Record
    • putSlot

      public Value putSlot(Value key, Value newValue)
      Overrides:
      putSlot in class Record
    • putSlot

      public Value putSlot(String key, Value newValue)
      Overrides:
      putSlot in class Record
    • setItem

      public Item setItem(int index, Item item)
      Description copied from class: Record
      Replaces the member of this Record at the given index with a new item, returning the previous Item at the given index, if the index is greater than or equal to zero, and less than the length of this Record.
      Specified by:
      setItem in class Record
    • add

      public boolean add(Item item)
      Description copied from interface: Builder
      Adds a single input value to this builder, returning true if the state of the builder changed.
      Specified by:
      add in interface Builder<I extends Value,O extends Value>
      Specified by:
      add in interface Collection<I extends Value>
      Specified by:
      add in interface List<I extends Value>
      Specified by:
      add in class Record
    • add

      public void add(int index, Item item)
      Specified by:
      add in interface List<I extends Value>
      Specified by:
      add in class Record
    • remove

      public Item remove(int index)
      Specified by:
      remove in interface List<I extends Value>
      Specified by:
      remove in class Record
    • removeKey

      public boolean removeKey(Value key)
      Overrides:
      removeKey in class Record
    • removeKey

      public boolean removeKey(String key)
      Overrides:
      removeKey in class Record
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<I extends Value>
      Specified by:
      clear in interface List<I extends Value>
      Specified by:
      clear in class Record
    • 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 extends Value,O extends Value>
    • 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 extends Value,O extends Value>
    • 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 extends Value,O extends Value>
    • 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 extends Value,O extends Value>
      Specified by:
      outlet in interface StreamletScope<I extends Value>
    • outlet

      protected <O2 extends Value> 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 extends Value,O extends Value>
    • 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 extends Value,O extends Value>
    • 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)
    • castInput

      public <T> T castInput(Inlet<? extends I> inlet, Form<T> form)
    • castInput

      public <T> T castInput(String key, Form<T> form)
    • castInput

      public <T> T castInput(Inlet<? extends I> inlet, Form<T> form, T orElse)
    • castInput

      public <T> T castInput(String key, Form<T> form, T orElse)
    • coerceInput

      public <T> T coerceInput(Inlet<? extends I> inlet, Form<T> form)
    • coerceInput

      public <T> T coerceInput(String key, Form<T> form)
    • coerceInput

      public <T> T coerceInput(Inlet<? extends I> inlet, Form<T> form, T orElse)
    • coerceInput

      public <T> T coerceInput(String key, Form<T> form, T orElse)
    • getOutput

      public O getOutput(Outlet<? super O> outlet)
      Specified by:
      getOutput in interface GenericStreamlet<I extends Value,O extends Value>
    • 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 extends Value,O extends Value>
    • 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 extends Value,O extends Value>
    • willDecohereInlet

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

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

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

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

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

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

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

      public void didRecohereOutlet(Outlet<? super O> outlet, int version)
      Specified by:
      didRecohereOutlet in interface GenericStreamlet<I extends Value,O extends Value>
    • 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)
    • compileInlets

      public static <I extends Value, O extends Value> void compileInlets(Class<?> streamletClass, RecordStreamlet<I,O> streamlet)