merge with the latest

This commit is contained in:
Ben Fry
2013-05-29 06:54:03 -04:00
27 changed files with 3306 additions and 2520 deletions

View File

@@ -101,8 +101,10 @@ public class IntDict {
}
/**
* Returns the number of key/value pairs
*
* @webref intdict:method
* @brief To come...
* @brief Returns the number of key/value pairs
*/
public int size() {
return count;
@@ -246,7 +248,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Return the internal array being used to store the keys
*/
public Iterable<Integer> values() {
return new Iterable<Integer>() {
@@ -293,6 +295,8 @@ public class IntDict {
* Fill an already-allocated array with the values (more efficient than
* creating a new array each time). If 'array' is null, or not the same
* size as the number of values, a new array will be allocated and returned.
*
* @param array values to copy into the array
*/
public int[] valueArray(int[] array) {
if (array == null || array.length != size()) {
@@ -316,8 +320,10 @@ public class IntDict {
}
/**
* Create a new key/value pair or change the value of one.
*
* @webref intdict:method
* @brief To come...
* @brief Create a new key/value pair or change the value of one
*/
public void set(String key, int amount) {
int index = index(key);
@@ -330,7 +336,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Check if a key is a part of the data structure
*/
public boolean hasKey(String key) {
return index(key) != -1;
@@ -338,10 +344,10 @@ public class IntDict {
/**
* Increase the value of a specific key by 1.
* Increase the value associated with a specific key by 1.
*
* @webref intdict:method
* @brief Increase the value of a specific key by 1
* @brief Increase the value of a specific key value by 1
*/
public void increment(String key) {
add(key, 1);
@@ -349,7 +355,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Add to a value
*/
public void add(String key, int amount) {
int index = index(key);
@@ -362,7 +368,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Subtract from a value
*/
public void sub(String key, int amount) {
add(key, -amount);
@@ -370,7 +376,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Multiply a value
*/
public void mult(String key, int amount) {
int index = index(key);
@@ -381,7 +387,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Divide a value
*/
public void div(String key, int amount) {
int index = index(key);
@@ -410,7 +416,7 @@ public class IntDict {
/**
* @webref intdict:method
* @brief To come...
* @brief Remove a key/value pair
*/
public void remove(String key) {
removeIndex(index(key));
@@ -456,8 +462,11 @@ public class IntDict {
}
/**
* Sort the keys alphabetically in reverse (ignoring case). Uses the value as a
* tie-breaker (only really possible with a key that has a case change).
*
* @webref intdict:method
* @brief To come...
* @brief Sort the keys alphabetially in reverse
*/
public void sortKeysReverse() {
sortImpl(true, true);
@@ -465,18 +474,25 @@ public class IntDict {
/**
<<<<<<< HEAD
* Sort by values in descending order (largest value will be at [0]).
*
=======
* Sort by values in ascending order. The smallest value will be at [0].
*
>>>>>>> cd467dc12a42d588638aaab06746bebdfb333cc4
* @webref intdict:method
* @brief Sort by values in descending order
* @brief Sort by values in ascending order
*/
public void sortValues() {
sortImpl(false, false);
}
/**
* Sort by values in descending order. The largest value will be at [0].
*
* @webref intdict:method
* @brief To come...
* @brief Sort by values in descending order
*/
public void sortValuesReverse() {
sortImpl(false, true);