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: package org.cougaar.glm.execution.common;
27:
28: import java.io.IOException;
29:
30: /**
31: * Report the Observable Aspects of a Task.
32: * In particular: START_TIME, END_TIME, & QUANTITY
33: **/
34: public class TaskEventReport extends Report implements
35: java.io.Serializable {
36: public static class Rescind extends TaskEventReport {
37: public Rescind() {
38: }
39:
40: public Rescind(TaskEventId aTaskEventId) {
41: theTaskEventId = aTaskEventId;
42: }
43:
44: public boolean isRescind() {
45: return true;
46: }
47: }
48:
49: public boolean isRescind() {
50: return false;
51: }
52:
53: public TaskEventId theTaskEventId;
54: public String theVerb = "";
55: public double theAspectValue;
56: public String theFullDescription = "";
57: public String theShortDescription = "";
58:
59: public TaskEventReport(TaskEventId aTaskEventId, String aVerb,
60: double anAspectValue, long aReportDate, long aReceivedDate,
61: String aFullDescription, String aShortDescription) {
62: super (aReportDate, aReceivedDate);
63: theTaskEventId = aTaskEventId;
64: theVerb = aVerb;
65: theAspectValue = anAspectValue;
66: theFullDescription = aFullDescription;
67: theShortDescription = aShortDescription;
68: }
69:
70: TaskEventReport() {
71: }
72:
73: public TaskEventReport(TaskEventReport original) {
74: this (original.theTaskEventId, original.theVerb,
75: original.theAspectValue, original.theReportDate,
76: original.theReceivedDate, original.theFullDescription,
77: original.theShortDescription);
78: }
79:
80: public void write(LineWriter writer) throws IOException {
81: super .write(writer);
82: writer.writeUID(theTaskEventId.theTaskUID);
83: writer.writeInt(theTaskEventId.theAspectType);
84: writer.writeUTF(theVerb);
85: writer.writeDouble(theAspectValue);
86: writer.writeUTF(theFullDescription);
87: writer.writeUTF(theShortDescription);
88: }
89:
90: public void read(LineReader reader) throws IOException {
91: super .read(reader);
92: theTaskEventId = new TaskEventId(reader.readUID(), reader
93: .readInt());
94: theVerb = reader.readUTF();
95: theAspectValue = reader.readDouble();
96: theFullDescription = reader.readUTF();
97: theShortDescription = reader.readUTF();
98: }
99: }
|