public class AbstractFoods
extends java.lang.Object
implements java.io.Serializable
Map
with the item number as key (a String)
and the Item
object as value.
Map
with the contact number as key (a String)
and the Contact
object as value.
List
of Trx
instances each representing
a posted sales transaction.
Object
.Constructor and Description |
---|
AbstractFoods()
Construct a company having empty collections.
|
AbstractFoods(java.util.Map<java.lang.String,Item> inventory,
java.util.Map<java.lang.String,Contact> contacts,
java.util.List<Trx> journal)
Construct a company having the passed collections.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,Contact> |
getContacts()
Determine the contacts map of
this company |
java.util.Map<java.lang.String,Item> |
getInventory()
Determine the inventory map of
this company |
java.util.List<Trx> |
getJournal()
Determine the transaction list of
this company |
static AbstractFoods |
getRandom()
Create a randomly chosen Abstract Foods Company.
|
java.lang.String |
toString()
Construct a string representation of
this company. |
public AbstractFoods()
public AbstractFoods(java.util.Map<java.lang.String,Item> inventory, java.util.Map<java.lang.String,Contact> contacts, java.util.List<Trx> journal)
inventory
- the inventory mapcontacts
- the contacts mapjournal
- the transaction listpublic java.util.Map<java.lang.String,Item> getInventory()
this
companypublic java.util.Map<java.lang.String,Contact> getContacts()
this
companypublic java.util.List<Trx> getJournal()
this
companypublic java.lang.String toString()
this
company.toString
in class java.lang.Object
Abstract Foods Company
".public static AbstractFoods getRandom()
Item
) mappings of which about
25% are for Fresh
items. The numbers, names, and prices are
randomly chosen but the numbers are 8-character each. The contacts map
consists of about 100 (contact number, Contact
) mappings of which
50% are Client
and 50% are Supplier
instances. The
numbers, names, ratings (for clients), and catalogues (for suppliers) are
randomly chosen but the numbers are formatted as 5-digit each. The
journal list consists of about 750 posted Trx
transactions
spanning approximately 4 months (with the latest occurring in the past 48
hours).
In order to facilitate the testing of front-ends and reports that are
based on this randomly-chosen company, it is persisted (serialized) by
storing the returned instance on disk in the file data.af
.
This method was added for pedagogical reasons.