public class ValuesFreq
extends java.lang.Object
this class store a pair of values (String) and their frequency (int)
Modifier and Type | Field and Description |
---|---|
protected int |
Freq
Frequecy of the value.
|
protected java.lang.String |
Value1
First String value.
|
protected java.lang.String |
Value2
Second String value.
|
Constructor and Description |
---|
ValuesFreq()
Creates a new instance of Pair Value-frequency
|
ValuesFreq(java.lang.String newValue1,
java.lang.String newValue2,
int newFreq)
Creates a new pair with established values and frequency
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Test it the provided object is equal in values to this object
Overrides Object.equals()
|
int |
getFreq()
Returns the frequency of this pair
|
java.lang.String |
getValue1()
Returns the first value of this object (the first string)
|
java.lang.String |
getValue2()
Returns the second value of the object (the second string)
|
void |
incFreq()
Increases this object frequency by one
|
boolean |
moreFreq(ValuesFreq ref)
Compares the frequencies of two pairs, and test if this object's frequency is higher than the provided one
|
protected java.lang.String Value1
protected java.lang.String Value2
protected int Freq
public ValuesFreq()
Creates a new instance of Pair Value-frequency
public ValuesFreq(java.lang.String newValue1, java.lang.String newValue2, int newFreq)
Creates a new pair with established values and frequency
newValue1
- The first value of the pairnewValue2
- The second value of the pairnewFreq
- The frequency associatedpublic boolean equals(java.lang.Object obj)
Test it the provided object is equal in values to this object Overrides Object.equals()
equals
in class java.lang.Object
public void incFreq()
Increases this object frequency by one
public boolean moreFreq(ValuesFreq ref)
Compares the frequencies of two pairs, and test if this object's frequency is higher than the provided one
ref
- The reference pairpublic java.lang.String getValue1()
Returns the first value of this object (the first string)
public java.lang.String getValue2()
Returns the second value of the object (the second string)
public int getFreq()
Returns the frequency of this pair