1 package org.apache.jcs.engine.stats;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.jcs.engine.stats.behavior.IStatElement;
23 import org.apache.jcs.engine.stats.behavior.IStats;
24
25
26 /***
27 * @author aaronsm
28 *
29 */
30 public class Stats
31 implements IStats
32 {
33 private static final long serialVersionUID = 227327902875154010L;
34
35 private IStatElement[] stats = null;
36
37 private String typeName = null;
38
39 /*
40 * (non-Javadoc)
41 *
42 * @see org.apache.jcs.engine.stats.behavior.IStats#getStatElements()
43 */
44 public IStatElement[] getStatElements()
45 {
46 return stats;
47 }
48
49 /*
50 * (non-Javadoc)
51 *
52 * @see org.apache.jcs.engine.stats.behavior.IStats#setStatElements(org.apache.jcs.engine.stats.behavior.IStatElement[])
53 */
54 public void setStatElements( IStatElement[] stats )
55 {
56 this.stats = stats;
57 }
58
59 /*
60 * (non-Javadoc)
61 *
62 * @see org.apache.jcs.engine.stats.behavior.IStats#getTypeName()
63 */
64 public String getTypeName()
65 {
66 return typeName;
67 }
68
69 /*
70 * (non-Javadoc)
71 *
72 * @see org.apache.jcs.engine.stats.behavior.IStats#setTypeName(java.lang.String)
73 */
74 public void setTypeName( String name )
75 {
76 typeName = name;
77 }
78
79 /*
80 * (non-Javadoc)
81 *
82 * @see java.lang.Object#toString()
83 */
84 public String toString()
85 {
86 StringBuffer buf = new StringBuffer();
87
88 buf.append( typeName );
89
90 if ( stats != null )
91 {
92 for ( int i = 0; i < stats.length; i++ )
93 {
94 buf.append( "\n" );
95 buf.append( stats[i] );
96 }
97 }
98
99 return buf.toString();
100 }
101
102 }