org.python.core

Class PyStringMap

public class PyStringMap extends PyObject

A faster Dictionary where the keys have to be strings.

This is the default for all __dict__ instances.

Constructor Summary
PyStringMap(int capacity)
PyStringMap()
PyStringMap(PyObject[] elements)
Method Summary
voidclear()
Remove all items from the dictionary.
PyStringMapcopy()
Return a shallow copy of the dictionary.
PyObjectget(PyObject key, PyObject default_object)
Return this[key] if the key exists in the mapping, default_object is returned otherwise.
PyObjectget(PyObject key)
Return this[key] if the key exists in the mapping, None is returned otherwise.
booleanhas_key(PyObject key)
Return true if the key exist in the dictionary.
PyListitems()
Return a copy of the mappings list of (key, value) tuple pairs.
PyObjectiteritems()
return an iterator over (key, value) pairs
PyObjectiterkeys()
return an iterator over the keys
PyObjectitervalues()
return an iterator over the values
PyListkeys()
Return a copy of the mappings list of keys.
PyObjectpopitem()
Return a random (key, value) tuple pair and remove the pair from the mapping.
PyObjectsetdefault(PyObject key)
Return this[key] if the key exist, otherwise insert key with a None value and return None.
PyObjectsetdefault(PyObject key, PyObject failobj)
Return this[key] if the key exist, otherwise insert key with the value of failobj and return failobj
StringtoString()
voidupdate(PyStringMap map)
Insert all the key:value pairs from map into this mapping.
voidupdate(PyDictionary dict)
Insert all the key:value pairs from dict into this mapping.
PyListvalues()
Return a copy of the mappings list of values.
int__cmp__(PyObject other)
void__delitem__(String key)
void__delitem__(PyObject key)
PyObject__finditem__(String key)
PyObject__finditem__(PyObject key)
PyObject__iter__()
int__len__()
boolean__nonzero__()
void__setitem__(String key, PyObject value)
void__setitem__(PyObject key, PyObject value)

Constructor Detail

PyStringMap

public PyStringMap(int capacity)

PyStringMap

public PyStringMap()

PyStringMap

public PyStringMap(PyObject[] elements)

Method Detail

clear

public void clear()
Remove all items from the dictionary.

copy

public PyStringMap copy()
Return a shallow copy of the dictionary.

get

public PyObject get(PyObject key, PyObject default_object)
Return this[key] if the key exists in the mapping, default_object is returned otherwise.

Parameters: key the key to lookup in the mapping. default_object the value to return if the key does not exists in the mapping.

get

public PyObject get(PyObject key)
Return this[key] if the key exists in the mapping, None is returned otherwise.

Parameters: key the key to lookup in the mapping.

has_key

public boolean has_key(PyObject key)
Return true if the key exist in the dictionary.

items

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

iteritems

public PyObject iteritems()
return an iterator over (key, value) pairs

iterkeys

public PyObject iterkeys()
return an iterator over the keys

itervalues

public PyObject itervalues()
return an iterator over the values

keys

public PyList keys()
Return a copy of the mappings list of keys.

popitem

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

setdefault

public PyObject setdefault(PyObject key)
Return this[key] if the key exist, otherwise insert key with a None value and return None.

Parameters: key the key to lookup in the mapping.

setdefault

public PyObject setdefault(PyObject key, PyObject failobj)
Return this[key] if the key exist, otherwise insert key with the value of failobj and return failobj

Parameters: key the key to lookup in the mapping. failobj the default value to insert in the mapping if key does not already exist.

toString

public String toString()

update

public void update(PyStringMap map)
Insert all the key:value pairs from map into this mapping.

update

public void update(PyDictionary dict)
Insert all the key:value pairs from dict into this mapping.

values

public PyList values()
Return a copy of the mappings list of values.

__cmp__

public int __cmp__(PyObject other)

__delitem__

public void __delitem__(String key)

__delitem__

public void __delitem__(PyObject key)

__finditem__

public PyObject __finditem__(String key)

__finditem__

public PyObject __finditem__(PyObject key)

__iter__

public PyObject __iter__()

__len__

public int __len__()

__nonzero__

public boolean __nonzero__()

__setitem__

public void __setitem__(String key, PyObject value)

__setitem__

public void __setitem__(PyObject key, PyObject value)