org.cfpm.caves.za
Class Stokvel

java.lang.Object
  extended by org.cfpm.caves.za.Group
      extended by org.cfpm.caves.za.SavingsClub
          extended by org.cfpm.caves.za.Stokvel

public class Stokvel
extends SavingsClub

A stokvel is a savings club with a monthly fee and either a monthly rotation of payouts (ROSCA) or a payout of accumulated savings at the end of a circle (ASCA). For the sake of simplicity, this class implements an ASCA-type stokvel. Thus it's easier to have grace periods like in burial societies.

Author:
Ruth

Field Summary
(package private)  int payOutDate
          next date (tick) of pay out (depends on number of members)
(package private)  java.util.ArrayList<java.lang.Integer> startDates
          list of start dates for all members
 
Fields inherited from class org.cfpm.caves.za.SavingsClub
holdings, monthlyFee, onGrace
 
Fields inherited from class org.cfpm.caves.za.Group
memberIDs, members, model, name, pcs
 
Constructor Summary
Stokvel(java.util.ArrayList<Person> members, SouthAfricaModel model)
          Creates a new stokvel for the given members
 
Method Summary
 void addMember(Person p)
          lets the given person join this stokvel
 void disband()
          disbands this stokvel
 int getPayOutDate()
          returns the next payout date
 int[] getStartDates()
          returns the start dates of all members
 double[] payOut()
          pay out accumulated savings to the members
 void removeMember(Person p)
          lets the given person leave this stokvel
private  void reset()
          internal function: resets all variables for the start of a new cycle
 void setPayOutDate(int date)
          sets the next payout date
 
Methods inherited from class org.cfpm.caves.za.SavingsClub
getGracePeriods, getHoldings, getMembersOnGrace, getMonthlyFee, payIn, requestGracePeriod, setHoldings, setMonthlyFee
 
Methods inherited from class org.cfpm.caves.za.Group
addPropertyChangeListener, getMemberIDs, getName, removePropertyChangeListener, setMemberIDs, setName, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startDates

java.util.ArrayList<java.lang.Integer> startDates
list of start dates for all members


payOutDate

int payOutDate
next date (tick) of pay out (depends on number of members)

Constructor Detail

Stokvel

public Stokvel(java.util.ArrayList<Person> members,
               SouthAfricaModel model)
Creates a new stokvel for the given members

Parameters:
members - list of members
model - the model
Method Detail

addMember

public void addMember(Person p)
lets the given person join this stokvel

Overrides:
addMember in class Group
Parameters:
p - the new member

removeMember

public void removeMember(Person p)
lets the given person leave this stokvel

Overrides:
removeMember in class SavingsClub
Parameters:
p - the leaving member

payOut

public double[] payOut()
pay out accumulated savings to the members

Returns:
list of each member's share of the current holdings

reset

private void reset()
internal function: resets all variables for the start of a new cycle


getPayOutDate

public int getPayOutDate()
returns the next payout date

Returns:
date of next payout

setPayOutDate

public void setPayOutDate(int date)
sets the next payout date

Parameters:
date - date of next payout

getStartDates

public int[] getStartDates()
returns the start dates of all members

Returns:
list of dates (ticks) when membership started

disband

public void disband()
disbands this stokvel