Synthia
Generic and flexible data structure generator
PeriodicSignal.java
Go to the documentation of this file.
1 /*
2  Synthia, a data structure generator
3  Copyright (C) 2019-2021 Laboratoire d'informatique formelle
4  Université du Québec à Chicoutimi, Canada
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 package ca.uqac.lif.synthia.signal;
20 
21 import ca.uqac.lif.synthia.Picker;
22 
23 /**
24  * A signal picker that is characterized by an amplitude and a phase.
25  * @author Sylvain Hallé
26  * @ingroup API
27  */
28 public abstract class PeriodicSignal implements Picker<Number>
29 {
30  /**
31  * A picker determining the amplitude of the signal.
32  */
33  /*@ non_null @*/ protected Picker<? extends Number> m_amplitude;
34 
35  /**
36  * A picker determining the frequency of the signal.
37  */
39 
40  /**
41  * A picker determining the phase of the signal.
42  */
44 
45  /**
46  * The current position in the signal.
47  */
48  protected float m_currentPosition;
49 
50  /**
51  * Creates a new instance of the signal picker.
52  * @param amplitude A picker determining the amplitude of the signal
53  * @param amplitude A picker determining the angular frequency of the signal
54  * @param m_phase A picker determining the phase of the signal
55  */
56  public PeriodicSignal(/*@ non_null @*/ Picker<? extends Number> amplitude, /*@ non_null @*/ Picker<? extends Number> frequency, /*@ non_null @*/ Picker<? extends Number> phase)
57  {
58  super();
59  m_amplitude = amplitude;
60  m_frequency = frequency;
61  m_phase = phase;
63  }
64 
65  @Override
66  public void reset()
67  {
69  m_phase.reset();
71  }
72 
73  /**
74  * Copies the content of a periodic signal picker into another.
75  * @param ps The picker to copy into
76  * @param with_state Whether the duplication is stateful
77  */
78  protected void copyInto(PeriodicSignal ps, boolean with_state)
79  {
80  ps.m_amplitude = m_amplitude.duplicate(with_state);
81  ps.m_phase = m_phase.duplicate(with_state);
82  if (with_state)
83  {
85  }
86  }
87 }
ca.uqac.lif.synthia.Picker
Picks an object.
Definition: Picker.java:36
ca.uqac.lif.synthia.signal.PeriodicSignal.m_phase
Picker<? extends Number > m_phase
A picker determining the phase of the signal.
Definition: PeriodicSignal.java:43
ca.uqac.lif.synthia.signal.PeriodicSignal
A signal picker that is characterized by an amplitude and a phase.
Definition: PeriodicSignal.java:28
ca.uqac
ca.uqac.lif.synthia
Definition: Bounded.java:19
ca.uqac.lif
ca
ca.uqac.lif.synthia.signal.PeriodicSignal.m_amplitude
Picker<? extends Number > m_amplitude
A picker determining the amplitude of the signal.
Definition: PeriodicSignal.java:33
ca.uqac.lif.synthia.signal.PeriodicSignal.m_currentPosition
float m_currentPosition
The current position in the signal.
Definition: PeriodicSignal.java:48
ca.uqac.lif.synthia.signal.PeriodicSignal.PeriodicSignal
PeriodicSignal(Picker<? extends Number > amplitude, Picker<? extends Number > frequency, Picker<? extends Number > phase)
Creates a new instance of the signal picker.
Definition: PeriodicSignal.java:56
ca.uqac.lif.synthia.signal.PeriodicSignal.reset
void reset()
Puts the picker back into its initial state.
Definition: PeriodicSignal.java:66
ca.uqac.lif.synthia.signal.PeriodicSignal.m_frequency
Picker<? extends Number > m_frequency
A picker determining the frequency of the signal.
Definition: PeriodicSignal.java:38
ca.uqac.lif.synthia.Picker.duplicate
Picker< T > duplicate(boolean with_state)
Creates a copy of the picker.
ca.uqac.lif.synthia.Picker.reset
void reset()
Puts the picker back into its initial state.
ca.uqac.lif.synthia.signal.PeriodicSignal.copyInto
void copyInto(PeriodicSignal ps, boolean with_state)
Copies the content of a periodic signal picker into another.
Definition: PeriodicSignal.java:78