tl.lin.data.fd
Class Int2IntFrequencyDistributionEntry

java.lang.Object
  extended by tl.lin.data.fd.Int2IntFrequencyDistributionEntry
All Implemented Interfaces:
Iterable<PairOfInts>, Int2IntFrequencyDistribution, SortableEntries<PairOfInts>

public class Int2IntFrequencyDistributionEntry
extends Object
implements Int2IntFrequencyDistribution

Implementation of Int2IntFrequencyDistribution based on HMapII.


Nested Class Summary
 
Nested classes/interfaces inherited from interface tl.lin.data.SortableEntries
SortableEntries.Order
 
Constructor Summary
Int2IntFrequencyDistributionEntry()
           
 
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, int cnt)
          Decrements the count of a particular event key by cnt.
 int get(int key)
          Returns the count of a particular event key.
 List<PairOfInts> getEntries(SortableEntries.Order ordering)
           
 List<PairOfInts> 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, int cnt)
          Increments the count of an event key by cnt.
 Iterator<PairOfInts> iterator()
          Iterator returns the same object every time, just with a different payload.
 int remove(int key)
          Removes the count of a particular event key.
 int set(int key, int cnt)
          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

Int2IntFrequencyDistributionEntry

public Int2IntFrequencyDistributionEntry()
Method Detail

increment

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

Specified by:
increment in interface Int2IntFrequencyDistribution

increment

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

Specified by:
increment in interface Int2IntFrequencyDistribution

decrement

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

Specified by:
decrement in interface Int2IntFrequencyDistribution

decrement

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

Specified by:
decrement in interface Int2IntFrequencyDistribution

contains

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

Specified by:
contains in interface Int2IntFrequencyDistribution

get

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

Specified by:
get in interface Int2IntFrequencyDistribution

computeRelativeFrequency

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

Specified by:
computeRelativeFrequency in interface Int2IntFrequencyDistribution

computeLogRelativeFrequency

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

Specified by:
computeLogRelativeFrequency in interface Int2IntFrequencyDistribution

set

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

Specified by:
set in interface Int2IntFrequencyDistribution

remove

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

Specified by:
remove in interface Int2IntFrequencyDistribution

clear

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

Specified by:
clear in interface Int2IntFrequencyDistribution

getNumberOfEvents

public int getNumberOfEvents()
Description copied from interface: Int2IntFrequencyDistribution
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 Int2IntFrequencyDistribution

getSumOfCounts

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

Specified by:
getSumOfCounts in interface Int2IntFrequencyDistribution

iterator

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

Specified by:
iterator in interface Iterable<PairOfInts>

getEntries

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

getEntries

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


Copyright © 2013. All Rights Reserved.