|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objecteos.io.printer.Printer
eos.io.printer.FirmsPrinter
public class FirmsPrinter
This printer tracks statistics of a group of firms. To use it:
1. Create a new FirmsPrinter. See
FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
.
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: total revenue
Col2: total output
Col3: total loan
Col4: average revenue
Col5: average output
Col6: average loan
Col7: average profit
Col8: average labor
Col9: average marginal profit
Col10: total cost
Col11: total labor cost
Col12: total capital cost
Field Summary |
---|
Fields inherited from class eos.io.printer.Printer |
---|
end, period, start |
Constructor Summary | |
---|---|
FirmsPrinter(int period,
Firm[] firms)
Create a new FirmsPrinter. |
|
FirmsPrinter(int period,
int start,
Firm[] firms)
Create a new FirmsPrinter. |
|
FirmsPrinter(int period,
int start,
int end,
Firm[] firms)
Create a new FirmsPrinter. |
|
FirmsPrinter(String fileName,
int period,
Firm[] firms)
Create a new FirmsPrinter. |
|
FirmsPrinter(String fileName,
int period,
int start,
Firm[] firms)
Create a new FirmsPrinter. |
|
FirmsPrinter(String fileName,
int period,
int start,
int end,
Firm[] firms)
Create a new FirmsPrinter. |
Method Summary | |
---|---|
void |
cleanup()
Clean up the printer |
String |
getFileName()
Returns the name of the output file. |
void |
print()
Print data, called by Economy.step() 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 FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
fileName
- name of the CSV output file. A default name will be used if it
is omitted
period
- number of steps between two printing. 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.
firms
- firms to be tracked
public FirmsPrinter(String fileName, int period, int start, Firm[] firms)
FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
. 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
firms
- firms to be tracked
public FirmsPrinter(String fileName, int period, Firm[] firms)
FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
. 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.
firms
- firms to be tracked
public FirmsPrinter(int period, int start, int end, Firm[] firms)
FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
. 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.
firms
- firms to be tracked
public FirmsPrinter(int period, int start, Firm[] firms)
FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
. 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
firms
- firms to be tracked
public FirmsPrinter(int period, Firm[] firms)
FirmsPrinter(String fileName, int period, int start, int end, Firm[] firms)
. 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.
firms
- firms 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 |