|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sysModel.env.AGlobalEnv sysModel.env.ASquareEnv sysModel.env.BoundedEnv
public class BoundedEnv
Implementation of a square bounded environment.
Nested Class Summary | |
---|---|
static class |
BoundedEnv.EmptyField
Empty field singleton. |
static interface |
BoundedEnv.IField
Field interface. |
static interface |
BoundedEnv.IFieldVisitor
Field visitor interface. |
protected class |
BoundedEnv.LocalEnvironment
Concrete local environment for the square bounded environment. |
static class |
BoundedEnv.NonEmptyField
Non-empty field class. |
static class |
BoundedEnv.Test_BoundedEnv
Test cases for BoundedEnv. |
static class |
BoundedEnv.Test_BoundedEnv_LocalEnv
Test cases for BoundedEnv.LocalEnv. |
Nested classes/interfaces inherited from class sysModel.env.ASquareEnv |
---|
ASquareEnv.ASquareLocalEnvironment, ASquareEnv.Direction, ASquareEnv.Location |
Nested classes/interfaces inherited from class sysModel.env.AGlobalEnv |
---|
AGlobalEnv.ALocalEnv, AGlobalEnv.BreedLambda, AGlobalEnv.ILocalEnvVisitor |
Field Summary | |
---|---|
protected BoundedEnv.IField[][] |
_fieldMap
List of local environments in this global environment. |
protected int |
_height
Height. |
protected BoundedEnv.LocalEnvironment |
_outOfBounds
"Singleton" instance for all out-of-bounds locations. |
protected int |
_width
Width. |
protected java.awt.geom.Point2D.Double |
PAN_CENTER
Center of the pan area. |
protected int |
PAN_SIZE
Size of the pan area. |
Fields inherited from class sysModel.env.AGlobalEnv |
---|
_breedLambdas, _cmdFactory, _moveLambdas, _securityAdapter, _waterColor, OCEAN_BLUE |
Constructor Summary | |
---|---|
BoundedEnv(ICmdFactory cmdFactory,
ISecurityAdapter sm)
Construct a new square bounded environment. |
|
BoundedEnv(ICmdFactory cmdFactory,
ISecurityAdapter sm,
int width,
int height)
Construct a new square bounded environment. |
Method Summary | |
---|---|
protected void |
addFishToInternalData(AGlobalEnv.ALocalEnv localEnv,
AFish fish)
Add the fish to the global environment. |
protected ASquareEnv.ASquareLocalEnvironment |
createLocalEnvironment(ASquareEnv.Location loc,
ASquareEnv.Direction dir)
Create a local environment with the given data. |
java.awt.Dimension |
getDisplaySize()
Get size of the display. |
java.awt.geom.Point2D.Double |
getPanDelta(java.awt.geom.Point2D.Double delta)
Ask the model how much to pan, given where the user scrolled. |
java.awt.geom.Point2D.Double |
getViewPosition(java.awt.geom.Point2D.Double pos)
Ask the model where to scroll, given where the user has scrolled. |
AEnvFactory |
makeEnvFactory()
Get the environment settings class. |
protected ASquareEnv.ASquareLocalEnvironment |
makeLocalEnv(ASquareEnv.Location loc,
ASquareEnv.Direction dir)
Create a local environment for the position. |
protected AGlobalEnv |
parseEnvironment(Lexer l)
Factory method for parsing a stream of tokens and creating a global environment from it. |
protected void |
printHeader(java.io.PrintWriter pw)
Print file header. |
protected void |
removeFishFromInternalData(AGlobalEnv.ALocalEnv localEnv)
Remove the fish from the global environment. |
void |
returnHome(IScrollAdapter sa)
The action to be executed if the display should return home. |
Methods inherited from class sysModel.env.ASquareEnv |
---|
editFish, getToolTipText, makeDirection, makeDirection, makeDirection, makeLocalEnv, makeLocation, parseFish |
Methods inherited from class sysModel.env.AGlobalEnv |
---|
addFish, deactivateBreedLambdas, deactivateMoveLambdas, drawBackground, makeDrawCmd, makeEditCmd, makeStepCmd, parse, removeFish, save |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int PAN_SIZE
protected final java.awt.geom.Point2D.Double PAN_CENTER
protected BoundedEnv.IField[][] _fieldMap
protected final BoundedEnv.LocalEnvironment _outOfBounds
protected int _width
protected int _height
Constructor Detail |
---|
public BoundedEnv(ICmdFactory cmdFactory, ISecurityAdapter sm)
cmdFactory
- command factory to usesm
- security manager to control fish actionspublic BoundedEnv(ICmdFactory cmdFactory, ISecurityAdapter sm, int width, int height)
cmdFactory
- command factory to usesm
- security manager to control fish actionswidth
- width of environmentheight
- height of environmentMethod Detail |
---|
protected void addFishToInternalData(AGlobalEnv.ALocalEnv localEnv, AFish fish)
addFishToInternalData
in class AGlobalEnv
localEnv
- local environmentfish
- fish to addprotected void removeFishFromInternalData(AGlobalEnv.ALocalEnv localEnv)
removeFishFromInternalData
in class AGlobalEnv
localEnv
- local environmentprotected ASquareEnv.ASquareLocalEnvironment makeLocalEnv(ASquareEnv.Location loc, ASquareEnv.Direction dir)
makeLocalEnv
in class ASquareEnv
loc
- locationdir
- direction
protected ASquareEnv.ASquareLocalEnvironment createLocalEnvironment(ASquareEnv.Location loc, ASquareEnv.Direction dir)
loc
- locationdir
- direction
protected AGlobalEnv parseEnvironment(Lexer l)
parseEnvironment
in class AGlobalEnv
l
- lexer
public AEnvFactory makeEnvFactory()
makeEnvFactory
in class AGlobalEnv
protected void printHeader(java.io.PrintWriter pw)
printHeader
in class AGlobalEnv
pw
- PrintWriter to usepublic java.awt.Dimension getDisplaySize()
getDisplaySize
in class AGlobalEnv
public void returnHome(IScrollAdapter sa)
returnHome
in class AGlobalEnv
sa
- scroll adapterpublic java.awt.geom.Point2D.Double getViewPosition(java.awt.geom.Point2D.Double pos)
getViewPosition
in class AGlobalEnv
pos
- position where the user scrolled to
IDisplayAdapter.getPanDelta(java.awt.geom.Point2D.Double)
public java.awt.geom.Point2D.Double getPanDelta(java.awt.geom.Point2D.Double delta)
getPanDelta
in class AGlobalEnv
delta
- how far the user scrolled
IDisplayAdapter.getViewPosition(java.awt.geom.Point2D.Double)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |