package net.sourceforge.fenixedu.domain.tests.predicates; import java.util.HashMap; import net.sourceforge.fenixedu.domain.Person; import net.sourceforge.fenixedu.domain.tests.NewNumericQuestion; import net.sourceforge.fenixedu.domain.tests.NewQuestion; import net.sourceforge.fenixedu.presentationTier.Action.teacher.tests.PredicateBean; public class NumericLessThanPredicate extends AtomicPredicate implements Predicate { private final double value; public NumericLessThanPredicate(double value) { super(); this.value = value; } public NumericLessThanPredicate(PredicateBean predicateBean) { this(predicateBean.getValue()); } public boolean evaluate(NewQuestion question, Person person) { NewNumericQuestion numericQuestion = (NewNumericQuestion) question; if (!numericQuestion.isAnswered(person)) { return false; } return numericQuestion.getNumericAnswer(person) < value; } public double getValue() { return value; } public boolean uses(Object object) { return false; } public Predicate transform(HashMap transformMap) { return new NumericLessThanPredicate(getValue()); } }