Class RingingPhone

java.lang.Object
  |
  +--RingingPhone

public class RingingPhone
extends java.lang.Object

Java class RingingPhone for testing a person. This has a response to step that is very simple. For 2 phone demo code for COM1204 OO Design Sp 2001

Version:
0.1, 4/28/2001
Author:
Bob Futrelle

Constructor Summary
RingingPhone()
           
 
Method Summary
 void dial()
          In 2phones, there is no number to dial.
There are a total of only two phones.
 void hangup()
          Will effectively break the connection, so nothing said will be sent and nothing can be heard from the other user.
 java.lang.String listen()
          Lets the person "hear" the current phone sound/message.
static void main(java.lang.String[] args)
          This test just loops on step to watch the phone change states in its predetermined way.
 void speak(java.lang.String say)
          Lets the person "say" a phone sound/message to the phone.
 void step()
          Primary simulation function to drive phone action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RingingPhone

public RingingPhone()
Method Detail

main

public static void main(java.lang.String[] args)
This test just loops on step to watch the phone change states in its predetermined way.

step

public void step()
Primary simulation function to drive phone action. In this class, it goes through a class that only responds to calls of its other methods.

dial

public void dial()
In 2phones, there is no number to dial.
There are a total of only two phones.

listen

public java.lang.String listen()
Lets the person "hear" the current phone sound/message.
Returns:
The string of what "sound" the phone is making, which could be what another user is saying, an empty string or the string "RING!".

speak

public void speak(java.lang.String say)
Lets the person "say" a phone sound/message to the phone.
Parameters:
say - A string representing what the person "says" to the phone.

hangup

public void hangup()
Will effectively break the connection, so nothing said will be sent and nothing can be heard from the other user.