## gate.creole
Class AbstractController

    java.lang.Object
      |
      +--gate.util.AbstractFeatureBearer
            |
            +--gate.creole.AbstractResource
                  |
                  +--gate.creole.AbstractController

All Implemented Interfaces:
  Controller, Executable, FeatureBearer, NameBearer, Resource, Serializable

Direct Known Subclasses:
  SerialController

public abstract class AbstractController
extends AbstractResource
implements Controller

See Also:
  Serialized Form

Inner Class Summary
`protected class` `AbstractController.InternalStatusListener` A simple status listener used to forward the events upstream.
`protected class` `AbstractController.IntervalProgressListener` A progress listener used to convert a 0..100 interval into a smaller one

Field Summary
`protected boolean` `interrupted`
`protected String` `name`
`private Vector` `progressListeners` The list of `ProgressListener`s registered with this resource
`private Vector` `statusListeners` The list of `StatusListener`s registered with this resource

Fields inherited from class gate.creole.AbstractResource
`serialVersionUID`

Fields inherited from class gate.util.AbstractFeatureBearer
`features`

Constructor Summary
`AbstractController()`

Method Summary
`void` `addProgressListener(ProgressListener l)` Adds a `ProgressListener` to the list of listeners for this processing resource.
`void` `addStatusListener(StatusListener l)` Adds a `StatusListener` to the list of listeners for this processing resource
`void` `cleanup()` Clears the internal data of the resource, when it gets released
`void` `execute()` Starts the execution of this executable
`protected void` `fireProcessFinished()` Notifies all the `ProgressListener`s of a progress finished.
`protected void` `fireProgressChanged(int e)` Notifies all the `ProgressListener`s of a progress change event.
`protected void` `fireStatusChanged(String e)` Notifies all the `StatusListener`s of a change of status.
`String` `getName()` Returns the name of this resource
`List` `getOffendingPocessingResources()` Checks whether all the contained PRs have all the required runtime parameters set.
`Resource` `init()` Initialise this resource, and return it.
`void` `interrupt()` Notifies all the PRs in this controller that they should stop their execution as soon as possible.
`boolean` `isInterrupted()` Returns true if this executable has been interrupted via the `interrupt()` method since the last time its `execute()` method was called
`void` `removeProgressListener(ProgressListener l)` Removes a `ProgressListener` from the list of listeners for this processing resource.
`void` `removeStatusListener(StatusListener l)` Removes a `StatusListener` from the list of listeners for this processing resource
`void` `setName(String name)` Sets the name of this resource
`void` `setPRs(Collection PRs)` Populates this controller from a collection of `ProcessingResource`s (optional operation).

Methods inherited from class gate.creole.AbstractResource
`checkParameterValues, getParameterValue, getParameterValue, removeResourceListeners, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners`

Methods inherited from class gate.util.AbstractFeatureBearer
`getFeatures, setFeatures`

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Methods inherited from interface gate.Controller
`getPRs`

Methods inherited from interface gate.Resource
`getParameterValue, setParameterValue, setParameterValues`

Methods inherited from interface gate.util.FeatureBearer
`getFeatures, setFeatures`

Field Detail

### name

    protected String name

### statusListeners

    private transient Vector statusListeners

  The list of `StatusListener`s registered with this resource

### progressListeners

    private transient Vector progressListeners

  The list of `ProgressListener`s registered with this resource

### interrupted

    protected boolean interrupted

Constructor Detail

### AbstractController

    public AbstractController()

Method Detail

### execute

    public void execute()
                 throws ExecutionException

  Starts the execution of this executable
  Specified by:
    `execute` in interface `Executable`

### init

    public Resource init()
                  throws ResourceInstantiationException

  Initialise this resource, and return it.
  Specified by:
    `init` in interface `Resource`
  Overrides:
    `init` in class `AbstractResource`

### cleanup

    public void cleanup()

  Clears the internal data of the resource, when it gets released
  Specified by:
    `cleanup` in interface `Resource`
  Overrides:
    `cleanup` in class `AbstractResource`

### setPRs

    public void setPRs(Collection PRs)

  Populates this controller from a collection of `ProcessingResource`s (optional operation). Controllers that are serializable must implement this method needed by GATE to restore their contents.
  Specified by:
    `setPRs` in interface `Controller`
  Throws:
    `UnsupportedOperationException` - if the `setPRs` method is not supported by this controller.

### interrupt

    public void interrupt()

  Notifies all the PRs in this controller that they should stop their execution as soon as possible.
  Specified by:
    `interrupt` in interface `Executable`

### isInterrupted

    public boolean isInterrupted()

  Description copied from interface: `Executable`
  Returns true if this executable has been interrupted via the `Executable.interrupt()` method since the last time its `Executable.execute()` method was called
  Specified by:
    `isInterrupted` in interface `Executable`

### removeStatusListener

    public void removeStatusListener(StatusListener l)

  Removes a `StatusListener` from the list of listeners for this processing resource

### addStatusListener

    public void addStatusListener(StatusListener l)

  Adds a `StatusListener` to the list of listeners for this processing resource

### fireStatusChanged

    protected void fireStatusChanged(String e)

  Notifies all the `StatusListener`s of a change of status.
  Parameters:
    `e` - the message describing the status change

### addProgressListener

    public void addProgressListener(ProgressListener l)

  Adds a `ProgressListener` to the list of listeners for this processing resource.

### removeProgressListener

    public void removeProgressListener(ProgressListener l)

  Removes a `ProgressListener` from the list of listeners for this processing resource.

### fireProgressChanged

    protected void fireProgressChanged(int e)

  Notifies all the `ProgressListener`s of a progress change event.
  Parameters:
    `e` - the new value of execution completion

### fireProcessFinished

    protected void fireProcessFinished()

  Notifies all the `ProgressListener`s of a progress finished.

### getOffendingPocessingResources

    public List getOffendingPocessingResources()
                                        throws ResourceInstantiationException

  Checks whether all the contained PRs have all the required runtime parameters set.
  Returns:
    a `List` of `ProcessingResource`s that have required parameters with null values if they exist `null` otherwise.

### setName

    public void setName(String name)

  Sets the name of this resource
  Specified by:
    `setName` in interface `NameBearer`
  Overrides:
    `setName` in class `AbstractResource`

### getName

    public String getName()

  Returns the name of this resource
  Specified by:
    `getName` in interface `NameBearer`
  Overrides:
    `getName` in class `AbstractResource`