Package nl.tudelft.simulation.dsol.tutorial.section42

## Class Retailer

- java.lang.Object
- - org.djutils.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-2020 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 TimedEventType` `BACKLOG_LEVEL` BACKLOG_LEVEL is fired on BACKLOG_LEVEL changes.
`static TimedEventType` `INVENTORY_LEVEL_EVENT` INVENTORY_LEVEL_EVENT is fired on changes in inventory.
`static TimedEventType` `TOTAL_ORDERING_COST_EVENT` TOTAL_ORDERING_COST_EVENT is fired whenever ordering occurs.

### Fields inherited from class org.djutils.event.EventProducer

`eventProducerImpl`

### Fields inherited from interface org.djutils.event.EventProducerInterface

`FIRST_POSITION, LAST_POSITION`

### Constructor Summary

Constructors
`Retailer​(DEVSSimulatorInterface.TimeDouble simulator, SellerInterface warehouse)` constructs a new Retailer.

### Method Summary

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

### Methods inherited from class org.djutils.event.EventProducer

`addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, 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 TimedEventType TOTAL_ORDERING_COST_EVENT

TOTAL_ORDERING_COST_EVENT is fired whenever ordering occurs.

#### INVENTORY_LEVEL_EVENT

    public static final TimedEventType INVENTORY_LEVEL_EVENT

INVENTORY_LEVEL_EVENT is fired on changes in inventory.

#### BACKLOG_LEVEL

    public static final TimedEventType 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` - DEVSSimulatorInterface.TimeDouble; the simulator on which we can schedule
  `warehouse` - SellerInterface; 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` - long; 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` - BuyerInterface; the requesting buyer
  `amount` - long; the requested amount

#### getSourceId

    public Serializable getSourceId()

Specified by:
  `getSourceId` in interface `EventProducerInterface`
Specified by:
  `getSourceId` in class `EventProducer`