Package org.rcsb.cif.binary.encoding
Class RunLengthEncoding
java.lang.Object
org.rcsb.cif.binary.encoding.RunLengthEncoding
- All Implemented Interfaces:
Encoding<IntArray,Int32Array>
public class RunLengthEncoding extends Object implements Encoding<IntArray,Int32Array>
Represents each integer value in the input as a pair of (value, number of repeats) and stores the result
sequentially as Int32Array. Additionally, stores the size of the original array to make decoding
easier.
RunLength {
kind = "RunLength"
srcType: int[]
srcSize: number
}
Example
[1, 1, 1, 2, 3, 3]
---RunLength--->
{ srcSize = 6 } [1, 3, 2, 1, 3, 2]
-
Constructor Summary
Constructors Constructor Description RunLengthEncoding()RunLengthEncoding(int srcType, int srcSize) -
Method Summary
Modifier and Type Method Description IntArraydecode(Int32Array data)Move one step up the encoding deque.Int32Arrayencode(IntArray data)Move one step down the encoding deque.Map<String,Object>getMapRepresentation()Converts this encoding to its map representation that can be serialized as BinaryCif.StringtoString()
-
Constructor Details
-
RunLengthEncoding
public RunLengthEncoding() -
RunLengthEncoding
public RunLengthEncoding(int srcType, int srcSize)
-
-
Method Details
-
getMapRepresentation
Description copied from interface:EncodingConverts this encoding to its map representation that can be serialized as BinaryCif.- Specified by:
getMapRepresentationin interfaceEncoding<IntArray,Int32Array>- Returns:
- a Map that contains all encoding information
-
decode
Description copied from interface:EncodingMove one step up the encoding deque. One step closer to the original representation of the data.- Specified by:
decodein interfaceEncoding<IntArray,Int32Array>- Parameters:
data- the container to decode- Returns:
- the decoded information
-
encode
Description copied from interface:EncodingMove one step down the encoding deque. One step closer to aByteArrayrepresentation.- Specified by:
encodein interfaceEncoding<IntArray,Int32Array>- Parameters:
data- the container to encode- Returns:
- the decoded information
-
toString
-