Package net.maswag.falcaun
Class Signal
java.lang.Object
net.maswag.falcaun.Signal
Signal is a sequence of values, each associated with an increasing timestamp.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe timestamps correspond to the signal values insignalValues.protected doubleThe time step of signals. -
Constructor Summary
ConstructorsConstructorDescriptionSignal(double timeStep) Constructs a new Signal with the specified time step. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a new value to the signal.voidaddAll(Collection<? extends List<Double>> inputValues) Adds all values from the specified collection to the signal.voidAdds all values from the specifiedWordto the signal.asList()Returns the list containing both the timestamps and the signal values.voidclear()Clears the signal.Returns the dimension of the signal.dimensionGet(int index) Returns the signal values of the index-th signal.doubleduration()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 givennewTimeStep, writing directly into the result.intsize()Returns the length of the signal.toString()
-
Field Details
-
timeStep
protected double timeStepThe time step of signals. When callingadd(List)oraddAll(Collection),timestampsare added asduration() + timeStep. -
signalValues
-
timestamps
The timestamps correspond to the signal values insignalValues.
-
-
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
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:
trueif the value was added successfully
-
addAll
Adds all values from the specified collection to the signal.- Parameters:
inputValues- the collection of values to add
-
addAll
Adds all values from the specifiedWordto 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
-
size
public int size()Returns the length of the signal.- Returns:
- the length of the signal
-
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
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
Returns the signal values of the index-th signal.- Parameters:
index- the index- Returns:
- the signal values of the index-th signal
-
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
Returns a new Signal whose values are linearly interpolated at the givennewTimeStep, writing directly into the result.- Parameters:
newTimeStep- the time step for the interpolated signal- Returns:
- a Signal containing the linearly interpolated data
-