Search in sources :

Example 1 with ConditionalController

use of gate.creole.ConditionalController in project gate-core by GateNLP.

the class ConditionalControllerPersistence method extractDataFromSource.

/**
 * Populates this Persistence with the data that needs to be stored from the
 * original source object.
 */
@Override
public void extractDataFromSource(Object source) throws PersistenceException {
    if (!(source instanceof ConditionalController)) {
        throw new UnsupportedOperationException(getClass().getName() + " can only be used for " + ConditionalController.class.getName() + " objects!\n" + source.getClass().getName() + " is not a " + ConditionalController.class.getName());
    }
    super.extractDataFromSource(source);
    ConditionalController controller = (ConditionalController) source;
    /*strategiesList = new ArrayList<RunningStrategy>(controller.getRunningStrategies().size());

    Iterator<RunningStrategy> stratIter = controller.getRunningStrategies().iterator();
    while(stratIter.hasNext()) ((List)strategiesList).add(stratIter.next());*/
    strategiesList = new ArrayList<RunningStrategy>(controller.getRunningStrategies());
    strategiesList = PersistenceManager.getPersistentRepresentation(strategiesList);
}
Also used : RunningStrategy(gate.creole.RunningStrategy) ConditionalController(gate.creole.ConditionalController)

Example 2 with ConditionalController

use of gate.creole.ConditionalController in project gate-core by GateNLP.

the class ConditionalControllerPersistence method createObject.

/**
 * Creates a new object from the data contained. This new object is supposed
 * to be a copy for the original object used as source for data extraction.
 */
@SuppressWarnings("unchecked")
@Override
public Object createObject() throws PersistenceException, ResourceInstantiationException {
    ConditionalController controller = (ConditionalController) super.createObject();
    controller.setRunningStrategies((Collection<RunningStrategy>) PersistenceManager.getTransientRepresentation(strategiesList, resourceName, initParamOverrides));
    return controller;
}
Also used : RunningStrategy(gate.creole.RunningStrategy) ConditionalController(gate.creole.ConditionalController)

Aggregations

ConditionalController (gate.creole.ConditionalController)2 RunningStrategy (gate.creole.RunningStrategy)2