public class TweetCountWordMap extends Object implements ReadWriteableBinary
Modifier and Type | Field and Description |
---|---|
static int |
INVALID_TWEET_COUNT
If the ntweets is set to this value, the ntweets should be ignored
|
Constructor and Description |
---|
TweetCountWordMap()
empty words and 0 tweets
|
TweetCountWordMap(int ntweets,
gnu.trove.map.hash.TObjectIntHashMap<String> wordMap) |
Modifier and Type | Method and Description |
---|---|
byte[] |
binaryHeader()
Header for binary input.
|
void |
combine(TweetCountWordMap that)
Add values from "that" to those in this if they exist, otherwise create the element
and start a new count
|
boolean |
equals(Object other) |
long |
getNTweets() |
gnu.trove.map.hash.TObjectIntHashMap<String> |
getTweetWordMap() |
void |
incrementTweetCount(int i) |
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
setNTweets(int ntweets)
set the number of tweets
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
public static final int INVALID_TWEET_COUNT
public TweetCountWordMap()
public TweetCountWordMap(int ntweets, gnu.trove.map.hash.TObjectIntHashMap<String> wordMap)
ntweets
- wordMap
- 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 gnu.trove.map.hash.TObjectIntHashMap<String> getTweetWordMap()
public void incrementTweetCount(int i)
i
- increment number of tweets by this amountpublic void combine(TweetCountWordMap that)
that
- public long getNTweets()
public void setNTweets(int ntweets)
ntweets
-