|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.simbrain.world.World
org.simbrain.world.odorworld.OdorWorld
public class OdorWorld
OdorWorld is the lowest-level environment panel which contains most of the world's "logic". Creature and flower/food icons are drawn here. Movement of the mouse in response to clicks and (very minimal) world-editing features are also handled here. Finally, the stimulus to the network is calculated here, on the basis of the creature's distance from objects, as follows:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
OdorWorld()
Default constructor. |
|
OdorWorld(OdorWorldFrame wf)
Construct a world, set its background color. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(ActionEvent e)
Tasks to perform when actions are performed. |
void |
addAgent(Point p)
Add an agent at point p. |
void |
addEntity(Point p)
Add a world object at point p. |
void |
addWall()
Adds a wall to the world. |
JPopupMenu |
buildPopupMenu(AbstractEntity theEntity)
Create a popup menu based on location of mouse click. |
void |
clear()
Remove all objects from world. |
void |
clearAllEntities()
Clears all entities from the world. |
ArrayList |
getAbstractEntityList()
|
ArrayList |
getAgentList()
Return the list of agents for this world. |
int |
getBackgroundColor()
|
ArrayList |
getDeadEntityList()
|
ArrayList |
getEntityList()
|
ArrayList |
getEntityNames()
|
int |
getHighestDimensionalStimulus()
Go through entities in this world and find the one with the greatest number of dimensions. |
JMenu |
getMotorCommandMenu(ActionListener al)
Returns a menu with the motor commands available to this agent. |
boolean |
getObjectDraggingInitiatesMovement()
|
boolean |
getObjectInhibitsMovement()
|
int |
getObjectSize()
|
OdorWorldFrame |
getParentFrame()
|
Workspace |
getParentWorkspace()
Return the parent workspace. |
AbstractEntity |
getSelectedEntity()
|
JMenu |
getSensorIdMenu(ActionListener al)
Returns a menu with a sub-menu for each agent. |
String |
getType()
Return the type of this world. |
boolean |
getUpdateWhileDragging()
|
boolean |
getUseLocalBounds()
|
int |
getWallColor()
|
int |
getWorldHeight()
|
String |
getWorldName()
Return the name of this world. |
int |
getWorldWidth()
|
void |
init()
Initialize world; used by Castor for persistences. |
boolean |
isUpdateCompleted()
Used by script thread to ensure that an update cycle is complete before updating again. |
void |
keyPressed(KeyEvent k)
Task to perform when keyboard button is pressed. |
void |
keyReleased(KeyEvent k)
Task to perform when keyboard button is released. |
void |
keyTyped(KeyEvent k)
Task to perform when keyboard button is typed. |
void |
mouseClicked(MouseEvent mouseEvent)
Task to perform when mouse button is clicked. |
void |
mouseDragged(MouseEvent e)
Task to perform when mouse button is held and mouse moved. |
void |
mouseEntered(MouseEvent mouseEvent)
Task to perform when mouse enters world. |
void |
mouseExited(MouseEvent mouseEvent)
Task to perform when the mouse exits world. |
void |
mouseMoved(MouseEvent e)
Task to perform when mouse is moved within the world. |
void |
mousePressed(MouseEvent mouseEvent)
Task to perform when mouse button is pressed. |
void |
mouseReleased(MouseEvent mouseEvent)
Task to perform when mouse button is released. |
void |
paintComponent(Graphics g)
Paints graphical component. |
void |
paintWorld(Graphics g)
Paint all the objects in the world. |
void |
removeEntity(AbstractEntity entity)
Remove the specified world entity. |
void |
resize()
Sets maximum size for the parent window. |
void |
setAbstractEntityList(ArrayList theList)
Sets the abstract entity list. |
void |
setBackgroundColor(int backgroundColor)
Sets the background color of the world. |
void |
setDeadEntityList(ArrayList deadEntityList)
Array list of dead or eaten entities. |
void |
setObjectDraggingInitiatesMovement(boolean objectDraggingInitiatesMovement)
|
void |
setObjectInhibitsMovement(boolean objectInhibitsMovement)
|
void |
setObjectSize(int objectSize)
|
void |
setParentFrame(OdorWorldFrame parentFrame)
|
void |
setParentWorkspace(Workspace parentWorkspace)
Workspace the world is contained. |
void |
setUpdateCompleted(boolean b)
Used by script thread to ensure that an update cycle is complete before updating again. |
void |
setUpdateWhileDragging(boolean b)
|
void |
setUseLocalBounds(boolean val)
Sets whether to use local bounds. |
void |
setWallColor(int wallColor)
|
void |
setWorldHeight(int worldHeight)
|
void |
setWorldName(String worldName)
|
void |
setWorldWidth(int worldWidth)
|
void |
showEntityDialog(OdorWorldEntity theEntity)
Call up a DialogOdorWorldEntity for a world object nearest to a specified point. |
void |
showGeneralDialog()
Shows the general world preferences dialog. |
void |
showScriptDialog()
Shows the script dialog box. |
void |
showWallDialog(Wall theWall)
Shows the wall properties dialog box. |
| Methods inherited from class org.simbrain.world.World |
|---|
addWorldListener, fireWorldChanged, removeWorldListener |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public OdorWorld()
public OdorWorld(OdorWorldFrame wf)
wf - the frame in which this world is rendered| Method Detail |
|---|
public void clear()
public void init()
public void mouseEntered(MouseEvent mouseEvent)
mouseEntered in interface MouseListenermouseEvent - Mouse eventpublic void mouseExited(MouseEvent mouseEvent)
mouseExited in interface MouseListenermouseEvent - Mouse eventpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenere - Mouse eventpublic void mouseClicked(MouseEvent mouseEvent)
mouseClicked in interface MouseListenermouseEvent - Mouse eventpublic void mouseReleased(MouseEvent mouseEvent)
mouseReleased in interface MouseListenermouseEvent - Mouse eventpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenere - Mouse eventpublic void mousePressed(MouseEvent mouseEvent)
mousePressed in interface MouseListenermouseEvent - Mouse eventpublic void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenere - Action eventpublic void keyReleased(KeyEvent k)
keyReleased in interface KeyListenerk - Keyboard event.public void keyTyped(KeyEvent k)
keyTyped in interface KeyListenerk - Keyboard event.public void keyPressed(KeyEvent k)
keyPressed in interface KeyListenerk - Keyboard event.public void clearAllEntities()
public void removeEntity(AbstractEntity entity)
entity - world entity to deletepublic void addEntity(Point p)
p - the location where the object should be addedpublic void addAgent(Point p)
p - the location where the agent should be addedpublic void addWall()
public void paintComponent(Graphics g)
paintComponent in class JComponentg - Graphic to paintpublic void paintWorld(Graphics g)
g - Reference to the world's graphics objectpublic void showEntityDialog(OdorWorldEntity theEntity)
DialogOdorWorldEntity for a world object nearest to a specified point.
theEntity - the non-creature entity closest to this point will have a dialog called uppublic void showWallDialog(Wall theWall)
theWall - Wall for which to set propertiespublic void showGeneralDialog()
public void showScriptDialog()
public void resize()
public ArrayList getAbstractEntityList()
public void setUseLocalBounds(boolean val)
val - Local boundspublic boolean getUseLocalBounds()
public AbstractEntity getSelectedEntity()
public void setAbstractEntityList(ArrayList theList)
theList - List of entitiespublic boolean getUpdateWhileDragging()
public void setUpdateWhileDragging(boolean b)
b - true if the network should be updated as the creature is dragged, false otherwisepublic JPopupMenu buildPopupMenu(AbstractEntity theEntity)
theEntity - the entity for which to build the menu
public int getHighestDimensionalStimulus()
public ArrayList getEntityNames()
public ArrayList getEntityList()
public JMenu getSensorIdMenu(ActionListener al)
getSensorIdMenu in class Worldal - the action listener (currently in the network panel) which listens to these menu events
public JMenu getMotorCommandMenu(ActionListener al)
getMotorCommandMenu in class Worldal - the action listener (currently in the network panel) which listens to these menu events
public ArrayList getAgentList()
World
getAgentList in class Worldpublic String getWorldName()
World
getWorldName in class Worldpublic void setWorldName(String worldName)
worldName - The worldName to set.public int getWorldHeight()
public void setWorldHeight(int worldHeight)
worldHeight - The worldHeight to set.public int getWorldWidth()
public void setWorldWidth(int worldWidth)
worldWidth - The worldWidth to set.public boolean getObjectDraggingInitiatesMovement()
public void setObjectDraggingInitiatesMovement(boolean objectDraggingInitiatesMovement)
objectDraggingInitiatesMovement - The objectDraggingInitiateMovement to set.public boolean getObjectInhibitsMovement()
public void setObjectInhibitsMovement(boolean objectInhibitsMovement)
objectInhibitsMovement - The objectInhibitsMovement to set.public int getObjectSize()
public void setObjectSize(int objectSize)
objectSize - The objectSize to set.public OdorWorldFrame getParentFrame()
public void setParentFrame(OdorWorldFrame parentFrame)
parentFrame - The parentFrame to set.public String getType()
World
getType in class Worldpublic int getWallColor()
public void setWallColor(int wallColor)
wallColor - The wallColor to set.public Workspace getParentWorkspace()
public void setParentWorkspace(Workspace parentWorkspace)
parentWorkspace - Parent workspacepublic int getBackgroundColor()
public void setBackgroundColor(int backgroundColor)
backgroundColor - Colorpublic ArrayList getDeadEntityList()
public void setDeadEntityList(ArrayList deadEntityList)
deadEntityList - List of entitiespublic boolean isUpdateCompleted()
public void setUpdateCompleted(boolean b)
b - whether the world has been updated or not.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||