|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.Activity
A class for activities in the activity-selection problem of Section 16.1 of Introduction to Algorithms, Second edition.
Field Summary | |
private double |
f
Finish time. |
private double |
s
Start time. |
Constructor Summary | |
Activity(double startTime,
double finishTime)
Creates a new activity. |
Method Summary | |
boolean |
comesAfter(com.mhhe.clrs2e.Activity act)
Returns a boolean value indicating whether this
activity starts no earlier than another finishes. |
int |
compareTo(java.lang.Object o)
Compares this activity to another, based on their finish times. |
java.lang.String |
toString()
Returns the String representation of this
activity, using half-open interval notation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private double s
private double f
Constructor Detail |
public Activity(double startTime, double finishTime)
startTime
- Start time.finishTime
- Finish time.Method Detail |
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- The other activity.
java.lang.ClassCastException
- if o
does not reference
an Activity
object.public boolean comesAfter(com.mhhe.clrs2e.Activity act)
boolean
value indicating whether this
activity starts no earlier than another finishes.
act
- The other activity.
true
if this activity starts no earlier
than act
finishes.public java.lang.String toString()
String
representation of this
activity, using half-open interval notation.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |