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

Class IIndexed

source code

object --+        
         |        
IContainer --+    
             |    
      IOrdered --+
                 |
                IIndexed
Known Subclasses:

Interface for IContainer classes whose Items can be accessed by their position in the container.

If the container is filtered or sorted, all indices refer to the filtered and sorted view. However, the addItemAt() methods may add items that will be filtered out after addition or moved to another position based on sorting.

Instance Methods [hide private]
 
indexOfId(self, itemId)
Gets the index of the Item corresponding to the itemId.
source code
 
getIdByIndex(self, index)
Gets the ID of an Item by an index number.
source code
 
addItemAt(self, index, newItemId=None)
Adds a new item at given index (in the filtered view).
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]

indexOfId(self, itemId)

source code 

Gets the index of the Item corresponding to the itemId. The following is True for the returned index: 0 <= index < size(), or index = -1 if there is no visible item with that id in the container.

Parameters:
  • itemId - ID of an Item in the IContainer
Returns:
index of the Item, or -1 if (the filtered and sorted view of) the IContainer does not include the Item

getIdByIndex(self, index)

source code 

Gets the ID of an Item by an index number.

Parameters:
  • index - Index of the requested id in (the filtered and sorted view of) the IContainer
Returns:
ID of the Item in the given index

addItemAt(self, index, newItemId=None)

source code 

Adds a new item at given index (in the filtered view).

The indices of the item currently in the given position and all the following items are incremented.

This method should apply filters to the added item after inserting it, possibly hiding it immediately. If the container is being sorted, the item may be added at the correct sorted position instead of the given position. See IIndexed, IOrdered, IFilterable and ISortable for more information.

Parameters:
  • index - Index (in the filtered and sorted view) at which to add the new item.
  • newItemId - Id of the new item to be added.
Returns:
new Item or null if the operation fails.
Raises:
  • NotImplementedError - if the operation is not supported by the container