|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objecteos.io.printer.Printer
eos.io.printer.BankPrinter
public class BankPrinter
This printer tracks the loan, deposit and interest rates of the bank. To use it:
1. Create a new BankPrinter. See constructor
BankPrinter(String fileName, int period, int start, int end)
.
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 when calling 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: loan interest rate
Col2: smoothed loan interest rate
Col3: deposit interest rate
Col4: smoothed deposit interest rate
Col5: total loan
Col6: total deposit
Field Summary |
---|
Fields inherited from class eos.io.printer.Printer |
---|
end, period, start |
Constructor Summary | |
---|---|
BankPrinter(int period)
Create a new BankPrinter. |
|
BankPrinter(int period,
int start)
Create a new BankPrinter. |
|
BankPrinter(int period,
int start,
int end)
Create a new BankPrinter. |
|
BankPrinter(String fileName,
int period)
Create a new BankPrinter. |
|
BankPrinter(String fileName,
int period,
int start)
Create a new BankPrinter. |
|
BankPrinter(String fileName,
int period,
int start,
int end)
Create a new BankPrinter. |
Method Summary | |
---|---|
void |
cleanup()
Clean up the printer |
String |
getFileName()
Return 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 BankPrinter(String fileName, int period, int start, int end)
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.
public BankPrinter(String fileName, int period, int start)
BankPrinter(String fileName, int period, int start, int end)
.
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
public BankPrinter(String fileName, int period)
BankPrinter(String fileName, int period, int start, int end)
.
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.
public BankPrinter(int period, int start, int end)
BankPrinter(String fileName, int period, int start, int end)
. 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.
public BankPrinter(int period, int start)
BankPrinter(String fileName, int period, int start, int end)
. 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
public BankPrinter(int period)
BankPrinter(String fileName, int period, int start, int end)
. A
default fileName is used. end is set to the end of the
simulation. start is set to 0.
period
- number of steps between two prints. e.g. if period =
5, data will be printed every 5 time steps.
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 |