org.cfpm.caves.za
Class Church

java.lang.Object
  extended by org.cfpm.caves.za.Church

public class Church
extends java.lang.Object

This class represents a church of a particular denomination in a village. We assume that all members of a household are members of the same church, i.e. membership is handled on the household level. Used as shadow fact in Jess.

Author:
scott, ruth

Field Summary
 jess.Value denomination
          this church's denomination
 jess.Value[] memberIDs
          list of member household names (for easier access in Jess)
(package private)  java.util.ArrayList<Household> members
          the list of households who are members of this church
 jess.Value name
          this church's name
private  java.beans.PropertyChangeSupport pcs
           
 
Constructor Summary
Church(java.lang.String nameString, java.lang.String denominationString, SouthAfricaModel model)
          Creates a new church of the given name and denomination
 
Method Summary
 void addHousehold(Household h)
          Add the household to the ArrayList members<\code> and replace the memberIDs array of Value<\code> with the same array extended to include the id of the added household.
 void addPropertyChangeListener(java.beans.PropertyChangeListener p)
          adds a property change listener (for Jess)
 jess.Value getDenomination()
          returns the denomination of this church
 jess.Value[] getMemberIDs()
          returns the member IDs
 jess.Value getName()
          returns the name of this church
 void removeHousehold(Household h)
          removes the ghiven household from the list of members
 void removePropertyChangeListener(java.beans.PropertyChangeListener p)
          removes a property change listener (for Jess)
 void setMemberIDs(java.util.ArrayList<jess.Value> memberIDsList)
          sets the member IDs to the given list of IDs
 void setMemberIDs(jess.Value[] memberIDs)
          sets the member IDs to the given list of IDs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

members

java.util.ArrayList<Household> members
the list of households who are members of this church


memberIDs

public jess.Value[] memberIDs
list of member household names (for easier access in Jess)


name

public jess.Value name
this church's name


denomination

public jess.Value denomination
this church's denomination


pcs

private java.beans.PropertyChangeSupport pcs
Constructor Detail

Church

public Church(java.lang.String nameString,
              java.lang.String denominationString,
              SouthAfricaModel model)
Creates a new church of the given name and denomination

Parameters:
nameString - the name
denominationString - the denomination
model - the model
Method Detail

addHousehold

public void addHousehold(Household h)
Add the household to the ArrayList members<\code> and replace the memberIDs array of Value<\code> with the same array extended to include the id of the added household.

Parameters:
h - the new member household

removeHousehold

public void removeHousehold(Household h)
removes the ghiven household from the list of members

Parameters:
h - the household leaving the church

getMemberIDs

public jess.Value[] getMemberIDs()
returns the member IDs

Returns:
list of household IDs

setMemberIDs

public void setMemberIDs(jess.Value[] memberIDs)
sets the member IDs to the given list of IDs

Parameters:
memberIDs - list of household IDs as an Array of Value

setMemberIDs

public void setMemberIDs(java.util.ArrayList<jess.Value> memberIDsList)
sets the member IDs to the given list of IDs

Parameters:
memberIDsList - list of household IDs as an ArrayList of Value

getName

public jess.Value getName()
returns the name of this church

Returns:
the name

getDenomination

public jess.Value getDenomination()
returns the denomination of this church

Returns:
the denomination

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener p)
adds a property change listener (for Jess)


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener p)
removes a property change listener (for Jess)