org.galagosearch.tupleflow
Class Delta

java.lang.Object
  extended by org.galagosearch.tupleflow.Delta

public class Delta
extends java.lang.Object

This class holds helper static methods that help with delta encoding for compression.

To encode 'a', with a previous value of 'b', write:

encode(output, a, b);
and decode as:
a = decode(input, b);

For integers, the order of the integers matters. If the values are ascending, meaning that (last <= current), use encodeAscending/decodeAscending. If the values are descending, meaning that (last >= current), use encodeDescending/decodeAscending.

Author:
trevor

Constructor Summary
Delta()
           
 
Method Summary
static java.lang.String decode(ArrayInput input, java.lang.String last)
           
static int decodeAscending(ArrayInput input, int last)
           
static long decodeAscending(ArrayInput input, long last)
           
static java.lang.String decodeAscending(ArrayInput input, java.lang.String last)
           
static int decodeDescending(ArrayInput input, int last)
           
static long decodeDescending(ArrayInput input, long last)
           
static java.lang.String decodeDescending(ArrayInput input, java.lang.String last)
           
static void encode(ArrayOutput output, java.lang.String current, java.lang.String last)
           
static void encodeAscending(ArrayOutput output, long current, long last)
           
static void encodeAscending(ArrayOutput output, java.lang.String current, java.lang.String last)
           
static void encodeDescending(ArrayOutput output, long current, long last)
           
static void encodeDescending(ArrayOutput output, java.lang.String current, java.lang.String last)
           
static int resetInt()
           
static long resetLong()
           
static java.lang.String resetString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Delta

public Delta()
Method Detail

encodeAscending

public static void encodeAscending(ArrayOutput output,
                                   java.lang.String current,
                                   java.lang.String last)
                            throws java.io.IOException
Throws:
java.io.IOException

encodeDescending

public static void encodeDescending(ArrayOutput output,
                                    java.lang.String current,
                                    java.lang.String last)
                             throws java.io.IOException
Throws:
java.io.IOException

encode

public static void encode(ArrayOutput output,
                          java.lang.String current,
                          java.lang.String last)
                   throws java.io.IOException
Throws:
java.io.IOException

decodeAscending

public static java.lang.String decodeAscending(ArrayInput input,
                                               java.lang.String last)
                                        throws java.io.IOException
Throws:
java.io.IOException

decodeDescending

public static java.lang.String decodeDescending(ArrayInput input,
                                                java.lang.String last)
                                         throws java.io.IOException
Throws:
java.io.IOException

decode

public static java.lang.String decode(ArrayInput input,
                                      java.lang.String last)
                               throws java.io.IOException
Throws:
java.io.IOException

encodeAscending

public static void encodeAscending(ArrayOutput output,
                                   long current,
                                   long last)
                            throws java.io.IOException
Throws:
java.io.IOException

encodeDescending

public static void encodeDescending(ArrayOutput output,
                                    long current,
                                    long last)
                             throws java.io.IOException
Throws:
java.io.IOException

decodeAscending

public static long decodeAscending(ArrayInput input,
                                   long last)
                            throws java.io.IOException
Throws:
java.io.IOException

decodeAscending

public static int decodeAscending(ArrayInput input,
                                  int last)
                           throws java.io.IOException
Throws:
java.io.IOException

decodeDescending

public static long decodeDescending(ArrayInput input,
                                    long last)
                             throws java.io.IOException
Throws:
java.io.IOException

decodeDescending

public static int decodeDescending(ArrayInput input,
                                   int last)
                            throws java.io.IOException
Throws:
java.io.IOException

resetString

public static java.lang.String resetString()

resetInt

public static int resetInt()

resetLong

public static long resetLong()


Copyright © 2009. All Rights Reserved.