Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
TupleComp Class Reference

Public Member Functions

def __init__
 
def compare
 

Data Fields

 comp_select_list
 

Detailed Description

This class provides a generic function for comparing any two tuples.
Each instance records a list of tuple-indices (from most significant
to least significant), and sort direction (ascending or decending) for
each tuple-index.  The compare functions can then be used as the function
argument to the system sort() function when a list of tuples need to be
sorted in the instances order.

Definition at line 421 of file pstats.py.

Constructor & Destructor Documentation

def __init__ (   self,
  comp_select_list 
)

Definition at line 429 of file pstats.py.

430  def __init__(self, comp_select_list):
431  self.comp_select_list = comp_select_list

Member Function Documentation

def compare (   self,
  left,
  right 
)

Definition at line 432 of file pstats.py.

References TupleComp.comp_select_list.

433  def compare (self, left, right):
434  for index, direction in self.comp_select_list:
435  l = left[index]
436  r = right[index]
437  if l < r:
438  return -direction
439  if l > r:
440  return direction
441  return 0
442 
443 #**************************************************************************
444 # func_name is a triple (file:string, line:int, name:string)

Field Documentation

comp_select_list

Definition at line 430 of file pstats.py.


The documentation for this class was generated from the following file: