nl.tudelft.simulation.dsol.tutorial.section42

## Class Retailer

- java.lang.Object
- - nl.tudelft.simulation.event.EventProducer
  - - nl.tudelft.simulation.dsol.tutorial.section42.Retailer

All Implemented Interfaces:
  Serializable, BuyerInterface, SellerInterface, EventProducerInterface

    public class Retailer
    extends EventProducer
    implements BuyerInterface, SellerInterface

A Retailer.

Copyright (c) 2002-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://simulation.tudelft.nl/dsol/3.0/license.html.

Author:
  Peter Jacobs
See Also:
  Serialized Form

### Field Summary

Fields
`static EventType` `BACKLOG_LEVEL` BACKLOG_LEVEL is fired on BACKLOG_LEVEL changes.
`static EventType` `INVENTORY_LEVEL_EVENT` INVENTORY_LEVEL_EVENT is fired on changes in inventory.
`static EventType` `TOTAL_ORDERING_COST_EVENT` TOTAL_ORDERING_COST_EVENT is fired whenever ordering occurs.

### Fields inherited from class nl.tudelft.simulation.event.EventProducer

`listeners`

### Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface

`FIRST_POSITION, LAST_POSITION`

### Constructor Summary

Constructors
Constructor and Description
`Retailer(DEVSSimulatorInterface.TimeDouble simulator, SellerInterface warehouse)` constructs a new Retailer.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `order(BuyerInterface buyer, long amount)` order a requested amount.
`void` `receiveProduct(long amount)` receive the ordered Product.

### Methods inherited from class nl.tudelft.simulation.event.EventProducer

`addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### TOTAL_ORDERING_COST_EVENT

    public static final EventType TOTAL_ORDERING_COST_EVENT

TOTAL_ORDERING_COST_EVENT is fired whenever ordering occurs.

#### INVENTORY_LEVEL_EVENT

    public static final EventType INVENTORY_LEVEL_EVENT

INVENTORY_LEVEL_EVENT is fired on changes in inventory.

#### BACKLOG_LEVEL

    public static final EventType BACKLOG_LEVEL

BACKLOG_LEVEL is fired on BACKLOG_LEVEL changes.

### Constructor Detail

#### Retailer

    public Retailer(DEVSSimulatorInterface.TimeDouble simulator,
                    SellerInterface warehouse)

constructs a new Retailer.

Parameters:
  `simulator` - the simulator on which we can schedule
  `warehouse` - the warehouse to buy at

### Method Detail

#### receiveProduct

    public final void receiveProduct(long amount)

receive the ordered Product.

Specified by:
  `receiveProduct` in interface `BuyerInterface`
Parameters:
  `amount` - the amount to receive

#### order

    public final void order(BuyerInterface buyer,
                            long amount)

order a requested amount.

Specified by:
  `order` in interface `SellerInterface`
Parameters:
  `buyer` - the requesting buyer
  `amount` - the requested amount