tl.lin.data.fd
Class Object2LongFrequencyDistributionEntry<K extends Comparable<K>>

java.lang.Object
  extended by tl.lin.data.fd.Object2LongFrequencyDistributionEntry<K>
All Implemented Interfaces:
Iterable<PairOfObjectLong<K>>, Object2LongFrequencyDistribution<K>, SortableEntries<PairOfObjectLong<K>>

public class Object2LongFrequencyDistributionEntry<K extends Comparable<K>>
extends Object
implements Object2LongFrequencyDistribution<K>

Implementation of Object2LongFrequencyDistribution based on HMapKL.


Nested Class Summary
 
Nested classes/interfaces inherited from interface tl.lin.data.SortableEntries
SortableEntries.Order
 
Constructor Summary
Object2LongFrequencyDistributionEntry()
           
 
Method Summary
 void clear()
          Removes all events.
 double computeLogRelativeFrequency(K k)
          Computes the log (base e) of the relative frequency of a particular event key.
 double computeRelativeFrequency(K k)
          Computes the relative frequency of a particular event key.
 boolean contains(K key)
          Returns true if key exists in this object.
 void decrement(K key)
          Decrements the count of an event key.
 void decrement(K key, long cnt)
          Decrements the count of a particular event key by cnt.
 long get(K key)
          Returns the count of a particular event key.
 List<PairOfObjectLong<K>> getEntries(SortableEntries.Order ordering)
           
 List<PairOfObjectLong<K>> 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(K key)
          Increments the count of an event key.
 void increment(K key, long cnt)
          Increments the count of an event key by cnt.
 Iterator<PairOfObjectLong<K>> iterator()
          Iterator returns the same object every time, just with a different payload.
 Set<K> keySet()
          Returns the set of keys.
 long remove(K k)
          Removes the count of a particular event key.
 long set(K 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

Object2LongFrequencyDistributionEntry

public Object2LongFrequencyDistributionEntry()
Method Detail

increment

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

Specified by:
increment in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

increment

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

Specified by:
increment in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

decrement

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

Specified by:
decrement in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

decrement

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

Specified by:
decrement in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

contains

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

Specified by:
contains in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

get

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

Specified by:
get in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

computeRelativeFrequency

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

Specified by:
computeRelativeFrequency in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

computeLogRelativeFrequency

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

Specified by:
computeLogRelativeFrequency in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

set

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

Specified by:
set in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

remove

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

Specified by:
remove in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

clear

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

Specified by:
clear in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

getNumberOfEvents

public int getNumberOfEvents()
Description copied from interface: Object2LongFrequencyDistribution
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 Object2LongFrequencyDistribution<K extends Comparable<K>>

getSumOfCounts

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

Specified by:
getSumOfCounts in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

keySet

public Set<K> keySet()
Description copied from interface: Object2LongFrequencyDistribution
Returns the set of keys.

Specified by:
keySet in interface Object2LongFrequencyDistribution<K extends Comparable<K>>

iterator

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

Specified by:
iterator in interface Iterable<PairOfObjectLong<K extends Comparable<K>>>

getEntries

public List<PairOfObjectLong<K>> getEntries(SortableEntries.Order ordering)
Specified by:
getEntries in interface SortableEntries<PairOfObjectLong<K extends Comparable<K>>>

getEntries

public List<PairOfObjectLong<K>> getEntries(SortableEntries.Order ordering,
                                            int n)
Specified by:
getEntries in interface SortableEntries<PairOfObjectLong<K extends Comparable<K>>>


Copyright © 2013. All Rights Reserved.