private CALC unbindAll ( AbstractCalculator < CALC > undbindFrom ) { // find root and first child AbstractCalculator root = undbindFrom . parentCalculator != null ? undbindFrom . parentCalculator : undbindFrom ; AbstractCalculator child = root . childCalculator ; while ( root != null ) { AbstractCalculator tmpParent = root . parentCalculator ; if ( tmpParent == null ) break ; else root = tmpParent ; child = root . childCalculator ; } // undbind all from root to last child while ( child != null ) { if ( child . isUnbind == false ) root . expression ( child , false ) ; child . isUnbind = true ; child = child . childCalculator ; // new unbind child } return ( CALC ) undbindFrom ; }
Unbind all binded calculators