Skip to content

Commit bd93e5b

Browse files
authored
Add files via upload
1 parent fbbc851 commit bd93e5b

File tree

11 files changed

+1119
-1119
lines changed

11 files changed

+1119
-1119
lines changed
Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
package aima.gui.swing.framework;
2-
3-
/**
4-
* Provides the base class for all controller implementations.
5-
*
6-
* @author Ruediger Lunde
7-
*/
8-
public abstract class AgentAppController {
9-
protected AgentAppFrame frame;
10-
11-
/**
12-
* Gives the controller access to the frame. This is useful to display
13-
* status information.
14-
*/
15-
public void setFrame(AgentAppFrame frame) {
16-
this.frame = frame;
17-
}
18-
19-
/**
20-
* The associated {@link AgentAppFrame} calls this method when the clear
21-
* button is pressed.
22-
*/
23-
public abstract void clear();
24-
25-
/**
26-
* The associated {@link AgentAppFrame} calls this method when the prepare
27-
* button is pressed or the selection state of the selectors changes.
28-
* @param changedSelector Name of the changed selector or null.
29-
*/
30-
public abstract void prepare(String changedSelector);
31-
32-
/**
33-
* Checks whether the current environment is prepared for starting
34-
* simulation.
35-
*/
36-
public abstract boolean isPrepared();
37-
38-
/**
39-
* The associated {@link AgentAppFrame} calls this method when the run
40-
* button is activated. This code runs in a second thread, which can be
41-
* stopped by the GUI at any time. Implementations should avoid to
42-
* access swing components because they are not thread-safe.
43-
*/
44-
public abstract void run(MessageLogger logger);
45-
46-
/**
47-
* The associated {@link AgentAppFrame} calls this method when the step
48-
* button is activated. This code runs in a second thread, which can be
49-
* stopped by the GUI at any time. Implementations should avoid to
50-
* access swing components because they are not thread-safe.
51-
*/
52-
public abstract void step(MessageLogger logger);
53-
54-
/**
55-
* This method is automatically called after the run and step methods
56-
* have finished. Implementations are responsible for displaying status
57-
* information in the frame and also for cleaning up the prepared
58-
* environment if the simulation was canceled.
59-
* @param simulationThread The thread which was used to run the simulation.
60-
*/
61-
public abstract void update(SimulationThread simulationThread);
62-
}
1+
package aima.gui.swing.framework;
2+
3+
/**
4+
* Provides the base class for all controller implementations.
5+
*
6+
* @author Ruediger Lunde
7+
*/
8+
public abstract class AgentAppController {
9+
protected AgentAppFrame frame;
10+
11+
/**
12+
* Gives the controller access to the frame. This is useful to display
13+
* status information.
14+
*/
15+
public void setFrame(AgentAppFrame frame) {
16+
this.frame = frame;
17+
}
18+
19+
/**
20+
* The associated {@link AgentAppFrame} calls this method when the clear
21+
* button is pressed.
22+
*/
23+
public abstract void clear();
24+
25+
/**
26+
* The associated {@link AgentAppFrame} calls this method when the prepare
27+
* button is pressed or the selection state of the selectors changes.
28+
* @param changedSelector Name of the changed selector or null.
29+
*/
30+
public abstract void prepare(String changedSelector);
31+
32+
/**
33+
* Checks whether the current environment is prepared for starting
34+
* simulation.
35+
*/
36+
public abstract boolean isPrepared();
37+
38+
/**
39+
* The associated {@link AgentAppFrame} calls this method when the run
40+
* button is activated. This code runs in a second thread, which can be
41+
* stopped by the GUI at any time. Implementations should avoid to
42+
* access swing components because they are not thread-safe.
43+
*/
44+
public abstract void run(MessageLogger logger);
45+
46+
/**
47+
* The associated {@link AgentAppFrame} calls this method when the step
48+
* button is activated. This code runs in a second thread, which can be
49+
* stopped by the GUI at any time. Implementations should avoid to
50+
* access swing components because they are not thread-safe.
51+
*/
52+
public abstract void step(MessageLogger logger);
53+
54+
/**
55+
* This method is automatically called after the run and step methods
56+
* have finished. Implementations are responsible for displaying status
57+
* information in the frame and also for cleaning up the prepared
58+
* environment if the simulation was canceled.
59+
* @param simulationThread The thread which was used to run the simulation.
60+
*/
61+
public abstract void update(SimulationThread simulationThread);
62+
}
Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
package aima.gui.swing.framework;
2-
3-
import javax.swing.JComponent;
4-
5-
import aima.core.agent.Environment;
6-
import aima.core.agent.EnvironmentView;
7-
8-
/**
9-
* Base class for all graphical environment view implementations.
10-
* An environment view visualizes agents in their environment.
11-
* Typically, 2D graphics will be used for visualization. Environment
12-
* changes are communicated to the viewer by means of an observer pattern.
13-
*
14-
* @author Ruediger Lunde
15-
*/
16-
public abstract class AgentAppEnvironmentView
17-
extends JComponent implements EnvironmentView {
18-
19-
private static final long serialVersionUID = 1L;
20-
/** The environment providing the data to be visualized. */
21-
protected Environment env;
22-
/**
23-
* If the view provides interactive means to modify the environment,
24-
* this controller should be responsible to initiate the changes.
25-
*/
26-
private AgentAppController controller;
27-
/** Message display is delegated to a separate logger. */
28-
private MessageLogger logger;
29-
30-
/** Sets the data source for the viewer. */
31-
public void setEnvironment(Environment env) {
32-
if (this.env != null)
33-
this.env.removeEnvironmentView(this);
34-
this.env = env;
35-
env.addEnvironmentView(this);
36-
repaint();
37-
}
38-
39-
/** Is called by the agent application frame. */
40-
protected void setController(AgentAppController controller) {
41-
this.controller = controller;
42-
}
43-
44-
/**
45-
* Provides a controller which is responsible for all
46-
* environment modifications initiated by user interactions.
47-
*/
48-
protected AgentAppController getController() {
49-
return controller;
50-
}
51-
52-
/** Selects a logger for message display. */
53-
public void setMessageLogger(MessageLogger logger) {
54-
this.logger = logger;
55-
}
56-
57-
/**
58-
* Provides a logger which is responsible for message display.
59-
*/
60-
protected MessageLogger getLogger() {
61-
return logger;
62-
}
63-
64-
/** Forwards a given message to the selected message logger. */
65-
public void notify(String msg) {
66-
if (logger != null)
67-
logger.log(msg);
68-
}
69-
}
1+
package aima.gui.swing.framework;
2+
3+
import javax.swing.JComponent;
4+
5+
import aima.core.agent.Environment;
6+
import aima.core.agent.EnvironmentView;
7+
8+
/**
9+
* Base class for all graphical environment view implementations.
10+
* An environment view visualizes agents in their environment.
11+
* Typically, 2D graphics will be used for visualization. Environment
12+
* changes are communicated to the viewer by means of an observer pattern.
13+
*
14+
* @author Ruediger Lunde
15+
*/
16+
public abstract class AgentAppEnvironmentView
17+
extends JComponent implements EnvironmentView {
18+
19+
private static final long serialVersionUID = 1L;
20+
/** The environment providing the data to be visualized. */
21+
protected Environment env;
22+
/**
23+
* If the view provides interactive means to modify the environment,
24+
* this controller should be responsible to initiate the changes.
25+
*/
26+
private AgentAppController controller;
27+
/** Message display is delegated to a separate logger. */
28+
private MessageLogger logger;
29+
30+
/** Sets the data source for the viewer. */
31+
public void setEnvironment(Environment env) {
32+
if (this.env != null)
33+
this.env.removeEnvironmentView(this);
34+
this.env = env;
35+
env.addEnvironmentView(this);
36+
repaint();
37+
}
38+
39+
/** Is called by the agent application frame. */
40+
protected void setController(AgentAppController controller) {
41+
this.controller = controller;
42+
}
43+
44+
/**
45+
* Provides a controller which is responsible for all
46+
* environment modifications initiated by user interactions.
47+
*/
48+
protected AgentAppController getController() {
49+
return controller;
50+
}
51+
52+
/** Selects a logger for message display. */
53+
public void setMessageLogger(MessageLogger logger) {
54+
this.logger = logger;
55+
}
56+
57+
/**
58+
* Provides a logger which is responsible for message display.
59+
*/
60+
protected MessageLogger getLogger() {
61+
return logger;
62+
}
63+
64+
/** Forwards a given message to the selected message logger. */
65+
public void notify(String msg) {
66+
if (logger != null)
67+
logger.log(msg);
68+
}
69+
}

0 commit comments

Comments
 (0)