Class Scheduler

java.lang.Object
  extended byjava.lang.Thread
      extended byeduni.simjava.Sim_entity
          extended byScheduler
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Runnable

public class Scheduler
extends eduni.simjava.Sim_entity

instance of this class represents Scheduler which is responsible for resource allocation


Field Summary
static double[] AllAsks
          stores reservation prices or rate of all resources registered with Scheduler
static double[] AllPP
          stores processing power of resources
static double[] AllReservationPrices
          stores reservation price or rate of resources
static int[][] allresourceids
          stores registering resources info : id and availability
static int NextPhase
           
static int ResultToResource
           
static int ResultToUser
           
static int SendParticipationAcknowledgement
           
static int[][] totaluserids
          stores registering users info : id and availability
static double[][] totaluserinfo
          stores registering users info : total work, number of tasks, and task budget
static int ValidatedSignalToResource
           
static int ValidResourcesBeforeAuction
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Scheduler(java.lang.String name, double delay)
          Creates a new instance of Scheduler
 
Method Summary
static int activeresources()
          returns number of participating resources that are not busy in serving any task
static int activeusers()
          returns number of participating users with at least one task left
 void body()
          defines behavior of entity
static int findresourceid(int id)
          returns position of a resource in allresourceids[][] when resource id is passed as parameter
static int finduserid(int id)
          returns position of a user in totaluserids[][] when user id is passed as parameter
 java.lang.String getname()
           
static void OrderRegistrationSequence()
          arranges the resource registration sequence in ascending order, method orders the resource registration sequence to fairly compare different protocols
 
Methods inherited from class eduni.simjava.Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SendParticipationAcknowledgement

public static final int SendParticipationAcknowledgement
See Also:
Constant Field Values

ResultToUser

public static final int ResultToUser
See Also:
Constant Field Values

ResultToResource

public static final int ResultToResource
See Also:
Constant Field Values

NextPhase

public static final int NextPhase
See Also:
Constant Field Values

ValidatedSignalToResource

public static final int ValidatedSignalToResource
See Also:
Constant Field Values

allresourceids

public static int[][] allresourceids
stores registering resources info : id and availability


totaluserids

public static int[][] totaluserids
stores registering users info : id and availability


totaluserinfo

public static double[][] totaluserinfo
stores registering users info : total work, number of tasks, and task budget


AllReservationPrices

public static double[] AllReservationPrices
stores reservation price or rate of resources


AllPP

public static double[] AllPP
stores processing power of resources


AllAsks

public static double[] AllAsks
stores reservation prices or rate of all resources registered with Scheduler


ValidResourcesBeforeAuction

public static int ValidResourcesBeforeAuction
Constructor Detail

Scheduler

public Scheduler(java.lang.String name,
                 double delay)
Creates a new instance of Scheduler

Method Detail

getname

public java.lang.String getname()

finduserid

public static int finduserid(int id)
returns position of a user in totaluserids[][] when user id is passed as parameter


findresourceid

public static int findresourceid(int id)
returns position of a resource in allresourceids[][] when resource id is passed as parameter


activeusers

public static int activeusers()
returns number of participating users with at least one task left


activeresources

public static int activeresources()
returns number of participating resources that are not busy in serving any task


OrderRegistrationSequence

public static void OrderRegistrationSequence()
arranges the resource registration sequence in ascending order, method orders the resource registration sequence to fairly compare different protocols


body

public void body()
defines behavior of entity