### Navigation

- index
- modules |
- next |
- previous |
- Basic Structures »

# Elements, Array and Lists With Clone Protocol, demonstration classes

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`

  Bases: `sage.structure.list_clone.ClonableArray`

  A small extension class for testing `ClonableArray`.

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingArrays
      sage: TestSuite(IncreasingArrays()([1,2,3])).run()
      sage: TestSuite(IncreasingArrays()([])).run()

  `check`()

    Check that `self` is 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

class `sage.structure.list_clone_demo.``IncreasingArrays`

  Bases: `sage.structure.unique_representation.UniqueRepresentation`, `sage.structure.parent.Parent`

  A small (incomplete) parent for testing `ClonableArray`

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingArrays
      sage: IncreasingArrays().element_class
      <type 'sage.structure.list_clone_demo.IncreasingArray'>

  `Element`

    alias of `IncreasingArray`

class `sage.structure.list_clone_demo.``IncreasingIntArray`

  Bases: `sage.structure.list_clone.ClonableIntArray`

  A small extension class for testing `ClonableIntArray`.

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingIntArrays
      sage: TestSuite(IncreasingIntArrays()([1,2,3])).run()
      sage: TestSuite(IncreasingIntArrays()([])).run()

  `check`()

    Check that `self` is 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

class `sage.structure.list_clone_demo.``IncreasingIntArrays`

  Bases: `sage.structure.list_clone_demo.IncreasingArrays`

  A small (incomplete) parent for testing `ClonableIntArray`

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingIntArrays
      sage: IncreasingIntArrays().element_class
      <type 'sage.structure.list_clone_demo.IncreasingIntArray'>

  `Element`

    alias of `IncreasingIntArray`

class `sage.structure.list_clone_demo.``IncreasingList`

  Bases: `sage.structure.list_clone.ClonableList`

  A small extension class for testing `ClonableList`

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingLists
      sage: TestSuite(IncreasingLists()([1,2,3])).run()
      sage: TestSuite(IncreasingLists()([])).run()

  `check`()

    Check that `self` is 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

class `sage.structure.list_clone_demo.``IncreasingLists`

  Bases: `sage.structure.list_clone_demo.IncreasingArrays`

  A small (incomplete) parent for testing `ClonableList`

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingLists
      sage: IncreasingLists().element_class
      <type 'sage.structure.list_clone_demo.IncreasingList'>

  `Element`

    alias of `IncreasingList`

class `sage.structure.list_clone_demo.``SortedList`

  Bases: `sage.structure.list_clone.NormalizedClonableList`

  A small extension class for testing `NormalizedClonableList`.

  TESTS:

      sage: from sage.structure.list_clone_demo import IncreasingIntArrays
      sage: TestSuite(IncreasingIntArrays()([1,2,3])).run()
      sage: TestSuite(IncreasingIntArrays()([])).run()

  `check`()

    Check that `self` is 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

  `normalize`()

    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]

class `sage.structure.list_clone_demo.``SortedLists`

  Bases: `sage.structure.list_clone_demo.IncreasingLists`

  A small (incomplete) parent for testing `NormalizedClonableList`

  TESTS:

      sage: from sage.structure.list_clone_demo import SortedList, SortedLists
      sage: SL = SortedLists()
      sage: SL([3,1,2])
      [1, 2, 3]

  `Element`

    alias of `SortedList`

### Navigation

- index
- modules |
- next |
- previous |
- Basic Structures »