Class Student

java.lang.Object
  |
  +--Student

public class Student
extends java.lang.Object

The Student class is a basic type of this model. The Model creates several instances of the student type of "agent". Each student has a name, it can send messages to other students, receive messages. The big addition in this model is that the student interacts with others, and when it does, it takes a note of the fingerprint of the other student, and then it puts that other into a map, using the fingerprint as a key. When asked to check its records on a fingerprint, the agent can then look int he map, see if there is anybody with that fingerprint, and then send back the identity of the other.


Constructor Summary
Student(java.lang.String s)
          Create a student and tell it its name.
 
Method Summary
 Student checkFingerprint(Fingerprint x)
          Find out if fingerprint of suspect is in records.
 Fingerprint getFingerprint()
          Return the fingerprint object
 java.lang.String getName()
          Return the student's name string
 double getSomeData()
           
 void receiveMessage(Student obj, java.lang.String s)
          The Student object receives a message from "obj" and the content of the message is a String s Note I'm inconsistent here in setting a precise type for obj in this method, whereas I used Object in sayHiTo().
 void sayHi()
          This is a diagnostic method.
 void sayHiTo(java.lang.Object target)
          The student is supposed to send a message to the target Object.
 void setContactList(java.util.HashSet aList)
           
 void step()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Student

public Student(java.lang.String s)
Create a student and tell it its name. Create the fingerprint Map
Method Detail

sayHiTo

public void sayHiTo(java.lang.Object target)
The student is supposed to send a message to the target Object. Please note that the target is cast as a Student before it is told what to do. You might have other kinds of targets and then you would need a different cast.

receiveMessage

public void receiveMessage(Student obj,
                           java.lang.String s)
The Student object receives a message from "obj" and the content of the message is a String s Note I'm inconsistent here in setting a precise type for obj in this method, whereas I used Object in sayHiTo().

getName

public java.lang.String getName()
Return the student's name string

getFingerprint

public Fingerprint getFingerprint()
Return the fingerprint object

sayHi

public void sayHi()
This is a diagnostic method. When a student is told to sayHi(), it just prints a line to the terminal telling its name. This way, I can check if a student exists.

setContactList

public void setContactList(java.util.HashSet aList)

checkFingerprint

public Student checkFingerprint(Fingerprint x)
Find out if fingerprint of suspect is in records. If so, send that person's name to the requester. Otherwise, send null back to them.

step

public void step()

getSomeData

public double getSomeData()