Permalink
Browse files

Changed case for constants

  • Loading branch information...
1 parent 9ddaa05 commit f4c0c6329788f4e5124f465a0c4aa5104fc57d2b @eljefe6a committed Dec 29, 2012
Showing with 21 additions and 21 deletions.
  1. +1 −1 src/BoggleDriver.java
  2. +1 −1 src/BoggleMapper.java
  3. +15 −15 src/BoggleRoll.java
  4. +4 −4 src/UserDictBloom.java
View
@@ -79,7 +79,7 @@ public int run(String[] args) throws Exception {
configuration.set(BLOOM_PARAM, bloomPath);
configuration.set(DICTIONARY_PARAM, dictionary);
- BoggleRoll roll = BoggleRoll.createRoll(configuration.getInt(ROLL_VERSION, BoggleRoll.bigBoggleVersion));
+ BoggleRoll roll = BoggleRoll.createRoll(configuration.getInt(ROLL_VERSION, BoggleRoll.NEW_VERSION));
configuration.set(ROLL_PARAM, roll.serialize());
int iteration = traverseGraph(input, configuration, fileSystem, roll);
View
@@ -30,7 +30,7 @@ public void setup(Context context) throws IOException {
// Load the Bloom Filter
FileSystem fileSystem = FileSystem.get(configuration);
- bloomFilter = new BloomFilter(UserDictBloom.vectorSize, UserDictBloom.nbHash, UserDictBloom.hashType);
+ bloomFilter = new BloomFilter(UserDictBloom.VECTOR_SIZE, UserDictBloom.NBHASH, UserDictBloom.HASH_TYPE);
bloomFilter.readFields(fileSystem.open(new Path(configuration.get(BoggleDriver.BLOOM_PARAM))));
}
View
@@ -10,30 +10,30 @@
*/
public class BoggleRoll {
/** Constant for new version of Boggle */
- public static final int newVersion = 0;
+ public static final int NEW_VERSION = 0;
/** Constant for old version of Boggle */
- public static final int oldVersion = 1;
+ public static final int OLD_VERSION = 1;
/** Constant for Big Boggle version */
- public static final int bigBoggleVersion = 2;
+ public static final int BIG_BOGGLE_VERSION = 2;
// Each dice in Boggle only certain characters. Each character represents a side of the dice
/** Dice for the new version of Boggle */
- public static final String[] newVersionDice = { "aaeegn", "elrtty", "aoottw", "abbjoo", "ehrtvw", "cimotv",
+ public static final String[] NEW_VERSION_DICE = { "aaeegn", "elrtty", "aoottw", "abbjoo", "ehrtvw", "cimotv",
"distty", "eiosst", "delrvy", "achops", "humnqu", "eeinsu", "eeghnw", "affkps", "hlnnrz", "deilrx" };
/** Dice for the old version of Boggle */
- public static final String[] oldVersionDice = { "aaciot", "ahmors", "egkluy", "abilty", "acdemp", "egintv",
+ public static final String[] OLD_VERSION_DICE = { "aaciot", "ahmors", "egkluy", "abilty", "acdemp", "egintv",
"gilruw", "elpstu", "denosw", "acelrs", "abjmoq", "eefhiy", "ehinps", "dknotu", "adenvz", "biforx" };
/** Dice for the Big Boggle version */
- public static final String[] bigBoggleVersionDice = { "aaafrs", "aaeeee", "aafirs", "adennn", "aeeeem", "aeegmu",
+ public static final String[] BIG_BOGGLE_VERSION_DICE = { "aaafrs", "aaeeee", "aafirs", "adennn", "aeeeem", "aeegmu",
"aegmnn", "afirsy", "bjkqxz", "ccenst", "ceiilt", "ceilpt", "ceipst", "ddhnot", "dhhlor", "dhlnor",
"dhlnor", "eiiitt", "emottt", "ensssu", "fiprsy", "gorrvw", "iprrry", "nootuw", "ooottu" };
/** The number of sides on a dice */
- private static final int diceSides = 6;
+ private static final int DICE_SIDES = 6;
/** The version of the dice to use */
public String[] versionDice;
@@ -57,12 +57,12 @@
private BoggleRoll(int version) {
this.version = version;
- if (version == newVersion) {
- versionDice = newVersionDice;
- } else if (version == oldVersion) {
- versionDice = oldVersionDice;
- } else if (version == bigBoggleVersion) {
- versionDice = bigBoggleVersionDice;
+ if (version == NEW_VERSION) {
+ versionDice = NEW_VERSION_DICE;
+ } else if (version == OLD_VERSION) {
+ versionDice = OLD_VERSION_DICE;
+ } else if (version == BIG_BOGGLE_VERSION) {
+ versionDice = BIG_BOGGLE_VERSION_DICE;
} else if (version > 5) {
createRandomVersion(version);
} else {
@@ -86,7 +86,7 @@ private void createRandomVersion(int size) {
// the dice sides are serialized correctly (they are).
for (int i = 0; i < versionDice.length; i++) {
- versionDice[i] = bigBoggleVersionDice[random.nextInt(bigBoggleVersionDice.length)];
+ versionDice[i] = BIG_BOGGLE_VERSION_DICE[random.nextInt(BIG_BOGGLE_VERSION_DICE.length)];
}
}
@@ -114,7 +114,7 @@ public static BoggleRoll createRoll(int version) {
// Choose a side of the dice
for (int i = 0; i < diceList.size(); i++) {
- int index = random.nextInt(diceSides);
+ int index = random.nextInt(DICE_SIDES);
String letter = roll.versionDice[diceList.get(i)].substring(index, index + 1);
View
@@ -14,11 +14,11 @@
public class UserDictBloom {
/** The vector size for the Bloom Filter */
- public static final int vectorSize = 1048576;
+ public static final int VECTOR_SIZE = 1048576;
/** The number of hashes for the Bloom Filter */
- public static final int nbHash = 3;
+ public static final int NBHASH = 3;
/** The type of hashing to use for the Bloom Filter */
- public static final int hashType = Hash.MURMUR_HASH;
+ public static final int HASH_TYPE = Hash.MURMUR_HASH;
public static void main(String args[]) {
try {
@@ -44,7 +44,7 @@ public static void main(String args[]) {
Pattern words = Pattern.compile("[a-z]*");
- BloomFilter bloomFilter = new BloomFilter(vectorSize, nbHash, hashType);
+ BloomFilter bloomFilter = new BloomFilter(VECTOR_SIZE, NBHASH, HASH_TYPE);
while ((line = dict.readLine()) != null) {
// Normalize all words to lower case and remove all dashes

0 comments on commit f4c0c63

Please sign in to comment.