package parameterrules; import java.io.*; import java.lang.Math; import main.BetterTokenizer; import main.GeneralInput; import main.MoreMath; import parameters.ParameterSet; /** Implements the manipulation the Parameter's value is multiplied by a constant before being used in a model. */ public class MultiplyParameterRule extends ParameterRule { /** The number of the parameter */ private int param_index = -1; /** The multiplier */ private float multiplier = 1; MultiplyParameterRule() {} public ParameterRule copy() { MultiplyParameterRule pr = (MultiplyParameterRule)super.copy(); return pr; } public float getFuzzyScore(float [] params) { return 0; } protected void loadParameter(String info, BetterTokenizer tokenizer) throws Exception { if(info.equals("Param")) { GeneralInput.nextToken(tokenizer); param_index = refParams.getPosition(tokenizer.sval); } else if(info.equals("Multiplier")) { GeneralInput.nextToken(tokenizer); multiplier = (float)tokenizer.nval; } else super.loadParameter(info, tokenizer); } public boolean changeParameters(float [] params, int mode, ParameterSet set) { params[param_index] = multiplier * params[param_index]; return true; } }