Top Fields Constructors Methods
org.terracotta.statistics

public Class StatisticMapper<SOURCE extends java.lang.Enum<SOURCE>, TARGET extends java.lang.Enum<TARGET>>

extends Object
implements OperationStatistic<TARGET extends Enum<TARGET>>
Class Inheritance
All Implemented Interfaces
org.terracotta.statistics.OperationStatistic, org.terracotta.statistics.SourceStatistic, org.terracotta.statistics.observer.OperationObserver
Imports
org.terracotta.statistics.observer.ChainedOperationObserver, java.util.Collections, .EnumMap, .EnumSet, .Map, .Map.Entry, .Set, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap

Field Summary

Modifier and TypeField and Description
private final ConcurrentMap<ChainedOperationObserver<? super TARGET>, ChainedOperationObserver<SOURCE>>
private final Map<SOURCE, TARGET>
private final Class<SOURCE>
private final OperationStatistic<SOURCE>
private final Class<TARGET>
private final Map<TARGET, Set<SOURCE>>

Constructor Summary

AccessConstructor and Description
public
StatisticMapper(Map<TARGET, Set<SOURCE>> translation, OperationStatistic<SOURCE> statistic)

Method Summary

Modifier and TypeMethod and Description
public void
addDerivedStatistic(final ChainedOperationObserver<? super TARGET>
statistic to be registered
derived
)

Implements org.terracotta.statistics.SourceStatistic.addDerivedStatistic.

Register the given Observer to be called by this SourceStatistic
public void
begin()

Implements org.terracotta.statistics.observer.OperationObserver.begin.

Called immediately prior to the operation beginning.
public long
count(TARGET
the result type
type
)

Implements org.terracotta.statistics.OperationStatistic.count.

Return the count of operations with the given type.
public void
end(TARGET
the operation result
result
)

Implements org.terracotta.statistics.observer.OperationObserver.end.

Called immediately after the operation completes with no interesting parameters.
public void
end(TARGET
the operation result
result
,
long...
the operation parameters
parameters
)

Implements org.terracotta.statistics.observer.OperationObserver.end.

Called immediately after the operation completes.
public void
removeDerivedStatistic(ChainedOperationObserver<? super TARGET>
statistic to be removed
derived
)

Implements org.terracotta.statistics.SourceStatistic.removeDerivedStatistic.

Remove the given registered Observer from this SourceStatistic.
private static <B extends Enum<B>, A extends Enum<A>> Map<B, A>
reverse(Map<A, Set<B>> map)

public ValueStatistic<Long>
statistic(TARGET
the result of interest
result
)

Implements org.terracotta.statistics.OperationStatistic.statistic.

Return a ValueStatistic returning the count for the given result.
public ValueStatistic<Long>
public long
public long
public Class<TARGET>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

derivedStatsback to summary
private final ConcurrentMap<ChainedOperationObserver<? super TARGET>, ChainedOperationObserver<SOURCE>> derivedStats
reverseTranslationback to summary
private final Map<SOURCE, TARGET> reverseTranslation
sourceTypeback to summary
private final Class<SOURCE> sourceType
statisticback to summary
private final OperationStatistic<SOURCE> statistic
targetTypeback to summary
private final Class<TARGET> targetType
translationback to summary
private final Map<TARGET, Set<SOURCE>> translation

Constructor Detail

StatisticMapperback to summary
public StatisticMapper(Map<TARGET, Set<SOURCE>> translation, OperationStatistic<SOURCE> statistic)

Method Detail

addDerivedStatisticback to summary
public void addDerivedStatistic(final ChainedOperationObserver<? super TARGET> derived)

Implements org.terracotta.statistics.SourceStatistic.addDerivedStatistic.

Doc from org.terracotta.statistics.SourceStatistic.addDerivedStatistic.

Register the given Observer to be called by this SourceStatistic

Parameters
derived:ChainedOperationObserver<? super TARGET>

statistic to be registered

Annotations
@Override
beginback to summary
public void begin()

Implements org.terracotta.statistics.observer.OperationObserver.begin.

Doc from org.terracotta.statistics.observer.OperationObserver.begin.

Called immediately prior to the operation beginning.

Annotations
@Override
countback to summary
public long count(TARGET type)

Implements org.terracotta.statistics.OperationStatistic.count.

Doc from org.terracotta.statistics.OperationStatistic.count.

Return the count of operations with the given type.

Parameters
type:TARGET

the result type

Returns:long

the operation count

Annotations
@Override
endback to summary
public void end(TARGET result)

Implements org.terracotta.statistics.observer.OperationObserver.end.

Doc from org.terracotta.statistics.observer.OperationObserver.end.

Called immediately after the operation completes with no interesting parameters.

Parameters
result:TARGET

the operation result

Annotations
@Override
endback to summary
public void end(TARGET result, long... parameters)

Implements org.terracotta.statistics.observer.OperationObserver.end.

Doc from org.terracotta.statistics.observer.OperationObserver.end.

Called immediately after the operation completes.

Parameters
result:TARGET

the operation result

parameters:long[]

the operation parameters

Annotations
@Override
removeDerivedStatisticback to summary
public void removeDerivedStatistic(ChainedOperationObserver<? super TARGET> derived)

Implements org.terracotta.statistics.SourceStatistic.removeDerivedStatistic.

Doc from org.terracotta.statistics.SourceStatistic.removeDerivedStatistic.

Remove the given registered Observer from this SourceStatistic.

Parameters
derived:ChainedOperationObserver<? super TARGET>

statistic to be removed

Annotations
@Override
reverseback to summary
private static <B extends Enum<B>, A extends Enum<A>> Map<B, A> reverse(Map<A, Set<B>> map)
statisticback to summary
public ValueStatistic<Long> statistic(TARGET result)

Implements org.terracotta.statistics.OperationStatistic.statistic.

Doc from org.terracotta.statistics.OperationStatistic.statistic.

Return a ValueStatistic returning the count for the given result.

Parameters
result:TARGET

the result of interest

Returns:ValueStatistic<Long>

a ValueStatistic instance

Annotations
@Override
statisticback to summary
public ValueStatistic<Long> statistic(Set<TARGET> results)

Implements org.terracotta.statistics.OperationStatistic.statistic, org.terracotta.statistics.OperationStatistic.statistic.

Annotations
@Override
sumback to summary
public long sum(Set<TARGET> types)

Implements org.terracotta.statistics.OperationStatistic.sum.

Annotations
@Override
sumback to summary
public long sum()

Implements org.terracotta.statistics.OperationStatistic.sum.

Annotations
@Override
typeback to summary
public Class<TARGET> type()

Implements org.terracotta.statistics.OperationStatistic.type.

Annotations
@Override