|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objecteos.io.printer.Printer
eos.io.printer.ConsumerMktVolPrinter
public class ConsumerMktVolPrinter
This printer tracks the trading volume of a consumer market (e.g. enjoyment market or necessity market) and prints to a CSV file. To use it:
1. Create a new ConsumerMktVolPrinter. See
ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
.
2. Call printTitles() to print column titles.
3. Add the printer to the Economy by calling Economy.addPrinter().
4. Call print() of this printer in Economy.step() to print data.
5. Include cleanup() of this printer in Economy.cleanUpPrinters(), and call that method to clean up the printers.
The output of the printer is a CSV file. If you have closely followed the above steps, the first line of the file should be the column titles, and the first column is the time step. All entries are comma-delimited (without space). The file could be directly used as an input file for Grapher and MultiAxisGrapher. You could also open the file with most spreadsheet softwares like Microsoft Excel and OpenOffice Spreadsheet, and perform any data processing you wish.
If you omit the file name or provide a simple file name in the constructor, the output file will be saved in a folder called "output". If on the other hand, you specify a directory in the file name, the output file will be saved in your specified directory.
The default columns to be printed are:
Col0: time step
Col1: volume traded
Col2: market supply
Field Summary |
---|
Fields inherited from class eos.io.printer.Printer |
---|
end, period, start |
Constructor Summary | |
---|---|
ConsumerMktVolPrinter(int period,
ConsumerGoodMarket market)
Create a new ConsumerMktVolPrinter. |
|
ConsumerMktVolPrinter(int period,
int start,
ConsumerGoodMarket market)
Create a new ConsumerMktVolPrinter. |
|
ConsumerMktVolPrinter(int period,
int start,
int end,
ConsumerGoodMarket market)
Create a new ConsumerMktVolPrinter. |
|
ConsumerMktVolPrinter(String fileName,
int period,
ConsumerGoodMarket market)
Create a new ConsumerMktVolPrinter. |
|
ConsumerMktVolPrinter(String fileName,
int period,
int start,
ConsumerGoodMarket market)
Create a new ConsumerMktVolPrinter. |
|
ConsumerMktVolPrinter(String fileName,
int period,
int start,
int end,
ConsumerGoodMarket market)
Create a new ConsumerMktVolPrinter. |
Method Summary | |
---|---|
void |
cleanup()
Clean up the printer |
String |
getFileName()
Return the name of the output file. |
void |
print()
Print data, called by Economy at each time step |
void |
printTitles()
Print column titles |
Methods inherited from class eos.io.printer.Printer |
---|
getEnd, getPeriod, getStart |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
e.g. To track the necessity volume,
ConsumerMktVolPrinter nVolPrinter = new ConsumerMktVolPrinter(5, nMarket);
fileName
- name of the CSV output file. A default name will be used if it
is omitted
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
start
- starting time step, no data will be printed before this
end
- ending step, no data will be printed after this. If
end is omitted, it will be taken to be the last step
of the simulation. If both start and end are
omitted, they will be taken to be the first and last step of
the simulation respectively.
market
- market to be tracked
public ConsumerMktVolPrinter(String fileName, int period, int start, ConsumerGoodMarket market)
ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
. end is set to the end of the simulation.
fileName
- name of the CSV output file. A default name will be used if it
is omitted
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
start
- starting time step, no data will be printed before this
market
- market to be tracked
public ConsumerMktVolPrinter(String fileName, int period, ConsumerGoodMarket market)
ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
. start is set to 0. end is set to the end of the
simulation.
fileName
- name of the CSV output file. A default name will be used if it
is omitted
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
market
- market to be tracked
public ConsumerMktVolPrinter(int period, int start, int end, ConsumerGoodMarket market)
ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
. A default fileName is used.
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
start
- starting time step, no data will be printed before this
end
- ending step, no data will be printed after this. If
end is omitted, it will be taken to be the last step
of the simulation. If both start and end are
omitted, they will be taken to be the first and last step of
the simulation respectively.
market
- market to be tracked
public ConsumerMktVolPrinter(int period, int start, ConsumerGoodMarket market)
ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
. A default fileName is used. end is set to the end of
the simulation.
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
start
- starting time step, no data will be printed before this
market
- market to be tracked
public ConsumerMktVolPrinter(int period, ConsumerGoodMarket market)
ConsumerMktVolPrinter(String fileName, int period, int start, int end, ConsumerGoodMarket market)
. A default fileName is used. start is set to 0.
end is set to the end of the simulation.
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
market
- market to be tracked
Method Detail |
---|
public void print()
print
in class Printer
public void printTitles()
printTitles
in class Printer
public void cleanup()
cleanup
in class Printer
public String getFileName()
getFileName
in class Printer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |