Synthia
Generic and flexible data structure generator
ca.uqac.lif.synthia.util.Tick Class Reference

Detailed Description

Generates a sequence of monotonically increasing numerical values.

The Tick picker requires two parameters:

  • A numerical picker indicating how the first value should be produced
  • Another numerical picker indicating by how much to increment the current value to produce the next one

Consider the following piece of code:

Tick t1 = new Tick(10, 0.5);
Tick t2 = new Tick(new RandomInteger(8, 12), new RandomIntervalFloat(0.5, 1.5));

The first instruction creates a Tick picker whose initial value is 10, and each subsequent value is incremented by exactly 0.5. The second instruction creates a Tick picker whose initial value is picked in the interval [8,12), and where each subsequent value is incremented by a number randomly chosen between 0.5 and 1.5.

Definition at line 51 of file Tick.java.

Inheritance diagram for ca.uqac.lif.synthia.util.Tick:

Public Member Functions

 Tick (Picker<? extends Number > start, Picker<? extends Number > increment)
 Creates a new Tick picker. More...
 
 Tick (Number start, Number increment)
 Creates a new Tick picker. More...
 
 Tick (Number start, Picker<? extends Number > increment)
 Creates a new Tick picker. More...
 
 Tick (Picker<? extends Number > increment)
 Creates a new Tick picker starting at value 0. More...
 
 Tick ()
 Creates a new Tick picker starting at value 0, and where each subsequent value is incremented by a number uniformly chosen in the interval [0,1]. More...
 
void reset ()
 Puts the tick back into its initial state. More...
 
Number pick ()
 Picks a tick value. More...
 
Tick duplicate (boolean with_state)
 Creates a copy of the tick picker. More...
 
Tick duplicate (float start_value)
 
Tick setValue (float value)
 Sets the current value of the tick picker. More...
 
String toString ()
 
PartNode getExplanation (Part p)
 
PartNode getExplanation (Part p, NodeFactory f)
 

Protected Attributes

Picker<? extends Number > m_startValue
 Picker that determines the start value. More...
 
double m_currentValue
 Variable holding the current value of the tick. More...
 
Picker<? extends Number > m_increment
 Picker that determines the increment for each subsequent value. More...
 

Constructor & Destructor Documentation

◆ Tick() [1/5]

ca.uqac.lif.synthia.util.Tick.Tick ( Picker<? extends Number >  start,
Picker<? extends Number >  increment 
)

Creates a new Tick picker.

Parameters
startA picker that determines the start value
incrementA picker that determines the increment for each subsequent value

Definition at line 80 of file Tick.java.

◆ Tick() [2/5]

ca.uqac.lif.synthia.util.Tick.Tick ( Number  start,
Number  increment 
)

Creates a new Tick picker.

Parameters
startThe start value
incrementThe increment added to each subsequent value

Definition at line 94 of file Tick.java.

◆ Tick() [3/5]

ca.uqac.lif.synthia.util.Tick.Tick ( Number  start,
Picker<? extends Number >  increment 
)

Creates a new Tick picker.

Parameters
startThe start value
incrementA picker that determines the increment for each subsequent value

Definition at line 105 of file Tick.java.

◆ Tick() [4/5]

ca.uqac.lif.synthia.util.Tick.Tick ( Picker<? extends Number >  increment)

Creates a new Tick picker starting at value 0.

Parameters
incrementA picker that determines the increment for each subsequent value

Definition at line 115 of file Tick.java.

◆ Tick() [5/5]

ca.uqac.lif.synthia.util.Tick.Tick ( )

Creates a new Tick picker starting at value 0, and where each subsequent value is incremented by a number uniformly chosen in the interval [0,1].

Definition at line 124 of file Tick.java.

Member Function Documentation

◆ duplicate() [1/2]

Tick ca.uqac.lif.synthia.util.Tick.duplicate ( boolean  with_state)

Creates a copy of the tick picker.

Parameters
with_stateIf set to false, the returned copy is set to the class' initial state (i.e. same thing as calling the picker's constructor). If set to true, the returned copy is put into the same internal state as the object it is copied from.
Returns
The copy of the tick picker

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 174 of file Tick.java.

◆ duplicate() [2/2]

Tick ca.uqac.lif.synthia.util.Tick.duplicate ( float  start_value)

Definition at line 185 of file Tick.java.

◆ getExplanation() [1/2]

PartNode ca.uqac.lif.synthia.util.Tick.getExplanation ( Part  p)

Definition at line 209 of file Tick.java.

◆ getExplanation() [2/2]

PartNode ca.uqac.lif.synthia.util.Tick.getExplanation ( Part  p,
NodeFactory  f 
)

Definition at line 215 of file Tick.java.

◆ pick()

Number ca.uqac.lif.synthia.util.Tick.pick ( )

Picks a tick value.

Typically, this method is expected to return non-null objects; a null return value is used to signal that no more objects will be produced. That is, once this method returns null, it should normally return null on all subsequent calls.

Returns
The tick value.

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 153 of file Tick.java.

◆ reset()

void ca.uqac.lif.synthia.util.Tick.reset ( )

Puts the tick back into its initial state.

This means that the sequence of calls to pick() will produce the same values as when the object was instantiated.

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 135 of file Tick.java.

◆ setValue()

Tick ca.uqac.lif.synthia.util.Tick.setValue ( float  value)

Sets the current value of the tick picker.

Parameters
valueThe new current value
Returns
The actual instance of the tick picker

Definition at line 195 of file Tick.java.

◆ toString()

String ca.uqac.lif.synthia.util.Tick.toString ( )

Definition at line 203 of file Tick.java.

Member Data Documentation

◆ m_currentValue

double ca.uqac.lif.synthia.util.Tick.m_currentValue
protected

Variable holding the current value of the tick.

Definition at line 61 of file Tick.java.

◆ m_increment

Picker<? extends Number> ca.uqac.lif.synthia.util.Tick.m_increment
protected

Picker that determines the increment for each subsequent value.

Definition at line 67 of file Tick.java.

◆ m_startValue

Picker<? extends Number> ca.uqac.lif.synthia.util.Tick.m_startValue
protected

Picker that determines the start value.

Definition at line 56 of file Tick.java.


The documentation for this class was generated from the following file: