view
Class PolygonFactory
java.lang.Object
view.PolygonFactory
public class PolygonFactory
- extends Object
This class opens and reads the file stated in its constructor call and
tries to convert one-line entries into Polygons. A one-line entry is
converted into a Polygon via this method:
- Ignore lines starting with '#'
- Construct a StringTokenizer out of the read line.
- Count the number of items: Only even numbers can be accepted.
- Step-by-step convert the tokens into integer pairs.
- If all conversions have been successful, construct a
Polygon from the gained pairs.
- See Also:
StringTokenizer
|
Method Summary |
static void |
main(String[] arg)
For testing purposes only. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Shape
public Polygon[] Shape
PolygonFactory
public PolygonFactory()
PolygonFactory
public PolygonFactory(File config)
- Constructs a new PolygonFactory. On construct, the config
file is opened and read. The Polygons are fed into the
Shape variable as they are found in the file.
main
public static void main(String[] arg)
- For testing purposes only. A new PolygonFactory is constructed from the
first command line argument and piped through to a tester unit.
Overriding this testing units provide a way to implement various tests
on the outer class without enlarging its bytesize.