public class TokenPairCount extends Pair<String> implements ReadWriteable
Modifier and Type | Field and Description |
---|---|
boolean |
isSingle |
long |
paircount
Number of times this pair appears together
|
Constructor and Description |
---|
TokenPairCount() |
TokenPairCount(String tok1) |
TokenPairCount(String tok1,
String tok2) |
Modifier and Type | Method and Description |
---|---|
void |
add(TokenPairCount that) |
String |
asciiHeader()
Header for ascii input.
|
byte[] |
binaryHeader()
Header for binary input.
|
String |
identifier() |
String |
identifier(long time) |
byte[] |
identifierBinary(long time)
Generate a byte array identifier with some time stamp included.
|
static IndependentPair<Long,TokenPairCount> |
parseTimeTokenID(String string)
Given a string, extract the time and TokenPairCount assuming the format:
time + TokenPairCount#TIMESPLIT +
identifier() |
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
static long |
timeFromBinaryIdentity(byte[] bytes) |
static long |
timeFromBinaryIdentity(byte[] bytes,
int start,
int length) |
String |
toString() |
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
equals, firstObject, getFirst, getFirstFunction, getFirstObject, getSecond, getSecondFunction, getSecondObject, pair, pairList, secondObject, setFirstObject, setSecondObject, swap, swapList
public long paircount
public boolean isSingle
public TokenPairCount()
public TokenPairCount(String tok1, String tok2)
tok1
- tok2
- public TokenPairCount(String tok1)
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic void add(TokenPairCount that)
public String identifier()
public void readASCII(Scanner in) throws IOException
ReadableASCII
readASCII
in interface ReadableASCII
in
- source to read from.IOException
- an error reading inputpublic String asciiHeader()
ReadableASCII
asciiHeader
in interface ReadableASCII
asciiHeader
in interface WriteableASCII
public void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
out
- sink to write toIOException
- an error writing to outpublic static IndependentPair<Long,TokenPairCount> parseTimeTokenID(String string) throws IOException
identifier()
string
- IOException
public String identifier(long time)
public byte[] identifierBinary(long time) throws IOException
writeBinary(DataOutput)
time
- TokenPairCount
IOException
public static long timeFromBinaryIdentity(byte[] bytes) throws IOException
IOException
public static long timeFromBinaryIdentity(byte[] bytes, int start, int length) throws IOException
IOException