Elements, Array and Lists With Clone Protocol, demonstration classes¶
This module demonstrate the usage of the various classes defined in
list_clone
- class sage.structure.list_clone_demo.IncreasingArray[source]¶
- Bases: - ClonableArray- A small extension class for testing - ClonableArray.- check()[source]¶
- Check that - selfis increasing.- EXAMPLES: - sage: from sage.structure.list_clone_demo import IncreasingArrays sage: IncreasingArrays()([1,2,3]) # indirect doctest [1, 2, 3] sage: IncreasingArrays()([3,2,1]) # indirect doctest Traceback (most recent call last): ... ValueError: array is not increasing - >>> from sage.all import * >>> from sage.structure.list_clone_demo import IncreasingArrays >>> IncreasingArrays()([Integer(1),Integer(2),Integer(3)]) # indirect doctest [1, 2, 3] >>> IncreasingArrays()([Integer(3),Integer(2),Integer(1)]) # indirect doctest Traceback (most recent call last): ... ValueError: array is not increasing 
 
- class sage.structure.list_clone_demo.IncreasingArrays[source]¶
- Bases: - UniqueRepresentation,- Parent- A small (incomplete) parent for testing - ClonableArray- Element[source]¶
- alias of - IncreasingArray
 
- class sage.structure.list_clone_demo.IncreasingIntArray[source]¶
- Bases: - ClonableIntArray- A small extension class for testing - ClonableIntArray.- check()[source]¶
- Check that - selfis increasing.- EXAMPLES: - sage: from sage.structure.list_clone_demo import IncreasingIntArrays sage: IncreasingIntArrays()([1,2,3]) # indirect doctest [1, 2, 3] sage: IncreasingIntArrays()([3,2,1]) # indirect doctest Traceback (most recent call last): ... ValueError: array is not increasing - >>> from sage.all import * >>> from sage.structure.list_clone_demo import IncreasingIntArrays >>> IncreasingIntArrays()([Integer(1),Integer(2),Integer(3)]) # indirect doctest [1, 2, 3] >>> IncreasingIntArrays()([Integer(3),Integer(2),Integer(1)]) # indirect doctest Traceback (most recent call last): ... ValueError: array is not increasing 
 
- class sage.structure.list_clone_demo.IncreasingIntArrays[source]¶
- Bases: - IncreasingArrays- A small (incomplete) parent for testing - ClonableIntArray- Element[source]¶
- alias of - IncreasingIntArray
 
- class sage.structure.list_clone_demo.IncreasingList[source]¶
- Bases: - ClonableList- A small extension class for testing - ClonableList- check()[source]¶
- Check that - selfis increasing.- EXAMPLES: - sage: from sage.structure.list_clone_demo import IncreasingLists sage: IncreasingLists()([1,2,3]) # indirect doctest [1, 2, 3] sage: IncreasingLists()([3,2,1]) # indirect doctest Traceback (most recent call last): ... ValueError: array is not increasing - >>> from sage.all import * >>> from sage.structure.list_clone_demo import IncreasingLists >>> IncreasingLists()([Integer(1),Integer(2),Integer(3)]) # indirect doctest [1, 2, 3] >>> IncreasingLists()([Integer(3),Integer(2),Integer(1)]) # indirect doctest Traceback (most recent call last): ... ValueError: array is not increasing 
 
- class sage.structure.list_clone_demo.IncreasingLists[source]¶
- Bases: - IncreasingArrays- A small (incomplete) parent for testing - ClonableList- Element[source]¶
- alias of - IncreasingList
 
- class sage.structure.list_clone_demo.SortedList[source]¶
- Bases: - NormalizedClonableList- A small extension class for testing - NormalizedClonableList.- check()[source]¶
- Check that - selfis strictly increasing.- EXAMPLES: - sage: from sage.structure.list_clone_demo import SortedList, SortedLists sage: SortedLists()([1,2,3]) # indirect doctest [1, 2, 3] sage: SortedLists()([3,2,2]) # indirect doctest Traceback (most recent call last): ... ValueError: list is not strictly increasing - >>> from sage.all import * >>> from sage.structure.list_clone_demo import SortedList, SortedLists >>> SortedLists()([Integer(1),Integer(2),Integer(3)]) # indirect doctest [1, 2, 3] >>> SortedLists()([Integer(3),Integer(2),Integer(2)]) # indirect doctest Traceback (most recent call last): ... ValueError: list is not strictly increasing 
 - normalize()[source]¶
- Normalize - self.- Sort the list stored in - self.- EXAMPLES: - sage: from sage.structure.list_clone_demo import SortedList, SortedLists sage: l = SortedList(SortedLists(), [3,1,2], False, False) sage: l # indirect doctest [1, 2, 3] sage: l[1] = 5; l [1, 5, 3] sage: l.normalize(); l [1, 3, 5] - >>> from sage.all import * >>> from sage.structure.list_clone_demo import SortedList, SortedLists >>> l = SortedList(SortedLists(), [Integer(3),Integer(1),Integer(2)], False, False) >>> l # indirect doctest [1, 2, 3] >>> l[Integer(1)] = Integer(5); l [1, 5, 3] >>> l.normalize(); l [1, 3, 5] 
 
- class sage.structure.list_clone_demo.SortedLists[source]¶
- Bases: - IncreasingLists- A small (incomplete) parent for testing - NormalizedClonableList- Element[source]¶
- alias of - SortedList