2 * Copyright (c) 2003-2005 The BISON Project
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.
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.
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.
19 package peersim.vector;
21 import peersim.core.*;
24 * Serves as an abstract superclass for {@link Control}s that deal
26 * It reads a {@link Setter} to be used by extending classes.
28 public abstract class VectControl implements Control {
31 // --------------------------------------------------------------------------
33 // --------------------------------------------------------------------------
36 * The protocol to operate on.
39 protected static final String PAR_PROT = "protocol";
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.
50 protected static final String PAR_METHOD = "setter";
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.
62 protected static final String PAR_GETTER = "getter";
64 // --------------------------------------------------------------------------
66 // --------------------------------------------------------------------------
68 /** The setter to be used to write a vector. */
69 protected final Setter setter;
71 /** The getter to be used to read a vector. */
72 protected final Getter getter;
74 // --------------------------------------------------------------------------
76 // --------------------------------------------------------------------------
79 * Standard constructor that reads the configuration parameters.
80 * Invoked by the simulation engine.
81 * @param prefix the configuration prefix for this class
83 protected VectControl(String prefix)
85 setter = new Setter(prefix,PAR_PROT,PAR_METHOD);
86 getter = new Getter(prefix,PAR_PROT,PAR_GETTER);