Synthia
Generic and flexible data structure generator
ColoredNodePicker.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.tree;
20 
21 import ca.uqac.lif.synthia.Picker;
22 
23 /**
24  *
25  * @author Sylvain Hallé
26  * @ingroup API
27  */
28 public class ColoredNodePicker implements Picker<Node<String>>
29 {
30  /**
31  * A picker to select the color for a node.
32  */
34 
35  /**
36  * Creates a new colored node picker.
37  * @param color_picker A picker to select the color for a node
38  */
39  public ColoredNodePicker(Picker<String> color_picker)
40  {
41  super();
42  m_colorPicker = color_picker;
43  }
44 
45  @Override
46  public void reset()
47  {
49  }
50 
51  @Override
52  public Node<String> pick()
53  {
54  return new Node<String>(m_colorPicker.pick());
55  }
56 
57  @Override
58  public ColoredNodePicker duplicate(boolean with_state)
59  {
60  return new ColoredNodePicker(m_colorPicker.duplicate(with_state));
61  }
62 }
ca.uqac.lif.synthia.Picker
Picks an object.
Definition: Picker.java:36
ca.uqac.lif.synthia.tree.ColoredNodePicker.duplicate
ColoredNodePicker duplicate(boolean with_state)
Creates a copy of the picker.
Definition: ColoredNodePicker.java:58
ca.uqac.lif.synthia.tree.ColoredNodePicker.pick
Node< String > pick()
Picks an object.
Definition: ColoredNodePicker.java:52
ca.uqac
ca.uqac.lif.synthia
Definition: Bounded.java:19
ca.uqac.lif.synthia.tree.ColoredNodePicker.reset
void reset()
Puts the picker back into its initial state.
Definition: ColoredNodePicker.java:46
ca.uqac.lif
ca.uqac.lif.synthia.tree.ColoredNodePicker.m_colorPicker
Picker< String > m_colorPicker
A picker to select the color for a node.
Definition: ColoredNodePicker.java:33
ca.uqac.lif.synthia.tree.ColoredNodePicker
Definition: ColoredNodePicker.java:28
ca
ca.uqac.lif.synthia.Picker.pick
T pick()
Picks an object.
ca.uqac.lif.synthia.tree.ColoredNodePicker.ColoredNodePicker
ColoredNodePicker(Picker< String > color_picker)
Creates a new colored node picker.
Definition: ColoredNodePicker.java:39
ca.uqac.lif.synthia.tree.Node
Simple implementation of a labeled nodel.
Definition: Node.java:31
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.