Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Energy, onHostDestruction: ensured ptr existence
[simgrid.git] / contrib / psg / src / peersim / vector / VectControl.java
1 /*
2  * Copyright (c) 2003-2005 The BISON Project
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  */
18
19 package peersim.vector;
20
21 import peersim.core.*;
22
23 /**
24  * Serves as an abstract superclass for {@link Control}s that deal
25  * with vectors.
26  * It reads a {@link Setter} to be used by extending classes.
27  */
28 public abstract class VectControl implements Control {
29
30
31 // --------------------------------------------------------------------------
32 // Parameter names
33 // --------------------------------------------------------------------------
34
35 /**
36  * The protocol to operate on.
37  * @config
38  */
39 protected static final String PAR_PROT = "protocol";
40
41 /**
42  * The setter method used to set values in the protocol instances. Defaults to
43  * <code>setValue</code>
44  * (for backward compatibility with previous implementation of this
45  * class, that were based on the {@link SingleValue} interface). Refer to the
46  * {@linkplain peersim.vector vector package description} for more
47  * information about getters and setters.
48  * @config
49  */
50 protected static final String PAR_METHOD = "setter";
51
52 /**
53  * The getter method used to obtain the protocol values. 
54  * Defaults to <code>getValue</code>
55  * (for backward compatibility with previous 
56  * implementation of this class, that were based on the 
57  * {@link SingleValue} interface).
58  * Refer to the {@linkplain peersim.vector vector package description} for more 
59  * information about getters and setters.
60  * @config
61  */
62 protected static final String PAR_GETTER = "getter";
63
64 // --------------------------------------------------------------------------
65 // Fields
66 // --------------------------------------------------------------------------
67
68 /** The setter to be used to write a vector. */
69 protected final Setter setter;
70
71 /** The getter to be used to read a vector. */
72 protected final Getter getter;
73
74 // --------------------------------------------------------------------------
75 // Initialization
76 // --------------------------------------------------------------------------
77
78 /**
79  * Standard constructor that reads the configuration parameters.
80  * Invoked by the simulation engine.
81  * @param prefix the configuration prefix for this class
82  */
83 protected VectControl(String prefix)
84 {
85         setter = new Setter(prefix,PAR_PROT,PAR_METHOD);
86         getter = new Getter(prefix,PAR_PROT,PAR_GETTER);
87 }
88
89 }
90