Class Event

java.lang.Object
  extended byEvent
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
BreakBondEvent, ConfChangeEvent, FormBondEvent

public class Event
extends java.lang.Object
implements java.lang.Comparable

Event implments Comparable so that two events can be compared based on the end time. The posting time of an Event can be checked against the valid time of Assemblies involved to see if the event has been made invalid by other events on the Assemblies involed.


Constructor Summary
Event()
          Constructs a default Event
Event(double curTime, double endTime, java.lang.String[] assemNamesInvolved)
          Constructs an Event made at curTime, with the given endTime and names of Assemblies involved
 
Method Summary
 int compareTo(java.lang.Object e)
          Compares Object e and this Event based on their end time.
 java.lang.String[] getAssemNamesInvolved()
          Gets the names of all Assemblies involved in this Event
 double getEndTime()
          Gets the end time of this Event
 double getPostTime()
          Gets the post time of this Event
 boolean isValid(double[] validTimes)
          Checks the validity of this Event.
 boolean sameAssembly()
          Returns true if there is only 1 assembly involved in this Event
 void setAssemNamesInvolved(java.lang.String[] assemNamesInvolved)
          Sets the names of all Assemblies involved in this Event
 void setEndTime(double newEndTime)
          Sets the end time of this Event to a new value
 void setPostTime(double newPostTime)
          Sets the post time of this Event to a new value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Event

public Event()
Constructs a default Event


Event

public Event(double curTime,
             double endTime,
             java.lang.String[] assemNamesInvolved)
Constructs an Event made at curTime, with the given endTime and names of Assemblies involved

Parameters:
curTime - double, current time when event is found
endTime - double, time when the event will be complete (used for priority)
assemNamesInvolved - String[]
Method Detail

getPostTime

public double getPostTime()
Gets the post time of this Event

Returns:
double

setPostTime

public void setPostTime(double newPostTime)
Sets the post time of this Event to a new value

Parameters:
newPostTime - double, newPostTime is the new value for post time of this event

setEndTime

public void setEndTime(double newEndTime)
Sets the end time of this Event to a new value

Parameters:
newEndTime - double, newEndTime is the new vlaue for end time of this event

getEndTime

public double getEndTime()
Gets the end time of this Event

Returns:
double

getAssemNamesInvolved

public java.lang.String[] getAssemNamesInvolved()
Gets the names of all Assemblies involved in this Event

Returns:
String[]

setAssemNamesInvolved

public void setAssemNamesInvolved(java.lang.String[] assemNamesInvolved)
Sets the names of all Assemblies involved in this Event

Parameters:
assemNamesInvolved - void

compareTo

public int compareTo(java.lang.Object e)
Compares Object e and this Event based on their end time.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
e - Object
Returns:
1 if this Event's end time is earlier than Object e, 0 if they are the same, -1 if this Event's end time is greater than Object e

isValid

public boolean isValid(double[] validTimes)
Checks the validity of this Event. Event is valid if it was post after the most recent events for the Assemblies involved. That is, if the posting time of this event is greater than or equal to validTimes of each Assembly involved. validTimes[1] may be null if only one assembly was involved in this event.

Parameters:
validTimes - Array of validTimes of all assemblies this event involves
Returns:
boolean

sameAssembly

public boolean sameAssembly()
Returns true if there is only 1 assembly involved in this Event

Returns:
boolean