Coverage Report - org.mule.util.counters.Counter
 
Classes in this File Line Coverage Branch Coverage Complexity
Counter
N/A
N/A
1
 
 1  
 /*
 2  
  * $Id: Counter.java 8077 2007-08-27 20:15:25Z 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 CPAL v1.0
 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  
 public interface Counter
 26  
 {
 27  
 
 28  
     /**
 29  
      * Accessor for the counter type.
 30  
      * 
 31  
      * @return the type of the counter
 32  
      */
 33  
     CounterFactory.Type getType();
 34  
 
 35  
     /**
 36  
      * Accessor for the counter's name.
 37  
      * 
 38  
      * @return the name of the counter
 39  
      */
 40  
     String getName();
 41  
 
 42  
     /**
 43  
      * Increment the counter's value by 1.0.
 44  
      * 
 45  
      * @return the new value of the counter
 46  
      */
 47  
     double increment();
 48  
 
 49  
     /**
 50  
      * Increment the counter's value by the specified amount.
 51  
      * 
 52  
      * @param value the amount to increment the counter by
 53  
      * @return the new value of the counter
 54  
      */
 55  
     double incrementBy(double value);
 56  
 
 57  
     /**
 58  
      * Decrement the counter's value by 1.0.
 59  
      * 
 60  
      * @return the new value of the counter
 61  
      */
 62  
     double decrement();
 63  
 
 64  
     /**
 65  
      * Set the counter's value to a new value.
 66  
      * 
 67  
      * @param value the new value of the counter
 68  
      */
 69  
     void setRawValue(double value);
 70  
 
 71  
     /**
 72  
      * Compute and return the value of the counter.
 73  
      * 
 74  
      * @return the value of the counter
 75  
      */
 76  
     double nextValue();
 77  
 
 78  
 }