org.simbrain.world.odorworld
Class OdorWorldEntity

java.lang.Object
  extended by org.simbrain.world.odorworld.AbstractEntity
      extended by org.simbrain.world.odorworld.OdorWorldEntity
Direct Known Subclasses:
OdorWorldAgent

public class OdorWorldEntity
extends AbstractEntity

WorldEntity represents an entity in the world. These objects represent distal stimuli relative to the creature. The functions in this class convert the properties of that distal stimulus into a proximal stimulus, that is, into a pattern of activity across the input nodes of the network.


Field Summary
static String[] IMAGENAMES
          for combo boxes.
 
Constructor Summary
OdorWorldEntity()
          Default constructor.
OdorWorldEntity(OdorWorld wr, String imageName, int x, int y)
          Construct a world entity with a random smell signature.
 
Method Summary
 int getBites()
           
 int getBitesToDie()
           
 boolean getEdible()
           
 int getHeight()
           
 String getImageName()
           
 int getImageNameIndex(String in)
          Helper function for combo boxes.
static String[] getImageNames()
          Names of images.
 Point getLocation()
           
 String getName()
           
 OdorWorld getParent()
           
 Rectangle getRectangle()
          Returns a Rectangle describing the location of the Entity (For Calculating Collisions).
 Rectangle getRectangle(Point p)
           
 double getResurrectionProb()
           
 Stimulus getStimulus()
           
 ImageIcon getTheImage()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
static ImageIcon[] imagesRenderer()
          To display images in combo boxes.
 void moveTo(int x, int y)
          Move world object to a specified location.
 void paintThis(Graphics g)
          Paint the entity.
 void reset()
          When an entity is resurrected, reset its bite counter.
 void setBites(int bites)
          Number of times bitten.
 void setBitesToDie(int bitesToDie)
           
 void setEdible(boolean edible)
           
 void setImageName(String string)
           
 void setLocation(Point newPosition)
          Sets new location of entity.
 void setName(String name)
           
 void setParent(OdorWorld parentWorld)
           
 void setResurrectionProb(double resurrectionProb)
           
 void setStimulus(Stimulus theStimulus)
           
 void setTheImage(ImageIcon theImage)
           
 void setX(int x)
          Sets x position.
 void setY(int y)
          Sets y position.
 void terminate()
          Removes the entity that was eaten.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGENAMES

public static final String[] IMAGENAMES
for combo boxes.

Constructor Detail

OdorWorldEntity

public OdorWorldEntity()
Default constructor.


OdorWorldEntity

public OdorWorldEntity(OdorWorld wr,
                       String imageName,
                       int x,
                       int y)
Construct a world entity with a random smell signature.

Parameters:
imageName - kind of entity (flower, cheese, etc)
x - x location of new entity
y - y location of new entity
wr - the world to which this belongs
Method Detail

getBites

public int getBites()
Specified by:
getBites in class AbstractEntity
Returns:
Number of bites.

setBites

public void setBites(int bites)
Number of times bitten.

Specified by:
setBites in class AbstractEntity
Parameters:
bites - Number of bites.

reset

public void reset()
When an entity is resurrected, reset its bite counter.


setLocation

public void setLocation(Point newPosition)
Sets new location of entity.

Parameters:
newPosition - New position of entity.

getLocation

public Point getLocation()
Specified by:
getLocation in class AbstractEntity
Returns:
Current location of entity.

getX

public int getX()
Specified by:
getX in class AbstractEntity
Returns:
X position.

getY

public int getY()
Specified by:
getY in class AbstractEntity
Returns:
Y position

setX

public void setX(int x)
Sets x position.

Specified by:
setX in class AbstractEntity
Parameters:
x - Location

setY

public void setY(int y)
Sets y position.

Specified by:
setY in class AbstractEntity
Parameters:
y - Location

getImageName

public String getImageName()
Returns:
Name of image.

setImageName

public void setImageName(String string)
Parameters:
string - Sets name of image.

imagesRenderer

public static ImageIcon[] imagesRenderer()
To display images in combo boxes.

Returns:
Image to display Is this really a good place for this method?

getImageNameIndex

public int getImageNameIndex(String in)
Helper function for combo boxes.

Parameters:
in - the string to compare
Returns:
the imageNameIndex

moveTo

public void moveTo(int x,
                   int y)
Move world object to a specified location.

Parameters:
x - x coordinate of target location
y - y coordintae of target location

getImageNames

public static String[] getImageNames()
Names of images.

Returns:
Array of image names

getParent

public OdorWorld getParent()
Specified by:
getParent in class AbstractEntity
Returns:
Returns the parentWorld.

setParent

public void setParent(OdorWorld parentWorld)
Specified by:
setParent in class AbstractEntity
Parameters:
parentWorld - The parentWorld to set.

getStimulus

public Stimulus getStimulus()
Specified by:
getStimulus in class AbstractEntity
Returns:
Returns the theStimulus.

setStimulus

public void setStimulus(Stimulus theStimulus)
Parameters:
theStimulus - The theStimulus to set.

getName

public String getName()
Returns:
Returns the name.

setName

public void setName(String name)
Parameters:
name - The name to set.

getTheImage

public ImageIcon getTheImage()
Returns:
The image.

setTheImage

public void setTheImage(ImageIcon theImage)
Parameters:
theImage - The image to be set.

getWidth

public int getWidth()
Specified by:
getWidth in class AbstractEntity
Returns:
Width of image.

getHeight

public int getHeight()
Specified by:
getHeight in class AbstractEntity
Returns:
Height of image.

getRectangle

public Rectangle getRectangle()
Description copied from class: AbstractEntity
Returns a Rectangle describing the location of the Entity (For Calculating Collisions).

Specified by:
getRectangle in class AbstractEntity
Returns:
Rectangle for wall.

getRectangle

public Rectangle getRectangle(Point p)
Specified by:
getRectangle in class AbstractEntity
Parameters:
p - Point at which rectangle is to be created.
Returns:
Rectangle for wall.

paintThis

public void paintThis(Graphics g)
Paint the entity.

Specified by:
paintThis in class AbstractEntity
Parameters:
g - reference to the World's graphics object

getBitesToDie

public int getBitesToDie()
Specified by:
getBitesToDie in class AbstractEntity
Returns:
Bites to eat item.

setBitesToDie

public void setBitesToDie(int bitesToDie)
Parameters:
bitesToDie - Bites to eat an item.

getEdible

public boolean getEdible()
Specified by:
getEdible in class AbstractEntity
Returns:
Whether or not an item is edible.

setEdible

public void setEdible(boolean edible)
Specified by:
setEdible in class AbstractEntity
Parameters:
edible - Sets whether an item is edible.

terminate

public void terminate()
Removes the entity that was eaten.

Specified by:
terminate in class AbstractEntity

getResurrectionProb

public double getResurrectionProb()
Specified by:
getResurrectionProb in class AbstractEntity
Returns:
Likelyhood entity will reappear.

setResurrectionProb

public void setResurrectionProb(double resurrectionProb)
Specified by:
setResurrectionProb in class AbstractEntity
Parameters:
resurrectionProb - Likelyhood entity will reappear.