Synthia
Generic and flexible data structure generator
Picker.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;
20
21
/**
22
* Picks an object. This is the interface that most classes in this library
23
* implement.
24
* <ul>
25
* <li>Objects of a given type <tt>T</tt> are obtained by calling the
26
* {@link #pick()} method.</li>
27
* <li>The picker can be put back into its initial state by calling its
28
* {@link #reset()} method.</li>
29
* <li>Copies of the picker can be made by calling its {@link #duplicate(boolean)}
30
* method. One can ask whether the copied is put in the initial state, or
31
* in the same state as the picker it is copied from.</li>
32
* </ul>
33
* @param <T> The type of object that the picker picks
34
* @ingroup API
35
*/
36
public
interface
Picker
<T>
extends
Resettable
37
{
38
/**
39
* Puts the picker back into its initial state. This means that the
40
* sequence of calls to {@link #pick()} will produce the same values
41
* as when the object was instantiated.
42
*/
43
@Override
44
public
void
reset
();
45
46
/**
47
* Picks an object. Typically, this method is expected to return non-null
48
* objects; a <tt>null</tt> return value is used to signal that no more
49
* objects will be produced. That is, once this method returns
50
* <tt>null</tt>, it should normally return <tt>null</tt> on all subsequent
51
* calls.
52
* @return The object
53
*/
54
/*@ null @*/
public
T
pick
();
55
56
/**
57
* Creates a copy of the picker.
58
* @param with_state If set to <tt>false</tt>, the returned copy is set to
59
* the class' initial state (i.e. same thing as calling the picker's
60
* constructor). If set to <tt>true</tt>, the returned copy is put into the
61
* same internal state as the object it is copied from.
62
* @return The copy of the picker
63
*/
64
/*@ non_null @*/
public
Picker<T>
duplicate
(
boolean
with_state);
65
}
ca.uqac.lif.synthia.Picker
Picks an object.
Definition:
Picker.java:36
ca.uqac.lif.synthia.Resettable
Signals that an object can be put back into its initial state.
Definition:
Resettable.java:27
ca.uqac.lif.synthia.Picker.pick
T pick()
Picks an object.
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.
Source
Core
src
ca
uqac
lif
synthia
Picker.java
Generated by
1.8.17