# -*- coding: iso-8859-1 -*-
#-----------------------------------------------------------------------------
# Modeling Framework: an Object-Relational Bridge for python
#
# Copyright (c) 2001-2004 Sbastien Bigaret <sbigaret@users.sourceforge.net>
# All rights reserved.
#
# This file is part of the Modeling Framework.
#
# This code is distributed under a "3-clause BSD"-style license;
# see the LICENSE file for details.
#-----------------------------------------------------------------------------
"""
SortOrdering API
SortOrdering instances hold every informations needed to sort objects
within the Framework. In particular, they are used by FetchSpecifications
so that the fetched objects are returned in a particular order.
More details SortOrdering instances binds a key with a comparison
operator. Objects are sorted according to that comparison operator, on
values extracted from objects using KeyValueCoding method 'valueForKey'.
SortOrderings are usually provided as tuples. These tuples can be either
singletons or plain tuples (len>1). In the latter case, the order within
these tuple uniquely defines an ordering method.
The SortOrdering module also define a functiond edicated to in-memory
ordering: sortedArrayUsingKeyOrderArray()
CVS Information
$Id: SortOrdering.py 932 2004-07-20 06:21:57Z sbigaret $
"""
__version__='$Revision: 932 $'[11:-2]
try:
from Interface import Base
except:
class Base:
pass
# module functions
def sortedArrayUsingKeyOrderArray(array, sortOrderings):
"""
Sorts the supplied array (either a tuple or a list) and returns it sorted
according to the sortOrderings. Return type is: list.
"""
def sortOrderingWithKey(key, operator):
"""
Returns a brand-new SortOrdering instance.
"""
class SortOrderingInterface(Base):
"""
SortOrdering
"""
def __init__(self, key, operator):
"""
Initializes a SortOrdering object
"""
def key(self):
"Return the key"
def operator(self):
"Return the comparison operator"
|