public class FreqListPair
extends java.lang.Object
This class represents a list of pairs frequency (i.e. the frequency associated to a determined pair of strings).
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector |
freqs
Frequencies vector of strings.
|
protected int |
index
Iterator index.
|
protected int |
totalElements
Total elements in the list.
|
Constructor and Description |
---|
FreqListPair()
Creates a new object, with fresh allocated memory
|
Modifier and Type | Method and Description |
---|---|
void |
AddElement(java.lang.String newElem1,
java.lang.String newElem2)
Adds a new pair, increasing its frequency if already exists, or
creating a new pair if not
|
int |
elem1SumFreq(java.lang.String val)
Sums the frequencies for the first elements which are equal to
the provided one
|
int |
elem2SumFreq(java.lang.String val)
Sums the frequencies for the second elements which are equal to
the provided one
|
ValuesFreq |
elementAt(int i)
Returns the element at position indicated
|
ValuesFreq |
getCurrent()
Obtains the element pointed currently by the iterator
|
int |
getPairFreq(java.lang.String e1,
java.lang.String e2)
Searches for the first pair which has its elements equals to the provided ones,
and return it frequency
|
boolean |
iterate()
Iterates to the next element in the list
|
ValuesFreq |
mostCommon()
Returns the most frequent pair
|
int |
numElems()
Number of different pairs of this list
|
boolean |
outOfBounds()
Test if the iterator is out of the bounds of the list
|
void |
reset()
Reset the iterator to the beginning of the list.
|
int |
sumPairFreq(java.lang.String e1,
java.lang.String e2)
Searches for the all the pairs which have its elements equals to the provided ones,
and return their cummulative frequency
|
int |
totalElems()
The total number of elements stored, i.e. the sum of all the frequencies
|
protected java.util.Vector freqs
protected int index
protected int totalElements
public FreqListPair()
Creates a new object, with fresh allocated memory
public void AddElement(java.lang.String newElem1, java.lang.String newElem2)
Adds a new pair, increasing its frequency if already exists, or creating a new pair if not
newElem1
- First element of the new pairnewElem2
- Second element of the new pairpublic ValuesFreq mostCommon()
Returns the most frequent pair
public int numElems()
Number of different pairs of this list
public ValuesFreq elementAt(int i)
Returns the element at position indicated
i
- Position of the element we wantpublic void reset()
Reset the iterator to the beginning of the list.
public boolean iterate()
Iterates to the next element in the list
public ValuesFreq getCurrent()
Obtains the element pointed currently by the iterator
public boolean outOfBounds()
Test if the iterator is out of the bounds of the list
public int totalElems()
The total number of elements stored, i.e. the sum of all the frequencies
public int elem1SumFreq(java.lang.String val)
Sums the frequencies for the first elements which are equal to the provided one
val
- the reference valuepublic int elem2SumFreq(java.lang.String val)
Sums the frequencies for the second elements which are equal to the provided one
val
- the reference valuepublic int getPairFreq(java.lang.String e1, java.lang.String e2)
Searches for the first pair which has its elements equals to the provided ones, and return it frequency
e1
- the first element of the paire2
- the second element of the pairpublic int sumPairFreq(java.lang.String e1, java.lang.String e2)
Searches for the all the pairs which have its elements equals to the provided ones, and return their cummulative frequency
e1
- the first element of the paire2
- the second element of the pair