?? 鱷魚文檔.txt
字號(hào):
English Specification for Catfish class:-
Attributes and behaviors similar to those for AlgaeColony
=========================================================
Constant class attributes:
ALIVE: Private attribute.
Represents status of Catfish that is alive as a String.
DEAD: Private attribute.
Represents status of Catfish that is dead as a String.
SPECIES: Private attribute.
Represents species of lifeform as a String.
BABY_MAX_ENERGY: Private attribute.
Represents maximum energy that can be carried as an integer.
BABY_MIN_ENERGY: Private attribute.
Represents minimum energy needed to stay alive as an integer.
RIGHT: Private attribute.
Represents the direction of Catfish facing right as a String.
LEFT: Private attribute.
Represents the direction of Catfish facing left as a String.
UP: Private attribute.
Represents the direction of Catfish facing up as a String.
DOWN: Private attribute.
Represents the direction of Catfish facing down as a String.
ENERGY_TO_SWIM:Private attribute
The amount of energy a catfish must expend to swim.
ENERGY_TO_EAT:Private attribute
The amount of energy a catfish must expend to eat.
ENERGY_TO_LOOK_FOR_FOOD:Private attribute
The amount of energy a catfish must expend to look for food in the form of AlgaeColony.
ENERGY_IN_A_FULL_MEAL:Private attribute
The amount of energy a catfish can gain from a full meal of AlgaeColony.
MIN_ENERGY_GROWTH_INCREMENT:Private attribute
The amount by which the minimum energy required by each catfish to stay alive increases in a time block.As each catfish gets older by a time block, the minimum energy it needs to survive should increase.
MAX_ENERGY_GROWTH_INCREMENT:Private attribute
The amount by which the maximum energy stored by each catfish increases in a time block.
As each catfish gets older by a time block, the maximum energy it can store should increase.
Constant instance attributes:
name: Private attribute.
Represents unique name as a String
Instance attributes:
row: Private attribute.
Represents row identifying the location as an integer.
column: Private attribute.
Represents column identifying the location as an integer.
deadOrAlive: Private attribute.
Represents living status as a String.
energy: Private attribute.
Represents current energy level as a String.
age: Private attribute.
Represents age as an integer.
simulation: Private attribute.
Represents simulation to which the Catfish belongs as an object of Simulation class.
minEnergy: Private attribute.
Represents minimum energy needed to survive as an integer.
maxEnergy: Private attribute.
Represents maximum energy that can be carried as an integer.
Instance attribute:
direction: This private attribute represents the direction in which the Catfish is facing as a String.
Class attributes:
nCatfishCreated: Private attribute.
Represents number of Catfish created so far as an integer, to help the Simulation object keep track of the total number of Catfish in the simulation.
Behaviors:
Constructor: Create an instance of the Catfish class.
getRow: Return the row in which Catfish is located as an integer.
Part of the public interface.
getColumn: Return the column in which Catfish is located as an integer.
Part of the public interface.
getAge: Return the age of Catfish as an integer.
Part of the public interface.
getColor: Return the color of the Catfish as a String.
Part of the public interface.
getName: Return the unique name identifying the Catfish as a String.
Part of the public interface.
getMinEnergy: Return the minimum energy needed to stay alive as an integer.
Part of the private interface.
getMaxEnergy: Return the maximum energy that can be carried as an integer.
Part of the private interface.
getEnergy: Return the current energy level as an integer.
Part of the public interface.
setEnergy: Set the energy level as specified by the integer value passed as a parameter.
Part of the private interface.
die: Update living status to being dead.
Returns nothing.
Part of the private interface.
isDead: Return the living status of the Catfish as a boolean.
Part of the public interface.
getDirection: Check the direction in which the Catfish is facing.
Returns a String.
Part of the private interface.
isHungry: Check if the current energy level of the Catfish is less than twice the amount needed for survival.
Returns a boolean.
Part of the private interface.
moveToRow: Move the Catfish to the row specified by the integer value passed as a parameter.
Returns the row where the Catfish is moved as an integer.
Part of the private interface.
moveToColumn: Move the Catfish to the column specified by the integer value passed as a parameter.
Returns the column where the Catfish is moved as an integer.
Part of the private interface.
getSpecies: Return the species of the Catfish as a String.
Part of the public interface.
getDisplayMechanism: Return the mechanism used for displaying the Catfish as a String.
Part of the public interface.
getImage: Return an image representing the Catfish.
Part of the public interface.
lookForFoodInNeighborhood: Try to locate any AlgaeColony close by. Relinquish some energy in the process.
Note that this behavior requires a way to store the neighboring AlgaeColony objects.
liveALittle: Live a block of time.
Part of the public interface.
eatIfPossible:Check if the current energy level of the Catfish is less than the amount needed for survival and decide wether to eat.part of private interface
swimIfPossible:Check if the current energy level of the Catfish is less than the amount needed for survival and decide
wether to swim.
part of the private interface.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -