Top Description Inners Fields Constructors Methods
org.python.core

public Class PyStringMap

extends AbstractDict
implements Traverseproc
Class Inheritance
All Implemented Interfaces
org.python.core.Traverseproc
Annotations
@ExposedType
name:stringmap
base:PyObject
isBaseType:false
Imports
java.util.Collection, .Iterator, .Map, .Set, .AbstractSet, .Map.Entry, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, org.python.core.AbstractDict.ValuesIter, .AbstractDict.KeysIter, .AbstractDict.ItemsIter, .PyMapSet.PySetIter, org.python.expose.ExposedClassMethod, .ExposedMethod, .ExposedNew, .ExposedType, .MethodType, org.python.util.Generic

Special fast dict implementation for __dict__ instances. Allows interned String keys in addition to PyObject unlike PyDictionary.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class
private class
private class

Field Summary

Modifier and TypeField and Description
private static PyType
lazyType

TYPE computed lazily, PyStringMap is used early in the bootstrap process and statically calling fromClass(PyStringMap.class) is unsafe.

private final ConcurrentMap<Object, PyObject>

Constructor Summary

AccessConstructor and Description
public
public
PyStringMap(int capacity)

public
public
PyStringMap(PyObject[] elements)

Method Summary

Modifier and TypeMethod and Description
public int
__cmp__(PyObject
the object to compare this with.
other
)

Overrides org.python.core.PyObject.__cmp__.

Equivalent to the standard Python __cmp__ method.

public boolean
__contains__(PyObject
the element to search for in this container.
o
)

Overrides org.python.core.PyObject.__contains__.

Equivalent to the standard Python __contains__ method.

public void
__delitem__(String
the key who will be removed - must be an interned string .
key
)

Overrides org.python.core.PyObject.__delitem__.

A variant of the __delitem__ method which accepts a String as the key.

public void
__delitem__(PyObject
the key to be removed from the container
key
)

Overrides org.python.core.PyObject.__delitem__.

Equivalent to the standard Python __delitem__ method.

public PyObject
__finditem__(String
the key to lookup in this sequence - must be an interned string .
key
)

Overrides org.python.core.PyObject.__finditem__.

A variant of the __finditem__ method which accepts a Java String as the key.

public PyObject
__finditem__(PyObject
the key to lookup in this container
key
)

Overrides org.python.core.PyObject.__finditem__.

Very similar to the standard Python __getitem__ method.

public PyObject
public PyObject
__getitem__(PyObject
the key to lookup in this container.
key
)

Overrides org.python.core.PyObject.__getitem__.

Equivalent to the standard Python __getitem__ method.

public PyObject
__iter__()

Overrides org.python.core.PyObject.__iter__.

Return an iterator that is used to iterate the element of this sequence.

public int
__len__()

Overrides org.python.core.PyObject.__len__.

Equivalent to the standard Python __len__ method.

public boolean
__nonzero__()

Overrides org.python.core.PyObject.__nonzero__.

Equivalent to the standard Python __nonzero__ method.

public void
__setitem__(String
the key whose value will be set - must be an interned string .
key
,
PyObject
the value to set this key to
value
)

Overrides org.python.core.PyObject.__setitem__.

A variant of the __setitem__ method which accepts a String as the key.

public void
__setitem__(PyObject
the key whose value will be set
key
,
PyObject
the value to set this key to
value
)

Overrides org.python.core.PyObject.__setitem__.

Equivalent to the standard Python __setitem__ method.

public void
clear()

Implements abstract org.python.core.AbstractDict.clear.

Remove all items from the dictionary.

public PyStringMap
copy()

Implements abstract org.python.core.AbstractDict.copy.

Return a shallow copy of the dictionary.

public Set<E>
public static PyObject
public static PyObject
fromkeys(PyObject keys, PyObject value)

public PyObject
get(PyObject
the key to lookup in the mapping.
key
,
PyObject
the value to return if the key does not exists in the mapping.
defaultObj
)

Implements abstract org.python.core.AbstractDict.get.

Return this[key] if the key exists in the mapping, defaultObj is returned otherwise.

public PyObject
get(PyObject
the key to lookup in the mapping.
key
)

Implements abstract org.python.core.AbstractDict.get.

Return this[key] if the key exists in the mapping, None is returned otherwise.

private static PyType
public ConcurrentMap<Object, PyObject>
public boolean
has_key(String key)

Return true if the key exist in the dictionary.

public boolean
public int
hashCode()

Overrides org.python.core.PyObject.hashCode.

Returns a hash code value for this object.

public boolean
public boolean
public PyList
items()

Implements abstract org.python.core.AbstractDict.items.

Return a copy of the mappings list of (key, value) tuple pairs.

private PyTuple
public PyObject
iteritems()

Implements abstract org.python.core.AbstractDict.iteritems.

return an iterator over (key, value) pairs

public PyObject
iterkeys()

Implements abstract org.python.core.AbstractDict.iterkeys.

return an iterator over the keys

public PyObject
itervalues()

Implements abstract org.python.core.AbstractDict.itervalues.

return an iterator over the values

public PyList
keys()

Implements abstract org.python.core.AbstractDict.keys.

Return a copy of the mappings list of keys.

private static PyObject
keyToPy(Object objKey)

private void
merge(PyObject
a PyObject with a keys() method
other
)

Merge another PyObject that supports keys() with this dict.

public void
merge(PyObject
a PyObject with a keys() method
other
,
boolean
if true, the value from other is used on key-collision
override
)

Implements abstract org.python.core.AbstractDict.merge.

Merge another PyObject that supports keys() with this dict.

private void
mergeFromKeys(PyObject
a PyObject with a keys() method
other
,
PyObject
the result of other's keys() method
keys
)

Merge another PyObject via its keys() method

public void
mergeFromKeys(PyObject
a PyObject with a keys() method
other
,
PyObject
the result of other's keys() method
keys
,
boolean
if true, the value from other is used on key-collision
override
)

Implements abstract org.python.core.AbstractDict.mergeFromKeys.

Merge another PyObject via its keys() method

private void
mergeFromSeq(PyObject
another PyObject
other
)

Merge any iterable object producing iterable objects of length 2 into this dict.

public void
mergeFromSeq(PyObject
another PyObject
other
,
boolean
if true, the value from other is used on key-collision
override
)

Implements abstract org.python.core.AbstractDict.mergeFromSeq.

Merge any iterable object producing iterable objects of length 2 into this dict.

public PyObject
public PyObject
pop(PyObject key, PyObject failobj)

Implements abstract org.python.core.AbstractDict.pop.

public PyObject
popitem()

Implements abstract org.python.core.AbstractDict.popitem.

Return a random (key, value) tuple pair and remove the pair from the mapping.

public Set<PyObject>
private static Object
public boolean
public PyObject
setdefault(PyObject
the key to lookup in the mapping.
key
)

Implements abstract org.python.core.AbstractDict.setdefault.

Return this[key] if the key exist, otherwise insert key with a None value and return None.

public PyObject
setdefault(PyObject
the key to lookup in the mapping.
key
,
PyObject
the default value to insert in the mapping if key does not already exist.
failobj
)

Implements abstract org.python.core.AbstractDict.setdefault.

Return this[key] if the key exist, otherwise insert key with the value of failobj and return failobj

pack-priv final int
pack-priv final boolean
pack-priv final void
pack-priv final PyObject
pack-priv final int
pack-priv final PyObject
pack-priv final int
pack-priv final void
pack-priv final void
pack-priv final PyStringMap
pack-priv static PyObject
pack-priv final PyObject
stringmap_get(PyObject key, PyObject defaultObj)

pack-priv final boolean
pack-priv final PyList
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyList
pack-priv static final PyObject
stringmap_new(PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords)

pack-priv final PyObject
pack-priv final PyObject
pack-priv final PyObject
pack-priv final String
pack-priv final void
stringmap_update(PyObject[] args, String[] keywords)

Insert all the key:value pairs from dict into this mapping.

pack-priv final PyList
public String
toString()

Overrides org.python.core.PyObject.toString.

Returns a string representation of the object.

public int
traverse(Visitproc visit, Object arg)

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

public void
public PyList
values()

Implements abstract org.python.core.AbstractDict.values.

Return a copy of the mappings list of values.

public PyObject
viewitems()

Overrides org.python.core.AbstractDict.viewitems.

Returns a dict_items on the dictionary's items

public PyObject
viewkeys()

Overrides org.python.core.AbstractDict.viewkeys.

Returns a dict_keys on the dictionary's keys

public PyObject
viewvalues()

Overrides org.python.core.AbstractDict.viewvalues.

Returns a dict_values on the dictionary's values

Inherited from org.python.core.AbstractDict:
tojava