org.terracotta.statistics
Class StatisticMapper<SOURCE extends Enum<SOURCE>,TARGET extends Enum<TARGET>>

java.lang.Object
  extended by org.terracotta.statistics.StatisticMapper<SOURCE,TARGET>
All Implemented Interfaces:
OperationObserver<TARGET>, OperationStatistic<TARGET>, SourceStatistic<ChainedOperationObserver<? super TARGET>>

public class StatisticMapper<SOURCE extends Enum<SOURCE>,TARGET extends Enum<TARGET>>
extends Object
implements OperationStatistic<TARGET>


Constructor Summary
StatisticMapper(Map<TARGET,Set<SOURCE>> translation, OperationStatistic<SOURCE> statistic)
           
 
Method Summary
 void addDerivedStatistic(ChainedOperationObserver<? super TARGET> derived)
          Register the given Observer to be called by this SourceStatistic
 void begin()
          Called immediately prior to the operation beginning.
 long count(TARGET type)
          Return the count of operations with the given type.
 void end(TARGET result)
          Called immediately after the operation completes with no interesting parameters.
 void end(TARGET result, long... parameters)
          Called immediately after the operation completes.
 void removeDerivedStatistic(ChainedOperationObserver<? super TARGET> derived)
          Remove the given registered Observer from this SourceStatistic.
 ValueStatistic<Long> statistic(Set<TARGET> results)
           
 ValueStatistic<Long> statistic(TARGET result)
          Return a ValueStatistic returning the count for the given result.
 long sum()
           
 long sum(Set<TARGET> types)
           
 Class<TARGET> type()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticMapper

public StatisticMapper(Map<TARGET,Set<SOURCE>> translation,
                       OperationStatistic<SOURCE> statistic)
Method Detail

type

public Class<TARGET> type()
Specified by:
type in interface OperationStatistic<TARGET extends Enum<TARGET>>

statistic

public ValueStatistic<Long> statistic(TARGET result)
Description copied from interface: OperationStatistic
Return a ValueStatistic returning the count for the given result.

Specified by:
statistic in interface OperationStatistic<TARGET extends Enum<TARGET>>
Parameters:
result - the result of interest
Returns:
a ValueStatistic instance

statistic

public ValueStatistic<Long> statistic(Set<TARGET> results)
Specified by:
statistic in interface OperationStatistic<TARGET extends Enum<TARGET>>

count

public long count(TARGET type)
Description copied from interface: OperationStatistic
Return the count of operations with the given type.

Specified by:
count in interface OperationStatistic<TARGET extends Enum<TARGET>>
Parameters:
type - the result type
Returns:
the operation count

sum

public long sum(Set<TARGET> types)
Specified by:
sum in interface OperationStatistic<TARGET extends Enum<TARGET>>

sum

public long sum()
Specified by:
sum in interface OperationStatistic<TARGET extends Enum<TARGET>>

addDerivedStatistic

public void addDerivedStatistic(ChainedOperationObserver<? super TARGET> derived)
Description copied from interface: SourceStatistic
Register the given Observer to be called by this SourceStatistic

Specified by:
addDerivedStatistic in interface SourceStatistic<ChainedOperationObserver<? super TARGET extends Enum<TARGET>>>
Parameters:
derived - statistic to be registered

removeDerivedStatistic

public void removeDerivedStatistic(ChainedOperationObserver<? super TARGET> derived)
Description copied from interface: SourceStatistic
Remove the given registered Observer from this SourceStatistic.

Specified by:
removeDerivedStatistic in interface SourceStatistic<ChainedOperationObserver<? super TARGET extends Enum<TARGET>>>
Parameters:
derived - statistic to be removed

begin

public void begin()
Description copied from interface: OperationObserver
Called immediately prior to the operation beginning.

Specified by:
begin in interface OperationObserver<TARGET extends Enum<TARGET>>

end

public void end(TARGET result)
Description copied from interface: OperationObserver
Called immediately after the operation completes with no interesting parameters.

Specified by:
end in interface OperationObserver<TARGET extends Enum<TARGET>>
Parameters:
result - the operation result

end

public void end(TARGET result,
                long... parameters)
Description copied from interface: OperationObserver
Called immediately after the operation completes.

Specified by:
end in interface OperationObserver<TARGET extends Enum<TARGET>>
Parameters:
result - the operation result
parameters - the operation parameters


Copyright © 2017. All rights reserved.