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.planning.ldm.policy;
28:
29: /**
30: * A RuleParameter is generic object containing a parameter value
31: *
32: * Values may be one of several types:
33: * INTEGER - Integer value type (within given bounds)
34: * DOUBLE - Double value type (within given bounds)
35: * STRING - String value type
36: * LONG - Long value type (within given bounds)
37: * ENUMERATION - Enumeration value type (String from given list)
38: * BOOLEAN - Boolean value type
39: * CLASS - Java class value type (implementing given interface)
40: * KEY - Set of String values (with default) indexed off a key
41: * RANGE - Set of values (String or RuleParameter) (with default) indexed
42: * from a list of integer ranges
43: *
44: */
45: public interface RuleParameter extends Cloneable {
46:
47: /**
48: * Define list of constant parameter types:
49: */
50: int INTEGER_PARAMETER = 1;
51: int DOUBLE_PARAMETER = 2;
52: int STRING_PARAMETER = 3;
53: int ENUMERATION_PARAMETER = 4;
54: int BOOLEAN_PARAMETER = 5;
55: int CLASS_PARAMETER = 6;
56: int KEY_PARAMETER = 7;
57: int RANGE_PARAMETER = 8;
58: int LONG_PARAMETER = 9;
59: int PREDICATE_PARAMETER = 10;
60:
61: /**
62: * Type of given parameter
63: * @return int type of given parameter
64: */
65: int ParameterType();
66:
67: /**
68: * Get parameter object value for parameter
69: * @return Object with given parameter value. Note : could be null.
70: */
71: Object getValue();
72:
73: /**
74: * Set parameter object value
75: * @param new_value - the new value to be set
76: * @throws RuleParameterIllegalValueException if value set is illegal for
77: * given parameter
78: */
79: void setValue(Object new_value)
80: throws RuleParameterIllegalValueException;
81:
82: /**
83: * Test the value to see if it is valid.
84: * @param test_object - the value to be tested
85: * @return true if the test_object is within the allowable range, false
86: * otherwise.
87: **/
88: boolean inRange(Object test_object);
89:
90: /**
91: * @return the name of the parameter
92: **/
93: String getName();
94:
95: Object clone();
96: }
|