com.pegacat.vcf.data
Class Loader

java.lang.Object
  |
  +--com.pegacat.vcf.data.Loader
Direct Known Subclasses:
OfflineLoader, WebLoader

public abstract class Loader
extends java.lang.Object

A Loader initialises the data variables of a DataLayer object.


Inner Class Summary
static interface Loader.Watcher
           
 
Field Summary
static boolean debug
           
 
Constructor Summary
Loader()
           
 
Method Summary
 VoyagerText getAllSurveys()
           
 VoyagerText getAllTech()
           
 VoyagerText getCargoReport()
           
 java.lang.String getCurrentTurnNo()
          Tries to work out what the current turn is, (currently, by loading up the cargo report and parsing the header - better methods greatfully accepted!).
abstract  VoyagerText getFile(java.lang.String fileName)
          This method is inherited by WebLoader and OfflineLoader (and conceivably other loaders) to provide their own way of getting the text file data...
 VoyagerText getNewSurveys()
           
 VoyagerText getNewTech()
           
 VoyagerText getObjectTree()
           
 VoyagerText getPopSurveys()
           
 VoyagerText getRaceDesc()
           
 VoyagerText getRawStars()
           
 VoyagerText getReport()
           
abstract  Star[] getStars()
          This method is inherited by WebLoader and OfflineLoader to get and parse the star list.
protected  Star[] getStars(java.lang.String starData)
          This parses the original star data file ('slocs.0'), that is still available on the web page...
 VoyagerText getSummary()
           
 void loadAll(DataLayer data, Loader.Watcher dataWatcher)
          This method is used to load all available data into the DataLayer object.
 void loadFinished(DataLayer data)
          This method can be extended to run any extra processing required when a 'loadAll()' method has completed successfully.
protected  int nextInt(java.util.StringTokenizer st)
           
 void saveAll(DataLayer data)
          This method can be extended by loaders that can also save data, such as the OfflineLoader which handles cached data...
protected  void setWatcher(Loader.Watcher watcher, int stage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Constructor Detail

Loader

public Loader()
Method Detail

loadAll

public void loadAll(DataLayer data,
                    Loader.Watcher dataWatcher)
This method is used to load all available data into the DataLayer object. Since this may take some time, their is facility to enable a 'Loader Watcher' which can report back (usually via gui) to the user to show them how the operation is progressing.
Parameters:
data - the DataLayer object to be initialised
watcher - the Loader.Watcher interface object to report back on progress - may be null.

loadFinished

public void loadFinished(DataLayer data)
This method can be extended to run any extra processing required when a 'loadAll()' method has completed successfully.

saveAll

public void saveAll(DataLayer data)
This method can be extended by loaders that can also save data, such as the OfflineLoader which handles cached data...

setWatcher

protected void setWatcher(Loader.Watcher watcher,
                          int stage)
                   throws java.lang.Exception

getReport

public VoyagerText getReport()

getSummary

public VoyagerText getSummary()

getPopSurveys

public VoyagerText getPopSurveys()

getCargoReport

public VoyagerText getCargoReport()

getAllSurveys

public VoyagerText getAllSurveys()

getNewSurveys

public VoyagerText getNewSurveys()

getAllTech

public VoyagerText getAllTech()

getNewTech

public VoyagerText getNewTech()

getRaceDesc

public VoyagerText getRaceDesc()

getRawStars

public VoyagerText getRawStars()

getObjectTree

public VoyagerText getObjectTree()

getCurrentTurnNo

public java.lang.String getCurrentTurnNo()
Tries to work out what the current turn is, (currently, by loading up the cargo report and parsing the header - better methods greatfully accepted!).

getFile

public abstract VoyagerText getFile(java.lang.String fileName)
This method is inherited by WebLoader and OfflineLoader (and conceivably other loaders) to provide their own way of getting the text file data...

getStars

public abstract Star[] getStars()
This method is inherited by WebLoader and OfflineLoader to get and parse the star list.

getStars

protected Star[] getStars(java.lang.String starData)
                   throws java.lang.Exception
This parses the original star data file ('slocs.0'), that is still available on the web page...

nextInt

protected int nextInt(java.util.StringTokenizer st)