Class Model

java.lang.Object
  |
  +--Model

public class Model
extends java.lang.Object

The Model class has methods that build objects and it also tells them to do things. Please note the use of both Lists and Sets here. For each student, it creates a set of "contacts" that serves an important role in the Student class.


Constructor Summary
Model(int n)
           
 
Method Summary
 void buildObjects()
          Create a List and fill it with N student objects.
 void checkAgents()
          Tell the agents to sayHi
 void runTheSimulation(int n)
          We want to repeatedly process the list of agents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Model

public Model(int n)
Method Detail

buildObjects

public void buildObjects()
Create a List and fill it with N student objects. Then, for each student, create a container for contacts, and randomly choose agents from the agentList to go into the contact list

checkAgents

public void checkAgents()
Tell the agents to sayHi

runTheSimulation

public void runTheSimulation(int n)
We want to repeatedly process the list of agents. So we create a for loop to control the number of repetitions, then we step through the list, one agent at a time. Note that if agents are born and added to the list, we need not change this code, because the whole list will get processed each time