public boolean vary ( Map < String , CSSProperty > properties , Map < String , Term < ? > > values ) { // try inherit variant if ( terms . size ( ) == 1 && checkInherit ( ALL_VARIANTS , terms . get ( 0 ) , properties ) ) return true ; // for all terms for ( IntegerRef i = new IntegerRef ( 0 ) ; i . get ( ) < terms . size ( ) ; i . inc ( ) ) { boolean passed = false ; // check all variants for ( int v = 0 ; v < variants ; v ++ ) { // check and if variant was already found // signalize error by discarding complete declaration // have to check variant condition firstly to avoid false // positive // variantPassed if ( ! variantCondition ( v , i ) ) continue ; //if this variant already passed, do not try again //TODO: check if we shouldn't try better combination of terms if ( variantPassed [ v ] ) continue ; //check if this term corresponds to this variant passed = variant ( v , i , properties , values ) ; if ( passed ) { // mark occurrence of variant variantPassed [ v ] = true ; // we have found, skip evaluation break ; } } // no variant could be assigned if ( ! passed ) return false ; } // all terms passed return true ; }
Test all terms