summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-05-20 17:58:16 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-05-20 17:58:16 -0400
commit40a9d99496e098562f090fb7ffce9e749011b131 (patch)
tree437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java
parentff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff)
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java')
-rw-r--r--projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java229
1 files changed, 103 insertions, 126 deletions
diff --git a/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java b/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java
index 0b291a7..ba58189 100644
--- a/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java
+++ b/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java
@@ -22,145 +22,122 @@ import java.util.Enumeration;
import java.util.Map;
/**
-* A pure java implementation of NSMutableDictionary that
-* implements Map for greater java interoperability.
-*
-* @author michael@mpowers.net
-* @author $Author: cgruber $
-* @version $Revision: 893 $
-*/
-public class NSMutableDictionary
- extends NSDictionary
-{
- /**
- * Default constructor produces an empty dictionary.
- */
- public NSMutableDictionary ()
- {
- super();
- }
-
- /**
- * Default constructor produces an empty dictionary.
- */
- public NSMutableDictionary (int initialSize)
- {
- super(initialSize);
- }
-
- /**
- * Produces a dictionary that contains one key referencing one value.
- */
- public NSMutableDictionary (Object key, Object value)
- {
- super( key, value );
- }
-
- /**
- * Produces a dictionary containing the specified keys and values.
- * An IllegalArgumentException is thrown if the arrays are not
- * of the same length.
- */
- public NSMutableDictionary (Object[] keys, Object[] values)
- {
- super( keys, values );
+ * A pure java implementation of NSMutableDictionary that implements Map for
+ * greater java interoperability.
+ *
+ * @author michael@mpowers.net
+ * @author $Author: cgruber $
+ * @version $Revision: 893 $
+ */
+public class NSMutableDictionary extends NSDictionary {
+ /**
+ * Default constructor produces an empty dictionary.
+ */
+ public NSMutableDictionary() {
+ super();
+ }
+
+ /**
+ * Default constructor produces an empty dictionary.
+ */
+ public NSMutableDictionary(int initialSize) {
+ super(initialSize);
+ }
+
+ /**
+ * Produces a dictionary that contains one key referencing one value.
+ */
+ public NSMutableDictionary(Object key, Object value) {
+ super(key, value);
+ }
+
+ /**
+ * Produces a dictionary containing the specified keys and values. An
+ * IllegalArgumentException is thrown if the arrays are not of the same length.
+ */
+ public NSMutableDictionary(Object[] keys, Object[] values) {
+ super(keys, values);
}
- /**
- * Produces a dictionary that is a copy of the specified map (or dictionary).
- */
- public NSMutableDictionary (Map aMap)
- {
- super( aMap );
- }
-
- /**
- * Removes the key-value pair for the specified key.
- */
- public void removeObjectForKey (Object aKey)
- {
- remove( aKey );
- }
-
- /**
- * Copies all mappings from the specified dictionary to this dictionary,
- * replacing any mappings this map had for any keys in the specified map.
- */
- public void addEntriesFromDictionary (Map aMap)
- {
- putAll( aMap );
- }
-
- /**
- * Removes all mappings from this dictionary.
- */
- public void removeAllObjects ()
- {
- clear();
- }
-
- /**
- * Removes all keys in the specified array from this dictionary.
- */
- public void removeObjectsForKeys (NSArray anArray)
- {
- Enumeration enumeration = anArray.objectEnumerator();
- while ( enumeration.hasMoreElements() )
- {
- removeObjectForKey( enumeration.nextElement() );
- }
- }
-
- /**
- * Clears all mappings in this dictionary and then adds all entries
- * in the specified dictionary.
- */
- public void setDictionary (Map aMap)
- {
- removeAllObjects();
- addEntriesFromDictionary( aMap );
- }
-
- /**
- * Sets the value for the specified key. If the key currently
- * exists to the dictionary, the old value is replaced with the
- * specified value. An IllegalArgumentException is thrown if
- * either the key or value is null.
- */
- public void setObjectForKey (Object aValue, Object aKey)
- {
- if ( ( aKey == null ) || ( aValue == null ) )
- {
- throw new IllegalArgumentException(
- "Cannot use null objects with an NSMutableDictionary." );
- }
- put( aKey, aValue );
- }
+ /**
+ * Produces a dictionary that is a copy of the specified map (or dictionary).
+ */
+ public NSMutableDictionary(Map aMap) {
+ super(aMap);
+ }
+
+ /**
+ * Removes the key-value pair for the specified key.
+ */
+ public void removeObjectForKey(Object aKey) {
+ remove(aKey);
+ }
+
+ /**
+ * Copies all mappings from the specified dictionary to this dictionary,
+ * replacing any mappings this map had for any keys in the specified map.
+ */
+ public void addEntriesFromDictionary(Map aMap) {
+ putAll(aMap);
+ }
+
+ /**
+ * Removes all mappings from this dictionary.
+ */
+ public void removeAllObjects() {
+ clear();
+ }
+
+ /**
+ * Removes all keys in the specified array from this dictionary.
+ */
+ public void removeObjectsForKeys(NSArray anArray) {
+ Enumeration enumeration = anArray.objectEnumerator();
+ while (enumeration.hasMoreElements()) {
+ removeObjectForKey(enumeration.nextElement());
+ }
+ }
+
+ /**
+ * Clears all mappings in this dictionary and then adds all entries in the
+ * specified dictionary.
+ */
+ public void setDictionary(Map aMap) {
+ removeAllObjects();
+ addEntriesFromDictionary(aMap);
+ }
+
+ /**
+ * Sets the value for the specified key. If the key currently exists to the
+ * dictionary, the old value is replaced with the specified value. An
+ * IllegalArgumentException is thrown if either the key or value is null.
+ */
+ public void setObjectForKey(Object aValue, Object aKey) {
+ if ((aKey == null) || (aValue == null)) {
+ throw new IllegalArgumentException("Cannot use null objects with an NSMutableDictionary.");
+ }
+ put(aKey, aValue);
+ }
}
/*
- * $Log$
- * Revision 1.2 2006/02/16 13:15:00 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * $Log$ Revision 1.2 2006/02/16 13:15:00 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.4 2005/05/11 15:21:53 cgruber
- * Change enum to enumeration, since enum is now a keyword as of Java 5.0
+ * Revision 1.4 2005/05/11 15:21:53 cgruber Change enum to enumeration, since
+ * enum is now a keyword as of Java 5.0
*
* A few other comments in the code.
*
- * Revision 1.3 2002/06/30 17:16:26 mpowers
- * Added new constructor taking an int: thanks cgruber.
+ * Revision 1.3 2002/06/30 17:16:26 mpowers Added new constructor taking an int:
+ * thanks cgruber.
*
*
- * Revision 1.2 2001/02/23 23:43:41 mpowers
- * Removed ill-advised this.
+ * Revision 1.2 2001/02/23 23:43:41 mpowers Removed ill-advised this.
*
- * Revision 1.1.1.1 2000/12/21 15:47:34 mpowers
- * Contributing wotonomy.
+ * Revision 1.1.1.1 2000/12/21 15:47:34 mpowers Contributing wotonomy.
*
- * Revision 1.3 2000/12/20 16:25:38 michael
- * Added log to all files.
+ * Revision 1.3 2000/12/20 16:25:38 michael Added log to all files.
*
*
*/
-