::xotcl::Class
::xo::OrderedComposite::IndexCompare
Class Hierarchy of ::xo::OrderedComposite::IndexCompare
- ::xotcl::Object
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Methods for instances:
- __api_make_doc, __api_make_forward_doc, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, check, classC, cleanupC, configureC, containsC, copyC, db_0or1rowC, db_1rowC, debug, defaultmethodC, destroyC, destroy_on_cleanup, ds, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearch, forward, hasclass, incrC, infoC, init, instvarC, invarC, isclass, ismetaclass, ismixin, isobject, istype, lappendC, log, method, mixinC, mixinguardC, moveC, msg, noinitC, objectparameter, parametercmdC, proc, procsearch, qn, requireNamespaceC, residualargsC, self, serialize, setC, set_instance_vars_defaults, show-object, substC, traceC, unknown, unsetC, uplevelC, upvarC, volatileC, vwait
- Methods to be applied on the class (in addition to the methods provided by the meta-class):
- getExitHandler, setExitHandler, unsetExitHandler
- ::xo::OrderedComposite::IndexCompare
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Methods for instances:
- __compare, __value_compare
- Methods to be applied on the class:
- Methods provided by the meta-class
Class Relations
- superclass: ::xotcl::Object
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xotcl::Class create ::xo::OrderedComposite::IndexCompare \
-superclass ::xotcl::Object
Methods
instproc __compare
::1457577 instproc __compare {a b} {
set by [my set __orderby]
set x [$a set $by]
set y [$b set $by]
#my log "--value compare $x $y] => [my __value_compare $x $y 0]"
return [my __value_compare $x $y 0]
}
instproc __value_compare
::1457577 instproc __value_compare {x y def} {
set xp [string first . $x]
set yp [string first . $y]
if {$xp == -1 && $yp == -1} {
if {$x < $y} {
return -1
} elseif {$x > $y} {
return 1
} else {
return $def
}
} elseif {$xp == -1} {
set yh [string range $y 0 [expr {$yp-1}]]
return [my __value_compare $x $yh -1]
} elseif {$yp == -1} {
set xh [string range $x 0 [expr {$xp-1}]]
return [my __value_compare $xh $y 1]
} else {
set xh [string range $x 0 $xp]
set yh [string range $y 0 $yp]
#puts "xh=$xh yh=$yh"
if {$xh < $yh} {
return -1
} elseif {$xh > $yh} {
return 1
} else {
incr xp
incr yp
#puts "rest [string range $x $xp end] [string range $y $yp end]"
return [my __value_compare [string range $x $xp end] [string range $y $yp end] $def]
}
}
}