JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.tracing
Class SimpleCountingWrapper

java.lang.Object
  |
  +--org.objectweb.jac.core.Wrapper
        |
        +--org.objectweb.jac.aspects.tracing.SimpleCountingWrapper
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
OptimizedCountingWrapper

public class SimpleCountingWrapper
extends Wrapper

This simple counter must wrap the methods of which calls have to be counted.

In some cases, optimizations can be achieved by grouping counts. See OptimizedCountingWrapper.

See Also:
OptimizedCountingWrapper, Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jac.core.Wrapper
ac
 
Constructor Summary
SimpleCountingWrapper(AspectComponent ac, Counter counter)
          Creates a new wrapper that uses the given counter.
 
Method Summary
 int getCounter()
          Role method: get the counter value.
 Object incr(Interaction interaction)
          This wrapping method increments the counter when the wrapped method is called.
 void printCounter()
          Prints the counter in System.out.
 void setCounter(int value)
          Role method: set the counter value.
 
Methods inherited from class org.objectweb.jac.core.Wrapper
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed, setAspectComponent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleCountingWrapper

public SimpleCountingWrapper(AspectComponent ac,
                             Counter counter)
Creates a new wrapper that uses the given counter.

Parameters:
counter - the counter
Method Detail

incr

public Object incr(Interaction interaction)
This wrapping method increments the counter when the wrapped method is called.

Returns:
the return value of the wrapped method

setCounter

public void setCounter(int value)
Role method: set the counter value.

Parameters:
value - the new counter value
See Also:
getCounter(), incr(Interaction)

getCounter

public int getCounter()
Role method: get the counter value.

Returns:
the counter value
See Also:
setCounter(int), incr(Interaction)

printCounter

public void printCounter()
Prints the counter in System.out.


Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli