yass.packet.schedule
Class AsapPacketScheduler

java.lang.Object
  extended by yass.packet.schedule.PacketScheduler
      extended by yass.packet.schedule.AsapPacketScheduler
All Implemented Interfaces:
Advanceable
Direct Known Subclasses:
AsapBoundedDropOldestPacketScheduler, AsapBoundedDropRandomPacketScheduler

public class AsapPacketScheduler
extends PacketScheduler

Simple packet scheduler implementation in which packets are scheduled such that they enter and leave the scheduler in strict FIFO order, are always available for transmission at any time, and are never dropped. In effect, this PacketScheduler-extending class implements a simple infinite-size queue.


Field Summary
 
Fields inherited from class yass.packet.schedule.PacketScheduler
accepted, dropped, extracted, maxScheduleSize, node, schedule
 
Constructor Summary
AsapPacketScheduler()
          Constructs a new instance of AsapPacketScheduler
 
Method Summary
 java.util.List<PacketScheduleEntry> extractAllWaiting(double delta)
          Obtains the collection of packets scheduled for transmission, if any, during the current simulation period.
 PacketScheduleEntry extractNextWaiting(double delta)
          Obtains the next packet scheduled for transmission, if any, during the current simulation period.
 PacketScheduleEntry reschedule(Packet packet)
          Accepts the supplied packet for scheduling for later transmission.
 PacketScheduleEntry schedule(Packet packet)
          Accepts the supplied packet for scheduling for later transmission.
 
Methods inherited from class yass.packet.schedule.PacketScheduler
advanceTime, countScheduleEntries, dropMissedDeadlines, dropScheduleEntry, dropScheduleEntry, extractScheduleEntry, findScheduleEntry, getAccepted, getDropped, getExtracted, getMaxScheduleSize, getNode, getSchedule, insertScheduleEntryAtHead, insertScheduleEntryAtTail, insertScheduleEntryByDeadline, peekFirst, peekLast, setNode, sortSchedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsapPacketScheduler

public AsapPacketScheduler()
Constructs a new instance of AsapPacketScheduler

Method Detail

schedule

public PacketScheduleEntry schedule(Packet packet)
Accepts the supplied packet for scheduling for later transmission. Proposed packet is accepted with earliest transmission time equal to current time, unless the TTL is not +ve or the delivery deadline has expired. The latest acceptable transmission time is taken to be the packet deadline. The schedule entry is placed at the tail of the queue. Packets with expired TTL or deadline are not scheduled, and a null is returned.

Specified by:
schedule in class PacketScheduler
Parameters:
packet - the packet
Returns:
the schedule entry describing the scheduled time if the packet has been accepted, otherwise null

reschedule

public PacketScheduleEntry reschedule(Packet packet)
Accepts the supplied packet for scheduling for later transmission. Every proposed packet is accepted with earliest transmission time equal to current time, unless the TTL is not +ve. The latest acceptable transmission time is taken to be the packet deadline. The schedule entry is placed at the head of the queue. Packets with expired TTL or deadline are not scheduled, and a null is returned.

Specified by:
reschedule in class PacketScheduler
Parameters:
packet - the packet to reschedule
Returns:
the schedule entry describing the scheduled time if the packet has been accepted, otherwise null

extractNextWaiting

public PacketScheduleEntry extractNextWaiting(double delta)
Obtains the next packet scheduled for transmission, if any, during the current simulation period. The returned entry is removed from the transmission schedule.

Specified by:
extractNextWaiting in class PacketScheduler
Parameters:
delta - the duration of the current simulation period, in seconds
Returns:
the next scheduled packet entry if any such packet is scheduled for delivery in the current simulation period, or null if no such scheduled packet exists

extractAllWaiting

public java.util.List<PacketScheduleEntry> extractAllWaiting(double delta)
Obtains the collection of packets scheduled for transmission, if any, during the current simulation period. The returned entries are removed from the transmission schedule, and are supplied in the natural order of the backing PacketScheduleEntry objects.

Specified by:
extractAllWaiting in class PacketScheduler
Parameters:
delta - the duration of the current simulation period, in seconds
Returns:
a collection of scheduled packet entries for transmission in the current simulation period, which will be an empty collection if no such schedule entries exist