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.util.Collection;
030:
031: import org.cougaar.core.blackboard.ChangeReport;
032: import org.cougaar.util.TimeSpan;
033: import org.cougaar.util.UnaryPredicate;
034:
035: /**
036: * A RelationshipSchedule is a representation of an object (must implement
037: * HasRelationships) relationships
038: **/
039:
040: public interface RelationshipSchedule extends Schedule {
041:
042: /**
043: * @return HasRelationships The object whose relationships are contained in
044: * the schedule
045: */
046: HasRelationships getHasRelationships();
047:
048: /** getMatchingRelationships - return all Relationships which pass the
049: * specified UnaryPredicate.
050: *
051: * @param predicate UnaryPredicate to use in screening Relationships
052: * @return a sorted Collection containing all Relationships which
053: * which pass the specified UnaryPredicate
054: **/
055: Collection getMatchingRelationships(UnaryPredicate predicate);
056:
057: /** getMatchingRelationships - return all Relationships where the other
058: * has the specified role. getMatchingRelationships(SUBORDINATE) returns
059: * relationships with my subordinates
060: *
061: * @param role Role to look for
062: * @return a sorted Collection containing all Relationships which
063: * which match the specified Role
064: **/
065: Collection getMatchingRelationships(Role role);
066:
067: /** getMatchingRelationships - return all Relationships which contain the
068: * specified role and intersect the time.
069: *
070: * @param role Role to look for
071: * @param time long specifying the time
072: * @return a sorted Collection containing all Relationships which
073: * which match the specified Role and intersect the specified time
074: **/
075: Collection getMatchingRelationships(Role role, long time);
076:
077: /** getMatchingRelationships - return all Relationships which contain the
078: * specified role and overlap the time span specified by the start and end
079: * time arguments
080: *
081: * @param role Role to look for
082: * @param startTime long specifying the start of the time span
083: * @param endTime long specifying the end of the time span
084: * @return a sorted Collection containing all Relationships which
085: * which match the specified Role and overlap the specified time span
086: * @deprecated Use getMatchingRelationships(Role role, TimeSpan timeSpan) or
087: * getMatchingRelationships(Role role, long time)
088: **/
089: Collection getMatchingRelationships(Role role, long startTime,
090: long endTime);
091:
092: /** getMatchingRelationships - return all Relationships which contain the
093: * specified role and overlap the specified time span.
094: *
095: * @param role Role to look for
096: * @param timeSpan TimeSpan
097: * @return a sorted Collection containing all Relationships which
098: * which match the specified Role and overlap the specified time span
099: **/
100: Collection getMatchingRelationships(Role role, TimeSpan timeSpan);
101:
102: /** getMatchingRelationships - return all Relationships which contain the
103: * specified other object, match the specified role and intersect the time.
104: *
105: * @param role Role to look for
106: * @param otherObject HasRelationships
107: * @param time long specifying the time
108: * @return a sorted Collection containing all Relationships which contain
109: * the specified other object, match the specified role and direct object
110: * flag, and intersect the specified time.
111: **/
112: Collection getMatchingRelationships(Role role,
113: HasRelationships otherObject, long time);
114:
115: /** getMatchingRelationships - return all Relationships which contain the
116: * specified other object, match the specified role, and overlap the
117: * specified time span.
118: *
119: * @param role Role to look for
120: * @param otherObject HasRelationships
121: * @param timeSpan TimeSpan
122: * @return a sorted Collection containing all Relationships which
123: * which match the specified Role and overlap the specified time span
124: **/
125: Collection getMatchingRelationships(Role role,
126: HasRelationships otherObject, TimeSpan timeSpan);
127:
128: /** getMatchingRelationships - return all Relationships which contain the
129: * specified other object, match the specified role, and overlap the
130: * the time span specified by the start and end time arguments
131: *
132: * @param role Role to look for
133: * @param otherObject HasRelationships
134: * @param startTime long specifying the start of the time span
135: * @param endTime long specifying the end of the time span
136: * @return a sorted Collection containing all Relationships which contain
137: * the specified other object, match the specified role and direct object
138: * flag, and overlap the specified time span.
139: * @deprecated Use getMatchingRelationships(Role role, HasRelationships otherObject, TimeSpan timeSpan) or
140: * getMatchingRelationships(Role role, HasRelationships otherObject, long time)
141: **/
142: Collection getMatchingRelationships(Role role,
143: HasRelationships otherObject, long startTime, long endTime);
144:
145: /** getMatchingRelationships - return all Relationships which contain the
146: * specified other object and intersect the specified time.
147: *
148: * @param otherObject HasRelationships
149: * @param time long
150: * @return a sorted Collection containing all Relationships which
151: * which contain the specified other HasRelationships and intersect the
152: * specified time span
153: **/
154: Collection getMatchingRelationships(HasRelationships otherObject,
155: long time);
156:
157: /** getMatchingRelationships - return all Relationships which contain the
158: * specified other object and overlap the specified time span.
159: *
160: * @param otherObject HasRelationships
161: * @param timeSpan TimeSpan
162: * @return a sorted Collection containing all Relationships which
163: * which contain the specified other HasRelationships and overlap the
164: * specified time span
165: **/
166: Collection getMatchingRelationships(HasRelationships otherObject,
167: TimeSpan timeSpan);
168:
169: /** getMatchingRelationships - return all Relationships which contain the
170: * specified other object and overlap the time span specified by the start and end
171: * time arguments.
172: *
173: * @param otherObject HasRelationships
174: * @param startTime long specifying the start of the time span
175: * @param endTime long specifying the end of the time span
176: * @return a sorted Collection containing all Relationships which
177: * which match the specified Role and overlap the specified time span
178: * @deprecated Use getMatchingRelationships(HasRelationships otherObject, TimeSpan timeSpan) or
179: * getMatchingRelationships(HasRelationships otherObject, long time)
180: **/
181: Collection getMatchingRelationships(HasRelationships otherObject,
182: long startTime, long endTime);
183:
184: /** getMatchingRelationships - return all Relationships which contain the
185: * specified role suffix and overlap the specified time span.
186: * getMatchingRelationships("Provider", timeSpan) will return
187: * relationships with providers.
188: *
189: * @param roleSuffix String specifying the role suffix to match
190: * @param timeSpan TimeSpan
191: * @return a sorted Collection containing all Relationships which
192: * which contain the specified role suffix and overlap the
193: * specified time span
194: **/
195: Collection getMatchingRelationships(String roleSuffix,
196: TimeSpan timeSpan);
197:
198: /** getMatchingRelationships - return all Relationships which contain the
199: * specified role suffix and intersect the specified time.
200: * getMatchingRelationships("Provider", time) will return
201: * relationships with providers.
202: *
203: * @param roleSuffix String specifying the role suffix to match
204: * @param time long
205: * @return a sorted Collection containing all Relationships which
206: * which contain the specified role suffix and intersect the
207: * specified time
208: **/
209: Collection getMatchingRelationships(String roleSuffix, long time);
210:
211: /** getMatchingRelationships - return all Relationships which contain the
212: * specified role suffix and overlap the time span specified by the start and end
213: * time arguments.
214: * getMatchingRelationships("Provider", startTime, endTime) will return
215: * relationships with providers.
216: *
217: * @param roleSuffix String specifying the role suffix to match
218: * @param startTime long specifying the start of the time span
219: * @param endTime long specifying the end of the time span
220: * @return a sorted Collection containing all Relationships which
221: * which match the specified Role suffix and overlap the specified time span
222: * @deprecated Use getMatchingRelationships(String roleSuffix, TimeSpan timeSpan) or
223: * getMatchingRelationships(String roleSuffix, long time)
224: **/
225: Collection getMatchingRelationships(String roleSuffix,
226: long startTime, long endTime);
227:
228: /** getMatchingRelationships - return all Relationships which overlap the
229: * specified time span.
230: *
231: * @param timeSpan TimeSpan
232: * @return a sorted Collection containing all Relationships which
233: * which contain overlap the specified time span
234: **/
235: Collection getMatchingRelationships(TimeSpan timeSpan);
236:
237: /** getMatchingRelationships - return all Relationships which intersect the
238: * specified time.
239: *
240: * @param time long
241: * @return a sorted Collection containing all Relationships which
242: * which intersect the specified time
243: **/
244: Collection getMatchingRelationships(long time);
245:
246: /** getMatchingRelationships - return all Relationships which overlap the
247: * time span specified by the start and end time arguments.
248: *
249: * @param startTime long specifying the start of the time span
250: * @param endTime long specifying the end of the time span
251: * @return a sorted Collection containing all Relationships which
252: * which match overlap the specified time span
253: * @deprecated Use getMatchingRelationships(TimeSpan timeSpan) or
254: * getMatchingRelationships(long time)
255: **/
256: Collection getMatchingRelationships(long startTime, long endTime);
257:
258: /** getMyRole - return role for schedule's HasRelationships in the specified
259: * relationship.
260: *
261: * @param relationship Relationship
262: * @return Role
263: */
264: Role getMyRole(Relationship relationship);
265:
266: /** getOtherRole - return role for other HasRelationships in the specified
267: * relationship.
268: *
269: * @param relationship Relationship
270: * @return Role
271: */
272: Role getOtherRole(Relationship relationship);
273:
274: /** getOther - return other (i.e. not schedule's) HasRelationships in the
275: * specified relationship.
276: *
277: * @param relationship Relationship
278: * @return HasRelationships
279: */
280: HasRelationships getOther(Relationship relationship);
281:
282: class RelationshipScheduleChangeReport implements ChangeReport {
283: public RelationshipScheduleChangeReport() {
284: }
285:
286: public String toString() {
287: return "RelationshipScheduleChangeReport";
288: }
289: }
290:
291: }
|