stsci.factory
Class Factory
java.lang.Object
|
+--stsci.factory.Factory
- Direct Known Subclasses:
- ADfactory, WebFactory
- public abstract class Factory
- extends java.lang.Object
Read objects from a text file on disk. This is an abstract class - the nextObj method is abstract and must be implemented by any concrete subclass.
Field Summary |
protected java.io.BufferedReader |
dstream
|
protected boolean |
finished
|
protected java.lang.String |
name
|
protected boolean |
opened
|
Constructor Summary |
Factory()
Default constructor is needed for subclasses. |
Factory(java.lang.String fn)
Open the given filenam - calls openDisk. |
Method Summary |
boolean |
finished()
Is the factory exhausted. |
abstract java.lang.Object |
nextObj()
The abstract method to consume input from dstream and create the next object. |
void |
open()
This should open the factory for reading. |
protected boolean |
openDisk(java.lang.String fn)
|
void |
setFinished()
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
name
protected java.lang.String name
finished
protected boolean finished
opened
protected boolean opened
dstream
protected java.io.BufferedReader dstream
Factory
public Factory(java.lang.String fn)
- Open the given filenam - calls openDisk.
Factory
public Factory()
- Default constructor is needed for subclasses.
openDisk
protected boolean openDisk(java.lang.String fn)
nextObj
public abstract java.lang.Object nextObj()
throws java.lang.Exception
- The abstract method to consume input from dstream and create the next object. This is specific to the particular type of input and must be implemented by the subclass.
open
public void open()
- This should open the factory for reading. This is overridden by speicalist factories.
finished
public boolean finished()
- Is the factory exhausted. typically a client will have a while !finished loop on the factory. In this case this will be when the dstream is no longer ready.
setFinished
public void setFinished()