01: /*
02: * <copyright>
03: *
04: * Copyright 1997-2004 BBNT Solutions, LLC
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: */
26:
27: package org.cougaar.lib.param;
28:
29: /**
30: * <pre>
31: * Interface for a parameter map.
32: * Supports [name, org.cougaar.lib.param.ParamTable] pairs.
33: *
34: * If a parameter does not exist, a ParamException will be thrown.
35: * This is not a RuntimeException,
36: * so clients can use the try{}catch{} trick. The catch block is a
37: * good place to put "default" values for parameters.
38: * </pre>
39: */
40: public interface ParamMap {
41: /**
42: * Add a parameter into the parameter table.
43: * @param n name of the paramter
44: * @param p the parameter to add
45: */
46: void addParam(String n, Param p);
47:
48: /**
49: * Get the value of a boolean parameter.
50: * @param name of the parameter to get
51: * @return the boolean value of the parameter
52: */
53: boolean getBooleanParam(String name) throws ParamException;
54:
55: /**
56: * Get the value of a double parameter.
57: * @param name of the parameter to get
58: * @return the double value of the parameter
59: */
60: double getDoubleParam(String name) throws ParamException;
61:
62: /**
63: * Get the value of a float parameter.
64: * @param name of the parameter to get
65: * @return the float value of the parameter
66: */
67: float getFloatParam(String name) throws ParamException;
68:
69: /**
70: * Get the value of a int parameter.
71: * @param name of the parameter to get
72: * @return the int value of the parameter
73: */
74: int getIntParam(String name) throws ParamException;
75:
76: /**
77: * Get the value of a long parameter.
78: * @param name of the parameter to get
79: * @return the long value of the parameter
80: */
81: long getLongParam(String name) throws ParamException;
82:
83: /**
84: * Get the value of a short parameter.
85: * @param name of the parameter to get
86: * @return the short value of the parameter
87: */
88: short getShortParam(String name) throws ParamException;
89:
90: /**
91: * Get the value of a String parameter.
92: * @param name of the parameter to get
93: * @return the String value of the parameter
94: */
95: String getStringParam(String name) throws ParamException;
96:
97: boolean hasParam(String name);
98: }
|