|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--edu.brook.ascape.model.AscapeObject
|
+--edu.brook.ascape.model.Agent
|
+--edu.brook.ascape.model.Cell
|
+--edu.brook.ascape.model.CellOccupant
|
+--edu.brook.ascape.model.Scape
The base class for all collections of agents within ascape.
Provides services to identify other scape members, execute rules
on members, support scape views, and other features.
Also provides methods for model creation and use; a model is simply
a special use of a scape.
While scapes are essentially collections of agents, there is no assumption that these
collections must be discrete. While there are currently no scapes representing continuous space, there is
no strong reason why a scape couldn't do so. Continuous (or at least very fine-grained!) time
may also be supported at some point.
Scapes are the basic building block of ascape models. Pick a scape appropriate for your
model. For example, you might want to create a model that uses cells in a 2-dimensional
array.
Simply create an instance of the scape you want:
ScapeGraph lattice = new ScapeArray2DVonNeumann(); lattice.setExtent(new Coordinate2DDiscrete(x, y)); lattice.setPrototypeAgent(new MyPrototypeCell());In this example, extent defines the size of the lattice, and prototype agent is the agent that wil be cloned to populate the lattice.
ScapeVector, is created, and other scapes are added to it:
root = new ScapeVector(); root.addAgent(lattice);Or simply subclass
Scape as a model, and use it as the root:
public class MyModel extends ScapeVector {
...
public MyModel() {
addAgent(lattice);
...
}
}
To provide behavior for your agents, you add rules to be executed upon them.
(If members are scapes, the rules can be executed on their members as well.)
lattice.addRule(new MyRule());Rules are executed once for every iteration, on every agent. Some rules are added by default, or are used by the scape internally. (For example, initialization and rule iteration itself are both managed by rules.) For more information, see the documentation for Rule.
lattice.addView(new Overhead2DView());This registers the view as a listener of the scape and automatically provides a window for it if appropriate. The scape uses an event based Model View Controller design. After each iteration, each scape sends an update event to each of its views, and then waits for the views to update. It is every view's responsibility to inform its scape when it has updated, which it does by sending a control event. More general control events are used to control scape execution. Usually, you simply add a control bar view, which gives the user complete control over model execution.
lattice.addView(new ControlBarView());(A model scape adds a control bar automatically.) Scapes can automatically collect statistics on their members. (See StatCollectorCSA documentation for a description of how stats are created.) Here is an example of how this might be done:
agents.addStatCollectors({new StatCollectorCSA() {
public double getValue(Object object) {
return ((MyAgent) object).getMyInterestingValue();
}
public String getName() {
return "Interesting Value";
}
},
...
}
ChartView myChart = new ChartView(); lattice.addView(myChart);You can double-click on a chart to select statistics to view, or add them in code.
chart.addSeries("Average Interesting Value", Color.blue);
Finally, if you haven't added a control view, or you want the model to begin running upon
execution, tell it to start. (Control events can be sent to any scape in the model,
unless the event is scape specific. Model scapes start automatically; you can easily
override this behavior.)
lattice.start();or send it
lattice.respondControl(ControlEvent.REQUEST_START);Scapes are initialized and iterated hierarchically. The initialization and iteration process are rules, and their behavior is well defined. For example, if you use a vector for your root scape, scapes will be initialized and iterated in the order in which they were added to the root. Of course, this is an imporant consideration whenever there are dependencies between scapes. On initialization, each scape first instantiates all of its members, and then initializes them. After initialization, statistics are gathered, and views are requested to update. Then, each rule is executed on its scape, statistics are gathered, and views are requested to update. This continues until a control event stops or pauses the model, or the iteration limit provided with
setAutoStopAt is reached. public class MyModel extends Scape {
...
createScape() {
[Instantiate and add scapes to model, add rules to the model]
}
createViews() {
[and views to the model.]
}
...
}
Application:java edu.brook.ascape.model.Scape mypath.MyModelApplet:
<APPLET name=AppletName codebase=[path] <param name="Scape" value="mypath.MyModel">></APPLET><BR>Note that it is neccesary to call Model with your model's fully qualified class name as the parameter. To allow your model to be invoked directly, override main.
Rule,
edu.brook.ascape.view.ScapeListener,
StatCollector,
CanvasView,
ControlEvent,
ControlBarView, Serialized Form| Field Summary | |
static int |
AGENT_ORDER
Symbol for by agent execution order. |
protected int |
agentsPerIteration
The number of agents to execute each rule across for each iteration. |
static int |
ALL_AGENTS
The symbol to execute rules against all agents in each iteration. |
protected boolean |
autoCreate
Should members of the scape be automatically created at startup? |
protected boolean |
cellsRequestUpdates
Should cells indicate that they need to be updated manually (imroving performance significantly) or should all cells be updated every iteration. |
static Rule |
COLLECT_STATS_RULE
A rule causing all children and members that are scapes to iterate. |
protected CollectStats |
collectStats
The value collection rule for this scape. |
static int |
COMPLETE_TOUR
Symbol for complete tour excution style. |
static java.lang.String |
copyrightAndCredits
Copyright and credits information for ascape. |
static Rule |
CREATE_RULE
A rule causing the target scape and all its children scapes to be populated if auto create is set to true. |
static Rule |
CREATE_SCAPE_RULE
A rule causing the target scape to be populated. |
protected static DataGroup |
dataGroup
Data group for all scapes. |
static java.lang.String[] |
demoModelClasses
Common demo model class specifications. |
static java.lang.String[] |
demoModelNames
Common demo model names. |
protected java.lang.String |
description
A brief descripiton (including credits) of the scape or of the model, if this is root scape. |
protected edu.brook.ascape.model.Scape.DrawFeatureObservable |
drawFeatureObservable
A delegate keeping track of observers of draw features. |
protected java.util.Vector |
drawFeatures
A vector of features available to draw memebers of this scape. |
protected static int |
earliestPeriod
The earliest period this scape is expected to be run at. |
protected int |
executionOrder
Order in which rules should be executed. |
protected int |
executionStyle
'Stlye' of rule execution. |
protected Geometry |
geometry
The basic geometric structure of this collection. |
protected static java.lang.String |
home
The system path in which all files are by default stored to and retrieved from. |
static Rule |
INITIAL_RULES_RULE
A rule causing the targets initial rules to be executed on its members. |
protected VectorSelection |
initialRules
The rules that this scape will execute on its members upon initializtion. |
protected static Rule |
INTERNAL_START_RULE
A rule causing the target scape to set its internal state to running. |
static Rule |
ITERATE_SCAPE_RULE
A rule causing all children and members that are scapes to iterate. |
protected int |
iteration
The number of iterations since the scape began iterating. |
protected static int |
latestPeriod
The latest period this scape is expected to be run at. |
protected boolean |
membersActive
Should members of the scape be iterated against? |
static Rule |
PAUSE_RULE
An rule causing the target scape to be paused. |
protected boolean |
paused
Is the scape currently paused? |
protected int |
period
The current period. |
protected static java.lang.String |
periodName
The unit of time each iteration or period represents. |
protected Agent |
prototypeAgent
An agent which which may be cloned to produce members of this collection. |
static int |
REPEATED_DRAW
Symbol for repeated random draw execution style. |
protected boolean |
restartAfterAutoStop
Should the scape be restarted automatically after being stopped? |
static Rule |
RESUME_RULE
An rule causing the target scape to resume execution. |
static int |
RULE_ORDER
Symbol for by rule execution order. |
protected VectorSelection |
rules
The rules that this scape will execute on its memebers. |
protected boolean |
running
Is the scape currently running? |
protected ScapeListener[] |
scapeListeners
The observers of this scape. |
protected ScapeListener |
selfView
A view of the scape that delegates back to the scape, often null. |
protected static StandardOutView |
standardOutView
A view that can report results to the console. |
static Rule |
START_RULE
A rule causing the target scape to resume execution. |
protected static boolean |
startOnOpen
Should the scape be started automatically upoin openning it? Default true. |
protected static int |
startPeriod
Iteration to start on when restarting, creating new model, etc... |
protected boolean |
step
Has a step been requested? |
static Rule |
STOP_RULE
A rule causing the target scape to cease execution. |
protected static int |
stopPeriod
Iteration to stop on. |
protected int |
updatedListeners
Count of the number of listeners that have been updated. |
protected int |
updatedMembers
Count of the number of members that have been updated. |
static java.lang.String |
version
The current version of the Ascape framework as a whole. |
| Fields inherited from class edu.brook.ascape.model.CellOccupant |
MOVE_RANDOM_LOCATION_RULE,
PLAY_HOST_RULE,
PLAY_NEIGHBORS_RULE,
PLAY_OTHER,
RANDOM_WALK_AVAILABLE_RULE,
RANDOM_WALK_RULE |
| Fields inherited from class edu.brook.ascape.model.Cell |
cellsNear,
coordinate,
neighbors,
thisUpdate |
| Fields inherited from class edu.brook.ascape.model.Agent |
DEATH_RULE,
deleteMarker,
FISSIONING_RULE,
FORCE_DIE_RULE,
FORCE_FISSION_RULE,
FORCE_MOVE_RULE,
INITIALIZE_RULE,
initialized,
ITERATE_AND_UPDATE_RULE,
ITERATE_RULE,
METABOLISM_RULE,
MOVEMENT_RULE,
UPDATE_RULE |
| Fields inherited from class edu.brook.ascape.model.AscapeObject |
ARBITRARY_SEED,
count,
name,
scape |
| Constructor Summary | |
Scape()
Constructs a scape. |
|
Scape(java.lang.String name,
Geometry geometry,
Cell prototypeAgent)
Constructs a scape of provided geometry, to be populated with clones of provided agent. |
|
| Method Summary | |
void |
addDrawFeature(DrawFeature feature)
Adds the provided draw feature to this scape. |
void |
addInitialRule(Rule rule)
Adds a rule to be executed once following initialization. |
void |
addInitialRule(Rule rule,
boolean select)
Adds a rule to be executed once following initialization. |
void |
addRule(Rule rule)
Adds a rule to this scape, automatically selecting it. |
void |
addRule(Rule rule,
boolean select)
Adds a rule to this scape. |
void |
addScapeListener(ScapeListener listener)
Adds an observer to this scape. |
void |
addStatCollector(StatCollector stat)
Adds the specified stat collector to this scape for automatic collection by the scape. |
void |
addStatCollectors(StatCollector[] stats)
Adds the specified stat collectors to this scape for automatic collection by the scape. |
void |
addView(ScapeListener view)
Adds a view to this scape. |
void |
addView(ScapeListener view,
boolean createWindow)
Adds a view to this scape. |
void |
addView(ScapeListener view,
boolean createWindow,
boolean showControlBar)
Adds a view to this scape. |
void |
addViews(ScapeListener[] views)
Adds a view to this scape. |
void |
addViews(ScapeListener[] views,
boolean createWindow)
Adds a view to this scape. |
void |
addViews(ScapeListener[] views,
boolean createWindow,
boolean showControlBar)
Adds a view to this scape. |
java.lang.Object |
clone()
Clones the host cell, performing deep copy of prototype agent and geometry so that they may be modified independent of the original. |
void |
close()
|
void |
closeAndOpenNew()
Requests the scape to open another model, closing the existing one. |
static void |
closeAndOpenNewFinally(Scape oldScape)
Requests the scape to open another model, closing the existing one. |
void |
closeFinally()
Closes the application; allowing views to close themseleves gracefully. |
java.lang.String |
contentsToString()
Returns a string composed of descriptions of the contents. |
static int[] |
createOrder(int length)
Creates a new array of ints for use as indexes for an ordered iteration. |
void |
createScape()
Create this scape; populate it, add rules, create statistic collectors, etc.. |
void |
createSelfView()
Makes the scape a view of itself. |
void |
createViews()
Override to create views for your agent scapes. |
void |
execute(java.lang.Object[] rules,
Agent[] agents)
Executes the provided rules on the supplied agents. |
void |
execute(Rule rule,
Agent[] agents)
Executes the provided rule on every member of the lattice, according to the rule settings and the execution order of this scape. |
void |
executeOnMembers()
Executes all of this scapes selected rules on its members. |
protected void |
executeOnMembers(java.lang.Object[] rules)
Executes the provided rules on every member of the scape, according to the rule settings and the execution order of this scape. |
void |
executeOnMembers(Rule rule)
Executes the provided rule on every member of the lattice, according to the rule settings and the execution order of this scape. |
void |
executeOnMembers(VectorSelection ruleSelection)
Executes the provided rules on every member of the lattice, according to the rule settings and the execution order of this scape. |
void |
executeOnRoot(Rule rule)
Propogates the rule for execution up to the root of the scape tree, then propogates down to all nodes. |
void |
executeOnRoot(Rule[] rules)
Propogates the rule for execution up to the root of the scape tree, then propogates down to all nodes. |
static void |
exit()
Final kill. |
abstract Agent[] |
getAgents()
Returns all agents in the scape as an array. |
Agent[] |
getAgentsNear(Agent centralAgent,
int distance,
boolean includeSelf)
Returns all agents within the specified distance from the supplied agents. |
int |
getAgentsPerIteration()
Returns the number of agents to iterate through each iteration cycle. |
java.util.Vector |
getAllScapes()
Returns all scapes that are composed with this scape. |
CollectStats |
getCollectStats()
Returns the value collection rule in effect; null if no value collection. |
ModelCustomizer |
getCustomizer()
Returns the customizer responsible for scape paramaters. |
DataGroup |
getData()
Returns the group of all data series for the current model. |
java.lang.String |
getDescription()
Returns a long (paragraph length suggested) description of the scape. |
java.util.Vector |
getDrawFeatures()
Returns, as a vector, the draw features available for interpretation of members of this scape. |
java.util.Observable |
getDrawFeaturesObservable()
Returns an observable delegate that notifies users of draw features that a change has occurred. |
int |
getExecutionOrder()
Returns the execution order that has been set for this scape. |
int |
getExecutionStyle()
Returns the execution style that has been set for this scape. |
Geometry |
getGeometry()
Return the geometry of this scape. |
java.lang.String |
getHome()
Returns the path in which all files should by default be stored to and retrieved from. |
VectorSelection |
getInitialRules()
Returns all the rules executed following scape initialization. |
int |
getIteration()
Returns current count of iterations. |
java.lang.String |
getName()
Returns the name of this scape, the model name if this is root and there is no name set. |
int |
getPeriod()
Returns the current period, which is just the iteration plus the period begin. |
java.lang.String |
getPeriodDescription()
Returns a string description of the current period, i.e. |
java.lang.String |
getPeriodName()
Returns the name that periods are referred to by. |
Agent |
getPrototypeAgent()
Returns the agent that is cloned to populate this scape. |
Scape |
getRoot()
Returns the root of this scape, which may be this scape. |
VectorSelection |
getRules()
Returns all rules that this scape might execute. |
abstract int |
getSize()
Returns the number of members of this scape. |
StandardOutView |
getStandardOutView()
Returns the customizer responsible for scape paramaters. |
int |
getStartPeriod()
Returns the period this scape begins running at. |
StatCollector[] |
getStatCollectors()
Returns the stat collectors currently calcualting stats for this scape. |
int |
getStopPeriod()
Returns the period this scape stops running at. |
void |
initialize()
Initializes the state of the scape. |
boolean |
isAllViewsUpdated()
Have all views and views of memebers of this scape been updated? [The grammer is terrible, but it fits the text pattern!] |
boolean |
isAutoCreate()
Is the scape responsible for creating itself and its members, or are other classes responsible for creating the scape? If true (default) calls the createScape method on model construction, typically causing the scape to be populated with clones of prototype agent. |
boolean |
isCellsRequestUpdates()
Do cells request view updates manually or are all cells automatically updated every view cycle? While requiring cells to request updates manually adds a little to complication to model design and maintenance, manual requests allow a significant boost in view performance, as all cells do not have to be drawn every cycle. |
boolean |
isMembersActive()
Are members of this active scape model participants, that is, do they have rules executed upon them? Default is true. |
boolean |
isMutable()
Is the scape mutable, that is, can it change its structure at runtime? Returns false for base class. |
boolean |
isPaused()
Has the scape been requested to pause? Note: indicates that a pause has been requested, not neccesarily that the simulation is paused; it may be completing its current iteration. |
boolean |
isRoot()
Is this scape the root within its entire simulation context? That is, does this root not have any parent scapes? |
boolean |
isRunning()
Has the scape been requested to run? Note: if false, indicates that a stop has been requested, not neccesarily that it has occured, as the simulation continues the current iteration. |
boolean |
isStartOnOpen(boolean startOnOpen)
Does the scape automatically start upon opening? True by default. |
boolean |
isValidPeriod(int period)
Is the supplied period a valid period for this scape? |
boolean |
isViewSelf()
Does the scape view itself? True by default for root scape when createViews is used, false otherwise. |
void |
iterateScape()
Called when each iteration completes. |
abstract ScapeIterator |
iterator()
|
protected void |
listenerOrMemberUpdated()
Called whenever a listener or member scape of this scape has been updated. |
void |
listenerUpdated(ScapeListener listener)
Called whenever a listener has been updated. |
static void |
main(java.lang.String[] args)
Creates, initializes and runs the model specified in the argument. |
void |
memberUpdated(Scape member)
Called whenever a member has been updated. |
void |
notifyViews(int id)
Notifies all scape listeners that this scapes state has changed. |
void |
onSetup()
If the scape has delegated a view to itself, called each time a scape sends a "setup" method, indicating it needs to be setup for a run. |
void |
onStart()
If the scape has delegated a view to itself, called each time the scape is started. |
void |
onStop()
If the scape has delegated a view to itself, called each time the scape is stopped. |
void |
onUpdate()
If the scape has delegated a view to itself, called each time the scape is updated. |
static void |
open()
Requests the scape to open a model, providing UI for this purpose. |
static Scape |
open(java.lang.String modelName)
Constructs, creates and runs the supplied model. |
static Scape |
open(java.lang.String modelName,
ModelApplet applet)
Constructs, creates and runs the supplied model. |
static Scape |
open(java.lang.String modelName,
ModelApplet applet,
java.lang.String[] args)
Constructs and creates the supplied model. |
static Scape |
open(java.lang.String modelName,
java.lang.String[] args)
Constructs, creates and runs the supplied model. |
protected void |
parseSettingArgs(java.lang.String[] args)
|
void |
pause()
Requests the scape to pause. |
void |
quit()
Exits the application; calling stop if running and allowing views to close themseleves gracefully. |
void |
quitFinally()
Exits the application; allowing views to close themseleves gracefully. |
abstract ScapeIterator |
randomIterator()
|
int[] |
randomizeOrder(int[] order)
Randomizes order of the supplied int. |
void |
removeScapeListener(ScapeListener listener)
Removes the observer from this scape. |
void |
requestRestart()
Requests the scape to restart. |
void |
respondControl(ControlEvent control)
Responds to any control events fired at this scape. |
void |
restart()
Stops the scape and requests the scape to restart. |
void |
resume()
Requests the scape to resume. |
PropertyAccessor[] |
retrieveAllAccessors()
Returns all property accessors for this scape and recursivly for all member scapes of this scape. |
PropertyAccessor[] |
retrieveAllAccessorsOrdered()
Returns all property accessors for this scape and recursivly for all member scapes of this scape. |
void |
run()
The basic execution cycle of a running scape. |
void |
save()
Requests the scape to save itself, providing UI for this purpose. |
static void |
save(Scape scape)
To be done. |
static void |
save(Scape scape,
java.io.File file)
To be done (perhaps.) Save the state of the scape to a file. |
void |
setAgentsPerIteration(int agentsPerIteration)
Sets the number of agents to iterate through each iteration cycle. |
void |
setAutoCreate(boolean autoCreate)
Sets wether the scape is responsible for creating itself and its memebers, or other model components handle this. |
void |
setAutoRestart(boolean restartAfterAutoStop)
Should the scape be automatically restarted upon stopping at its stop period? Setting this value to true allows easy cycling of models for demonstrations, model explorations, etc. |
void |
setCellsRequestUpdates(boolean cellsRequestUpdates)
Should cells request view updates manually or are all cells automatically updated every view cycle? See above. |
void |
setCollectStats(boolean collect)
If true, turns on value (typically for statistics) collection, else turns off stat collection. |
void |
setCollectStats(CollectStats collectStats)
Sets the value collection rule to the one supplied. |
void |
setCustomizer(ModelCustomizer customizer)
Sets the chart view being edited. |
void |
setDescription(java.lang.String description)
Returns a long (paragraph length suggested) description of the scape. |
void |
setEarliestPeriod(int earliestPeriod)
Sets the earliest period this scape is expected to be run at. |
void |
setExecutionOrder(int symbol)
Sets the order of rule execution for this scape. |
void |
setExecutionStyle(int symbol)
Sets the style that rules will be executed upon this scape. |
void |
setGeometry(Geometry geometry)
Sets the geometry or basic structure of this scape. |
void |
setHome(java.lang.String _home)
Sets the path in which to store all scape related files. |
void |
setInternalPaused(boolean paused)
Sets the paused state for all parent and memberren scapes. |
void |
setInternalRunning(boolean running)
Sets this scape's running property. |
void |
setLatestPeriod(int latestPeriod)
Sets the latest period this scape is expected to be run at. |
void |
setMembersActive(boolean membersActive)
Sets whether members of this scape actively execute rules upon members. |
void |
setPaused(boolean paused)
Sets the paused state for all parent and memberren scapes. |
void |
setPeriodName(java.lang.String name)
Sets the name that periods are referred to by. |
void |
setPrototypeAgent(Agent prototypeAgent)
Sets the prototype agent, the agent that, in default implementations, will be cloned to populate this scape. |
void |
setRunning(boolean running)
Sets the running state for all scapes. |
void |
setStartOnOpen(boolean startOnOpen)
Should the scape be automatically started upon opening? True by default. |
void |
setStartPeriod(int startPeriod)
Sets the start period for this scape. |
void |
setStopPeriod(int stopPeriod)
Sets the stop period for this scape. |
void |
setViewSelf(boolean viewSelf)
Sets wether the scape is a view of itself. |
void |
start()
Requests the scape to start. |
void |
stop()
Requests the scape to stop. |
java.lang.String |
toString()
Returns a string representation of this scape. |
void |
waitForViewsUpdate()
Blocks until all views of this scape and this scape's members have been updated. |
| Methods inherited from class edu.brook.ascape.model.CellOccupant |
die,
getAvailableNeighboringCells,
getCellsNearOnHost,
getHostCell,
getHostScape,
getNeighborsOnHost,
leave,
moveAway,
moveTo,
moveToRandomLocation,
moveToward,
randomWalk,
randomWalkAvailable,
setHostScape |
| Methods inherited from class edu.brook.ascape.model.Cell |
countNeighbors,
countWithin,
findMaximumWithin,
findNearestCell,
findNearestCell,
findNearestCell,
findRandomNeighbor,
getCellsNear,
getCoordinate,
getDistance,
getNeighbors,
getNeighbors,
getNetwork,
getOccupant,
hasWithin,
isAvailable,
isUpdateNeeded,
removeOccupant,
requestUpdate,
requestUpdateNext,
setCoordinate,
setNeighbors,
setNetwork,
setOccupant |
| Methods inherited from class edu.brook.ascape.model.Agent |
death,
deathCondition,
execute,
execute,
fission,
fissionCondition,
fissioning,
getColor,
getColor,
getImage,
getImage,
getModel,
isDelete,
isInitialized,
iterate,
markForDeletion,
metabolism,
move,
movement,
movementCondition,
play,
scapeCreated,
update |
| Methods inherited from class edu.brook.ascape.model.AscapeObject |
getRandom,
getRandomSeed,
getScape,
randomInRange,
randomInRange,
randomIs,
randomToLimit,
reseed,
setName,
setRandom,
setRandomSeed,
setScape |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final java.lang.String version
public static final java.lang.String copyrightAndCredits
public static final java.lang.String[] demoModelNames
public static final java.lang.String[] demoModelClasses
public static final Rule CREATE_RULE
public static final Rule CREATE_SCAPE_RULE
public static final Rule INITIAL_RULES_RULE
public static final Rule ITERATE_SCAPE_RULE
public static final Rule COLLECT_STATS_RULE
public static final Rule START_RULE
protected static final Rule INTERNAL_START_RULE
public static final Rule STOP_RULE
public static final Rule PAUSE_RULE
public static final Rule RESUME_RULE
public static final int ALL_AGENTS
public static final int AGENT_ORDER
public static final int RULE_ORDER
public static final int COMPLETE_TOUR
public static final int REPEATED_DRAW
protected Agent prototypeAgent
protected Geometry geometry
protected int iteration
protected int period
protected static int earliestPeriod
protected static int latestPeriod
protected static java.lang.String periodName
protected java.lang.String description
protected static int startPeriod
protected static java.lang.String home
protected static boolean startOnOpen
protected static StandardOutView standardOutView
protected static int stopPeriod
protected boolean restartAfterAutoStop
protected VectorSelection rules
protected VectorSelection initialRules
protected ScapeListener[] scapeListeners
protected int agentsPerIteration
protected int executionOrder
setExecutionOrderprotected int executionStyle
setExecutionOrderprotected boolean membersActive
protected boolean autoCreate
protected boolean cellsRequestUpdates
protected CollectStats collectStats
protected static DataGroup dataGroup
protected ScapeListener selfView
protected java.util.Vector drawFeatures
protected boolean paused
protected boolean running
protected boolean step
protected int updatedListeners
protected int updatedMembers
protected edu.brook.ascape.model.Scape.DrawFeatureObservable drawFeatureObservable
| Constructor Detail |
public Scape()
public Scape(java.lang.String name,
Geometry geometry,
Cell prototypeAgent)
name - a descriptive name for the scapegeometry - the strucutre of the graphprototypeAgent - the agent whose clones will be used to populate this scape| Method Detail |
public abstract int getSize()
public void setPrototypeAgent(Agent prototypeAgent)
prototypeAgent - the agent whose clones will populate this scapeGeometry.newScape()public Agent getPrototypeAgent()
public void setGeometry(Geometry geometry)
geometry - the structure of this scapeGeometry.newScape()public Geometry getGeometry()
public ModelCustomizer getCustomizer()
public StandardOutView getStandardOutView()
public void setCustomizer(ModelCustomizer customizer)
public int getAgentsPerIteration()
public void setAgentsPerIteration(int agentsPerIteration)
public int getExecutionOrder()
public void setExecutionOrder(int symbol)
symbol - RULE_ORDER for by rule execution, AGENT_ORDER for by agent executionpublic int getExecutionStyle()
public void setExecutionStyle(int symbol)
symbol - one of COMPLETE_TOUR or REPEATED_DRAWpublic java.lang.String getName()
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
public Scape getRoot()
public boolean isRoot()
public void createScape()
public void initialize()
public int getIteration()
public int getPeriod()
public java.lang.String getPeriodName()
public java.lang.String getPeriodDescription()
public void setPeriodName(java.lang.String name)
public void addRule(Rule rule)
public void addRule(Rule rule,
boolean select)
rule - the rule to addtrue - if rule should be run false if rule should just be made available to be runpublic VectorSelection getRules()
public void addInitialRule(Rule rule)
rule - to be executed at simulation start
public void addInitialRule(Rule rule,
boolean select)
rule - to be executed at simulation starttrue - if rule should be run false if rule should just be made available to be runpublic VectorSelection getInitialRules()
public void addView(ScapeListener view)
view - ComponentView to display in window
public void addView(ScapeListener view,
boolean createWindow)
view - ComponentView to display in window
public void addView(ScapeListener view,
boolean createWindow,
boolean showControlBar)
view - ComponentView to display in windowshowControlBar - IGNORED -- this feature not currently supported...should a control bar appear in the view window?public void addViews(ScapeListener[] views)
view - ComponentView to display in window
public void addViews(ScapeListener[] views,
boolean createWindow)
view - ComponentView to display in window
public void addViews(ScapeListener[] views,
boolean createWindow,
boolean showControlBar)
view - ComponentView to display in windowshowControlBar - IGNORED -- this feature not currently supported...should a control bar appear in the view window?public void addScapeListener(ScapeListener listener)
public void removeScapeListener(ScapeListener listener)
public void notifyViews(int id)
public void waitForViewsUpdate()
public final boolean isAllViewsUpdated()
protected void listenerOrMemberUpdated()
public void listenerUpdated(ScapeListener listener)
listenerOrMemberUpdatedpublic void memberUpdated(Scape member)
listenerOrMemberUpdatedpublic void respondControl(ControlEvent control)
public void run()
public void setInternalRunning(boolean running)
public void setRunning(boolean running)
running - if true, starts the thread, if false, stops it.public void start()
setRunningpublic void stop()
setRunningpublic void save()
public void requestRestart()
public void restart()
setRunningpublic void close()
public void closeFinally()
close() instead,
allowing a running scape to stop gracefully.
Override this method if you want to provide any scape related pre-quit finalization or clean-up.quit()public void quit()
quitFinally if you want to provide any pre-quit finalization or clean-up.quitFinally()public void quitFinally()
quit() instead,
allowing a running scape to stop gracefully.
Override this method if you want to provide any scape related pre-quit finalization or clean-up.quit()public static void exit()
public boolean isRunning()
public void setInternalPaused(boolean paused)
paused - If true, pauses, otherwise resumes iterationspublic void setPaused(boolean paused)
paused - If true, pauses, otherwise resumes iterationspublic void pause()
setPausedpublic void resume()
setPausedpublic boolean isPaused()
public void setEarliestPeriod(int earliestPeriod)
earliestPeriod - the lowest period value this scape can havepublic void setLatestPeriod(int latestPeriod)
latestPeriod - the highest period value this scape can havepublic boolean isValidPeriod(int period)
period - the period to testpublic int getStartPeriod()
public void setStartPeriod(int startPeriod)
throws SpatialTemporalException
startPeriod - the period to begin runs atpublic int getStopPeriod()
public void setStopPeriod(int stopPeriod)
throws SpatialTemporalException
stopPeriod - the period the scape will stop at upon reachingsetAutoRestartpublic boolean isStartOnOpen(boolean startOnOpen)
public void setStartOnOpen(boolean startOnOpen)
startOnOpen - true to start the scape upon opening a modelpublic void setAutoRestart(boolean restartAfterAutoStop)
restartAfterAutoStop - true to restart the scape upon reaching stop period, false to simple stopsetStopPeriodpublic java.lang.String getHome()
public void setHome(java.lang.String _home)
_home - the fully qualified path name for this scapepublic boolean isMembersActive()
public boolean isMutable()
public void setMembersActive(boolean membersActive)
memebersActive - true if members actively execute rules, false otherwisepublic boolean isCellsRequestUpdates()
public void setCellsRequestUpdates(boolean cellsRequestUpdates)
requestUpdate method
is called anytime a cell's state changes such that a view may be affected. Some of these
calls will be handled for you automatically, for instance, it is not neccesary
to call requestUpdate when a cell moves, since the HostCell calls requestUpdates for
you. Typically, you will need to request updates when the internal state of a
cell changes and that is reflected in how a cell is represeneted in a view, for
example, if you color an agent for wealth, you will need to call requestUpdate
anytime the agent wealth changes.true - if cells should request updates, false if cell updates should be handled automaticallyCell.requestUpdate()public static int[] createOrder(int length)
public int[] randomizeOrder(int[] order)
public void execute(java.lang.Object[] rules,
Agent[] agents)
public void execute(Rule rule,
Agent[] agents)
public void executeOnMembers()
public void executeOnMembers(VectorSelection ruleSelection)
public void executeOnMembers(Rule rule)
protected void executeOnMembers(java.lang.Object[] rules)
public abstract ScapeIterator iterator()
public abstract ScapeIterator randomIterator()
public void executeOnRoot(Rule[] rules)
public void executeOnRoot(Rule rule)
public void iterateScape()
public void setCollectStats(boolean collect)
public CollectStats getCollectStats()
public void setCollectStats(CollectStats collectStats)
public boolean isAutoCreate()
public void setAutoCreate(boolean autoCreate)
autoCreate - if true calls createScape at construction, otherwise model is built manuallypublic DataGroup getData()
public void addStatCollectors(StatCollector[] stats)
stats - the stat collectors to add to this scape.public void addStatCollector(StatCollector stat)
stat - the stat collector to add to this scape.public StatCollector[] getStatCollectors()
public void addDrawFeature(DrawFeature feature)
DrawFeaturepublic java.util.Observable getDrawFeaturesObservable()
public java.util.Vector getDrawFeatures()
DrawFeaturepublic PropertyAccessor[] retrieveAllAccessors()
public PropertyAccessor[] retrieveAllAccessorsOrdered()
public java.util.Vector getAllScapes()
public abstract Agent[] getAgents()
public Agent[] getAgentsNear(Agent centralAgent,
int distance,
boolean includeSelf)
centralAgent - the agent at the search origin location.distance - the maximimum distance that another location can be from the centralAgent to be includedincludeSelf - should the centralAgent itself be included in the results of this methodpublic boolean isViewSelf()
viewSelf - if a scape self view existspublic void setViewSelf(boolean viewSelf)
viewSelf - should the scape view itself.public void createSelfView()
public void createViews()
public void onSetup()
edu.brook.pd.PD2D#onSetuppublic void onStart()
edu.brook.pd.PD2D#onSetuppublic void onStop()
edu.brook.pd.PD2D#onSetuppublic void onUpdate()
public static void save(Scape scape,
java.io.File file)
throws java.io.IOException
public void closeAndOpenNew()
public static void closeAndOpenNewFinally(Scape oldScape)
public static Scape open(java.lang.String modelName,
ModelApplet applet,
java.lang.String[] args)
modelName - the fully qualified name of the Java class for the model's root scapeapplet - are we in an applet vm contextargs - paramter arguments for the scape
public static Scape open(java.lang.String modelName,
java.lang.String[] args)
modelName - the fully qualified name of the Java class for the model's root scapeargs - paramter arguments for the scape
public static Scape open(java.lang.String modelName,
ModelApplet applet)
modelName - the fully qualified name of the Java class for the model's root scapeapplet - are we in an applet vm contextpublic static Scape open(java.lang.String modelName)
modelName - the fully qualified name of the Java class for the model's root scapepublic static void open()
public static void save(Scape scape)
protected void parseSettingArgs(java.lang.String[] args)
public static void main(java.lang.String[] args)
public MyModel extends Model {
public static void main(String[] args) {
(open("mypath.MyModel")).start();
}
}
Otherwise, assuming your classpath is set up correctly, to invoke a model
from the command line type:
java edu.brook.ascape.model.Scape mypath.myModel
args - at index 0; the name of the subclass of this class to runpublic java.lang.Object clone()
public java.lang.String contentsToString()
public java.lang.String toString()
|
(c) 1998-2000 The Brookings Insitution Webpage |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||