jsim.process
Class Facility

java.lang.Object
  extended by jsim.process.DynamicNode
      extended by jsim.process.Server
          extended by jsim.process.Facility

public class Facility
extends Server

The Facility class allows service facilities to be created. A Facility object consists of a set of tokens (service units) feed by a common queue.


Nested Class Summary
protected  class Facility.Line
          Waiting line for entities waiting to use the facility.
 
Nested classes/interfaces inherited from class jsim.process.Server
Server.TokenVec
 
Field Summary
 
Fields inherited from class jsim.process.Server
tokenV
 
Fields inherited from class jsim.process.DynamicNode
costs, duration, occupancy, outgoing, props, trc
 
Constructor Summary
Facility(int id, Prop props, java.util.LinkedList<Coroutine> waitQueue, Transport[] outgoing, AnimationQueue queue)
          Construct a Facility.
Facility(Prop props, java.util.LinkedList<Coroutine> waitQueue, Transport[] outgoing)
          Construct a Facility.
 
Method Summary
 void contract()
          Remove a service unit (token) from the facility.
 void expand()
          Add a service unit (token) to the facility.
 Statistic[] getNodeStats()
          Get all statistics for this node.
 SimObject preempt(int tokenNum)
          Preempt the service of the entity being served by token.
 void pushBack(int tokenNum)
          Preempt the service of the entity being served by token and push it back unto the queue.
 int queueLength()
          Get the length of the facility's wait queue.
 void request(SimObject entity)
          Request a token (service unit).
 void use(SimObject entity)
          This method causes the SimObject entity to use the server.
 void use(SimObject entity, double service, double cost)
          This method causes the SimObject entity to use the server.
 
Methods inherited from class jsim.process.Server
getId, preempt, setId
 
Methods inherited from class jsim.process.DynamicNode
getOutgoing, getProps, setBatchProperties, setPrimary, setProps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Facility

public Facility(Prop props,
                java.util.LinkedList<Coroutine> waitQueue,
                Transport[] outgoing)
Construct a Facility. This constructor has sufficient information to draw the node and its outgoing edges.

Parameters:
property - properties of node
location - position of node
waitQueue - where entities wait
outgoing - outgoing transports

Facility

public Facility(int id,
                Prop props,
                java.util.LinkedList<Coroutine> waitQueue,
                Transport[] outgoing,
                AnimationQueue queue)
Construct a Facility. This constructor has sufficient information to draw the node and its outgoing edges.

Parameters:
property - properties of node
location - position of node
waitQueue - where entities wait
outgoing - outgoing transports
Method Detail

getNodeStats

public Statistic[] getNodeStats()
Get all statistics for this node.

Overrides:
getNodeStats in class DynamicNode
Returns:
Statistic [] statistics for this node

queueLength

public int queueLength()
Get the length of the facility's wait queue.

Returns:
int the queue length

request

public void request(SimObject entity)
Request a token (service unit). If no token is available enqueue the requesting entity in the wait queue. If the queue has finite capacity, the entity may be lost.

Overrides:
request in class Server
Parameters:
entity - the SimObject (entity) requesting service

use

public void use(SimObject entity,
                double service,
                double cost)
This method causes the SimObject entity to use the server.

Overrides:
use in class Server
Parameters:
entity - the SimObject trying to use a server
service - service time

use

public void use(SimObject entity)
This method causes the SimObject entity to use the server. The service time is randomly generated.

Overrides:
use in class Server
Parameters:
entity - the SimObject trying to use a server

preempt

public SimObject preempt(int tokenNum)
Preempt the service of the entity being served by token. See if there is an entity in the queue to use the new token.

Parameters:
tokenNum - preempt the service of this token
Returns:
SimObject the preempted entity

pushBack

public void pushBack(int tokenNum)
Preempt the service of the entity being served by token and push it back unto the queue. Not yet tested.

Parameters:
tokenNum - preempt the service of this token

expand

public void expand()
Add a service unit (token) to the facility. See if there is an entity in the queue to use the new token.

Overrides:
expand in class Server

contract

public void contract()
Remove a service unit (token) from the facility. Handle a possible preempted entity (a SimObject).

Overrides:
contract in class Server