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: /**
030: * Constraint Interface
031: * A Constraint is part of a Workflow.
032: * Constraints provide pair-wise precedence
033: * relationship information about the Tasks
034: * contained in the Workflow. A Task can have
035: * more than one applicable Constraint.
036: **/
037: public interface Constraint {
038: int COINCIDENT = 0;
039: int BEFORE = -1;
040: int AFTER = 1;
041: int GREATERTHAN = 1;
042: int LESSTHAN = -1;
043: int EQUALTO = 0;
044:
045: /**
046: * <PRE> Task mytask = myconstraint.getConstrainingTask(); </PRE>
047: * @return Task Returns the Task which is constraining another event or Task.
048: **/
049: Task getConstrainingTask();
050:
051: /**
052: * <PRE> Task mytask = myconstraint.getConstrainedTask(); </PRE>
053: * @return Task Returns a Task which is constrained by another event or Task.
054: **/
055: Task getConstrainedTask();
056:
057: /**
058: * Returns an int which represents the
059: * order of the Constraint.
060: * <PRE> int myorder = myconstraint.getConstraintOrder(); </PRE>
061: * @return int The int value
062: * will be equal to "0" (COINCIDENT), "-1" (BEFORE) or "1" (AFTER).
063: * There are also order analogues for constraints on non-temporal aspects.
064: * These are "1" (GREATERTHAN), "-1" (LESSTHAN) or "0" (EQUALTO).
065: **/
066: int getConstraintOrder();
067:
068: /**
069: * Returns the aspect type of the constraint for the constraining task
070: * For non temporal constraints, constraining aspect and constrained aspect
071: * will be the same. For temporal constraints, they can be different.
072: * Eg (START_TIME and END_TIME)
073: **/
074: int getConstrainingAspect();
075:
076: /**
077: * Returns the aspect type of the constraint for the constrained task
078: * For non temporal constraints, constraining aspect and constrained aspect
079: * will be the same. For temporal constraints, they can be different.
080: * Eg (START_TIME and END_TIME)
081: **/
082: int getConstrainedAspect();
083:
084: /** Return the ConstraintEvent object for the constraining task
085: */
086: ConstraintEvent getConstrainingEventObject();
087:
088: /** Return the ConstraintEvent object for the constrained task
089: */
090: ConstraintEvent getConstrainedEventObject();
091:
092: /**
093: * Returns a double which represents the offset
094: * of the Constraint.
095: * @return the value to be added to the constraining value before
096: * comparing to the constrained value.
097: **/
098: double getOffsetOfConstraint();
099:
100: /* Calculate a value from constraining event, offset and order
101: * to alleviate constraint violation on constrained event
102: * Note that the current implementation only computes for
103: * temporal constraint aspects.
104: */
105: double computeValidConstrainedValue();
106:
107: }
|