haifa.shopsim.kernel
Class Machine

java.lang.Object
  |
  +--javaSimulation.Linkage
        |
        +--javaSimulation.Link
              |
              +--javaSimulation.Process
                    |
                    +--haifa.shopsim.kernel.Machine
All Implemented Interfaces:
JobHolder, SimulationEntity

class Machine
extends javaSimulation.Process
implements JobHolder

This class is an enity in the simulation. It's state represents the state of a machine working in the job shop at a given point in time. It contains a HashMap of Machine.JobClass objects. Each of these objects has a reference to the machine that passes jobs of such a class to the current machine and to the machine which is the destination of jobs after they are finished. (These do not have to be machines but actually JobHolders (they can also be route ends and starts).

The Machine class uses it's reference to the shopRun class to ask questions such as who to schedule, and if quit has been called.


Inner Class Summary
private  class Machine.JobClass
          This inner class represents a buffer in a machine.
 
Field Summary
private  java.util.HashMap classes
          Maps the classes(buffers) in a shop.
private  int machineNumber
          The machine number of the machine as specified by the shopData.
private  boolean processing
          Determines whether the machine is currently processing a job or is idle.
(package private)  double restTime
           
private  ShopData shopData
          A reference to the data.
private  ShopRun shopRun
          A reference to the ShopRun object, the main process.
 
Fields inherited from class javaSimulation.Process
after, after_code, at, at_code, before, before_code, delay, delay_code, direct_code, EVTIME, MAIN, myCoroutine, PRED, prior, SQS, SUC, TERMINATED
 
Constructor Summary
(package private) Machine(ShopData shopData_, int machineNumber_, ShopRun shopRun_)
          Constructor sets up all of the buffers (JobClass objects).
 
Method Summary
 void actions()
          The actions that a machine performs are the following: If all buffers are empty, call the doSchedule method which will handle things with the shop algorithm and determine which buffer to draw from next.
(package private)  void bindInput(Operation op, JobHolder input_)
          Convinience class that helps setup network of routes.
(package private)  void bindOutput(Operation op, JobHolder output_)
          Convencie class that helps setup network of routes.
 void getJob(Job job)
          Get a job and put in the appropriate JobClass.
(package private)  java.util.Map getQMap()
          Returns a map of the Q lengths for each of the operations that the job has.
(package private)  boolean isEmpty()
          Returns true if all buffers for machine are empty.
(package private)  boolean isProcessing()
          Returns true if the Machine is currently processing a job.
 java.lang.String toString()
          Returns the machineNumber in a string.
 
Methods inherited from class javaSimulation.Process
, activat, activate, activate, activate, activate, activate, activate, activate, cancel, cancel, current, error, evTime, hold, idle, main, nextEv, passivate, reactivate, reactivate, reactivate, reactivate, reactivate, reactivate, reactivate, scheduleAfter, terminated, time, wait
 
Methods inherited from class javaSimulation.Link
follow, into, out, precede
 
Methods inherited from class javaSimulation.Linkage
pred, prev, suc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

processing

private boolean processing
Determines whether the machine is currently processing a job or is idle.

classes

private java.util.HashMap classes
Maps the classes(buffers) in a shop. A class is identified by an Operation object.

shopData

private ShopData shopData
A reference to the data.

machineNumber

private int machineNumber
The machine number of the machine as specified by the shopData.

shopRun

private ShopRun shopRun
A reference to the ShopRun object, the main process.

restTime

double restTime
Constructor Detail

Machine

Machine(ShopData shopData_,
        int machineNumber_,
        ShopRun shopRun_)
Constructor sets up all of the buffers (JobClass objects).
Method Detail

isProcessing

boolean isProcessing()
Returns true if the Machine is currently processing a job.

bindInput

void bindInput(Operation op,
               JobHolder input_)
Convinience class that helps setup network of routes.

bindOutput

void bindOutput(Operation op,
                JobHolder output_)
Convencie class that helps setup network of routes.

getQMap

java.util.Map getQMap()
Returns a map of the Q lengths for each of the operations that the job has. (Based on the classes map.)

isEmpty

boolean isEmpty()
Returns true if all buffers for machine are empty.

actions

public void actions()
The actions that a machine performs are the following: If all buffers are empty, call the doSchedule method which will handle things with the shop algorithm and determine which buffer to draw from next. The machine should then "start processing" the job by holding for the job processing time. (currently there is no preemption).
Overrides:
actions in class javaSimulation.Process

toString

public java.lang.String toString()
Returns the machineNumber in a string.
Overrides:
toString in class java.lang.Object

getJob

public void getJob(Job job)
Get a job and put in the appropriate JobClass. This method is to be used by the predecessor of the machine
Specified by:
getJob in interface JobHolder