| Home | Trees | Indices | Help |
|
|---|
|
|
UserList.UserList --+
|
ListSet
Class to represent Sets of objects stored in a list. There is an
implicit order amongst the objects and there can be duplicate objects.
__getattr__, __setattr__ and __delattr__ have been modified to operate on
the list of objects rather than the TreeNodeSet itself, i.e. if atm is an
instance of a ListSet a.xxx will not return the member xxx of the object
atm but rather a list of the members xxx from each object in the set atm.
xxx can be a member of a function that requires no argument.
Example:
if atm is an instance of a ListSet:
atm.name return the name attribute of each Atom in atm
atm.newprop = 7.2 creates a newprop attribute for each Atom in atm
with an initial value of 7.2
atm.newIndex = range(len(atm)) create a newIndex attribute for each Atom
in atm with values 0 for the first atom, 1 for the
second, etc...
del atm.newIndex
This class also implement boolean operations on ListSets. These operation
overload some operators.
A uniq() method returns a list with the double removed.
A makeUnique() method removes duplicates from list (in place).
|
|||
| __init__(self, data=None, elementType=None, stringRepr=None, comments="", keywords=[]) | ||
|
setStringRepr(self,
string) set the string representation of this set |
||
|
getStringRepr(self) return the string representation of this set |
||
|
copy(self) return a copy of the set |
||
|
__str__(self) add here because __str__ is missing in UserList which creates a pb in jpython |
||
| __delattr__(self, member) | ||
| __iter__(self, *cfg, **kw) | ||
|
__getattr__(self,
member) Extract the specified member from each objects in the set and returns them as a list |
||
| getAll(self, member) | ||
| setAll(self, member, value) | ||
|
__setattr__(self,
member,
value) Set or create member in each object in this set. |
||
| append(self, item) | ||
| insert(self, i, item) | ||
| pop(self, i=-1) | ||
| remove(self, item) | ||
| __getslice__(self, i, j) | ||
| __delslice__(self, i, j) | ||
| __mul__(self, n) | ||
| __imul__(self, n) | ||
| extend(self, right) | ||
|
__iadd__(self,
right) See add: overloads += operator |
||
|
__add__(self,
right) See add: overloads + operator |
||
|
union(self,
right) Union: returns a Set holding objects appearing in either list |
||
|
__or__(self,
right) See union: overloads | operator |
||
|
xor(self,
right) XOR operation: Returns a set made of the elements appearing in first or second set but not in both |
||
|
__xor__(self,
right) See union: overloads ^ operator |
||
|
inter(self,
right) Intersection: returns a Set holding objects appearing in both sets |
||
|
__and__(self,
right) See inter: overloads & operator |
||
|
subtract(self,
right) Returns a set made of the elements of the first set not appearing in the second set |
||
|
__sub__(self,
right) See subtract: overloads - operator |
||
|
makeUniq(self) removes duplicates from set (in place) |
||
| uniq(self) | ||
|
Inherited from |
|||
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0alpha3 on Fri Nov 2 14:10:27 2007 | http://epydoc.sourceforge.net |