vsp
Class Generator

java.lang.Object
  extended by java.lang.Thread
      extended by cz.zcu.fav.kiv.jsim.JSimProcess
          extended by vsp.Generator
All Implemented Interfaces:
JSimDisplayable, Comparable<JSimProcess>, Runnable

public class Generator
extends JSimProcess

Transaction generator

Author:
Jan Tichava

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  double deviation
          Deviation for Gaussian
private  boolean gauss
           
private  int generated
          Number of generated transactions
private  double lambda
          Exponential distribution ratio
private  double median
          Median for Gaussian
private  QueueWithServer queue
          Queue for server
private static boolean SILENT
          Silent mode for generating Gaussian
 
Fields inherited from class cz.zcu.fav.kiv.jsim.JSimProcess
INT_REQUESTS_TO_IGNORE, myParent
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Generator(String name, JSimSimulation simulation, double median, double deviation, QueueWithServer queue)
          Creates new Gaussian generator
Generator(String name, JSimSimulation simulation, double lambda, QueueWithServer queue)
          Creates exponential new generator
 
Method Summary
private  QueueWithServer addTransaction(JSimLink link, QueueWithServer queue)
          Add transaction to queue
 int getGenerated()
          Get number of generated transaction
 double getLq()
          Get median requests count
protected  void life()
          In infinite loop: - generates new transaction - generates random number from <0; 1> - adds transation to queue - pause process in depend of lambda
 
Methods inherited from class cz.zcu.fav.kiv.jsim.JSimProcess
activate, activateNow, blockOnSemaphore, cancel, compareTo, copyToMessageClipboard, createDetailedInfoWindow, equals, error, getDetailedInformationArray, getMessageBox, getObjectListItemDescription, getParent, getPrivateLock, getProcessName, getProcessNumber, getProcessState, getProcessStateAsString, getReady, getSenderIAmWaitingFor, getScheduleTime, hasBeenStarted, hasEmptyMessageClipboard, hashCode, hold, isIdle, mainSwitchingRoutine, message, messageNoNL, passivate, reactivate, readFromClipboard, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, run, sendMessageWithBlocking, sendMessageWithBlocking, sendMessageWithBlocking, sendMessageWithoutBlocking, sendMessageWithoutBlocking, sendMessageWithoutBlocking, setProcessState, start, toString, unblockFromSemaphore, wait
 
Methods inherited from class java.lang.Thread
activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, checkAccess, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SILENT

private static final boolean SILENT
Silent mode for generating Gaussian

See Also:
Constant Field Values

lambda

private double lambda
Exponential distribution ratio


queue

private QueueWithServer queue
Queue for server


generated

private int generated
Number of generated transactions


median

private double median
Median for Gaussian


deviation

private double deviation
Deviation for Gaussian


gauss

private boolean gauss
Constructor Detail

Generator

public Generator(String name,
                 JSimSimulation simulation,
                 double lambda,
                 QueueWithServer queue)
          throws JSimSimulationAlreadyTerminatedException,
                 JSimInvalidParametersException,
                 JSimTooManyProcessesException
Creates exponential new generator

Parameters:
name - name of generator
simulation - simulation object
lambda - lambda
queue - output queue
Throws:
JSimSimulationAlreadyTerminatedException
JSimInvalidParametersException
JSimTooManyProcessesException

Generator

public Generator(String name,
                 JSimSimulation simulation,
                 double median,
                 double deviation,
                 QueueWithServer queue)
          throws JSimSimulationAlreadyTerminatedException,
                 JSimInvalidParametersException,
                 JSimTooManyProcessesException
Creates new Gaussian generator

Parameters:
name - name of generator
simulation - simulation object
median - median
deviation - deviation
queue - output queue
Throws:
JSimSimulationAlreadyTerminatedException
JSimInvalidParametersException
JSimTooManyProcessesException
Method Detail

life

protected void life()
In infinite loop: - generates new transaction - generates random number from <0; 1> - adds transation to queue - pause process in depend of lambda

Overrides:
life in class JSimProcess

addTransaction

private QueueWithServer addTransaction(JSimLink link,
                                       QueueWithServer queue)
                                throws JSimSecurityException,
                                       JSimInvalidParametersException
Add transaction to queue

Parameters:
link -
queue -
Returns:
Throws:
JSimSecurityException
JSimInvalidParametersException

getGenerated

public int getGenerated()
Get number of generated transaction

Returns:
the generated

getLq

public double getLq()
Get median requests count

Returns: