Package io.debezium.crdt
Class StateBasedPNDeltaCounter
- java.lang.Object
-
- io.debezium.crdt.StateBasedPNCounter
-
- io.debezium.crdt.StateBasedPNDeltaCounter
-
- All Implemented Interfaces:
Count,DeltaCount,DeltaCounter,GCount,GCounter,PNCount,PNCounter
@NotThreadSafe class StateBasedPNDeltaCounter extends StateBasedPNCounter implements DeltaCounter
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStateBasedPNDeltaCounter()protectedStateBasedPNDeltaCounter(long totalAdds, long totalRemoves, long recentAdds, long recentRemoves)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeltaCounterdecrement()Decrement the counter and get the result.longdecrementAndGet()Decrement the counter and get the result.longgetAndDecrement()Decrement the counter and get the result.longgetAndIncrement()Increment the counter and get the result.PNCountgetChanges()Get the changes in the current value during the last interval.CountgetPriorCount()Get the value of this count prior to thechanges.booleanhasChanges()Determine if there are any changes in this count.DeltaCounterincrement()Increment the counter and get the result.longincrementAndGet()Increment the counter and get the result.DeltaCountermerge(Count other)Merge the supplied counter into this counter.voidreset()Start a new interval and reset theDeltaCount.getChanges()to initial values.StringtoString()-
Methods inherited from class io.debezium.crdt.StateBasedPNCounter
get, getDecrement, getIncrement
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.debezium.crdt.GCount
getIncrement
-
Methods inherited from interface io.debezium.crdt.PNCount
get, getDecrement
-
-
-
-
Field Detail
-
delta
private PNCounter delta
-
-
Method Detail
-
increment
public DeltaCounter increment()
Description copied from interface:PNCounterIncrement the counter and get the result.- Specified by:
incrementin interfaceDeltaCounter- Specified by:
incrementin interfaceGCounter- Specified by:
incrementin interfacePNCounter- Overrides:
incrementin classStateBasedPNCounter- Returns:
- this instance so methods can be chained together; never null
-
decrement
public DeltaCounter decrement()
Description copied from interface:PNCounterDecrement the counter and get the result.- Specified by:
decrementin interfaceDeltaCounter- Specified by:
decrementin interfacePNCounter- Overrides:
decrementin classStateBasedPNCounter- Returns:
- this instance so methods can be chained together; never null
-
incrementAndGet
public long incrementAndGet()
Description copied from interface:GCounterIncrement the counter and get the result.- Specified by:
incrementAndGetin interfaceGCounter- Overrides:
incrementAndGetin classStateBasedPNCounter- Returns:
- the current result after incrementing
-
decrementAndGet
public long decrementAndGet()
Description copied from interface:PNCounterDecrement the counter and get the result.- Specified by:
decrementAndGetin interfacePNCounter- Overrides:
decrementAndGetin classStateBasedPNCounter- Returns:
- the current result after decrementing
-
getAndIncrement
public long getAndIncrement()
Description copied from interface:GCounterIncrement the counter and get the result.- Specified by:
getAndIncrementin interfaceGCounter- Overrides:
getAndIncrementin classStateBasedPNCounter- Returns:
- the current result before incrementing
-
getAndDecrement
public long getAndDecrement()
Description copied from interface:PNCounterDecrement the counter and get the result.- Specified by:
getAndDecrementin interfacePNCounter- Overrides:
getAndDecrementin classStateBasedPNCounter- Returns:
- the current result before decrementing
-
getChanges
public PNCount getChanges()
Description copied from interface:DeltaCountGet the changes in the current value during the last interval.- Specified by:
getChangesin interfaceDeltaCount- Returns:
- the changes in the value during the last interval; never null
-
hasChanges
public boolean hasChanges()
Description copied from interface:DeltaCountDetermine if there are any changes in this count.- Specified by:
hasChangesin interfaceDeltaCount- Returns:
trueif there are non-zerochanges, orfalseotherwise
-
getPriorCount
public Count getPriorCount()
Description copied from interface:DeltaCountGet the value of this count prior to thechanges.- Specified by:
getPriorCountin interfaceDeltaCount- Returns:
- the prior count; never null
-
reset
public void reset()
Description copied from interface:DeltaCounterStart a new interval and reset theDeltaCount.getChanges()to initial values.- Specified by:
resetin interfaceDeltaCounter
-
merge
public DeltaCounter merge(Count other)
Description copied from interface:PNCounterMerge the supplied counter into this counter.- Specified by:
mergein interfaceDeltaCounter- Specified by:
mergein interfaceGCounter- Specified by:
mergein interfacePNCounter- Overrides:
mergein classStateBasedPNCounter- Parameters:
other- the other counter to merge into this one; may be null- Returns:
- this counter so that methods can be chained
-
toString
public String toString()
- Overrides:
toStringin classStateBasedPNCounter
-
-