edu.umd.cloud9.io.fastuil
Class Int2FloatOpenHashMapWritable

java.lang.Object
  extended by it.unimi.dsi.fastutil.ints.AbstractInt2FloatFunction
      extended by it.unimi.dsi.fastutil.ints.AbstractInt2FloatMap
          extended by it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap
              extended by edu.umd.cloud9.io.fastuil.Int2FloatOpenHashMapWritable
All Implemented Interfaces:
Function<Integer,Float>, Hash, Int2FloatFunction, Int2FloatMap, Serializable, Cloneable, Map<Integer,Float>, Writable

public class Int2FloatOpenHashMapWritable
extends Int2FloatOpenHashMap
implements Writable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2FloatMap
AbstractInt2FloatMap.BasicEntry
 
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash
Hash.Strategy<K>
 
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.ints.Int2FloatMap
Int2FloatMap.Entry, Int2FloatMap.FastEntrySet
 
Field Summary
 
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
Int2FloatOpenHashMapWritable()
          Creates an Int2FloatOpenHashMapWritable object.
 
Method Summary
static Int2FloatOpenHashMapWritable create(byte[] bytes)
          Returns the serialized representation of this object as a byte array.
static Int2FloatOpenHashMapWritable create(DataInput in)
          Creates an Int2FloatOpenHashMapWritable object from a DataInput.
 void decode()
          In lazy decoding mode, populates the map with deserialized data.
 int dot(Int2FloatOpenHashMapWritable m)
          Computes the dot product of this map with another map.
 Int2FloatMap.Entry[] getEntriesSortedByValue()
          Returns entries sorted by descending value.
 Int2FloatMap.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
 float[] getValues()
          In lazy decoding mode, returns an array of all the values if the map hasn't been decoded yet.
 boolean hasBeenDecoded()
           
 void lazyplus(Int2FloatOpenHashMapWritable m)
          In lazy decoding mode, adds values from keys of another map to this map.
 void plus(Int2FloatOpenHashMapWritable m)
          Adds values of keys from another map to this map.
 void readFields(DataInput in)
          Deserializes the map.
 byte[] serialize()
          Returns the serialized representation of this object as 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.Int2FloatOpenHashMap
clear, clone, containsKey, containsValue, get, get, growthFactor, growthFactor, hashCode, int2FloatEntrySet, isEmpty, keySet, put, put, rehash, remove, remove, size, trim, trim, values
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2FloatMap
containsValue, entrySet, equals, putAll, toString
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractInt2FloatFunction
containsKey, defaultReturnValue, defaultReturnValue, get
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.Int2FloatFunction
defaultReturnValue, defaultReturnValue
 
Methods inherited from interface it.unimi.dsi.fastutil.Function
containsKey, get
 
Methods inherited from interface java.util.Map
containsKey, get
 

Constructor Detail

Int2FloatOpenHashMapWritable

public Int2FloatOpenHashMapWritable()
Creates an Int2FloatOpenHashMapWritable object.

Method Detail

readFields

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

Specified by:
readFields in interface Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

decode

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

Throws:
IOException

hasBeenDecoded

public boolean hasBeenDecoded()

write

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

Specified by:
write in interface Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

serialize

public byte[] serialize()
                 throws IOException
Returns the serialized representation of this object as a byte array.

Returns:
byte array representing the serialized representation of this object
Throws:
IOException

create

public static Int2FloatOpenHashMapWritable create(DataInput in)
                                           throws IOException
Creates an Int2FloatOpenHashMapWritable object from a DataInput.

Parameters:
in - DataInput for reading the serialized representation
Returns:
a newly-created Int2FloatOpenHashMapWritable object
Throws:
IOException

create

public static Int2FloatOpenHashMapWritable create(byte[] bytes)
                                           throws IOException
Returns the serialized representation of this object as a byte array.

Returns:
byte array representing the serialized representation of this object
Throws:
IOException

plus

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

Parameters:
m - the other map

dot

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

Parameters:
m - the other map

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 float[] 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(Int2FloatOpenHashMapWritable 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 Int2FloatMap.Entry[] getEntriesSortedByValue()
Returns entries sorted by descending value. Ties broken by the key.

Returns:
entries sorted by descending value

getEntriesSortedByValue

public Int2FloatMap.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