Download Setting Up a Project for Murphy Tutorial JBuilderX

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
1
Building the CarryDrop Simulation
in JBuilderX
By
Deddy Koesrindartoto
08/16/2004
Introduction
This tutorial will explain, step by step, how to create a new project using
existing RePast/Java code for a RePast Tutorial by John Murphy.
To be consistent with Murphy’s Tutorial, the project name will be
Demo.jpx, and it will contain three Java class :
CarryDropModel.java;
CarryDropSpace.java;
CarryDropAgent.java.
To follow this tutorial you will need:
• JBuilder X installed and running
• RePast library installed
• Access to the source code of John Murphy’s RePast Tutorial at :
http://www.u.arizona.edu/~jtmurphy/H2R/HowTo01.htm
2
3
Creating a Demo Project
Fig 1
•
•
Start JBuilder X
Go to File -> New Project
•
In the Project Wizard dialog box (Fig
2.A) fill in the project name.
•
Use Demo as project name. In
JBuilder, this project name will also
be used as the package name.
•
Leave the default settings for the rest
of the fields.
4
Creating a project Demo…continued:
(3)
(2)
(1)
Fig 2.A
Fig 2.B
In Fig 2.A click the Next button (1) to configure the library/libraries that will be used
in Demo project. Dialog box (Fig 2.B) will appear. Press the Required Libraries (2),
and press Add button to proceed (3). Leave the default settings for the rest of the
fields.
5
Setting up required libraries:
(1)
(2)
Fig 3.A
(3)
Fig 3.B
(4)
Navigate through the list of libraries shown in Fig 3.A. Select RePast-2.2 library (1)
and press the OK button (2). The new dialog box (Fig. 3.B) will acknowledge that
the RePast-2.2 library has been added (3) to the Demo project. Leave the default
settings for the rest of the fields, and click the Finish button(4).
Setting up required libraries … Continued:
(1)
Fig 4
At this point, the process of creating the Demo project is finished.
Demo.jpx is now listed at the JBuilder project pane (1).
However, the project is still empty. There are no classes associated with this
project. The next steps will explain how to add classes to this project.
6
7
Adding a Java class to the Demo project:
• The next steps will show how to add
CarryDropModel.java classes to the Demo
project.
• Go to File->New Class…
• A Class Wizard dialog box should appear.
Fig 5
Adding a Java class to the Demo project... continued:
8
(1)
(5)
(4)
(2)
(3)
Fig 6.B
Fig 6.A
•
•
As shown in Fig 6.A, type CarryDropModel (1) as the Class name, and leave all
other settings at default values. Note that, if nothing is checked in the Options
choices (2), it will generate an empty class which contains only the class name and
the respective package used in this class. Hit the “OK” button (3)
Fig 6.B shows how the CarryDropModel class now appears in the structure pane
(4). Meanwhile, the CarryDropModel source code appears in content pane (5).
Copying Murphy’s source code for CarryDropModel.java from his website:
Open your browser, and go to:
http://www.u.arizona.edu/~jtmurphy/H2R/HowTo03.htm . Select and copy
the whole source code for the CarryDropModel to the clipboard.
9
Copying Murphy’s source code for CarryDropModel.java…continued:
10
(2)
(1)
Go to JBuilder content pane of CarryDropModel.java.
Press Edit -> Select All (1)
and then Edit -> Paste (2) . It will automatically
paste the code you copied earlier from the website
for CarryDropModel.java into the content pane.
11
Adding other classes to the Demo project…continued:
(2)
(1)
Repeat the same process for adding code for
the CarryDropSpace and CarryDropAgent
Java classes from Murphy’s website.
When all three classes are added, they will
be listed by name in project pane (1) and
their code will be shown in content pane (2).
Follow the Murphy Tutorial and modify
these three .java classes as needed.