|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.shirako.common.ReservationSet
public class ReservationSet
ReservationSet is a collection of reservations indexed by
ReservationID, basically a HashMap wrapper
with a few auxiliary methods.
ReservationSet is used primarily by resource managers and as
an internal representation of the resources in a lease or slice.
| Field Summary | |
|---|---|
protected java.util.HashMap<ReservationID,ResourceReservation> |
reservations
The internal hash map. |
| Constructor Summary | |
|---|---|
ReservationSet()
Crates a new empty set. |
|
| Method Summary | |
|---|---|
void |
add(ReservationSet set)
Adds the given reservation set to the reservation set. |
void |
add(ResourceReservation reservation)
Adds the reservation to the set. |
void |
clear()
Removes all reservations from the set. |
ReservationSet |
clone()
|
boolean |
contains(ReservationID rid)
Checks if the set contains a reservation with the specified identifier. |
boolean |
contains(ResourceReservation reservation)
Checks if the reservation is part of the set. |
void |
count(ResourceCount rc,
java.util.Date when)
Tally up resources in the ReservationSet. |
long |
forecast(java.util.Date when)
Count the resources forecast to be held or needed by reservations in this set. |
ResourceReservation |
get(ReservationID rid)
Retrieves a reservation from the set. |
ResourceReservation |
getException(ReservationID rid)
Retrieves a reservation from the set. |
boolean |
isEmpty()
Checks if the set is empty |
java.util.Iterator<ResourceReservation> |
iterator()
Returns an iterator for the set. |
void |
remove(ResourceReservation reservation)
Removes the specified reservation. |
int |
size()
Returns the number of reservations in the set. |
java.lang.String |
toString()
|
java.lang.String |
toStringByState(java.lang.String prefix,
int state,
java.util.Date when)
Creates a string of all reservations in the set, which are in the given state |
java.lang.String |
toStringSummaryByState(java.lang.String prefix,
java.util.Date when)
Creates a string of all reservations in the set grouped by reservation state. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.HashMap<ReservationID,ResourceReservation> reservations
| Constructor Detail |
|---|
public ReservationSet()
| Method Detail |
|---|
public ReservationSet clone()
clone in class java.lang.Objectpublic void add(ResourceReservation reservation)
reservation - the reservation to addpublic void add(ReservationSet set)
set - the set to addpublic java.util.Iterator<ResourceReservation> iterator()
iterator in interface java.lang.Iterable<ResourceReservation>public void remove(ResourceReservation reservation)
reservation -
public ResourceReservation getException(ReservationID rid)
throws java.lang.Exception
rid - the reservation identifier
java.lang.Exception - if the requested reservation is not present in the setpublic ResourceReservation get(ReservationID rid)
rid - reservation identifierpublic boolean contains(ReservationID rid)
rid - reservation identifierpublic boolean contains(ResourceReservation reservation)
reservation - reservation to check
public boolean isEmpty()
public void count(ResourceCount rc,
java.util.Date when)
rc - holder for countswhen - date relative to which to do the countingpublic long forecast(java.util.Date when)
Reservation.forecastUnits
for the reservations. Note that this primitive is meaningful only when
all reservations in the set are the same type: caller beware.
when - some time now or in the future
java.lang.Exception
public java.lang.String toStringSummaryByState(java.lang.String prefix,
java.util.Date when)
prefix - prefix to prepend to each state summarywhen - time instance
public java.lang.String toStringByState(java.lang.String prefix,
int state,
java.util.Date when)
prefix - prefix to prependstate - state reservation must be inwhen - time instance
public java.lang.String toString()
toString in class java.lang.Objectpublic int size()
public void clear()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||