|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstresstests.datasets.TraversalOutFile
public class TraversalOutFile
An output iterator for City objects for file output.
Field Summary | |
---|---|
protected javax.swing.JFileChooser |
chooser
|
protected City[] |
cities
the list of cities to output |
protected boolean |
closed
true if the file is closed |
protected int |
i
loop counter |
protected java.lang.String |
s
a String object to hold file contents |
Constructor Summary | |
---|---|
TraversalOutFile(City[] aCities)
Select a file where the data will be stored, make sure it can be written. |
Method Summary | |
---|---|
City |
getFirst()
return the most recent city processed - if available |
Traversal<City> |
getRest()
process next item, if available |
boolean |
isEmpty()
verify that new city is available to add to the file |
static void |
main(java.lang.String[] argv)
|
static void |
writeFile(java.io.File f,
java.lang.String data,
boolean overwrite)
Writes the given data to the given file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected City[] cities
protected int i
protected boolean closed
protected java.lang.String s
protected javax.swing.JFileChooser chooser
Constructor Detail |
---|
public TraversalOutFile(City[] aCities)
Method Detail |
---|
public Traversal<City> getRest()
getRest
in interface Traversal<City>
Traversal
for
the rest of this dataset if available -- otherwise
throws IllegalUseOfTraversalException
public City getFirst()
getFirst
in interface Traversal<City>
IllegalUseOfTraversalException
public boolean isEmpty()
isEmpty
in interface Traversal<City>
public static void writeFile(java.io.File f, java.lang.String data, boolean overwrite) throws java.io.IOException
f
- the file to be writtendata
- the data to write to the fileoverwrite
- whether or not to automatically
overwrite existing file contents
FileExistsException
- if the file exists
and is not to be automatically overwritten
java.io.IOException
- if there is an error
writing the filepublic static void main(java.lang.String[] argv)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |