|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdemo.CarryDropSpace
Space object for the CarryDropModel Includes functions for placing agents into the space, determining the amount of money at a given cell or in the entire space, moving agents, removing agents, etc.
| Constructor Summary | |
CarryDropSpace(int xSize,
int ySize)
Constructor that takes as arguments to x,y dimensions of the space to be created |
|
| Method Summary | |
boolean |
addAgent(CarryDropAgent agent)
Add an agent to this space. |
CarryDropAgent |
getAgentAt(int x,
int y)
Return a pointer to the agent at position x,y. |
uchicago.src.sim.space.Object2DGrid |
getCurrentAgentSpace()
Get the 'agent space' object |
uchicago.src.sim.space.Object2DGrid |
getCurrentMoneySpace()
Get the 'money space' object |
int |
getMoneyAt(int x,
int y)
Get the amount of money currently stored at the cell location specified |
int |
getTotalMoney()
Return the total money found in the landscape |
boolean |
IsCellOccupied(int x,
int y)
Determine if a given cell is occupied |
boolean |
moveAgentAt(int x,
int y,
int newX,
int newY)
Moves an agent from one location to another. |
void |
removeAgentAt(int x,
int y)
Removes the agent from the specified location. |
void |
spreadMoney(int money)
Randomly distributes an amount of money around the landscape |
int |
takeMoneyAt(int x,
int y)
Removes the money found at the specified location |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CarryDropSpace(int xSize,
int ySize)
xSize - size of X dimensionySize - size of Y dimension| Method Detail |
public void spreadMoney(int money)
money - the (total) amount of money to be distributed
public int getMoneyAt(int x,
int y)
x - X coordinate of the desired celly - Y coordinate of the desired cell
public CarryDropAgent getAgentAt(int x,
int y)
x - X coordinate of the desired celly - Y coordinate of the desired cell
public uchicago.src.sim.space.Object2DGrid getCurrentMoneySpace()
public uchicago.src.sim.space.Object2DGrid getCurrentAgentSpace()
public boolean IsCellOccupied(int x,
int y)
x - X coordinate of the desired celly - Y coordinate of the desired cell
public boolean addAgent(CarryDropAgent agent)
agent - The agent to be placed
public void removeAgentAt(int x,
int y)
x - the X coordinate of the cell from which the agent is to be removedy - the Y coordinate of the cell from which the agent is to be removed
public int takeMoneyAt(int x,
int y)
x - the X coordinate of the cell from which the money is to be removedy - the Y coordinate of the cell from which the money is to be removed
public boolean moveAgentAt(int x,
int y,
int newX,
int newY)
x - the X coordinate of the original locationy - the Y coordinate of the original locationnewX - the X coordinate of the destination locationnewY - the Y coordinate of the destination location
public int getTotalMoney()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||