Chemical Data Processing Library Python API - Version 1.4.0
Public Member Functions | Properties | List of all members
CDPL.Chem.ElectronSystemList Class Reference

Data structure for the storage of Chem.ElectronSystem instances. More...

+ Inheritance diagram for CDPL.Chem.ElectronSystemList:

Public Member Functions

None __init__ ()
 Creates an empty list.
 
None __init__ (ElectronSystemList list)
 Contructs a copy of the ElectronSystemList instance list. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
int getSize ()
 Returns the number of elements stored in the list. More...
 
bool isEmpty ()
 Tells whether the list is empty (getSize() == 0). More...
 
None resize (int num_elem, ElectronSystem value)
 Inserts or erases elements at the end so that the size becomes num_elem. More...
 
None reserve (int num_elem)
 Preallocates memory for (at least) num_elem elements. More...
 
int getCapacity ()
 Returns the number of elements for which memory has been allocated. More...
 
None clear ()
 Erases all elements.
 
ElectronSystemList assign (ElectronSystemList list)
 Replaces the current state with a copy of the state of the ElectronSystemList instance list. More...
 
None assign (int num_elem, ElectronSystem value)
 This function fills the array with num_elem copies of the given value. More...
 
None addElement (ElectronSystem value)
 Adds a new element at the end of the list. More...
 
None addElements (ElectronSystemList values)
 Adds the elements of values to the end of the list. More...
 
None insertElement (int idx, ElectronSystem value)
 Inserts a new element before the location specified by the index idx. More...
 
None insertElements (int idx, int num_elem, ElectronSystem value)
 Inserts num_elem copies of value before the location specified by the index idx. More...
 
None insertElements (int idx, ElectronSystemList values)
 Insert the elements of values before the location specified by the index idx. More...
 
None popLastElement ()
 Removes the last element of the list. More...
 
None removeElement (int idx)
 Removes the element at index idx. More...
 
None removeElements (int begin_idx, int end_idx)
 Removes the elements at indices in the range [begin_idx, end_idx). More...
 
ElectronSystem getFirstElement ()
 Returns the first element of the list. More...
 
ElectronSystem getLastElement ()
 Returns the last element of the list. More...
 
ElectronSystem getElement (int idx)
 Returns the element at index idx. More...
 
None setElement (int idx, ElectronSystem value)
 Assigns a new value to the element at index idx. More...
 
None __delitem__ (int idx)
 Removes the element at index idx. More...
 
ElectronSystem __getitem__ (int idx)
 Returns the element at index idx. More...
 
int __len__ ()
 Returns the number of elements stored in the list. More...
 
None __setitem__ (int idx, ElectronSystem value)
 Assigns a new value to the element at index idx. More...
 
bool __eq__ (object list)
 Returns the result of the comparison operation self == list. More...
 
bool __ne__ (object list)
 Returns the result of the comparison operation self != list. More...
 

Properties

 objectID = property(getObjectID)
 
 size = property(getSize)
 

Detailed Description

Data structure for the storage of Chem.ElectronSystem instances.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.ElectronSystemList.__init__ ( ElectronSystemList  list)

Contructs a copy of the ElectronSystemList instance list.

Parameters
listThe ElectronSystemList instance to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.ElectronSystemList.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python ElectronSystemList 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 ElectronSystemList 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().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ getSize()

int CDPL.Chem.ElectronSystemList.getSize ( )

Returns the number of elements stored in the list.

Returns
The size of the list.

◆ isEmpty()

bool CDPL.Chem.ElectronSystemList.isEmpty ( )

Tells whether the list is empty (getSize() == 0).

Returns
True if the list is empty, False otherwise.

◆ resize()

None CDPL.Chem.ElectronSystemList.resize ( int  num_elem,
ElectronSystem  value 
)

Inserts or erases elements at the end so that the size becomes num_elem.

Parameters
num_elemThe new size.
valueThe value for newly inserted elements.

◆ reserve()

None CDPL.Chem.ElectronSystemList.reserve ( int  num_elem)

Preallocates memory for (at least) num_elem elements.

If num_elem is less than or equal to the current capacity, this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then the capacity is greater than or equal to num_elem. Otherwise, the capacity is unchanged. In either case, the number of elements will not change.

Parameters
num_elemThe number of elements to reserve memory for.
See also
getCapacity()

◆ getCapacity()

int CDPL.Chem.ElectronSystemList.getCapacity ( )

Returns the number of elements for which memory has been allocated.

The capacity is always greater than or equal to the number of currently stored elements.

Returns
The current capacity.

◆ assign() [1/2]

ElectronSystemList CDPL.Chem.ElectronSystemList.assign ( ElectronSystemList  list)

Replaces the current state with a copy of the state of the ElectronSystemList instance list.

Parameters
listThe ElectronSystemList instance to copy.
Returns
self.

◆ assign() [2/2]

None CDPL.Chem.ElectronSystemList.assign ( int  num_elem,
ElectronSystem  value 
)

This function fills the array with num_elem copies of the given value.

Note that the assignment completely changes the array and the new size is the same as the number of elements assigned. Old data will be lost.

Parameters
num_elemThe number of elements to be assigned.
valueThe value to be assigned.

◆ addElement()

None CDPL.Chem.ElectronSystemList.addElement ( ElectronSystem  value)

Adds a new element at the end of the list.

Parameters
valueThe value of the new element.

◆ addElements()

None CDPL.Chem.ElectronSystemList.addElements ( ElectronSystemList  values)

Adds the elements of values to the end of the list.

Parameters
valuesThe ElectronSystemList instance providing the elements to add.

◆ insertElement()

None CDPL.Chem.ElectronSystemList.insertElement ( int  idx,
ElectronSystem  value 
)

Inserts a new element before the location specified by the index idx.

Parameters
idxThe location where to insert the new element.
valueThe value of the element to insert.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()].

◆ insertElements() [1/2]

None CDPL.Chem.ElectronSystemList.insertElements ( int  idx,
int  num_elem,
ElectronSystem  value 
)

Inserts num_elem copies of value before the location specified by the index idx.

Parameters
idxThe location where to insert the new elements.
num_elemThe number of elements to insert.
valueThe value of the elements to insert.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()].

◆ insertElements() [2/2]

None CDPL.Chem.ElectronSystemList.insertElements ( int  idx,
ElectronSystemList  values 
)

Insert the elements of values before the location specified by the index idx.

Parameters
idxThe zero-based insertion index.
valuesThe ElectronSystemList instance providing the elements to insert.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()].

◆ popLastElement()

None CDPL.Chem.ElectronSystemList.popLastElement ( )

Removes the last element of the list.

Exceptions
Base.OperationFailedif the list is empty.

◆ removeElement()

None CDPL.Chem.ElectronSystemList.removeElement ( int  idx)

Removes the element at index idx.

Parameters
idxThe zero-based index of the element to remove.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()).

◆ removeElements()

None CDPL.Chem.ElectronSystemList.removeElements ( int  begin_idx,
int  end_idx 
)

Removes the elements at indices in the range [begin_idx, end_idx).

Parameters
begin_idxThe zero-based index range start.
end_idxThe zero-based index range end.
Exceptions
Base.IndexErrorif begin_idx or end_idx is not in the range [0, getSize()] or end_idx < begin_idx.

◆ getFirstElement()

ElectronSystem CDPL.Chem.ElectronSystemList.getFirstElement ( )

Returns the first element of the list.

Returns
The first element.
Exceptions
Base.OperationFailedif the list is empty.

◆ getLastElement()

ElectronSystem CDPL.Chem.ElectronSystemList.getLastElement ( )

Returns the last element of the list.

Returns
The last element.
Exceptions
Base.OperationFailedif the list is empty.

◆ getElement()

ElectronSystem CDPL.Chem.ElectronSystemList.getElement ( int  idx)

Returns the element at index idx.

The method is equivalent to __getitem__().

Parameters
idxThe zero-based index of the element.
Returns
The value of the element.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()).

◆ setElement()

None CDPL.Chem.ElectronSystemList.setElement ( int  idx,
ElectronSystem  value 
)

Assigns a new value to the element at index idx.

Parameters
idxThe zero-based index of the element.
valueThe new value of the element after assignment.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()).

◆ __delitem__()

None CDPL.Chem.ElectronSystemList.__delitem__ ( int  idx)

Removes the element at index idx.

Parameters
idxThe zero-based index of the element to remove.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()).

◆ __getitem__()

ElectronSystem CDPL.Chem.ElectronSystemList.__getitem__ ( int  idx)

Returns the element at index idx.

Parameters
idxThe zero-based index of the element.
Returns
The value of the element.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()).

◆ __len__()

int CDPL.Chem.ElectronSystemList.__len__ ( )

Returns the number of elements stored in the list.

Returns
The size of the list.

◆ __setitem__()

None CDPL.Chem.ElectronSystemList.__setitem__ ( int  idx,
ElectronSystem  value 
)

Assigns a new value to the element at index idx.

Parameters
idxThe zero-based index of the element.
valueThe new value of the element after assignment.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()).

◆ __eq__()

bool CDPL.Chem.ElectronSystemList.__eq__ ( object  list)

Returns the result of the comparison operation self == list.

Parameters
listThe object instance to be compared with.
Returns
The result of the comparison operation.

◆ __ne__()

bool CDPL.Chem.ElectronSystemList.__ne__ ( object  list)

Returns the result of the comparison operation self != list.

Parameters
listThe object instance to be compared with.
Returns
The result of the comparison operation.