This class stores integers in ordered compact lists eg: [[1,2,3],[6,7,8]] the methods help splitting and merging the internal lists Example: s=Segments([1,2,3]) is [[1,2,3]] s.add(4) is [[1,2,3,4]] (add right) s.add(3) is [[1,2,3,4]] (item already existing) s.add(7) is [[1,2,3,4],[7]] (new list) s.add([8,9]) is [[1,2,3,4],[7,8,9]] (add item right) s.add([5,6]) is [[1,2,3,4,5,6,7,8,9]] (merge) s.remove(3) is [[1,2],[4,5,6,7,8,9]] (split) etc.
More...
This class stores integers in ordered compact lists eg: [[1,2,3],[6,7,8]] the methods help splitting and merging the internal lists Example: s=Segments([1,2,3]) is [[1,2,3]] s.add(4) is [[1,2,3,4]] (add right) s.add(3) is [[1,2,3,4]] (item already existing) s.add(7) is [[1,2,3,4],[7]] (new list) s.add([8,9]) is [[1,2,3,4],[7,8,9]] (add item right) s.add([5,6]) is [[1,2,3,4,5,6,7,8,9]] (merge) s.remove(3) is [[1,2],[4,5,6,7,8,9]] (split) etc.
- Note
- This class is only available in Python.
Definition at line 610 of file tools.py.
def IMP.pmi.tools.Segments.__init__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
index can be a integer or a list of integers
Definition at line 627 of file tools.py.
def IMP.pmi.tools.Segments.add |
( |
|
self, |
|
|
|
index |
|
) |
| |
index can be a integer or a list of integers
Definition at line 638 of file tools.py.
def IMP.pmi.tools.Segments.get_flatten |
( |
|
self | ) |
|
Returns a flatten list.
Definition at line 691 of file tools.py.
def IMP.pmi.tools.Segments.remove |
( |
|
self, |
|
|
|
index |
|
) |
| |
index can be a integer
Definition at line 673 of file tools.py.
The documentation for this class was generated from the following file: