| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectaim4.im.v2i.policy.BasePolicy
public final class BasePolicy
The base policy.
| Nested Class Summary | |
|---|---|
static class | 
BasePolicy.ProposalFilterResult
The result of the standard proposal filter  | 
static class | 
BasePolicy.ReservationRecord
The record of a reservation.  | 
static class | 
BasePolicy.ReserveParam
The reservation parameter record generated by processProposals()  | 
| Field Summary | |
|---|---|
protected  V2IManagerCallback | 
im
The V2IManager of which this Policy is a part.  | 
| Constructor Summary | |
|---|---|
BasePolicy(V2IManagerCallback im,
           RequestHandler requestHandler)
Create a new base policy for a given V2IManagerCallback (implemented by a V2IManager) and a request handler.  | 
|
BasePolicy(V2IManagerCallback im,
           RequestHandler requestHandler,
           StatCollector<BasePolicy> statCollector)
Create a new base policy for a given V2IManagerCallback (implemented by a V2IManager) and a request handler.  | 
|
| Method Summary | |
|---|---|
 void | 
act(double timeStep)
Give the policy a chance to do any processing it might need to do in order to respond to requests, if it hasn't responded to them already.  | 
 BasePolicy.ReserveParam | 
findReserveParam(Request msg,
                 List<Request.Proposal> proposals)
Compute the reservation parameter given the request message and a set of proposals.  | 
 double | 
getCurrentTime()
Get the current time  | 
 RequestHandler | 
getRequestHandler()
Get the request handler.  | 
 ReservationGrid | 
getReservationGrid()
Get the reservation grid.  | 
 StatCollector<BasePolicy> | 
getStatCollector()
Get the statistic collector.  | 
 TrackModel | 
getTrackMode()
 | 
 boolean | 
hasReservation(int vin)
Check whether the vehicle currently has a reservation.  | 
 void | 
processAwayMsg(Away msg)
Submit an away message to the policy.  | 
 void | 
processCancelMsg(Cancel msg)
Submit a cancel message to the policy.  | 
 void | 
processDoneMsg(Done msg)
Submit a done message to the policy.  | 
 void | 
processV2IMessage(V2IMessage msg)
Process a V2I message  | 
 void | 
sendComfirmMsg(int latestRequestId,
               BasePolicy.ReserveParam reserveParam)
Send a confirm message  | 
 void | 
sendRejectMsg(int vin,
              int latestRequestId,
              Reject.Reason reason)
Send a reject message  | 
 void | 
setRequestHandler(RequestHandler RequestHandler)
Set the request handler.  | 
 void | 
setV2IManagerCallback(V2IManagerCallback im)
Set the V2I manager call-back.  | 
static BasePolicy.ProposalFilterResult | 
standardProposalsFilter(List<Request.Proposal> proposals,
                        double currentTime)
Remove the proposals that are either too early or too late.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected V2IManagerCallback im
| Constructor Detail | 
|---|
public BasePolicy(V2IManagerCallback im,
                  RequestHandler requestHandler)
im - the V2IManagerCallback for which this FCFSPolicy is
                        being createdrequestHandler - the request handler
public BasePolicy(V2IManagerCallback im,
                  RequestHandler requestHandler,
                  StatCollector<BasePolicy> statCollector)
im - the V2IManagerCallback for which this FCFSPolicy is
                        being createdrequestHandler - the request handlerstatCollector - the statistic collector| Method Detail | 
|---|
public static BasePolicy.ProposalFilterResult standardProposalsFilter(List<Request.Proposal> proposals,
                                                                      double currentTime)
proposals - the list of proposalscurrentTime - the current time
public void setV2IManagerCallback(V2IManagerCallback im)
setV2IManagerCallback in interface Policyim - the V2I manager's call-backpublic RequestHandler getRequestHandler()
public void setRequestHandler(RequestHandler RequestHandler)
RequestHandler - the request handler.public void act(double timeStep)
act in interface PolicytimeStep - the size of the time step to simulate, in seconds
public void sendComfirmMsg(int latestRequestId,
                           BasePolicy.ReserveParam reserveParam)
sendComfirmMsg in interface BasePolicyCallbacklatestRequestId - the latest request id of the vehiclereserveParam - the reservation parameter
public void sendRejectMsg(int vin,
                          int latestRequestId,
                          Reject.Reason reason)
sendRejectMsg in interface BasePolicyCallbackvin - the VINlatestRequestId - the latest request id of the vehiclereason - the reason of rejection
public BasePolicy.ReserveParam findReserveParam(Request msg,
                                                List<Request.Proposal> proposals)
findReserveParam in interface BasePolicyCallbackmsg - the request messageproposals - the set of proposals
public double getCurrentTime()
getCurrentTime in interface BasePolicyCallbackpublic ReservationGrid getReservationGrid()
getReservationGrid in interface ExtendedBasePolicyCallbackpublic boolean hasReservation(int vin)
hasReservation in interface BasePolicyCallbackvin - the VIN of the vehicle
public void processV2IMessage(V2IMessage msg)
processV2IMessage in interface Policymsg - the V2I messagepublic void processCancelMsg(Cancel msg)
msg - the cancel messagepublic void processDoneMsg(Done msg)
msg - the done messagepublic void processAwayMsg(Away msg)
msg - the away messagepublic StatCollector<BasePolicy> getStatCollector()
getStatCollector in interface Policypublic TrackModel getTrackMode()
getTrackMode in interface BasePolicyCallback
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||