clubs
Class SavingsClub

java.lang.Object
  extended by clubs.SavingsClub

public class SavingsClub
extends java.lang.Object

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

cycle

private int cycle
a savings club may either be disbanded or a new cycle starts


months

private int months
a savings club may either be disbanded or a new cycle starts


moderator

private Agent moderator

candidates

private java.util.ArrayList<Agent> candidates

members

private java.util.ArrayList<Agent> members

model

private Model model

viable

private boolean viable
Constructor Detail

SavingsClub

public SavingsClub()
Default constructor


SavingsClub

public SavingsClub(Agent _moderator,
                   java.util.ArrayList<Agent> _members,
                   Model _model)
Creates a stokvel (savings club) with a moderator

Parameters:
_moderator -
_members -
_model -
Method Detail

initialize

public void initialize()
Reinitializing the stokvel after every cycle


chooseRandomNextBenefactor

public Agent chooseRandomNextBenefactor()
Choose a random benefactor


step

public void step()
Called from the model. Handles members' pulling out the stokvels and also if the stokvel needs to be reinitialized.


restart

public 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. We might also like to invite more people who're not part of the cycle before


mainStep

public void mainStep()
Main step for stokves. Gets the recipient for the current terms.


abandon

public void abandon()
Abandon the stokvel when it is no longer viable. *


main

public static void main(java.lang.String[] args)

getCycle

public int getCycle()
Returns the number of cycles for this stokvel.

Returns:

getModerator

public Agent getModerator()
Returns the moderator for this stokvel.

Returns:

setModerator

public void setModerator(Agent moderator)
Sets the moderator for this stokvel.

Parameters:
moderator -

setCycle

public void setCycle(int cycle)
Sets the cycle for this stokvels.

Parameters:
cycle -

getMonths

public int getMonths()
Returns the number of months this stokvel is running.

Returns:

isViable

public boolean isViable()
If this stokvel is viable or not.

Returns:

setViable

public void setViable(boolean viable)
Sets the viability status of the stokvel.


getMembers

public java.util.ArrayList<Agent> getMembers()
Returns the member list of the stokvels

Returns:

setMembers

public void setMembers(java.util.ArrayList<Agent> members)
Sets the member list of the stokvels

Parameters:
members -