orca.shirako.time.calendar
Class AuthorityCalendar

java.lang.Object
  extended by orca.shirako.time.calendar.BaseCalendar
      extended by orca.shirako.time.calendar.AuthorityCalendar

public class AuthorityCalendar
extends BaseCalendar

An AuthorityCalendar is used to organized reservation information for an authority. It extends the functionality of BaseCalendar with a number of collections:


AuthorityCalendar is locked because there are calls made to it with either the ManagerLock held, or the ActorLock held and we need to prevent dual access to the calendar data structures.

Author:
aydan

Field Summary
protected  ReservationList closing
          List of reservations to be closed grouped by cycle
protected  ReservationHoldings outlays
          All currently active reservations
protected  ReservationList requests
          List of incoming requests grouped by start cycle
 
Fields inherited from class orca.shirako.time.calendar.BaseCalendar
clock
 
Constructor Summary
AuthorityCalendar(ActorClock clock)
           
 
Method Summary
 void addClosing(ResourceReservation reservation, long cycle)
          Add a reservation to be closed on the given cycle
 void addOutlay(ResourceReservation reservation, long start, long end)
          Add the serviced client reservation
 void addRequest(ResourceReservation reservation, long cycle)
          Add a client request
 ReservationSet getClosing(long cycle)
          Return the set of reservation marked closed for a particular cycle
 ReservationSet getOutlays()
          Return the active client reservations
 ReservationSet getOutlays(long cycle)
          Return the active client reservations at the given time instance
 ReservationSet getRequests(long cycle)
          Obtain all client requests for the given cycle
 void remove(ResourceReservation reservation)
           
 void removeClosing(ResourceReservation reservation)
          Remove the given reservation from the list of closing reservations.
 void removeClosing(ResourceReservation reservation, long cycle)
          Remove the given reservation from the list of closing reservations on the given cycle.
 void removeOutlay(AuthorityReservation reservation)
           
 void removeRequest(ReservationServer reservation)
           
 void removeScheduledOrInProgress(ResourceReservation reservation)
           
 void tick(long cycle)
          Perform calendar cleanup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requests

protected ReservationList requests
List of incoming requests grouped by start cycle


closing

protected ReservationList closing
List of reservations to be closed grouped by cycle


outlays

protected ReservationHoldings outlays
All currently active reservations

Constructor Detail

AuthorityCalendar

public AuthorityCalendar(ActorClock clock)
Method Detail

remove

public void remove(ResourceReservation reservation)

removeScheduledOrInProgress

public void removeScheduledOrInProgress(ResourceReservation reservation)

removeClosing

public void removeClosing(ResourceReservation reservation)
Remove the given reservation from the list of closing reservations.

Parameters:
reservation - The reservation

getRequests

public ReservationSet getRequests(long cycle)
Obtain all client requests for the given cycle

Parameters:
cycle -
Returns:
the requests for a particular cycle

addRequest

public void addRequest(ResourceReservation reservation,
                       long cycle)
Add a client request

Parameters:
reservation -
cycle -

removeRequest

public void removeRequest(ReservationServer reservation)

getClosing

public ReservationSet getClosing(long cycle)
Return the set of reservation marked closed for a particular cycle

Parameters:
cycle -
Returns:
set of reservations
Throws:
java.lang.Exception

addClosing

public void addClosing(ResourceReservation reservation,
                       long cycle)
Add a reservation to be closed on the given cycle

Parameters:
reservation - The reservation
cycle - The cycle

removeClosing

public void removeClosing(ResourceReservation reservation,
                          long cycle)
Remove the given reservation from the list of closing reservations on the given cycle.

Parameters:
reservation - The reservation
cycle - The cycle

addOutlay

public void addOutlay(ResourceReservation reservation,
                      long start,
                      long end)
Add the serviced client reservation

Parameters:
reservation - The client reservation
term - The term of the client reservation

removeOutlay

public void removeOutlay(AuthorityReservation reservation)

getOutlays

public ReservationSet getOutlays()
Return the active client reservations

Returns:
all outlays

getOutlays

public ReservationSet getOutlays(long cycle)
Return the active client reservations at the given time instance

Parameters:
cycle -
Returns:
all outlays for a specified cycle

tick

public void tick(long cycle)
Description copied from class: BaseCalendar
Perform calendar cleanup

Overrides:
tick in class BaseCalendar


Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.