public static boolean areConditionsMet(final List<ICondition> rulesToTest,final HashMap<ICondition,Boolean> testedConditions,final String conditionType){
  boolean met=false;
  if (conditionType.equals("AND")) {
    for (    final ICondition c : rulesToTest) {
      met=testedConditions.get(c);
      if (!met) {
        break;
      }
    }
  }
 else   if (conditionType.equals("OR")) {
    for (    final ICondition c : rulesToTest) {
      met=testedConditions.get(c);
      if (met) {
        break;
      }
    }
  }
 else {
    final String[] nums=conditionType.split("-");
    if (nums.length == 1) {
      final int start=Integer.parseInt(nums[0]);
      int count=0;
      for (      final ICondition c : rulesToTest) {
        met=testedConditions.get(c);
        if (met) {
          count++;
        }
      }
      met=(count == start);
    }
 else     if (nums.length == 2) {
      final int start=Integer.parseInt(nums[0]);
      final int end=Integer.parseInt(nums[1]);
      int count=0;
      for (      final ICondition c : rulesToTest) {
        met=testedConditions.get(c);
        if (met) {
          count++;
        }
      }
      met=(count >= start && count <= end);
    }
  }
  return met;
}

public static boolean areConditionsMet ( final List < ICondition > rulesToTest , final HashMap < ICondition , Boolean > testedConditions , final String conditionType ) { boolean met = false ; if ( conditionType . equals ( "AND" ) ) { for ( final ICondition c : rulesToTest ) { met = testedConditions . get ( c ) ; if ( ! met ) { break ; } } } else if ( conditionType . equals ( "OR" ) ) { for ( final ICondition c : rulesToTest ) { met = testedConditions . get ( c ) ; if ( met ) { break ; } } } else { final String [ ] nums = conditionType . split ( "-" ) ; if ( nums . length == 1 ) { final int start = Integer . parseInt ( nums [ 0 ] ) ; int count = 0 ; for ( final ICondition c : rulesToTest ) { met = testedConditions . get ( c ) ; if ( met ) { count ++ ; } } met = ( count == start ) ; } else if ( nums . length == 2 ) { final int start = Integer . parseInt ( nums [ 0 ] ) ; final int end = Integer . parseInt ( nums [ 1 ] ) ; int count = 0 ; for ( final ICondition c : rulesToTest ) { met = testedConditions . get ( c ) ; if ( met ) { count ++ ; } } met = ( count >= start && count <= end ) ; } } return met ; }
accounts for all listed rules , according to the conditiontype . takes the mapped conditions generated by testallconditions and uses it to know which conditions are true and which are false . there is no testing of conditions done in this method .
