org.apache.mina.examples.tennis
Class TennisBall

java.lang.Object
  extended by org.apache.mina.examples.tennis.TennisBall

public class TennisBall
extends java.lang.Object

A tennis ball which has TTL value and state whose value is one of 'PING' and 'PONG'.

Version:
$Rev: 123611 $, $Date: 2004-12-29 18:16:58 +0900 (수, 29 12월 2004) $
Author:
Trustin Lee (trustin@apache.org)

Constructor Summary
TennisBall(int ttl)
          Creates a new ball with the specified TTL (Time To Live) value.
 
Method Summary
 int getTTL()
          Returns the TTL value of this ball.
 TennisBall stroke()
          Returns the ball after TennisPlayer's stroke.
 java.lang.String toString()
          Returns string representation of this message ([PING|PONG] (TTL)).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TennisBall

public TennisBall(int ttl)
Creates a new ball with the specified TTL (Time To Live) value.

Method Detail

getTTL

public int getTTL()
Returns the TTL value of this ball.


stroke

public TennisBall stroke()
Returns the ball after TennisPlayer's stroke. The returned ball has decreased TTL value and switched PING/PONG state.


toString

public java.lang.String toString()
Returns string representation of this message ([PING|PONG] (TTL)).

Overrides:
toString in class java.lang.Object