Synthia
Generic and flexible data structure generator
SetPicker.java
Go to the documentation of this file.
1 /*
2  Synthia, a data structure generator
3  Copyright (C) 2019-2020 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.collection;
20 
21 import ca.uqac.lif.synthia.Picker;
22 import java.util.Collections;
23 import java.util.HashSet;
24 import java.util.Set;
25 
26 /**
27  * Picker that merges the result of other pickers into a set.
28  * @ingroup API
29  */
30 public class SetPicker extends CompositePicker<Set<Object>>
31 {
32  /**
33  * Creates a new set picker
34  * @param pickers The pickers used to generate the values
35  */
36  public SetPicker(Picker<?> ... pickers)
37  {
38  super(pickers);
39  }
40 
41  /**
42  * Returns a new set picker
43  * @param pickers The pickers used to generate the values
44  * @return The new set picker
45  */
46  @Override
47  public SetPicker newPicker(Picker<?> ... pickers)
48  {
49  return new SetPicker(pickers);
50  }
51 
52 
53 
54  @Override
55  public Set<Object> getOutput(Object ... values)
56  {
57  Set<Object> set = new HashSet<>(values.length);
58  Collections.addAll(set, values);
59  return set;
60  }
61 }
ca.uqac.lif.synthia.Picker
Picks an object.
Definition: Picker.java:36
ca.uqac
ca.uqac.lif.synthia.collection.SetPicker.SetPicker
SetPicker(Picker<?> ... pickers)
Creates a new set picker.
Definition: SetPicker.java:36
ca.uqac.lif.synthia.collection.CompositePicker
Picker that merges the result of other pickers into a composite data structure.
Definition: CompositePicker.java:29
ca.uqac.lif.synthia
Definition: Bounded.java:19
ca.uqac.lif.synthia.collection.SetPicker.getOutput
Set< Object > getOutput(Object ... values)
Definition: SetPicker.java:55
ca.uqac.lif
ca.uqac.lif.synthia.collection.SetPicker.newPicker
SetPicker newPicker(Picker<?> ... pickers)
Returns a new set picker.
Definition: SetPicker.java:47
ca
ca.uqac.lif.synthia.collection.SetPicker
Picker that merges the result of other pickers into a set.
Definition: SetPicker.java:30