tl.lin.data.fd
Class Int2LongFrequencyDistributionEntry

java.lang.Object
  extended by tl.lin.data.fd.Int2LongFrequencyDistributionEntry
All Implemented Interfaces:
Iterable<PairOfIntLong>, Int2LongFrequencyDistribution, SortableEntries<PairOfIntLong>

public class Int2LongFrequencyDistributionEntry
extends Object
implements Int2LongFrequencyDistribution

Implementation of Int2LongFrequencyDistribution based on HMapIL.


Nested Class Summary
 
Nested classes/interfaces inherited from interface tl.lin.data.SortableEntries
SortableEntries.Order
 
Constructor Summary
Int2LongFrequencyDistributionEntry()
           
 
Method Summary
 void clear()
          Removes all events.
 double computeLogRelativeFrequency(int k)
          Computes the log (base e) of the relative frequency of a particular event key.
 double computeRelativeFrequency(int k)
          Computes the relative frequency of a particular event key.
 boolean contains(int key)
          Returns true if key exists in this object.
 void decrement(int key)
          Decrements the count of an event key.
 void decrement(int key, long cnt)
          Decrements the count of a particular event key by cnt.
 long get(int key)
          Returns the count of a particular event key.
 List<PairOfIntLong> getEntries(SortableEntries.Order ordering)
           
 List<PairOfIntLong> getEntries(SortableEntries.Order ordering, int n)
           
 int getNumberOfEvents()
          Returns number of distinct events observed.
 long getSumOfCounts()
          Returns the sum of counts of all observed events.
 void increment(int key)
          Increments the count of an event key.
 void increment(int key, long cnt)
          Increments the count of an event key by cnt.
 Iterator<PairOfIntLong> iterator()
          Iterator returns the same object every time, just with a different payload.
 long remove(int k)
          Removes the count of a particular event key.
 long set(int k, long v)
          Sets the count of a particular event key to cnt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Int2LongFrequencyDistributionEntry

public Int2LongFrequencyDistributionEntry()
Method Detail

increment

public void increment(int key)
Description copied from interface: Int2LongFrequencyDistribution
Increments the count of an event key.

Specified by:
increment in interface Int2LongFrequencyDistribution

increment

public void increment(int key,
                      long cnt)
Description copied from interface: Int2LongFrequencyDistribution
Increments the count of an event key by cnt.

Specified by:
increment in interface Int2LongFrequencyDistribution

decrement

public void decrement(int key)
Description copied from interface: Int2LongFrequencyDistribution
Decrements the count of an event key.

Specified by:
decrement in interface Int2LongFrequencyDistribution

decrement

public void decrement(int key,
                      long cnt)
Description copied from interface: Int2LongFrequencyDistribution
Decrements the count of a particular event key by cnt.

Specified by:
decrement in interface Int2LongFrequencyDistribution

contains

public boolean contains(int key)
Description copied from interface: Int2LongFrequencyDistribution
Returns true if key exists in this object.

Specified by:
contains in interface Int2LongFrequencyDistribution

get

public long get(int key)
Description copied from interface: Int2LongFrequencyDistribution
Returns the count of a particular event key.

Specified by:
get in interface Int2LongFrequencyDistribution

computeRelativeFrequency

public double computeRelativeFrequency(int k)
Description copied from interface: Int2LongFrequencyDistribution
Computes the relative frequency of a particular event key. That is, f(key) / SUM_i f(key_i).

Specified by:
computeRelativeFrequency in interface Int2LongFrequencyDistribution

computeLogRelativeFrequency

public double computeLogRelativeFrequency(int k)
Description copied from interface: Int2LongFrequencyDistribution
Computes the log (base e) of the relative frequency of a particular event key.

Specified by:
computeLogRelativeFrequency in interface Int2LongFrequencyDistribution

set

public long set(int k,
                long v)
Description copied from interface: Int2LongFrequencyDistribution
Sets the count of a particular event key to cnt.

Specified by:
set in interface Int2LongFrequencyDistribution

remove

public long remove(int k)
Description copied from interface: Int2LongFrequencyDistribution
Removes the count of a particular event key.

Specified by:
remove in interface Int2LongFrequencyDistribution

clear

public void clear()
Description copied from interface: Int2LongFrequencyDistribution
Removes all events.

Specified by:
clear in interface Int2LongFrequencyDistribution

getNumberOfEvents

public int getNumberOfEvents()
Description copied from interface: Int2LongFrequencyDistribution
Returns number of distinct events observed. Note that if an event is observed and then its count subsequently removed, the event will not be included in this count.

Specified by:
getNumberOfEvents in interface Int2LongFrequencyDistribution

getSumOfCounts

public long getSumOfCounts()
Description copied from interface: Int2LongFrequencyDistribution
Returns the sum of counts of all observed events. That is, SUM_i f(key_i).

Specified by:
getSumOfCounts in interface Int2LongFrequencyDistribution

iterator

public Iterator<PairOfIntLong> iterator()
Iterator returns the same object every time, just with a different payload.

Specified by:
iterator in interface Iterable<PairOfIntLong>

getEntries

public List<PairOfIntLong> getEntries(SortableEntries.Order ordering)
Specified by:
getEntries in interface SortableEntries<PairOfIntLong>

getEntries

public List<PairOfIntLong> getEntries(SortableEntries.Order ordering,
                                      int n)
Specified by:
getEntries in interface SortableEntries<PairOfIntLong>


Copyright © 2013. All Rights Reserved.