|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Printer
Represents a printer in a simulation. Also records certain statistics.
| Constructor Summary | |
Printer(int pageRate,
int paperCapacity)
Creates a new printer |
|
| Method Summary | |
(package private) int |
getPrintTime(int pages)
Returns how long it will take to print the given number of pages, but does not actually print them. |
int |
print(int pages)
Tells this printer to simulate printing a print job. |
protected void |
reset()
Resets this printer, setting all statistics to zero. |
String |
toString()
Returns the settings and statistics of this printer. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public Printer(int pageRate,
int paperCapacity)
pageRate - How many seconds it takes this printer to print one pagepaperCapacity - How many pages this printer holds when its paper tray
is full| Method Detail |
protected void reset()
int getPrintTime(int pages)
pages - Number of pages to "print"IllegalArgumentException - if you try to print < 0 pages.
public int print(int pages)
throws IllegalArgumentException
Updates all the relevant stats for this printer concerning number of jobs (++), total pages printed (+= pages), current pages in the printer tray (-= pages), etc.
Returns how long it takes to print the given number of pages at this printer's print rate.
pages - Number of pages to "print"IllegalArgumentException - if you try to print < 0 pages.public String toString()
toString in class Object
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||