pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.statistics.model.aggregation
Class AverageTimePerVisitAggregation

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.component.statistics.model.aggregation.AbstractAggregation
          extended by org.torweg.pulse.component.statistics.model.aggregation.AverageTimePerVisitAggregation
All Implemented Interfaces:
java.io.Serializable, ICount, IHasDuration

@Entity
public class AverageTimePerVisitAggregation
extends AbstractAggregation
implements ICount

Aggregates Visits and stores information about the average time spent on a "per Visit" basis for the set Duration.

Version:
$Revision: 1579 $
Author:
Daniel Dietz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.torweg.pulse.component.statistics.model.aggregation.AbstractAggregation
AbstractAggregation.Hour
 
Field Summary
 
Fields inherited from class org.torweg.pulse.component.statistics.model.aggregation.AbstractAggregation
LOGGER
 
Constructor Summary
protected AverageTimePerVisitAggregation()
          Deprecated. 
  AverageTimePerVisitAggregation(StatisticsServer server, Duration duration)
          Creates a new AverageTimePerVisitAggregation with the given StatisticsServer and the given Duration.
 
Method Summary
 void accumulate(AverageTimePerVisitAggregation aggr)
          Adds the values of the given AverageTimePerVisitAggregation if its Duration lies within the Duration of the current AverageTimePerVisitAggregation.
 boolean aggregate(Visit visit, org.hibernate.Session s)
          Aggregates the given Visit.
 int getCount()
          Returns the Visit-count.
 double getTime()
          Returns the average time in milliseconds per Visit.
protected  void increase()
          Adds 1 to the internal counter counter.
protected  void increaseBy(int i)
          Adds the given integer to the internal counter.
 boolean isAggregateable(Visit visit)
          Test if the given Visit is aggregate-able by this CountryPerVisitAggregation.
 
Methods inherited from class org.torweg.pulse.component.statistics.model.aggregation.AbstractAggregation
getDataResolution, getDuration, getEndMillis, getStartMillis, getStatisticsServer, setDuration, setEndMillis, setStartMillis, setStatisticsServer, toString
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AverageTimePerVisitAggregation

@Deprecated
protected AverageTimePerVisitAggregation()
Deprecated. 

Default constructor for HibernateTM and JAXB.


AverageTimePerVisitAggregation

public AverageTimePerVisitAggregation(StatisticsServer server, Duration duration)
Creates a new AverageTimePerVisitAggregation with the given StatisticsServer and the given Duration.

Parameters:
server - the StatisticsServer
duration - the Duration
Method Detail

getTime

public final double getTime()
Returns the average time in milliseconds per Visit.

Returns:
the time

getCount

public final int getCount()
Returns the Visit-count.

Specified by:
getCount in interface ICount
Returns:
the counter

increase

protected final void increase()
Adds 1 to the internal counter counter.


increaseBy

protected final void increaseBy(int i)
Adds the given integer to the internal counter.

Parameters:
i - an integer
Throws:
java.lang.IllegalArgumentException - if the given i is less than zero

isAggregateable

public final boolean isAggregateable(Visit visit)
Test if the given Visit is aggregate-able by this CountryPerVisitAggregation.

Specified by:
isAggregateable in class AbstractAggregation
Parameters:
visit - the Visit
Returns:
true if and only if this AbstractAggregation can process the given Visit, false otherwise
See Also:
#isAggregateable(org.torweg.pulse.component.statistics.model.Visit)

aggregate

public final boolean aggregate(Visit visit,
                               org.hibernate.Session s)
Aggregates the given Visit.

Specified by:
aggregate in class AbstractAggregation
Parameters:
visit - the Visit
s - the Session UNUSED
Returns:
true if and only if the Visit has been processed, false otherwise
See Also:
#aggregate(org.torweg.pulse.component.statistics.model.Visit)

accumulate

public final void accumulate(AverageTimePerVisitAggregation aggr)
Adds the values of the given AverageTimePerVisitAggregation if its Duration lies within the Duration of the current AverageTimePerVisitAggregation.

Parameters:
aggr - the AverageTimePerVisitAggregation
Throws:
java.lang.NullPointerException - if the given AverageTimePerVisitAggregation is null
java.lang.IllegalArgumentException - if the Duration of the given AverageTimePerVisitAggregation does not lie within the Duration of the current AverageTimePerVisitAggregation