KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > util > counters > Counter


1 /*
2  * $Id: Counter.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.util.counters;
12
13 /**
14  * This interface is the interface implemented for all counter types. A Counter can
15  * represent a real counter or a virtual counter that will be computed using one or
16  * more other counters.<br/>
17  * <h3>Real counters</h3>
18  * are counters which represent real values. The user will call methods of such
19  * counters to modify the associated value of the counter.
20  * <h3>Computed counters</h3>
21  * are computed using one or more associated counters. Such counters represent
22  * operations computed on associated counters. Usually, these counters will never be
23  * used directly, but will only used to retrieve the computed values.
24  *
25  * @author <a HREF="mailto:gnt@codehaus.org">Guillaume Nodet</a>
26  * @version $Revision: 3798 $
27  */

28 public interface Counter
29 {
30
31     /**
32      * Accessor for the counter type.
33      *
34      * @return the type of the counter
35      */

36     CounterFactory.Type getType();
37
38     /**
39      * Accessor for the counter's name.
40      *
41      * @return the name of the counter
42      */

43     String JavaDoc getName();
44
45     /**
46      * Increment the counter's value by 1.0.
47      *
48      * @return the new value of the counter
49      */

50     double increment();
51
52     /**
53      * Increment the counter's value by the specified amount.
54      *
55      * @param value the amount to increment the counter by
56      * @return the new value of the counter
57      */

58     double incrementBy(double value);
59
60     /**
61      * Decrement the counter's value by 1.0.
62      *
63      * @return the new value of the counter
64      */

65     double decrement();
66
67     /**
68      * Set the counter's value to a new value.
69      *
70      * @param value the new value of the counter
71      */

72     void setRawValue(double value);
73
74     /**
75      * Compute and return the value of the counter.
76      *
77      * @return the value of the counter
78      */

79     double nextValue();
80
81 }
82
Popular Tags