public boolean mergeEffects ( String expr , Effect [ ] effects , float [ ] results ) { boolean result ; if ( expr . equals ( "some(where (p_eft == allow))" ) ) { result = false ; for ( Effect eft : effects ) { if ( eft == Effect . Allow ) { result = true ; break ; } } } else if ( expr . equals ( "!some(where (p_eft == deny))" ) ) { result = true ; for ( Effect eft : effects ) { if ( eft == Effect . Deny ) { result = false ; break ; } } } else if ( expr . equals ( "some(where (p_eft == allow)) && !some(where (p_eft == deny))" ) ) { result = false ; for ( Effect eft : effects ) { if ( eft == Effect . Allow ) { result = true ; } else if ( eft == Effect . Deny ) { result = false ; break ; } } } else if ( expr . equals ( "priority(p_eft) || deny" ) ) { result = false ; for ( Effect eft : effects ) { if ( eft != Effect . Indeterminate ) { if ( eft == Effect . Allow ) { result = true ; } else { result = false ; } break ; } } } else { throw new Error ( "unsupported effect" ) ; } return result ; }
mergeEffects merges all matching results collected by the enforcer into a single decision .