|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectclubs.SavingsClub
public class SavingsClub
TODO: need mechansim for handling requests for getting money out of turn ... if more than one agents request, we need to maintain a priority queuue so that which is 'supposed' to be just ... if there is a delay due to the size of members and/or number of requests, a member may opt to leave the saving club and join another but it's a kind of tension ... because a savings club which is older and larger may attract more people than otherwise ... if there're many members, then you can get a much larger amount of money ... but on the cost that your turn comes late too as the consquence people get togeter to create a savings scheme ... "it appears that some people might be involved in more than one scheme while others are involved in no schemes."
Field Summary | |
---|---|
private java.util.ArrayList<Agent> |
candidates
|
private int |
cycle
a savings club may either be disbanded or a new cycle starts |
private java.util.ArrayList<Agent> |
members
|
private Model |
model
|
private Agent |
moderator
|
private int |
months
a savings club may either be disbanded or a new cycle starts |
private boolean |
viable
|
Constructor Summary | |
---|---|
SavingsClub()
Default constructor |
|
SavingsClub(Agent _moderator,
java.util.ArrayList<Agent> _members,
Model _model)
Creates a stokvel (savings club) with a moderator |
Method Summary | |
---|---|
void |
abandon()
Abandon the stokvel when it is no longer viable. |
Agent |
chooseRandomNextBenefactor()
Choose a random benefactor |
int |
getCycle()
Returns the number of cycles for this stokvel. |
java.util.ArrayList<Agent> |
getMembers()
Returns the member list of the stokvels |
Agent |
getModerator()
Returns the moderator for this stokvel. |
int |
getMonths()
Returns the number of months this stokvel is running. |
void |
initialize()
Reinitializing the stokvel after every cycle |
boolean |
isViable()
If this stokvel is viable or not. |
static void |
main(java.lang.String[] args)
|
void |
mainStep()
Main step for stokves. |
void |
restart()
for restarting the club, we have got to check if we've the remaining candidates intact and if they're viable for the club. |
void |
setCycle(int cycle)
Sets the cycle for this stokvels. |
void |
setMembers(java.util.ArrayList<Agent> members)
Sets the member list of the stokvels |
void |
setModerator(Agent moderator)
Sets the moderator for this stokvel. |
void |
setViable(boolean viable)
Sets the viability status of the stokvel. |
void |
step()
Called from the model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int cycle
private int months
private Agent moderator
private java.util.ArrayList<Agent> candidates
private java.util.ArrayList<Agent> members
private Model model
private boolean viable
Constructor Detail |
---|
public SavingsClub()
public SavingsClub(Agent _moderator, java.util.ArrayList<Agent> _members, Model _model)
_moderator
- _members
- _model
- Method Detail |
---|
public void initialize()
public Agent chooseRandomNextBenefactor()
public void step()
public void restart()
public void mainStep()
public void abandon()
public static void main(java.lang.String[] args)
public int getCycle()
public Agent getModerator()
public void setModerator(Agent moderator)
moderator
- public void setCycle(int cycle)
cycle
- public int getMonths()
public boolean isViable()
public void setViable(boolean viable)
public java.util.ArrayList<Agent> getMembers()
public void setMembers(java.util.ArrayList<Agent> members)
members
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |