tl.lin.data.map
Class Int2IntOpenHashMapWritable

java.lang.Object
  extended by it.unimi.dsi.fastutil.ints.AbstractInt2IntFunction
      extended by it.unimi.dsi.fastutil.ints.AbstractInt2IntMap
          extended by it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
              extended by tl.lin.data.map.Int2IntOpenHashMapWritable
All Implemented Interfaces:
it.unimi.dsi.fastutil.Function<Integer,Integer>, it.unimi.dsi.fastutil.Hash, it.unimi.dsi.fastutil.ints.Int2IntFunction, it.unimi.dsi.fastutil.ints.Int2IntMap, Serializable, Cloneable, Map<Integer,Integer>, org.apache.hadoop.io.Writable

public class Int2IntOpenHashMapWritable
extends it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
implements org.apache.hadoop.io.Writable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2IntMap
it.unimi.dsi.fastutil.ints.AbstractInt2IntMap.BasicEntry
 
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash
it.unimi.dsi.fastutil.Hash.Strategy<K>
 
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.ints.Int2IntMap
it.unimi.dsi.fastutil.ints.Int2IntMap.Entry, it.unimi.dsi.fastutil.ints.Int2IntMap.FastEntrySet
 
Field Summary
 
Fields inherited from class it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
entries, f, key, mask, maxFill, n, size, used, value
 
Fields inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2IntFunction
defRetValue
 
Fields inherited from interface it.unimi.dsi.fastutil.Hash
DEFAULT_GROWTH_FACTOR, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, FAST_LOAD_FACTOR, FREE, OCCUPIED, PRIMES, REMOVED, VERY_FAST_LOAD_FACTOR
 
Constructor Summary
Int2IntOpenHashMapWritable()
          Creates an Int2IntOpenHashMapWritable object.
 
Method Summary
static Int2IntOpenHashMapWritable create(byte[] bytes)
          Creates object from serialized representation.
static Int2IntOpenHashMapWritable create(DataInput in)
          Creates object from serialized representation.
 void decode()
          In lazy decoding mode, populates the map with deserialized data.
 int dot(Int2IntOpenHashMapWritable m)
          Computes the dot product of this map with another map.
 it.unimi.dsi.fastutil.ints.Int2IntMap.Entry[] getEntriesSortedByValue()
          Returns entries sorted by descending value.
 it.unimi.dsi.fastutil.ints.Int2IntMap.Entry[] getEntriesSortedByValue(int k)
          Returns top k entries sorted by descending value.
 int[] getKeys()
          In lazy decoding mode, returns an array of all the keys if the map hasn't been decoded yet.
static boolean getLazyDecodeFlag()
          Returns the value of the lazy decoding flag
 int[] getValues()
          In lazy decoding mode, returns an array of all the values if the map hasn't been decoded yet.
 boolean hasBeenDecoded()
           
 void increment(int key)
          Increments the key.
 void increment(int key, int n)
          Increments the key.
 void lazyplus(Int2IntOpenHashMapWritable m)
          In lazy decoding mode, adds values from keys of another map to this map.
 void plus(Int2IntOpenHashMapWritable m)
          Adds values of keys from another map to this map.
 void readFields(DataInput in)
          Deserializes the map.
 byte[] serialize()
          Serializes this object to a byte array.
static void setLazyDecodeFlag(boolean b)
          Sets the lazy decoding flag.
 void write(DataOutput out)
          Serializes the map.
 
Methods inherited from class it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
add, addTo, clear, clone, containsKey, containsValue, get, get, growthFactor, growthFactor, hashCode, int2IntEntrySet, isEmpty, keySet, put, put, rehash, rehash, remove, remove, shiftKeys, size, trim, trim, values
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2IntMap
containsValue, entrySet, equals, putAll, toString
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2IntFunction
containsKey, defaultReturnValue, defaultReturnValue, get
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.Int2IntFunction
defaultReturnValue, defaultReturnValue
 
Methods inherited from interface it.unimi.dsi.fastutil.Function
containsKey, get
 
Methods inherited from interface java.util.Map
containsKey, get
 

Constructor Detail

Int2IntOpenHashMapWritable

public Int2IntOpenHashMapWritable()
Creates an Int2IntOpenHashMapWritable object.

Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes the map.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

decode

public void decode()
In lazy decoding mode, populates the map with deserialized data. Otherwise, does nothing.


hasBeenDecoded

public boolean hasBeenDecoded()

write

public void write(DataOutput out)
           throws IOException
Serializes the map.

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

serialize

public byte[] serialize()
                 throws IOException
Serializes this object to a byte array.

Returns:
byte array representing the serialized representation
Throws:
IOException

create

public static Int2IntOpenHashMapWritable create(DataInput in)
                                         throws IOException
Creates object from serialized representation.

Parameters:
in - source of serialized representation
Returns:
newly-created object
Throws:
IOException

create

public static Int2IntOpenHashMapWritable create(byte[] bytes)
                                         throws IOException
Creates object from serialized representation.

Parameters:
bytes - source of serialized representation
Returns:
newly-created object
Throws:
IOException

plus

public void plus(Int2IntOpenHashMapWritable m)
Adds values of keys from another map to this map.

Parameters:
m - the other map

dot

public int dot(Int2IntOpenHashMapWritable m)
Computes the dot product of this map with another map.

Parameters:
m - the other map

increment

public void increment(int key)
Increments the key. If the key does not exist in the map, its value is set to one.

Parameters:
key - key to increment

increment

public void increment(int key,
                      int n)
Increments the key. If the key does not exist in the map, its value is set to one.

Parameters:
key - key to increment
n - amount to increment

setLazyDecodeFlag

public static void setLazyDecodeFlag(boolean b)
Sets the lazy decoding flag.

Parameters:
b - the value of the lazy decoding flag

getLazyDecodeFlag

public static boolean getLazyDecodeFlag()
Returns the value of the lazy decoding flag

Returns:
the value of the lazy decoding flag

getKeys

public int[] getKeys()
In lazy decoding mode, returns an array of all the keys if the map hasn't been decoded yet. Otherwise, returns null.

Returns:
an array of all the keys

getValues

public int[] getValues()
In lazy decoding mode, returns an array of all the values if the map hasn't been decoded yet. Otherwise, returns null.

Returns:
an array of all the values

lazyplus

public void lazyplus(Int2IntOpenHashMapWritable m)
In lazy decoding mode, adds values from keys of another map to this map. This map must have already been decoded, but the other map must not have been already decoded.

Parameters:
m - the other map

getEntriesSortedByValue

public it.unimi.dsi.fastutil.ints.Int2IntMap.Entry[] getEntriesSortedByValue()
Returns entries sorted by descending value. Ties broken by the key.

Returns:
entries sorted by descending value

getEntriesSortedByValue

public it.unimi.dsi.fastutil.ints.Int2IntMap.Entry[] getEntriesSortedByValue(int k)
Returns top k entries sorted by descending value. Ties broken by the key.

Parameters:
k - number of entries to return
Returns:
top k entries sorted by descending value


Copyright © 2013. All Rights Reserved.