net.sourceforge.cobertura.metrics.api.event
Class AbstractSourceLocationListener

java.lang.Object
  extended by net.sourceforge.cobertura.metrics.api.event.AbstractSourceLocationListener
All Implemented Interfaces:
SourceLocationListener

public abstract class AbstractSourceLocationListener
extends Object
implements SourceLocationListener

Abstract implementation of the SourceLocationListener specification, used to provide a base for subclassing.

Author:
Lennart Jörelid, jGuru Europe AB

Constructor Summary
AbstractSourceLocationListener()
           
 
Method Summary
 void addExecutionStep(SourceLocation location)
          Adds 1 to the recorded execution steps ("hits"/"touches") to the supplied SourceLocation.
 void addExecutionSteps(SourceLocation location, int numSteps)
          Adds a given number of execution steps ("hits"/"touches") to the supplied SourceLocation.
protected abstract  void addInternalExecutionSteps(SourceLocation nonNullLocation, int positiveNumSteps)
          Adds a given number of execution steps ("hits"/"touches") to the supplied SourceLocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSourceLocationListener

public AbstractSourceLocationListener()
Method Detail

addExecutionSteps

public void addExecutionSteps(SourceLocation location,
                              int numSteps)
Adds a given number of execution steps ("hits"/"touches") to the supplied SourceLocation. The addExecutionSteps method should be implemented to be atomic/synchronized, in regards to the data state it updates.

Specified by:
addExecutionSteps in interface SourceLocationListener
Parameters:
location - The SourceLocation where 1 execution step should be added. Cannot be null.
numSteps - The number of execution steps to add to the supplied SourceLocation. Cannot be less than 1.

addInternalExecutionSteps

protected abstract void addInternalExecutionSteps(SourceLocation nonNullLocation,
                                                  int positiveNumSteps)
Adds a given number of execution steps ("hits"/"touches") to the supplied SourceLocation.

The addInternalExecutionSteps method should be implemented to be atomic/synchronized, in regards to the data it updates. In plain english, the data updated by this SourceLocationListener must fully change its internal storage state before this method returns.

Parameters:
nonNullLocation - The SourceLocation where 1 execution step should be added. Guaranteed never to be null.
positiveNumSteps - The number of execution steps to add to the supplied SourceLocation. Guaranteed not to be negative.

addExecutionStep

public final void addExecutionStep(SourceLocation location)
Adds 1 to the recorded execution steps ("hits"/"touches") to the supplied SourceLocation. The addExecutionStep method should be implemented to be atomic/synchronized, in regards to the data state it updates.

Specified by:
addExecutionStep in interface SourceLocationListener
Parameters:
location - The SourceLocation where 1 execution step should be added. Cannot be null.


Copyright © 2013–2015 Cobertura. All rights reserved.