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`, `org.djutils.event.EventProducerInterface`

    public class Retailer
    extends org.djutils.event.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
Modifier and Type | Field | Description
--- | --- | ---
`static org.djutils.event.EventType` | `BACKLOG_LEVEL` | BACKLOG_LEVEL is fired on BACKLOG_LEVEL changes.
`static org.djutils.event.EventType` | `INVENTORY_LEVEL_EVENT` | INVENTORY_LEVEL_EVENT is fired on changes in inventory.
`static org.djutils.event.EventType` | `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
Constructor | Description
--- | ---
`Retailer​(DEVSSimulatorInterface.TimeDouble simulator, SellerInterface warehouse)` | constructs a new Retailer.

## Method Summary

Modifier and Type | Method | Description
--- | --- | ---
`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, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, 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 Details

### TOTAL_ORDERING_COST_EVENT

public static final org.djutils.event.EventType TOTAL_ORDERING_COST_EVENT
TOTAL_ORDERING_COST_EVENT is fired whenever ordering occurs.

### INVENTORY_LEVEL_EVENT

public static final org.djutils.event.EventType INVENTORY_LEVEL_EVENT
INVENTORY_LEVEL_EVENT is fired on changes in inventory.

### BACKLOG_LEVEL

public static final org.djutils.event.EventType BACKLOG_LEVEL
BACKLOG_LEVEL is fired on BACKLOG_LEVEL changes.

## Constructor Details

### 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 Details

### 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 `org.djutils.event.EventProducerInterface`
Specified by:
  `getSourceId` in class `org.djutils.event.EventProducer`