public class HashStringMap extends java.util.AbstractMap implements StringMap
StringMap
interface, using a
java.util.HashMap
internally. This implementation requires that
both the name and value String
instances be non-null
,
but imposes no other restrictions.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT |
static java.lang.String |
VERSION |
Constructor and Description |
---|
HashStringMap()
Default constructor.
|
HashStringMap(int initialCapacity)
Constructs an empty HashStringMap with the specified initial
capacity and the default load factor (0.75).
|
HashStringMap(java.util.Map aMap)
'Copy' constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all associations from the collection.
|
boolean |
containsKey(java.lang.Object aName)
Identifies whether there is an association for the specified name.
|
boolean |
containsValue(java.lang.Object aValue)
Identifies whether this map maps one or more keys to the specified value.
|
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this instance.
|
boolean |
equals(java.lang.Object aObject)
Compares the specified object with this map for equality.
|
int |
estimateInternalStringSize() |
java.lang.Object |
get(java.lang.Object aName)
Identifies the value, if any, that is associated with the specified name.
|
java.lang.String |
getKeyString(ClassDefinition aClassDef)
Deprecated.
this method should only be used internally
|
java.lang.String |
getKeyString(ClassDefinition aClassDef,
java.lang.String aAspect)
Returns a string representation of the key values of this map, assuming
that this map represents the key properties for an instance.
|
java.util.List<java.lang.String> |
getKeyStrings(ClassDefinition aClassDef,
java.lang.String aAspect,
boolean aUseInsId) |
java.util.List<java.lang.String> |
getKeyStrings(ClassDefinition aClassDef,
java.lang.String aUpperCaseClassName,
java.lang.String aAspect,
boolean aUseInsId) |
java.lang.String |
getString(java.lang.String aName)
Identifies the value, if any, that is associated with the specified name.
|
int |
hashCode()
Returns the hash code value for this instance, which will be the hashCode
value of the underlying
java.util.HashMap . |
boolean |
isEmpty()
Inicates whether this map contains no name-value associations.
|
java.util.Set |
keySet()
Returns a set view of the keys (names) contained in this instance.
|
java.lang.Object |
put(java.lang.Object aName,
java.lang.Object aValue)
Associates the specified value with the specified name in this instance,
provided that they are both
String instances. |
void |
putAll(java.util.Map aMap)
Copies all conforming mappings from the specified
Map to
this instance. |
void |
putString(java.lang.String aName,
java.lang.String aValue)
Associates the specified value with the specified name in this instance.
|
java.lang.Object |
remove(java.lang.Object aName)
Removes any association for this name from this instance.
|
void |
remove(java.lang.String aName)
Removes any association for this name from this instance.
|
int |
size()
Returns the number of name-value mappings in this instance.
|
java.lang.String |
toString()
Returns a string representation of this map.
|
java.lang.String |
toStringUpper()
Returns a string representation of this map with all keys and values
converted to upper cases.
|
java.util.Collection |
values()
Returns a collection view of the values contained in this instance.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
public HashStringMap()
public HashStringMap(int initialCapacity)
initialCapacity
- the initial capacity.java.lang.IllegalArgumentException
- if the initial capacity is negative.public HashStringMap(java.util.Map aMap)
String
.aMap
- the Map
to be copiedpublic void clear()
clear
in interface java.util.Map
clear
in class java.util.AbstractMap
public java.lang.String getString(java.lang.String aName)
public void putString(java.lang.String aName, java.lang.String aValue)
public void remove(java.lang.String aName)
aName
- name to be removed from this instancepublic boolean containsKey(java.lang.Object aName)
containsKey
in interface java.util.Map
containsKey
in class java.util.AbstractMap
aName
- name whose presence is to be testedtrue
when this instance includes an association
for this namepublic boolean containsValue(java.lang.Object aValue)
containsValue
in interface java.util.Map
containsValue
in class java.util.AbstractMap
aValue
- value whose presence is to be testedtrue
when this instance associates this value with
at least one namepublic java.util.Set entrySet()
entrySet
in interface java.util.Map
entrySet
in class java.util.AbstractMap
public boolean equals(java.lang.Object aObject)
equals
in interface java.util.Map
equals
in class java.util.AbstractMap
aObject
- true
when this instance is equivalent to the
specified objectpublic java.lang.Object get(java.lang.Object aName)
get
in interface java.util.Map
get
in class java.util.AbstractMap
aName
- name whose associated value is to be returnednull
if this instance includes no association for this namepublic int hashCode()
java.util.HashMap
.hashCode
in interface java.util.Map
hashCode
in class java.util.AbstractMap
public boolean isEmpty()
isEmpty
in interface java.util.Map
isEmpty
in class java.util.AbstractMap
true
when this instance contains no name-value
associationspublic java.util.Set keySet()
keySet
in interface java.util.Map
keySet
in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object aName, java.lang.Object aValue)
String
instances. Any previous
association for this name is replaced.put
in interface java.util.Map
put
in class java.util.AbstractMap
aName
- name with which the specified value is to be associatedaValue
- value to be associated with the specified namenull
if there
was nonejava.lang.ClassCastException
- if either argument is not a String
java.lang.NullPointerException
- if either argument is null
public void putAll(java.util.Map aMap)
Map
to
this instance. Entries in the specified Map
are ignored
if the key is not a String
or if the value does not identify
a String
.putAll
in interface java.util.Map
putAll
in class java.util.AbstractMap
aMap
- the Map
to be copiedpublic java.lang.Object remove(java.lang.Object aName)
remove
in interface java.util.Map
remove
in class java.util.AbstractMap
aName
- name to be removed from this instancenull
if there
was nonepublic int size()
size
in interface java.util.Map
size
in class java.util.AbstractMap
public java.util.Collection values()
values
in interface java.util.Map
values
in class java.util.AbstractMap
public java.lang.String toString()
This implementation creates an empty string buffer, appends a left brace, and iterates over the map's entrySet view, appending the string representation of each map.entry in turn. After appending each entry except the last, the string ", " is appended. Finally a right brace is appended. A string is obtained from the stringbuffer, and returned.
public java.util.List<java.lang.String> getKeyStrings(ClassDefinition aClassDef, java.lang.String aUpperCaseClassName, java.lang.String aAspect, boolean aUseInsId)
public java.util.List<java.lang.String> getKeyStrings(ClassDefinition aClassDef, java.lang.String aAspect, boolean aUseInsId)
public java.lang.String getKeyString(ClassDefinition aClassDef)
aClassDef
- the class of the rule represented by the keyspublic java.lang.String getKeyString(ClassDefinition aClassDef, java.lang.String aAspect)
This method should only be used internally by PegaRULES.
aClassDef
- the class of the rule represented by the keysaAspect
- the aspect of the rulepublic java.lang.String toStringUpper()
This implementation creates an empty string buffer, appends a left brace, and iterates over the map's entrySet view, appending the string representation of each map.entry in turn. After appending each entry except the last, the string ", " is appended. Finally a right brace is appended. A string is obtained from the stringbuffer, and returned.
public int estimateInternalStringSize()
Copyright © 2015 Pegasystems Inc. All Rights Reserved.