- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::OrderedComposite::IndexCompare
::xo::OrderedComposite::IndexCompare create ...
Defined in
Class Relations
::xotcl::Class create ::xo::OrderedComposite::IndexCompare \ -superclass ::xotcl::ObjectMethods (to be applied on instances)
__compare (scripted)
<instance of xo::OrderedComposite::IndexCompare> __compare
- Testcases:
- includelet_toc, xowiki
set by ${:__orderby} set x [$a set $by] set y [$b set $by] #:log "--value compare $x $y] => [:__value_compare $x $y 0]" return [:__value_compare $x $y 0]__value_compare (scripted)
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 $yp-1] return [:__value_compare $x $yh -1] } elseif {$yp == -1} { set xh [string range $x 0 $xp-1] return [:__value_compare $xh $y 1] } else { set xh [string range $x 0 $xp] set yh [string range $y 0 $yp] #:log "xh=$xh yh=$yh" if {$xh < $yh} { return -1 } elseif {$xh > $yh} { return 1 } else { incr xp incr yp #:log "rest [string range $x $xp end] [string range $y $yp end]" return [:__value_compare [string range $x $xp end] [string range $y $yp end] $def] } }
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables