public class Model extends java.util.Observable
Model(AnimatorBuilder, int, int).| Constructor and Description |
|---|
Model(AnimatorBuilder builder,
int rows,
int columns)
Creates a model to be visualized using the
builder. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Throw away this model.
|
void |
run(double duration)
Run the simulation for
duration model seconds. |
public Model(AnimatorBuilder builder, int rows, int columns)
builder.
If the builder is null, no visualization is performed.
The number of rows and columns
indicate the number of Lights, organized as a 2D
matrix. These are separated and surrounded by horizontal and
vertical Roads. For example, calling the constructor with 1
row and 2 columns generates a model of the form:
| |
--@--@--
| |
where @ is a Light, | is a
vertical Road and -- is a horizontal Road.
Each road has one Car.
The AnimatorBuilder is used to set up an Animator.
AnimatorBuilder.getAnimator() is registered as
an observer of this model.