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.planning.ldm.plan;
028:
029: import java.io.Serializable;
030:
031: /**
032: *
033: *
034: */
035:
036: public class AspectScorePoint implements Serializable, Cloneable {
037: private AspectValue value;
038: private double score;
039:
040: public AspectScorePoint(AspectValue value, double score) {
041: this .value = value;
042: this .score = score;
043: }
044:
045: /** @deprecated Use AspectScorePoint(AspectValue,double) instead **/
046: public AspectScorePoint(double value, double score, int type) {
047: this .value = AspectValue.newAspectValue(type, value);
048: this .score = score;
049: }
050:
051: public boolean equals(Object o) {
052: if (o instanceof AspectScorePoint) {
053: AspectScorePoint that = (AspectScorePoint) o;
054: return this .score == that.score
055: && this .value.equals(that.value);
056: }
057: return false;
058: }
059:
060: public int hashCode() {
061: long bits = Double.doubleToRawLongBits(score);
062: return (int) (bits & 0xffffffffL)
063: ^ (int) ((bits >> 32) & 0xFFFFFFFFL) ^ value.hashCode();
064: }
065:
066: public Object clone() {
067: return new AspectScorePoint(value, score);
068: }
069:
070: /* @return double The 'score'.
071: */
072: public double getScore() {
073: return score;
074: }
075:
076: /* @return Aspect The value and type of aspect.
077: * @see org.cougaar.planning.ldm.plan.AspectValue
078: */
079: public AspectValue getAspectValue() {
080: return value;
081: }
082:
083: public double getValue() {
084: return value.getValue();
085: }
086:
087: public int getAspectType() {
088: return value.getAspectType();
089: }
090:
091: public static final AspectScorePoint getNEGATIVE_INFINITY(int type) {
092: return new AspectScorePoint(AspectValue.newAspectValue(type,
093: 0.0), Double.NEGATIVE_INFINITY);
094: }
095:
096: public static final AspectScorePoint getPOSITIVE_INFINITY(int type) {
097: return new AspectScorePoint(AspectValue.newAspectValue(type,
098: 0.0), Double.POSITIVE_INFINITY);
099: }
100:
101: }
|