Package bosco :: Module ranking :: Class SequenceCourseValidator
[hide private]
[frames] | no frames]

Class SequenceCourseValidator

source code

   object --+            
            |            
CachingObject --+        
                |        
        Validator --+    
                    |    
      CourseValidator --+
                        |
                       SequenceCourseValidator

Validation strategy for a normal orienteering course. This class uses a dynamic programming "longest common subsequence" algorithm to validate the run and find missing and additional punches.

Instance Methods [hide private]
 
__init__(self, course, reorder=None, cache=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
validate(self, run)
Validate the run if it is valid for this course.
source code

Inherited from CachingObject (private): _from_cache, _to_cache

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

Static Methods [hide private]
 
_exact_match(plist, clist)
check if plist exactly matches clist
source code
 
_build_lcs_matrix(plist, clist)
Builds the matrix of lcs subsequence lengths.
source code
 
_backtrack(C, plist, clist, i=None, j=None)
Backtrack through the LCS Matrix to find one of possibly several longest common subsequences.
source code
 
_diff(C, plist, clist, i=None, j=None)
Returns: list of (status, punch or control) tuples.
source code
Class Variables [hide private]

Inherited from Validator: DID_NOT_FINISH, DID_NOT_START, DISQUALIFIED, MISSING_CONTROLS, NOT_COMPLETED, OK

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, course, reorder=None, cache=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • cache - scoreing cache
Overrides: object.__init__
(inherited documentation)

_exact_match(plist, clist)
Static Method

source code 

check if plist exactly matches clist

Parameters:
  • plist - list of punches
  • clist - list of controls. All controls with no sistations or which are overriden must be removed!
Returns:
True or False

_build_lcs_matrix(plist, clist)
Static Method

source code 

Builds the matrix of lcs subsequence lengths.

Parameters:
  • plist - list of punches
  • clist - list of controls. All controls with no sistations or which are overriden must be removed!
Returns:
matrix of lcs subsequence lengths.

_diff(C, plist, clist, i=None, j=None)
Static Method

source code 
Returns:
list of (status, punch or control) tuples. status is 'ok', 'additional' or 'missing' or '' (for special SIStations)

validate(self, run)

source code 

Validate the run if it is valid for this course.

Overrides: Validator.validate