XPUSP - Home

br.usp.ime.xpusp
Class DefaultGenerator

java.lang.Object
  |
  +--br.usp.ime.xpusp.DefaultGenerator
All Implemented Interfaces:
ScheduleGenerator

public class DefaultGenerator
extends java.lang.Object
implements ScheduleGenerator

This class is the default ScheduleGenerator implementation. It's main goal is to avoid null pointer exceptions when calls to start/stop etc are performed. All it does is log calls to the methods. It's also responsible for generating an instance of ScheduleGenerator via calls to getInstance. It uses the class named by TurbineResources.properties property named: br.usp.ime.xpusp.generatorClassName. If the property is not defined, or if anything goes wrong when instantiating it, an instance of DefaultGenerator is returned.

Version:
$Id: DefaultGenerator.java,v 1.3 2002/05/31 04:09:31 alex_freire Exp $
Author:
Christian Willy Asmussen

Field Summary
static java.lang.String PROP_NAME
          br.usp.ime.xpusp.generatorClassName
 
Constructor Summary
DefaultGenerator()
           
 
Method Summary
 void cleanUp()
          If there is a necessity to cleanup between one year and anotherone.
static ScheduleGenerator getInstance()
          Fetches the property defined by PROP_NAME and instantiates the class with that name.
 void prepare()
          If there is a need to perform preparation before starting to generate the solution, this method should implement that.
 void startSolving(Year year)
          Start solving the problem.
 void stopSolving(Year year)
          Stop solving the problem.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

PROP_NAME

public static final java.lang.String PROP_NAME
br.usp.ime.xpusp.generatorClassName
Constructor Detail

DefaultGenerator

public DefaultGenerator()
Method Detail

getInstance

public static ScheduleGenerator getInstance()
Fetches the property defined by PROP_NAME and instantiates the class with that name. If anything goes wrong, and instance of DefaultGenerator is returned.

cleanUp

public void cleanUp()
             throws java.lang.Exception
Description copied from interface: ScheduleGenerator
If there is a necessity to cleanup between one year and anotherone. This method should be able to do that. It is called by Year.doStartpooling to ensure that everything has been cleaned up.
Specified by:
cleanUp in interface ScheduleGenerator
Throws:
java.lang.Exception -

prepare

public void prepare()
             throws java.lang.Exception
Description copied from interface: ScheduleGenerator
If there is a need to perform preparation before starting to generate the solution, this method should implement that. It is called by Year.doStoppooling
Specified by:
prepare in interface ScheduleGenerator
Throws:
java.lang.Exception -

startSolving

public void startSolving(Year year)
                  throws java.lang.Exception
Description copied from interface: ScheduleGenerator
Start solving the problem. Called by Year.doStartsolving you can assume that PoolResults have been calculated here
Specified by:
startSolving in interface ScheduleGenerator
Throws:
java.lang.Exception -

stopSolving

public void stopSolving(Year year)
                 throws java.lang.Exception
Description copied from interface: ScheduleGenerator
Stop solving the problem. Called by Year.doStopsolving you can assume that PoolResults have been calculated here
Specified by:
stopSolving in interface ScheduleGenerator
Throws:
java.lang.Exception -

XPUSP - Home