|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Party
public class Party
Field Summary | |
---|---|
private int |
currentPartySize
The size of the Party |
private Person[] |
theParty
An array of Person which represents the traveling group |
Constructor Summary | |
---|---|
Party()
Party default constructor. |
Method Summary | |
---|---|
void |
addLeader(java.lang.String name)
Adds a leader (Person) to the party. |
void |
addPartyMember(java.lang.String name)
Adds a new party member (Person) to the party |
int |
getCurrentPartySize()
Returns the value of currentPartySize |
int |
getNumberAlive()
Returns the number of people in the Party who are still alive |
Person |
getPerson(int position)
Returns a Person given their position in the Party |
private void |
increaseCapacity()
Increases the capacity of theParty array |
boolean |
isAnybodyAlive()
Returns if any member of the Party is alive |
Person |
pickRandomPerson()
Returns a random person picked from the Party. |
void |
printPartyStatus()
Prints the status of the people in the Party. |
void |
starve()
Starves the entire Party. |
java.lang.String |
toString()
Creates a String that can be used in print statements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Person[] theParty
private int currentPartySize
Constructor Detail |
---|
public Party()
Method Detail |
---|
public int getCurrentPartySize()
public Person getPerson(int position)
position
- The position in the Party array
public void addLeader(java.lang.String name)
name
- The name of the leaderprivate void increaseCapacity()
public void addPartyMember(java.lang.String name)
name
- The name of the new Party memberpublic java.lang.String toString()
toString
in class java.lang.Object
public boolean isAnybodyAlive()
public Person pickRandomPerson()
public void starve()
Game.STARVATION_HEALTH_COST
public int getNumberAlive()
public void printPartyStatus()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |