Changes to Dict and List classes for reference

This commit is contained in:
REAS
2013-05-19 23:50:35 -07:00
parent eb326b7125
commit 59e39a9b18
7 changed files with 562 additions and 60 deletions

View File

@@ -75,13 +75,21 @@ public class StringDict {
}
}
/**
* @webref stringdict:method
* @brief To come...
*/
public int size() {
return count;
}
/** Remove all entries. */
/**
* Remove all entries.
*
* @webref stringdict:method
* @brief Remove all entries
*/
public void clear() {
count = 0;
indices = new HashMap<String, Integer>();
@@ -110,7 +118,10 @@ public class StringDict {
// return keys;
// }
/**
* @webref stringdict:method
* @brief To come...
*/
public Iterable<String> keys() {
return new Iterable<String>() {
@@ -138,6 +149,9 @@ public class StringDict {
/**
* Return a copy of the internal keys array. This array can be modified.
*
* @webref stringdict:method
* @brief Return a copy of the internal keys array
*/
public String[] keyArray() {
return keyArray(null);
@@ -157,7 +171,10 @@ public class StringDict {
return values[index];
}
/**
* @webref stringdict:method
* @brief To come...
*/
public Iterable<String> values() {
return new Iterable<String>() {
@@ -185,6 +202,9 @@ public class StringDict {
/**
* Create a new array and copy each of the values into it.
*
* @webref stringdict:method
* @brief Create a new array and copy each of the values into it
*/
public int[] valueArray() {
return valueArray(null);
@@ -207,6 +227,9 @@ public class StringDict {
/**
* Return a value for the specified key.
*
* @webref stringdict:method
* @brief Return a value for the specified key
*/
public String get(String key) {
int index = index(key);
@@ -214,7 +237,10 @@ public class StringDict {
return values[index];
}
/**
* @webref stringdict:method
* @brief To come...
*/
public void set(String key, String amount) {
int index = index(key);
if (index == -1) {
@@ -230,7 +256,10 @@ public class StringDict {
return (found == null) ? -1 : found.intValue();
}
/**
* @webref stringdict:method
* @brief To come...
*/
public boolean hasKey(String key) {
return index(key) != -1;
}
@@ -247,7 +276,10 @@ public class StringDict {
count++;
}
/**
* @webref stringdict:method
* @brief To come...
*/
public void remove(String key) {
removeIndex(index(key));
}
@@ -283,12 +315,18 @@ public class StringDict {
/**
* Sort the keys alphabetically (ignoring case). Uses the value as a
* tie-breaker (only really possible with a key that has a case change).
*
* @webref stringdict:method
* @brief Sort the keys alphabetically
*/
public void sortKeys() {
sortImpl(true, false);
}
/**
* @webref stringdict:method
* @brief To come...
*/
public void sortKeysReverse() {
sortImpl(true, true);
}
@@ -296,12 +334,19 @@ public class StringDict {
/**
* Sort by values in descending order (largest value will be at [0]).
*
* @webref stringdict:method
* @brief Sort by values in descending order
*/
public void sortValues() {
sortImpl(false, false);
}
/**
* @webref stringdict:method
* @brief To come...
*/
public void sortValuesReverse() {
sortImpl(false, true);
}