self.solver = solver
def __getitem__(self, index):
+ """
+ Get the datatype constructor with the given index, where index can
+ be either a numeric id starting with zero, or the name of the
+ constructor. In the latter case, this is a linear search through the
+ constructors, so in case of multiple, similarly-named constructors,
+ the first is returned.
+
+ :param index: The id or name of the datatype constructor.
+ :return: The matching datatype constructor.
+ """
cdef DatatypeConstructor dc = DatatypeConstructor(self.solver)
if isinstance(index, int) and index >= 0:
dc.cdc = self.cd[(<int?> index)]
return self.cd.toString().decode()
def __iter__(self):
+ """Iterate over all constructors."""
for ci in self.cd:
dc = DatatypeConstructor(self.solver)
dc.cdc = ci
self.solver = solver
def __getitem__(self, index):
+ """
+ Get the datatype selector with the given index, where index can be
+ either a numeric id starting with zero, or the name of the selector.
+ In the latter case, this is a linear search through the selectors,
+ so in case of multiple, similarly-named selectors, the first is
+ returned.
+
+ :param index: The id or name of the datatype selector.
+ :return: The matching datatype selector.
+ """
cdef DatatypeSelector ds = DatatypeSelector(self.solver)
if isinstance(index, int) and index >= 0:
ds.cds = self.cdc[(<int?> index)]
return self.cdc.toString().decode()
def __iter__(self):
+ """Iterate over all datatype selectors."""
for ci in self.cdc:
ds = DatatypeSelector(self.solver)
ds.cds = ci
"""
return self.cop.getNumIndices()
- def __getitem__(self, i):
+ def __getitem__(self, int i):
"""
Get the index at position ``i``.
return self.cterm >= other.cterm
def __getitem__(self, int index):
+ """
+ Get the child term at a given index.
+
+ :param index: The index of the child term to return.
+ :return: The child term with the given index.
+ """
cdef Term term = Term(self.solver)
if index >= 0:
term.cterm = self.cterm[index]
return self.cterm.toString().decode()
def __iter__(self):
+ """Iterate over all child terms."""
for ci in self.cterm:
term = Term(self.solver)
term.cterm = ci