source: trunk/org/expeditee/agents/Agent.java@ 4

Last change on this file since 4 was 4, checked in by davidb, 16 years ago

Starting source code to Expeditee

File size: 2.1 KB
Line 
1package org.expeditee.agents;
2
3import org.expeditee.gui.Frame;
4
5/**
6 * The Interface that all Agents must implement. This interface allows the JAG
7 * classes\ to be loaded dynamically at run-time.
8 *
9 * @author jdm18
10 *
11 */
12public interface Agent extends Runnable {
13
14 /**
15 * This method should always be called before calling process(). The Frame
16 * passed in should be scanned for any paramters that should be set before
17 * process() is called. If this method returns false then process() should
18 * not be called.
19 *
20 * @param toInit
21 * The Frame that has any parameters that need to be set before
22 * processing begins. Typically this is the Frame the Item that
23 * invoked this Agent is on.
24 * @return True if the initialisation executed correctly, False if an error
25 * occured.
26 */
27 public boolean initialise(Frame toInit);
28
29 /**
30 * Sets the first Frame to process to the given Frame using any settings
31 * previously set by a call to initialise(). Note that Tree based Agents
32 * will use this Frame as the start Frame of the tree, and will then be
33 * responsible for traversing the tree themselves.
34 *
35 * @param toProcess
36 * The Frame apply this Agent to, or the root of the Tree for
37 * Tree-based Agents.
38 */
39 public void setStartFrame(Frame start);
40
41 /**
42 * Specifies whether this Agents produces a Frame of results to be shown to
43 * the user after execution has completed, or if the program should return
44 * to the Frame the user was on when they invoked this Agent.
45 *
46 * @return True if this Agent produces a results Frame, false otherwise.
47 */
48 public boolean hasResultFrame();
49
50 /**
51 * Returns the results Frame produced by this Agent. This method is only
52 * called if hasResultFrame() returns true. If hasResultFrame() returns
53 * false, it is expected that this method returns null.
54 *
55 * @return The result Frame produced by this Agent if there is one, or null
56 * otherwise.
57 */
58 public Frame getResultFrame();
59
60 public abstract boolean isRunning();
61
62 public abstract void stop();
63
64 public abstract void interrupt();
65}
Note: See TracBrowser for help on using the repository browser.