|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface World
Objects of type World represent the "outside world" from
which all customers and profit flow.
The simulator interacts with the World via two object
types:
CIT). The
World generates tokens of this type to describe orders
to the simulator/plant. Those tokens may represent:
CIT.getPrevTransactionReceipt()
field is null.
CIT.getPrevTransactionReceipt()
is non-null and the CIT.isCancellation() is
false.
CIT.getPrevTransactionReceipt()
is non-null and the CIT.isCancellation() is
true.
OrderReceipt). The Simulator
generates receipts of this type to indicate:
deliver(int, OrderReceipt, ComputerOrder, boolean)
method, to identify which order is being completed and should
be cleared.
The basic order of operations for using an object of type World
is:
World object (probably with
an associated XRandom pseudo-random number generator)
acknowledgeOrder(OrderReceipt,int) with a
null receipt in order to get the arrival time
of the first order.
getOrderAtTime(int) to receive a new CIT
acknowledgeOrder(OrderReceipt,int) to acknowledge
that the order has been received and is being processed and to
assign a unique order receipt to the order.
deliver(int, OrderReceipt, ComputerOrder, boolean)
to fulfill an outstanding order.
finalReport(DiscrEventSimulator)
to finalize the simulation and get a summary of results.
The World maintains a set of outstanding orders.
These are orders that have been placed, but not yet filled. When
the plant fills an order (by calling
deliver(int, OrderReceipt, ComputerOrder, boolean))
the corresponding outstanding order is "cleared" -- that is, removed
from the outstanding order set.
| Method Summary | |
|---|---|
int |
acknowledgeOrder(OrderReceipt r,
int time)
This method is called by the simulator/factory when an order has been received (via the getOrderAtTime(int)
method). |
void |
deliver(int time,
OrderReceipt r,
ComputerOrder delivered,
boolean isFaulty)
Called to indicate that an order has been completed and is being delivered to the customer. |
String |
finalReport(DiscrEventSimulator finalState)
Generate a report and assessment of the final performance of the Grell plant at the end of the simulation. |
CIT |
getOrderAtTime(int time)
|
| Method Detail |
|---|
void deliver(int time,
OrderReceipt r,
ComputerOrder delivered,
boolean isFaulty)
World will use
the delivery information to adjust the customer satisfaction
information.
The following conditions are illegal and will cause an
IllegalArgumentException to be thrown:
ComputerOrder that
wasn't what the customer asked for.
Note that it is required that the delivered computer
type actually match the ordered type. (That is, the type of
the most recent order, if there has been a change order placed.)
In this discrete event simulation, we encompass all possible
manufacture errors in the single boolean flag isFaulty.
time - Time stamp at which the order is delivered.r - Original order receipt that was generated for this
order.delivered - Type of computer that was actually delivered
(should be the same as the type in the most recent order!)isFaulty - true iff the delivered computer
was broken in some way, because some assembler somewhere screwed
up.
IllegalArgumentException - If any of the illegal conditions
described above occurs.CIT getOrderAtTime(int time)
time - Time for which an arrived order is being requested
time.
IllegalArgumentException - if time doesn't match
arrival time of the next customer token.
int acknowledgeOrder(OrderReceipt r,
int time)
getOrderAtTime(int)
method). This notifies the customer that the order has been
received and is being processed. It also assigns an order
number to a customer that they can later use to communicate
back with the factory and request a change or cancellation.
When this is called, it returns the time that the next
order will be placed, which allows the event simulator to know
when next to call getOrderAtTime(int).
Note that this method is called every time an order is placed, including cancellation and change orders. For new orders, the receipt is a new receipt and should include a newly-generated (unique) order ID. For change and cancellation orders, the receipt is the same receipt generated for the original order, including the same order ID.
To get the whole simulation ball rolling, this method can be
called with a null receipt. It will then generate
the timestamp of the first order event and return that. After
the first such call, it is an error to pass null
into this method, and it will throw a NullPointerException
in response.
r - Receipt for the most recently placed order, including
a (factory-generated) order ID. null on the first
call, to initialize the world simulator.time - Time stamp at which receipt is returned. Should be
the same as the time stamp at which the order was retrieved
via getOrderAtTime(int).
NullPointerException - if r==null any time after
the first call.String finalReport(DiscrEventSimulator finalState)
finalState - Final state of the simulation
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||