private void appendHourFormat ( MethodSpec . Builder method , List < Node > fmt ) { for ( Node n : fmt ) { if ( n instanceof Text ) { String t = ( ( Text ) n ) . text ( ) ; boolean minute = t . equals ( ":" ) || t . equals ( "." ) ; if ( minute ) { method . beginControlFlow ( "if (emitMins)" ) ; } method . addStatement ( "b.append($S)" , t ) ; if ( minute ) { method . endControlFlow ( ) ; } } else { Field f = ( Field ) n ; if ( f . ch ( ) == ' ' ) { if ( f . width ( ) == 1 ) { method . addStatement ( "zeroPad2(b, hours, 1)" ) ; } else { method . addStatement ( "zeroPad2(b, hours, _short ? 1 : $L)" , f . width ( ) ) ; } } else { method . beginControlFlow ( "if (emitMins)" ) ; method . addStatement ( "zeroPad2(b, mins, $L)" , f . width ( ) ) ; method . endControlFlow ( ) ; } } } }
Appends code to emit the hourFormat for positive or negative .