Package muntjac :: Package data :: Module container :: Class ISortable
[hide private]
[frames] | no frames]

Class ISortable

source code

object --+        
         |        
IContainer --+    
             |    
      IOrdered --+
                 |
                ISortable

Interface for IContainer classes whose Items can be sorted.

When an IOrdered or IIndexed container is sorted, all relevant operations of these interfaces should only use the filtered and sorted contents and the filtered indices to the container. Indices or item identifiers in the public API refer to the visible view unless otherwise stated. However, the addItem*() methods may add items that will be filtered out after addition or moved to another position based on sorting.

How sorting is performed when a IHierarchical container implements ISortable is implementation specific and should be documented in the implementing class. However, the recommended approach is sorting the roots and the sets of children of each item separately.

Depending on the container type, sorting a container may permanently change the internal order of items in the container.

Instance Methods [hide private]
 
sort(self, propertyId, ascending)
Sort method.
source code
 
getSortableContainerPropertyIds(self)
Gets the container property IDs which can be used to sort the items.
source code

Inherited from IOrdered: addItemAfter, firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId

Inherited from IContainer: addContainerProperty, addItem, containsId, getContainerProperty, getContainerPropertyIds, getItem, getItemIds, getType, removeAllItems, removeContainerProperty, removeItem, size

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

sort(self, propertyId, ascending)

source code 

Sort method.

Sorts the container items.

Sorting a container can irreversibly change the order of its items or only change the order temporarily, depending on the container.

Parameters:
  • propertyId - Array of container property IDs, whose values are used to sort the items in container as primary, secondary, ... sorting criterion. All of the item IDs must be in the collection returned by getSortableContainerPropertyIds
  • ascending - Array of sorting order flags corresponding to each property ID used in sorting. If this array is shorter than propertyId array, ascending order is assumed for items where the order is not specified. Use True to sort in ascending order, False to use descending order.

getSortableContainerPropertyIds(self)

source code 

Gets the container property IDs which can be used to sort the items.

Returns:
the IDs of the properties that can be used for sorting the container