org.apache.mina.example.tennis

## Class TennisBall

- java.lang.Object
- - org.apache.mina.example.tennis.TennisBall

-     public class TennisBall
      extends Object

  A tennis ball which has TTL value and state whose value is one of 'PING' and 'PONG'.
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TennisBall(int ttl)` Creates a new ball with the specified TTL (Time To Live) value.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getTTL()` Returns the TTL value of this ball.
    `TennisBall` | `stroke()` Returns the ball after `TennisPlayer`'s stroke.
    `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 String toString()

      Returns string representation of this message (`[PING|PONG] (TTL)`).
      Overrides:
        `toString` in class `Object`

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.