-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#8] Started work on prioritizing words with higher counts
- Loading branch information
Frederik Kammel
committed
Sep 12, 2016
1 parent
2b415cb
commit 63c3357
Showing
4 changed files
with
133 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package algorithm; | ||
|
||
/** | ||
* A class that contains a {@link String} and a count how often users used this | ||
* word already. This allows the algorithm to prioritize words. | ||
* | ||
* @author frede | ||
* | ||
*/ | ||
public class Word { | ||
|
||
private String word; | ||
private int count; | ||
|
||
public Word() { | ||
this(""); | ||
} | ||
|
||
public Word(String word) { | ||
this(word, 0); | ||
} | ||
|
||
public Word(String word, int count) { | ||
this.setWord(word); | ||
this.setCount(count); | ||
} | ||
|
||
/** | ||
* @return the word | ||
*/ | ||
public String getWord() { | ||
return word; | ||
} | ||
|
||
/** | ||
* @param word | ||
* the word to set | ||
*/ | ||
public void setWord(String word) { | ||
this.word = word; | ||
} | ||
|
||
/** | ||
* @return the count | ||
*/ | ||
public int getCount() { | ||
return count; | ||
} | ||
|
||
/** | ||
* @param count | ||
* the count to set | ||
*/ | ||
public void setCount(int count) { | ||
this.count = count; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (o instanceof Word) { | ||
return (this.getWord().equals(((Word) o).getWord())); | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters