org.modeshape.jcr.index.local

## Class MapDB.LocalTuple2KeySerializer<A,B>

- java.lang.Object
- - org.mapdb.BTreeKeySerializer<org.mapdb.Fun.Tuple2<A,B>>
  - - org.modeshape.jcr.index.local.MapDB.LocalTuple2KeySerializer<A,B>

- Type Parameters:
    `A` - first tuple value
    `B` - second tuple value
  All Implemented Interfaces:
    Serializable
  Enclosing class:
    MapDB

      protected static final class MapDB.LocalTuple2KeySerializer<A,B>
      extends org.mapdb.BTreeKeySerializer<org.mapdb.Fun.Tuple2<A,B>>
      implements Serializable

  Applies delta compression on array of tuple. First tuple value may be shared between consequentive tuples, so only first occurrence is serialized. An example:

           Value            Serialized as
           -------------------------
           Tuple(1, 1)       1, 1
           Tuple(1, 2)          2
           Tuple(1, 3)          3
           Tuple(1, 4)          4

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.mapdb.BTreeKeySerializer

      `org.mapdb.BTreeKeySerializer.BasicKeySerializer, org.mapdb.BTreeKeySerializer.Tuple2KeySerializer<A,B>, org.mapdb.BTreeKeySerializer.Tuple3KeySerializer<A,B,C>, org.mapdb.BTreeKeySerializer.Tuple4KeySerializer<A,B,C,D>, org.mapdb.BTreeKeySerializer.Tuple5KeySerializer<A,B,C,D,E>, org.mapdb.BTreeKeySerializer.Tuple6KeySerializer<A,B,C,D,E,F>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Comparator<A>` | `aComparator`
    `protected org.mapdb.Serializer<A>` | `aSerializer`
    `protected org.mapdb.Serializer<B>` | `bSerializer`
    `protected Comparator<org.mapdb.Fun.Tuple2<A,B>>` | `comparator`

    - ### Fields inherited from class org.mapdb.BTreeKeySerializer

      `BASIC, STRING, TUPLE2, TUPLE3, TUPLE4, ZERO_OR_POSITIVE_INT, ZERO_OR_POSITIVE_LONG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapDB.LocalTuple2KeySerializer(Comparator<A> aComparator, org.mapdb.Serializer<A> aSerializer, org.mapdb.Serializer<B> bSerializer, Comparator<org.mapdb.Fun.Tuple2<A,B>> comparator)` Construct new Tuple2 Key Serializer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object[]` | `deserialize(DataInput in, int start, int end, int size)`
    `boolean` | `equals(Object o)`
    `Comparator<org.mapdb.Fun.Tuple2<A,B>>` | `getComparator()`
    `int` | `hashCode()`
    `void` | `serialize(DataOutput out, int start, int end, Object[] keys)`

    - ### Methods inherited from class org.mapdb.BTreeKeySerializer

      `leadingValuePackRead, leadingValuePackWrite`

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

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

- - ### Field Detail

    - #### aComparator

          protected final Comparator<A> aComparator

    - #### aSerializer

          protected final org.mapdb.Serializer<A> aSerializer

    - #### bSerializer

          protected final org.mapdb.Serializer<B> bSerializer

    - #### comparator

          protected final Comparator<org.mapdb.Fun.Tuple2<A,B>> comparator

  - ### Constructor Detail

    - #### MapDB.LocalTuple2KeySerializer

          public MapDB.LocalTuple2KeySerializer(Comparator<A> aComparator,
                                        org.mapdb.Serializer<A> aSerializer,
                                        org.mapdb.Serializer<B> bSerializer,
                                        Comparator<org.mapdb.Fun.Tuple2<A,B>> comparator)

      Construct new Tuple2 Key Serializer. You may pass null for some value, In that case 'default' value will be used, Comparable comparator and Default Serializer from DB.
      Parameters:
        `aComparator` - comparator used for first tuple value
        `aSerializer` - serializer used for first tuple value
        `bSerializer` - serializer used for second tuple value
        `comparator` - the comparator for the tuple

  - ### Method Detail

    - #### serialize

          public void serialize(DataOutput out,
                       int start,
                       int end,
                       Object[] keys)
                         throws IOException

      Specified by:
        `serialize` in class `org.mapdb.BTreeKeySerializer<org.mapdb.Fun.Tuple2<A,B>>`
      Throws:
        `IOException`

    - #### deserialize

          public Object[] deserialize(DataInput in,
                             int start,
                             int end,
                             int size)
                               throws IOException

      Specified by:
        `deserialize` in class `org.mapdb.BTreeKeySerializer<org.mapdb.Fun.Tuple2<A,B>>`
      Throws:
        `IOException`

    - #### getComparator

          public Comparator<org.mapdb.Fun.Tuple2<A,B>> getComparator()

      Specified by:
        `getComparator` in class `org.mapdb.BTreeKeySerializer<org.mapdb.Fun.Tuple2<A,B>>`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.