Package com.googlecode.javaewah
Class RunningLengthWord
- java.lang.Object
-
- com.googlecode.javaewah.RunningLengthWord
-
- All Implemented Interfaces:
java.lang.Cloneable
public final class RunningLengthWord extends java.lang.Object implements java.lang.CloneableMostly for internal use.- Since:
- 0.1.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BufferbufferThe array of words.static intLARGEST_LITERAL_COUNTlargest number of literal words in a run.static longLARGEST_RUNNING_LENGTH_COUNTlargest number of clean words in a runprivate static intLITERAL_BITSprivate static longNOT_RUNNING_LENGTH_PLUS_RUNNING_BITprivate static longNOT_SHIFTED_LARGEST_RUNNING_LENGTH_COUNT(package private) intpositionThe position in array.static intRUNNING_LENGTH_BITSnumber of bits dedicated to marking of the running length of clean wordsprivate static longRUNNING_LENGTH_PLUS_RUNNING_BITprivate static longSHIFTED_LARGEST_RUNNING_LENGTH_COUNT
-
Constructor Summary
Constructors Constructor Description RunningLengthWord(Buffer buffer, int p)Instantiates a new running length word.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RunningLengthWordclone()intgetNumberOfLiteralWords()Gets the number of literal words.(package private) static intgetNumberOfLiteralWords(Buffer buffer, int position)booleangetRunningBit()Gets the running bit.(package private) static booleangetRunningBit(Buffer buffer, int position)longgetRunningLength()Gets the running length.(package private) static longgetRunningLength(Buffer buffer, int position)voidsetNumberOfLiteralWords(long number)Sets the number of literal words.(package private) static voidsetNumberOfLiteralWords(Buffer buffer, int position, long number)voidsetRunningBit(boolean b)Sets the running bit.(package private) static voidsetRunningBit(Buffer buffer, int position, boolean b)voidsetRunningLength(long number)Sets the running length.(package private) static voidsetRunningLength(Buffer buffer, int position, long number)longsize()Return the size in uncompressed words represented by this running length word.java.lang.StringtoString()
-
-
-
Field Detail
-
buffer
final Buffer buffer
The array of words.
-
position
int position
The position in array.
-
RUNNING_LENGTH_BITS
public static final int RUNNING_LENGTH_BITS
number of bits dedicated to marking of the running length of clean words- See Also:
- Constant Field Values
-
LITERAL_BITS
private static final int LITERAL_BITS
- See Also:
- Constant Field Values
-
LARGEST_LITERAL_COUNT
public static final int LARGEST_LITERAL_COUNT
largest number of literal words in a run.- See Also:
- Constant Field Values
-
LARGEST_RUNNING_LENGTH_COUNT
public static final long LARGEST_RUNNING_LENGTH_COUNT
largest number of clean words in a run- See Also:
- Constant Field Values
-
RUNNING_LENGTH_PLUS_RUNNING_BIT
private static final long RUNNING_LENGTH_PLUS_RUNNING_BIT
- See Also:
- Constant Field Values
-
SHIFTED_LARGEST_RUNNING_LENGTH_COUNT
private static final long SHIFTED_LARGEST_RUNNING_LENGTH_COUNT
- See Also:
- Constant Field Values
-
NOT_RUNNING_LENGTH_PLUS_RUNNING_BIT
private static final long NOT_RUNNING_LENGTH_PLUS_RUNNING_BIT
- See Also:
- Constant Field Values
-
NOT_SHIFTED_LARGEST_RUNNING_LENGTH_COUNT
private static final long NOT_SHIFTED_LARGEST_RUNNING_LENGTH_COUNT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RunningLengthWord
RunningLengthWord(Buffer buffer, int p)
Instantiates a new running length word.- Parameters:
buffer- the bufferp- position in the buffer where the running length word is located.
-
-
Method Detail
-
getNumberOfLiteralWords
public int getNumberOfLiteralWords()
Gets the number of literal words.- Returns:
- the number of literal words
-
getNumberOfLiteralWords
static int getNumberOfLiteralWords(Buffer buffer, int position)
-
getRunningBit
public boolean getRunningBit()
Gets the running bit.- Returns:
- the running bit
-
getRunningBit
static boolean getRunningBit(Buffer buffer, int position)
-
getRunningLength
public long getRunningLength()
Gets the running length.- Returns:
- the running length
-
getRunningLength
static long getRunningLength(Buffer buffer, int position)
-
setNumberOfLiteralWords
public void setNumberOfLiteralWords(long number)
Sets the number of literal words.- Parameters:
number- the new number of literal words
-
setNumberOfLiteralWords
static void setNumberOfLiteralWords(Buffer buffer, int position, long number)
-
setRunningBit
public void setRunningBit(boolean b)
Sets the running bit.- Parameters:
b- the new running bit
-
setRunningBit
static void setRunningBit(Buffer buffer, int position, boolean b)
-
setRunningLength
public void setRunningLength(long number)
Sets the running length.- Parameters:
number- the new running length
-
setRunningLength
static void setRunningLength(Buffer buffer, int position, long number)
-
size
public long size()
Return the size in uncompressed words represented by this running length word.- Returns:
- the size
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
public RunningLengthWord clone() throws java.lang.CloneNotSupportedException
- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-