public boolean isUseful(Result current,LinkedList<Result> otherResults,int criterion,ExampleSet exampleSet,int min_model_number){
  boolean result=true;
switch (criterion) {
case IteratingGSS.TYPE_WORST_UTILITY:
    double worstUtility=current.getUtility() - current.getConfidence();
  if (worstUtility < this.min_utility_useful) {
    result=false;
  }
 else {
    result=true;
  }
break;
case IteratingGSS.TYPE_UTILITY:
double utility=current.getUtility();
if (utility < this.min_utility_useful) {
result=false;
}
 else {
result=true;
}
break;
case IteratingGSS.TYPE_BEST_UTILITY:
double bestUtility=current.getUtility() + current.getConfidence();
if (bestUtility < this.min_utility_useful) {
result=false;
}
 else {
result=true;
}
break;
case IteratingGSS.TYPE_EXAMPLE:
if (otherResults.size() == 0 || otherResults.size() < min_model_number) {
return true;
}
double sum=0.0d;
Iterator it=otherResults.iterator();
while (it.hasNext()) {
Result r=(Result)it.next();
sum=sum + r.getTotalWeight();
}
double average=sum / otherResults.size();
if (current.getTotalWeight() < this.exampleFactor * average) {
result=true;
}
 else {
result=false;
}
break;
}
return result;
}

public boolean isUseful ( Result current , LinkedList < Result > otherResults , int criterion , ExampleSet exampleSet , int min_model_number ) { boolean result = true ; switch ( criterion ) { case IteratingGSS . TYPE_WORST_UTILITY : double worstUtility = current . getUtility ( ) - current . getConfidence ( ) ; if ( worstUtility < this . min_utility_useful ) { result = false ; } else { result = true ; } break ; case IteratingGSS . TYPE_UTILITY : double utility = current . getUtility ( ) ; if ( utility < this . min_utility_useful ) { result = false ; } else { result = true ; } break ; case IteratingGSS . TYPE_BEST_UTILITY : double bestUtility = current . getUtility ( ) + current . getConfidence ( ) ; if ( bestUtility < this . min_utility_useful ) { result = false ; } else { result = true ; } break ; case IteratingGSS . TYPE_EXAMPLE : if ( otherResults . size ( ) == 0 || otherResults . size ( ) < min_model_number ) { return true ; } double sum = 0.0d ; Iterator it = otherResults . iterator ( ) ; while ( it . hasNext ( ) ) { Result r = ( Result ) it . next ( ) ; sum = sum + r . getTotalWeight ( ) ; } double average = sum / otherResults . size ( ) ; if ( current . getTotalWeight ( ) < this . exampleFactor * average ) { result = true ; } else { result = false ; } break ; } return result ; }
test if the model is useful according to the given criterion .
