EMMA Coverage Report (generated Mon Jul 11 13:15:38 KST 2005)
[all classes][org.apache.mina.common]

COVERAGE SUMMARY FOR SOURCE FILE [BaseSessionConfig.java]

nameclass, %method, %block, %line, %
BaseSessionConfig.java100% (1/1)57%  (4/7)30%  (34/115)38%  (10/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BaseSessionConfig100% (1/1)57%  (4/7)30%  (34/115)38%  (10/26)
getWriteTimeout (): int 0%   (0/1)0%   (0/3)0%   (0/1)
setIdleTime (IdleStatus, int): void 0%   (0/1)0%   (0/48)0%   (0/10)
setWriteTimeout (int): void 0%   (0/1)0%   (0/18)0%   (0/4)
getIdleTime (IdleStatus): int 100% (1/1)60%  (18/30)86%  (6/7)
BaseSessionConfig (): void 100% (1/1)100% (3/3)100% (2/2)
getIdleTimeInMillis (IdleStatus): long 100% (1/1)100% (7/7)100% (1/1)
getWriteTimeoutInMillis (): long 100% (1/1)100% (6/6)100% (1/1)

1/*
2 *   @(#) $Id: BaseSessionConfig.java 210062 2005-07-11 03:52:38Z trustin $
3 *
4 *   Copyright 2004 The Apache Software Foundation
5 *
6 *   Licensed under the Apache License, Version 2.0 (the "License");
7 *   you may not use this file except in compliance with the License.
8 *   You may obtain a copy of the License at
9 *
10 *       http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *   Unless required by applicable law or agreed to in writing, software
13 *   distributed under the License is distributed on an "AS IS" BASIS,
14 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *   See the License for the specific language governing permissions and
16 *   limitations under the License.
17 *
18 */
19package org.apache.mina.common;
20 
21import org.apache.mina.common.IdleStatus;
22import org.apache.mina.common.SessionConfig;
23 
24/**
25 * Base implementation of {@link SessionConfig}s.
26 * 
27 * @author Trustin Lee (trustin@apache.org)
28 * @version $Rev: 210062 $, $Date: 2005-07-11 12:52:38 +0900 $
29 */
30public abstract class BaseSessionConfig implements SessionConfig
31{
32    private int idleTimeForRead;
33 
34    private int idleTimeForWrite;
35 
36    private int idleTimeForBoth;
37 
38    private int writeTimeout;
39 
40    protected BaseSessionConfig()
41    {
42    }
43 
44    public int getIdleTime( IdleStatus status )
45    {
46        if( status == IdleStatus.BOTH_IDLE )
47            return idleTimeForBoth;
48 
49        if( status == IdleStatus.READER_IDLE )
50            return idleTimeForRead;
51 
52        if( status == IdleStatus.WRITER_IDLE )
53            return idleTimeForWrite;
54 
55        throw new IllegalArgumentException( "Unknown idle status: " + status );
56    }
57 
58    public long getIdleTimeInMillis( IdleStatus status )
59    {
60        return getIdleTime( status ) * 1000L;
61    }
62 
63    public void setIdleTime( IdleStatus status, int idleTime )
64    {
65        if( idleTime < 0 )
66            throw new IllegalArgumentException( "Illegal idle time: "
67                                                + idleTime );
68 
69        if( status == IdleStatus.BOTH_IDLE )
70            idleTimeForBoth = idleTime;
71        else if( status == IdleStatus.READER_IDLE )
72            idleTimeForRead = idleTime;
73        else if( status == IdleStatus.WRITER_IDLE )
74            idleTimeForWrite = idleTime;
75        else
76            throw new IllegalArgumentException( "Unknown idle status: "
77                                                + status );
78    }
79 
80    public int getWriteTimeout()
81    {
82        return writeTimeout;
83    }
84 
85    public long getWriteTimeoutInMillis()
86    {
87        return writeTimeout * 1000L;
88    }
89 
90    public void setWriteTimeout( int writeTimeout )
91    {
92        if( writeTimeout < 0 )
93            throw new IllegalArgumentException( "Illegal write timeout: "
94                                                + writeTimeout );
95        this.writeTimeout = writeTimeout;
96    }
97}

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