question: protected float calculateStateTransitionPercentage ( String name , boolean flapping ) { int flapInterval = getFlapInterval ( name ) ; LinkedList < Boolean > list = getFlaps ( name ) ; float lowWeight = getFlapLowWeight ( name ) ; float highWeight = getFlapHighWeight ( name ) ; float weightRange = highWeight - lowWeight ; float result = 0 ; for ( int i = list . size ( ) - 1 ; i >= 0 ; i -- ) { boolean thisFlap = list . get ( i ) ; if ( flapping != thisFlap ) { float weight = lowWeight + ( weightRange * i / ( flapInterval - 1 ) ) ; result += weight ; } } return result / flapInterval ; }
target:  Calculate state transition percentage.