@ SafeVarargs private final Map < String , FieldSpec > buildConditionFields ( Map < String , PluralData > ... pluralMaps ) { Map < String , FieldSpec > index = new LinkedHashMap <> ( ) ; int seq = 0 ; for ( Map < String , PluralData > pluralMap : pluralMaps ) { for ( Map . Entry < String , PluralData > entry : pluralMap . entrySet ( ) ) { PluralData data = entry . getValue ( ) ; // Iterate over the rules, drilling into the OR conditions and // building a field to evaluate each AND condition. for ( Map . Entry < String , PluralData . Rule > rule : data . rules ( ) . entrySet ( ) ) { Node < PluralType > orCondition = rule . getValue ( ) . condition ; if ( orCondition == null ) { continue ; } // Render the representation for each AND condition, using that as a // key to map to the corresponding lambda Condition field that // computes it. for ( Node < PluralType > andCondition : orCondition . asStruct ( ) . nodes ( ) ) { String repr = PluralRulePrinter . print ( andCondition ) ; if ( index . containsKey ( repr ) ) { continue ; } // Build the field that represents the evaluation of the AND condition. FieldSpec field = buildConditionField ( seq , andCondition . asStruct ( ) ) ; index . put ( repr , field ) ; seq ++ ; } } } } return index ; }
Maps an integer to each AND condition s canonical representation .