SimObs
Class GEntity

java.lang.Object
  |
  +--SimObs.GEntity
Direct Known Subclasses:
Observer, PersCust, PhoneEnq

public abstract class GEntity
extends java.lang.Object

General entity class for three phase simulation. Will be used to define the entities required in a particular simulation. GEntity needs to be known by the Executive class, since it creates several Vectors to contain GEntity objects.


Field Summary
protected  boolean avail
          If true, the entity is currently not committed to a B
protected  int entNum
          Unique counter ID for this entity
 java.lang.String name
          The name of the entity
protected  Activity nextB
          The B in which this entity will engage when clock reaches the time cell
protected  long prevTime
          The previous time cell of the entity
protected  long tCell
          The time cell (time of next state change) of the entity
protected  long util
          Total time for which the entity has been committed thus far
 
Constructor Summary
GEntity(java.lang.String thisName)
          Simple constructor.
 
Method Summary
 void commit(long thisTime, Activity nextAct)
          Updates the time cell, availability and next B of the entity.
 void doNextB()
          Calls the method representing the next B.
 boolean getAvail()
          Returns with a boolean state showing whether the entity is currently committed to a B.
 int getEntNum()
          Returns with the number of the entity.
 java.lang.String getName()
          Returns with the name of the entity.
 long getTCell()
          Returns with the current value of the time cell of the entity.
 long getUtil()
          Returns with the current utilisation of the entity.
 void release()
          Releases an entity by putting avail to false and updating tCell.
 void show()
          Writes information about the entity to the tracefile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
The name of the entity

tCell

protected long tCell
The time cell (time of next state change) of the entity

prevTime

protected long prevTime
The previous time cell of the entity

avail

protected boolean avail
If true, the entity is currently not committed to a B

util

protected long util
Total time for which the entity has been committed thus far

entNum

protected int entNum
Unique counter ID for this entity

nextB

protected Activity nextB
The B in which this entity will engage when clock reaches the time cell
Constructor Detail

GEntity

public GEntity(java.lang.String thisName)
Simple constructor. Gives the entity a name and keeps count of how many entities have been created in total.
Method Detail

getName

public java.lang.String getName()
Returns with the name of the entity.

getEntNum

public int getEntNum()
Returns with the number of the entity.

getTCell

public long getTCell()
Returns with the current value of the time cell of the entity.

getAvail

public boolean getAvail()
Returns with a boolean state showing whether the entity is currently committed to a B.

commit

public void commit(long thisTime,
                   Activity nextAct)
Updates the time cell, availability and next B of the entity. Usually called by Executive.schedule after checking that the values passed are sensible. Allows Executive to be recoded if necessary.

release

public void release()
Releases an entity by putting avail to false and updating tCell. DANGEROUS unless called from Executive!

doNextB

public void doNextB()
Calls the method representing the next B.

getUtil

public long getUtil()
Returns with the current utilisation of the entity. Utilisation is the total time for which the entity has been committed thus far. This could exceed current simulation clock if the entity is currently scheduled for some B in the distant future.

show

public void show()
Writes information about the entity to the tracefile.