Class Signal

java.lang.Object
net.maswag.falcaun.Signal

public class Signal extends Object
Signal is a sequence of values, each associated with an increasing timestamp.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<List<Double>>
     
    protected List<Double>
    The timestamps correspond to the signal values in signalValues.
    protected double
    The time step of signals.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Signal(double timeStep)
    Constructs a new Signal with the specified time step.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(List<Double> inputValue)
    Adds a new value to the signal.
    void
    addAll(Collection<? extends List<Double>> inputValues)
    Adds all values from the specified collection to the signal.
    void
    addAll(net.automatalib.word.Word<? extends List<Double>> inputValues)
    Adds all values from the specified Word to the signal.
    Returns the list containing both the timestamps and the signal values.
    void
    Clears the signal.
    Returns the dimension of the signal.
    dimensionGet(int index)
    Returns the signal values of the index-th signal.
    double
    Returns the duration of the signal, the difference between the last and first timestamps.
    get(int index)
    Returns the value of the index-th control point of the signal.
    linearInterpolate(double newTimeStep)
    Returns a new Signal whose values are linearly interpolated at the given newTimeStep, writing directly into the result.
    int
    Returns the length of the signal.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • timeStep

      protected double timeStep
      The time step of signals. When calling add(List) or addAll(Collection), timestamps are added as duration() + timeStep.
    • signalValues

      protected List<List<Double>> signalValues
    • timestamps

      protected List<Double> timestamps
      The timestamps correspond to the signal values in signalValues.
  • Constructor Details

    • Signal

      public Signal(double timeStep)
      Constructs a new Signal with the specified time step.
      Parameters:
      timeStep - the time step for the signal
  • Method Details

    • add

      public boolean add(List<Double> inputValue)
      Adds a new value to the signal. The first value is added at time 0.0, and the other values are added at the last timestamp + timeStep.
      Parameters:
      inputValue - the value to add
      Returns:
      true if the value was added successfully
    • addAll

      public void addAll(Collection<? extends List<Double>> inputValues)
      Adds all values from the specified collection to the signal.
      Parameters:
      inputValues - the collection of values to add
    • addAll

      public void addAll(net.automatalib.word.Word<? extends List<Double>> inputValues)
      Adds all values from the specified Word to the signal.
      Parameters:
      inputValues - the word of values to add
    • duration

      public double duration()
      Returns the duration of the signal, the difference between the last and first timestamps. In this class, the duration is the same as the last timestamp. If the signal is empty, returns 0.0.
      Returns:
      the duration of the signal
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • size

      public int size()
      Returns the length of the signal.
      Returns:
      the length of the signal
    • dimension

      public Integer dimension()
      Returns the dimension of the signal.
      Returns:
      the dimension of the signal if the input value is already set, otherwise null
    • clear

      public void clear()
      Clears the signal.
    • get

      public List<Double> get(int index)
      Returns the value of the index-th control point of the signal.
      Parameters:
      index - the index
      Returns:
      the value of the index-th control point of the signal
    • dimensionGet

      public List<Double> dimensionGet(int index)
      Returns the signal values of the index-th signal.
      Parameters:
      index - the index
      Returns:
      the signal values of the index-th signal
    • asList

      public List<List<Double>> asList()
      Returns the list containing both the timestamps and the signal values.
      Returns:
      a list of lists. Each inner list contains the timestamp followed by the signal values
    • linearInterpolate

      public Signal linearInterpolate(double newTimeStep)
      Returns a new Signal whose values are linearly interpolated at the given newTimeStep, writing directly into the result.
      Parameters:
      newTimeStep - the time step for the interpolated signal
      Returns:
      a Signal containing the linearly interpolated data