001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.core.qos.metrics;
028:
029: /**
030: * Metrics are the information abstraction for the values manipulated
031: * by the MetricsService. This includes the value itself, which can
032: * be of various types, and meta-data about the value: how credible it
033: * is, where it come from, when it was collected, etc.
034: */
035: public interface Metric {
036: /**
037: * Returns the value as a String. The caller is assumed to know
038: * that the value is, in fact, a String.
039: */
040: String stringValue();
041:
042: /**
043: * Returns the value as a byte. The caller is assumed to know
044: * that the value is, in fact, a number that can coerced to a
045: * byte.
046: */
047: byte byteValue();
048:
049: /**
050: * Returns the value as a short. The caller is assumed to know
051: * that the value is, in fact, a number that can be coerced to a
052: * short.
053: */
054: short shortValue();
055:
056: /**
057: * Returns the value as an int. The caller is assumed to know
058: * that the value is, in fact, a number that can be coerced to an
059: * int.
060: */
061: int intValue();
062:
063: /**
064: * Returns the value as a long. The caller is assumed to know
065: * that the value is, in fact, a number that can be coerced to a
066: * long.
067: */
068: long longValue();
069:
070: /**
071: * Returns the value as a float. The caller is assumed to know
072: * that the value is, in fact, a number that can be coerced to a
073: * float.
074: */
075: float floatValue();
076:
077: /**
078: * Returns the value as a double. The caller is assumed to know
079: * that the value is, in fact, a number that can be coerced to a
080: * double.
081: */
082: double doubleValue();
083:
084: /**
085: * Returns the value as a char. The caller is assumed to know
086: * that the value is, in fact, a char.
087: */
088: char charValue();
089:
090: /**
091: * Returns the value as a boolean. The caller is assumed to know
092: * that the value is, in fact, a boolean.
093: */
094: boolean booleanValue();
095:
096: /**
097: * Returns the raw value. Use this only if you don't know what
098: * type the value should be.
099: */
100: Object getRawValue();
101:
102: /**
103: * Returns the credibility of the value, as double in the range
104: * 0.0 (no knowledge) to 1.0 (perfect knowledge).
105: */
106: double getCredibility();
107:
108: /**
109: * Returns the units of the value. This is not currently used in
110: * Cougaar
111: */
112: String getUnits();
113:
114: /**
115: * Returns the source of the value, as a string with no semantics.
116: */
117: String getProvenance();
118:
119: /**
120: * Returns the time the value was collected or generated.
121: */
122: long getTimestamp();
123:
124: /**
125: * Returns a numeric measure of how long the value is good for.
126: */
127: long getHalflife();
128: }
|