EMMA Coverage Report (generated Tue Dec 20 11:01:01 KST 2005)
[all classes][org.apache.mina.examples.tennis]

COVERAGE SUMMARY FOR SOURCE FILE [TennisBall.java]

nameclass, %method, %block, %line, %
TennisBall.java0%   (0/1)0%   (0/5)0%   (0/58)0%   (0/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TennisBall0%   (0/1)0%   (0/5)0%   (0/58)0%   (0/11)
TennisBall (int): void 0%   (0/1)0%   (0/5)0%   (0/2)
TennisBall (int, boolean): void 0%   (0/1)0%   (0/9)0%   (0/4)
getTTL (): int 0%   (0/1)0%   (0/3)0%   (0/1)
stroke (): TennisBall 0%   (0/1)0%   (0/14)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/3)

1/*
2 * @(#) $Id: TennisBall.java 357871 2005-12-20 01:56:40Z trustin $
3 */
4package org.apache.mina.examples.tennis;
5 
6/**
7 * A tennis ball which has TTL value and state whose value is one of 'PING' and
8 * 'PONG'.
9 * 
10 * @author The Apache Directory Project (dev@directory.apache.org)
11 * @version $Rev: 357871 $, $Date: 2005-12-20 10:56:40 +0900 (Tue, 20 Dec 2005) $
12 */
13public class TennisBall
14{
15    private final boolean ping;
16 
17    private final int ttl;
18 
19    /**
20     * Creates a new ball with the specified TTL (Time To Live) value.
21     */
22    public TennisBall( int ttl )
23    {
24        this( ttl, true );
25    }
26 
27    /**
28     * Creates a new ball with the specified TTL value and PING/PONG state.
29     */
30    private TennisBall( int ttl, boolean ping )
31    {
32        this.ttl = ttl;
33        this.ping = ping;
34    }
35 
36    /**
37     * Returns the TTL value of this ball.
38     */
39    public int getTTL()
40    {
41        return ttl;
42    }
43 
44    /**
45     * Returns the ball after {@link TennisPlayer}'s stroke.
46     * The returned ball has decreased TTL value and switched PING/PONG state.
47     */
48    public TennisBall stroke()
49    {
50        return new TennisBall( ttl - 1, !ping );
51    }
52 
53    /**
54     * Returns string representation of this message (<code>[PING|PONG]
55     * (TTL)</code>).
56     */
57    public String toString()
58    {
59        if( ping )
60        {
61            return "PING (" + ttl + ")";
62        }
63        else
64        {
65            return "PONG (" + ttl + ")";
66        }
67    }
68}

[all classes][org.apache.mina.examples.tennis]
EMMA 2.0.4217 (C) Vladimir Roubtsov