com.tibbo.aggregate.common.datatable.encoding

## Class AbstractFormatCache

- java.lang.Object
- - com.tibbo.aggregate.common.datatable.encoding.AbstractFormatCache

- All Implemented Interfaces:
    FormatCache
  Direct Known Subclasses:
    LocalFormatCache, RemoteFormatCache

      public abstract class AbstractFormatCache
      extends java.lang.Object
      implements FormatCache

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.Integer,TableFormat>` | `cache`
    `protected java.util.concurrent.locks.ReentrantReadWriteLock` | `cacheLock`
    `protected java.util.Map<TableFormat,java.lang.Integer>` | `reverse`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractFormatCache(java.lang.String name)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract java.lang.Integer` | `add(TableFormat tableFormat)`
    `java.lang.Integer` | `addIfNotExists(TableFormat format)`
    `protected TableFormat` | `addImpl(TableFormat format, int id)`
    `void` | `clear()`
    `TableFormat` | `get(int id)`
    `TableFormat` | `getCachedVersion(TableFormat format)`
    `java.lang.String` | `getName()`
    `int` | `getSize()`
    `protected java.lang.Integer` | `obtainId(TableFormat format)`
    `void` | `put(int id, TableFormat format)`

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

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

- - ### Field Detail

    - #### cache

          protected final java.util.Map<java.lang.Integer,TableFormat> cache

    - #### reverse

          protected final java.util.Map<TableFormat,java.lang.Integer> reverse

    - #### cacheLock

          protected final java.util.concurrent.locks.ReentrantReadWriteLock cacheLock

  - ### Constructor Detail

    - #### AbstractFormatCache

          public AbstractFormatCache(java.lang.String name)

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Specified by:
        `getName` in interface `FormatCache`

    - #### getSize

          public int getSize()

    - #### get

          public TableFormat get(int id)

      Specified by:
        `get` in interface `FormatCache`

    - #### addImpl

          protected TableFormat addImpl(TableFormat format,
                                        int id)

    - #### addIfNotExists

          public java.lang.Integer addIfNotExists(TableFormat format)

      Specified by:
        `addIfNotExists` in interface `FormatCache`

    - #### add

          protected abstract java.lang.Integer add(TableFormat tableFormat)

    - #### obtainId

          protected java.lang.Integer obtainId(TableFormat format)

    - #### getCachedVersion

          public TableFormat getCachedVersion(TableFormat format)

      Specified by:
        `getCachedVersion` in interface `FormatCache`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `FormatCache`

    - #### put

          public void put(int id,
                          TableFormat format)

      Specified by:
        `put` in interface `FormatCache`