1 | package org.expeditee.agents;
|
---|
2 |
|
---|
3 | import org.expeditee.gui.Frame;
|
---|
4 | import org.expeditee.items.Item;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * The Interface that all Agents must implement. This interface allows the JAG
|
---|
8 | * classes\ to be loaded dynamically at run-time.
|
---|
9 | *
|
---|
10 | * @author jdm18
|
---|
11 | *
|
---|
12 | */
|
---|
13 | public interface Agent extends Runnable {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * This method should always be called before calling process(). The Frame
|
---|
17 | * passed in should be scanned for any paramters that should be set before
|
---|
18 | * process() is called. If this method returns false then process() should
|
---|
19 | * not be called.
|
---|
20 | *
|
---|
21 | * @param toInit
|
---|
22 | * The Frame that has any parameters that need to be set before
|
---|
23 | * processing begins. It is also the first frame for the agent.
|
---|
24 | * @param launcher
|
---|
25 | * The item that was clicked on to launch this agent.
|
---|
26 | * @return True if the initialisation executed correctly, False if an error
|
---|
27 | * occured.
|
---|
28 | */
|
---|
29 | public boolean initialise(Frame toInit, Item launcher);
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Specifies whether this Agents produces a Frame of results to be shown to
|
---|
33 | * the user after execution has completed, or if the program should return
|
---|
34 | * to the Frame the user was on when they invoked this Agent.
|
---|
35 | *
|
---|
36 | * @return True if this Agent produces a results Frame, false otherwise.
|
---|
37 | */
|
---|
38 | public boolean hasResultFrame();
|
---|
39 |
|
---|
40 | public boolean hasResultString();
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Returns the results Frame produced by this Agent. This method is only
|
---|
44 | * called if hasResultFrame() returns true. If hasResultFrame() returns
|
---|
45 | * false, it is expected that this method returns null.
|
---|
46 | *
|
---|
47 | * @return The result Frame produced by this Agent if there is one, or null
|
---|
48 | * otherwise.
|
---|
49 | */
|
---|
50 | public Frame getResultFrame();
|
---|
51 |
|
---|
52 | public abstract boolean isRunning();
|
---|
53 |
|
---|
54 | public abstract void stop();
|
---|
55 |
|
---|
56 | public abstract void interrupt();
|
---|
57 | }
|
---|