![]() |
Chemical Data Processing Library Python API - Version 1.4.0
|
Half-open index range \( [start, stop) \) used for slicing vector and matrix expressions. More...
Inheritance diagram for CDPL.Math.Range:Public Member Functions | |
| None | __init__ () |
| Constructs an empty range \( [0, 0) \). | |
| None | __init__ (Range r) |
Initializes a copy of the Range instance r. More... | |
| None | __init__ (int start, int stop) |
| Constructs the range \( [start, stop) \). More... | |
| int | getStart () |
| Returns the lower (inclusive) bound. More... | |
| int | getStop () |
| Returns the upper (exclusive) bound. More... | |
| int | getSize () |
| Returns the size of the range, \( stop - start \). More... | |
| bool | isEmpty () |
| Tells whether the range is empty. More... | |
| int | getIndex (int i) |
| Range | assign (Range r) |
Replaces the current state of self with a copy of the state of the Range instance r. More... | |
| None | swap (Range r) |
Swaps the contents of self and r. More... | |
| int | getObjectID () |
| Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
| bool | __eq__ (Range r) |
| Equality comparison. More... | |
| bool | __ne__ (Range r) |
| Inequality comparison. More... | |
| int | __call__ (int i) |
| Maps the local position i to the global index start + i. More... | |
| int | __getitem__ (int i) |
Properties | |
| objectID = property(getObjectID) | |
| start = property(getStart) | |
| stop = property(getStop) | |
| size = property(getSize) | |
Half-open index range \( [start, stop) \) used for slicing vector and matrix expressions.
| None CDPL.Math.Range.__init__ | ( | Range | r | ) |
Initializes a copy of the Range instance r.
| r | The Range instance to copy. |
| None CDPL.Math.Range.__init__ | ( | int | start, |
| int | stop | ||
| ) |
Constructs the range \( [start, stop) \).
| start | The lower (inclusive) bound. |
| stop | The upper (exclusive) bound. |
| Base.RangeError | if start > stop. |
| int CDPL.Math.Range.getStart | ( | ) |
Returns the lower (inclusive) bound.
| int CDPL.Math.Range.getStop | ( | ) |
Returns the upper (exclusive) bound.
| int CDPL.Math.Range.getSize | ( | ) |
Returns the size of the range, \( stop - start \).
| bool CDPL.Math.Range.isEmpty | ( | ) |
Tells whether the range is empty.
True if the range is empty, and False otherwise. | int CDPL.Math.Range.getIndex | ( | int | i | ) |
| i |
Replaces the current state of self with a copy of the state of the Range instance r.
| r | The Range instance to copy. |
| None CDPL.Math.Range.swap | ( | Range | r | ) |
Swaps the contents of self and r.
| r | The other range. |
| int CDPL.Math.Range.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python Range instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two Range instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().
| bool CDPL.Math.Range.__eq__ | ( | Range | r | ) |
Equality comparison.
| r | The other range. |
True if both ranges have the same start and stop, and False otherwise. | bool CDPL.Math.Range.__ne__ | ( | Range | r | ) |
Inequality comparison.
| r | The other range. |
True if the ranges differ in start or stop, and False otherwise. | int CDPL.Math.Range.__call__ | ( | int | i | ) |
Maps the local position i to the global index start + i.
| i | The zero-based local position. |
| Base.IndexError | if i is not in the range \( [0, size) \). |
| int CDPL.Math.Range.__getitem__ | ( | int | i | ) |
| i |