01: /*
02: * <copyright>
03: *
04: * Copyright 2002-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.core.adaptivity;
28:
29: /**
30: * A control input for a component (for example, a plugin). The {@link
31: * AdaptivityEngine} sets OperatingMode values according to the plays
32: * it selects. OperatingModes are generally created by the component
33: * whose operation can be controlled. OperatingModes should be
34: * published to the blackboard so they are accessible to the {@link
35: * OperatingModeServiceProvider}. The component should also subscribe
36: * to the OperatingMode if it needs to know when changes occur.
37: * Alternatively, the value can be examined as needed.
38: **/
39: public interface OperatingMode extends java.io.Serializable {
40: /**
41: * Gets the (distinct) name of this OperatingMode. The names of
42: * all the OperatingMode on a particular blackboard must be
43: * distinct. This can be achieved by establishing naming
44: * conventions such has including the class name of the plugin or
45: * other component in the name. Where the same component class may
46: * be instantiated multiple times, the multiple instances may
47: * already have some sor of name that can be used in addition to
48: * the class name. It is the responsibility of the component
49: * designer to insure that OperatingMode names are not ambiguous.
50: * @return the name of this OperatingMode
51: **/
52: String getName();
53:
54: /**
55: * Get the list of allowed value ranges for this OperatingMode.
56: * Attempts to set the value outside these ranges will fail.
57: * @return a list of allowed value ranges
58: **/
59: OMCRangeList getAllowedValues();
60:
61: /**
62: * Get the current value of this OperatingMode. This value must
63: * never be outside the allowed value ranges.
64: * @return the current value of this OperatingMode
65: **/
66: Comparable getValue();
67:
68: /**
69: * Set a new value for this OperatingMode. Used by the
70: * AdaptivityEngine to alter the mode of the component having this
71: * OperatingMode.
72: * @param newValue the new value for this OperatingMode. Must be
73: * in the allowed value ranges.
74: * @exception IllegalArgumentException if the newValue is not
75: * allowed.
76: **/
77: void setValue(Comparable newValue);
78: }
|