package dk.silverbullet.telemed.questionnaire.node;
import com.google.gson.annotations.Expose;
import dk.silverbullet.telemed.questionnaire.Questionnaire;
import dk.silverbullet.telemed.questionnaire.expression.Constant;
import dk.silverbullet.telemed.questionnaire.expression.Variable;
import dk.silverbullet.telemed.questionnaire.expression.VariableLinkFailedException;
import dk.silverbullet.telemed.utils.Util;
import java.util.Map;
public class WeightTestDeviceNode extends DeviceNode {
@SuppressWarnings("unused")
private static final String TAG = Util.getTag(WeightTestDeviceNode.class);
@Expose
private Variable<Float> weight;
public WeightTestDeviceNode(Questionnaire questionnaire, String nodeName) {
super(questionnaire, nodeName);
}
@Override
public void enter() {
super.enter();
questionnaire.setCurrentNode(getNextNode());
}
@Override
public void linkVariables(Map<String, Variable<?>> variablePool) throws VariableLinkFailedException {
super.linkVariables(variablePool);
weight = Util.linkVariable(variablePool, weight);
}
@Override
public void deviceLeave() {
weight.setValue(new Constant<Float>(Util.random(15, 170)));
}
public void setWeight(Variable<Float> weight) {
this.weight = weight;
}
}