Skip to content

Commit 5385764

Browse files
committed
Code polished.
1 parent f3dd4a6 commit 5385764

File tree

6 files changed

+249
-248
lines changed

6 files changed

+249
-248
lines changed

aima-gui/src/main/java/aima/gui/fx/applications/IntegratedAimaFxApp.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
import javafx.stage.Stage;
3333

3434
/**
35-
* Integrated application which provides access to all JavaFX applications (...App) and command line demos (...Demo)
36-
* which are currently available in the AIMA-GUI project.
35+
* Integrated application which provides access to all JavaFX applications
36+
* (...App) and command line demos (...Demo) which are currently available in
37+
* the AIMA-GUI project.
3738
*
3839
* @author Ruediger Lunde
3940
*/
@@ -46,7 +47,7 @@ public static void main(String[] args) {
4647
@Override
4748
public void start(Stage primaryStage) throws Exception {
4849
IntegratedAppPaneBuilder builder = new IntegratedAppPaneBuilder();
49-
builder.defineTitle("Integrated AIMA FX App");
50+
builder.defineTitle("Integrated AIMA3e FX App");
5051
defineContent(builder);
5152
BorderPane root = new BorderPane();
5253
builder.getResultFor(root, primaryStage);
@@ -68,10 +69,10 @@ public static void defineContent(IntegratedAppPaneBuilder builder) {
6869

6970
builder.registerApp(SimulatedAnnealingMaximumFinderApp.class);
7071
builder.registerApp(GeneticMaximumFinderApp.class);
71-
72+
7273
builder.registerDemo(CspNQueensDemo.class);
7374
builder.registerDemo(GeneticMaximumFinderDemo.class);
74-
75+
7576
builder.registerDemo(NQueensSearchDemo.class);
7677
builder.registerDemo(TrivialVacuumDemo.class);
7778
builder.registerDemo(EightPuzzleDemo.class);

aima-gui/src/main/java/aima/gui/swing/applications/AimaDemoFrame.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
import aima.gui.swing.framework.MessageLoggerPanel;
1717

1818
/**
19-
* Provides a simple frame for starting agent applications and console program
20-
* demos.
19+
* Provides a simple frame for starting agent applications and command line demos.
2120
*
2221
* @author Ruediger Lunde
2322
*/
@@ -57,17 +56,17 @@ public void addApp(Class<?> appClass) {
5756
*/
5857
public void addDemo(Class<?> demoClass) {
5958
JMenuItem item = addDemoToMenu(demosMenu, demoClass);
60-
item.addActionListener(new ProgStarter(demoClass));
59+
item.addActionListener(new DemoStarter(demoClass));
6160
}
6261

6362
/**
64-
* Adds a new demo (agent application or console application) to the specified
63+
* Adds a new program (agent application or command line demo) to the specified
6564
* menu.
6665
*/
67-
private JMenuItem addDemoToMenu(JMenu menu, Class<?> demoClass) {
68-
JMenuItem item = new JMenuItem(demoClass.getSimpleName());
66+
private JMenuItem addDemoToMenu(JMenu menu, Class<?> progClass) {
67+
JMenuItem item = new JMenuItem(progClass.getSimpleName());
6968
JMenu subMenu = null;
70-
String packageName = demoClass.getPackage().getName();
69+
String packageName = progClass.getPackage().getName();
7170
Component[] menuComps = menu.getMenuComponents();
7271
int i;
7372
for (i = 0; i < menuComps.length; i++) {
@@ -122,14 +121,14 @@ public void actionPerformed(ActionEvent ev) {
122121
}
123122

124123
/**
125-
* Implements an action listener which starts a console application demo.
124+
* Implements an action listener which starts a command line demo.
126125
*
127126
* @author Ruediger Lunde
128127
*/
129-
protected class ProgStarter implements ActionListener {
128+
protected class DemoStarter implements ActionListener {
130129
Class<?> demoClass;
131130

132-
ProgStarter(Class<?> dc) {
131+
DemoStarter(Class<?> dc) {
133132
demoClass = dc;
134133
}
135134

aima-gui/src/main/java/aima/gui/swing/applications/IntegratedAimaApp.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
*/
3131
public class IntegratedAimaApp {
3232

33-
/** Registers agent applications and console program demos. */
34-
public static void registerDemos(AimaDemoFrame frame) {
33+
/** Registers agent applications and command line demos. */
34+
public static void defineContent(AimaDemoFrame frame) {
3535
frame.addApp(VacuumApp.class);
3636
frame.addApp(RouteFindingAgentApp.class);
3737
frame.addApp(EightPuzzleApp.class);
@@ -62,10 +62,10 @@ public static void registerDemos(AimaDemoFrame frame) {
6262
frame.addDemo(LearningDemo.class);
6363
}
6464

65-
/** Starts the demo. */
65+
/** Starts the application. */
6666
public static void main(String[] args) {
6767
AimaDemoFrame frame = new AimaDemoFrame();
68-
registerDemos(frame);
68+
defineContent(frame);
6969
frame.setSize(1000, 700);
7070
frame.setVisible(true);
7171
}

0 commit comments

Comments
 (0)