CounterContext.ContextState (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.db.context

## Class CounterContext.ContextState

- java.lang.Object
- - org.apache.cassandra.db.context.CounterContext.ContextState

- Enclosing class:
    CounterContext

      public static class CounterContext.ContextState
      extends java.lang.Object

  Helper class to work on contexts (works by iterating over them). A context being abstractly a list of tuple (counterid, clock, count), a ContextState encapsulate a context and a position to one of the tuple. It also allow to create new context iteratively. Note: this is intrinsically a private class intended for use by the methods of CounterContext only. It is however public because it is convenient to create handcrafted context for unit tests.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.nio.ByteBuffer` | `context`
    `int` | `headerLength`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CounterContext.ContextState` | `allocate(int globalCount, int localCount, int remoteCount)` Allocate a new context big enough for globalCount + localCount + remoteCount elements and return the initial corresponding ContextState.
    `int` | `compareIdTo(CounterContext.ContextState other)`
    `void` | `copyTo(CounterContext.ContextState other)`
    `long` | `getClock()`
    `long` | `getCount()`
    `CounterId` | `getCounterId()`
    `int` | `getElementIndex()`
    `boolean` | `hasRemaining()`
    `boolean` | `isGlobal()`
    `boolean` | `isLocal()`
    `boolean` | `isRemote()`
    `void` | `moveToNext()`
    `void` | `reset()`
    `static CounterContext.ContextState` | `wrap(java.nio.ByteBuffer context)`
    `void` | `writeGlobal(CounterId id, long clock, long count)`
    `void` | `writeLocal(CounterId id, long clock, long count)`
    `void` | `writeRemote(CounterId id, long clock, long count)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### context

          public final java.nio.ByteBuffer context

    - #### headerLength

          public final int headerLength

  - ### Method Detail

    - #### wrap

          public static CounterContext.ContextState wrap(java.nio.ByteBuffer context)

    - #### allocate

          public static CounterContext.ContextState allocate(int globalCount,
                                                             int localCount,
                                                             int remoteCount)

      Allocate a new context big enough for globalCount + localCount + remoteCount elements and return the initial corresponding ContextState.

    - #### isGlobal

          public boolean isGlobal()

    - #### isLocal

          public boolean isLocal()

    - #### isRemote

          public boolean isRemote()

    - #### hasRemaining

          public boolean hasRemaining()

    - #### moveToNext

          public void moveToNext()

    - #### copyTo

          public void copyTo(CounterContext.ContextState other)

    - #### compareIdTo

          public int compareIdTo(CounterContext.ContextState other)

    - #### reset

          public void reset()

    - #### getElementIndex

          public int getElementIndex()

    - #### getCounterId

          public CounterId getCounterId()

    - #### getClock

          public long getClock()

    - #### getCount

          public long getCount()

    - #### writeGlobal

          public void writeGlobal(CounterId id,
                                  long clock,
                                  long count)

    - #### writeLocal

          public void writeLocal(CounterId id,
                                 long clock,
                                 long count)

    - #### writeRemote

          public void writeRemote(CounterId id,
                                  long clock,
                                  long count)

Copyright © 2018 The Apache Software Foundation