KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > profile > PeekValueProfilePoint


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.profile;
9
10 /**
11  * The ProfilPoint interface is to mark objects that can be sampled by a
12  * Profiler. The interface only has one sampling method to simplify the items
13  * that can be sampled.
14  *
15  * @author <a HREF="mailto:bloritsch@apache.org">Berin Loritsch</a>
16  */

17 public class PeekValueProfilePoint extends AbstractProfilePoint
18 {
19     private int m_value = 0;
20
21     /**
22      * Creates a PeekValueProfilePoint with an initial name.
23      */

24     public PeekValueProfilePoint( String JavaDoc name )
25     {
26         super( name );
27     }
28
29     /**
30      * Set the sample value
31      */

32     public void setValue( int currentValue )
33     {
34         if ( currentValue > m_value )
35         {
36             m_value = currentValue;
37         }
38     }
39
40     /**
41      * Obtain the sample. All samples are an integer, so the profiled objects
42      * must measure quantity (numbers of items), rate (items/period), time in
43      * milliseconds, etc.
44      */

45     public int getSample()
46     {
47         return m_value;
48     }
49 }
50
Popular Tags