| Home | Trees | Index | Help |
|---|
| Module interval :: Class FrozenIntervalSet |
|
object --+
|
BaseIntervalSet --+
|
FrozenIntervalSet
An immutable version of BaseIntervalSet
FrozenIntervalSet is like IntervalSet, only add and remove are not implemented, and hashes can be generated.>>> fs = FrozenIntervalSet([3, 6, 2, 4]) >>> fs.add(12) Traceback (most recent call last): ... AttributeError: 'FrozenIntervalSet' object has no attribute 'add' >>> fs.remove(4) Traceback (most recent call last): ... AttributeError: 'FrozenIntervalSet' object has no attribute 'remove' >>> fs.clear() Traceback (most recent call last): ... AttributeError: 'FrozenIntervalSet' object has no attribute 'clear'Because FrozenIntervalSets are immutable, they can be used as a dictionary key.
>>> d = {
... FrozenIntervalSet([3, 66]) : 52,
... FrozenIntervalSet.less_than(3) : 3}
| Method Summary | |
|---|---|
Initializes the FrozenIntervalSet | |
Generates a 32-bit hash key | |
Constructs a new FrozenInteralSet (Static method) | |
Returns an evaluable representation of the object | |
Duplicates the object | |
| Inherited from BaseIntervalSet | |
Returns the union of two IntervalSets | |
Returns the intersection of self and other. | |
Compares two BaseIntervalSets | |
Tells whether the BaseIntervalSet contains the given value | |
Tests if two BaseIntervalSets are equivalent | |
Tests if the given operand is a superset or is equal to the object | |
Gets the interval at the given index | |
Tests if the given operand is a superset of the object | |
Returns the disjoint set of self | |
Returns an iterator over the intervals in the set | |
Tests if the given operand is a subset or is equal to the object | |
Returns the number of intervals contained in the object | |
Tests if the given operand is a subset of the object | |
Tests if two BaseIntervalSets are not equivalent | |
Returns the union of two IntervalSets. | |
Returns a string representation of the object | |
Subtracts intervals in the given object from the object and returns the result | |
Returns the exclusive or of two IntervalSets. | |
Returns an interval set containing all values (Class method) | |
Returns an IntervalSet of all values between a and b. (Class method) | |
Returns an interval that encompasses the entire BaseIntervalSet | |
Returns the difference between the object and the given object | |
Returns an interval set containing no values. (Class method) | |
Returns an IntervalSet containing values greater than the given value (Class method) | |
Returns an IntervalSet containing values greater than or equal to the given value (Class method) | |
Returns the intersection between the object and the given value | |
Tells if the given object is a subset of the object | |
Tells whether the given object is a superset of the object | |
Returns an IntervalSet containing values less than the given value (Class method) | |
Returns an IntervalSet containing values less than or equal to the given value (Class method) | |
Returns the lower boundary of the BaseIntervalSet | |
Returns a boolean telling whether the lower bound is closed or not | |
Returns an IntervalSet of all values not equal to n (Class method) | |
Returns the exclusive or of the given value with the object | |
Returns the union of the given value with the object | |
Returns the upper boundary of the BaseIntervalSet | |
Returns a boolean telling whether the upper bound is closed or not | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
| Instance Method Details |
|---|
__init__(self,
items=[])
Initializes the FrozenIntervalSet
|
__hash__(self)
Generates a 32-bit hash key
|
__repr__(self)
Returns an evaluable representation of the object
|
copy(self)Duplicates the object For FrozenIntervalSet objects, since they're immutable, a reference, not a copy, of self is returned.>>> s = FrozenIntervalSet( ... [7, 2, 3, 2, 6, 2, Interval.greater_than(3)]) >>> s2 = s.copy() >>> s == s2 True >>> id(s) == id(s2) True
|
| Static Method Details |
|---|
__new__(cls, items=[])Constructs a new FrozenInteralSet Object creation is just like with a regular IntervalSet, except for the special case where another FrozenIntervalSet is passed as the initializer iterable. If it is, then the result points to the same object.>>> fs1 = FrozenIntervalSet.greater_than(12) >>> fs2 = FrozenIntervalSet(fs1) >>> id(fs1) == id(fs2) True
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Wed Nov 9 22:22:37 2005 | http://epydoc.sf.net |