001 package org.hd.d.pg2k.ai.scorer;
002
003 public interface ScorerParam
004 {
005 /**Returns a parameter with a small perturbation of the value (if possible); never null.
006 * If there is a bias in the perturbation direction then it is applied.
007 * @return legal value of same type as this, possibly with small perturbation applied
008 */
009 public ScorerParam perturb();
010
011 /**Get the parameter name; never null or empty. */
012 public String getName();
013
014 /**Generate the "name=value" text; never null or empty, though the value part may be empty. */
015 public String toNameValueString();
016
017 /**Parse the String representation of a parameter returning a value of the same type; never null.
018 * If the argument is null or unparsable or out of range,
019 * then the result has the default value,
020 * else an instance with the requested parameter value is returned.
021 * @return legal value of the same type as this, with the parsed input String's value if possible
022 */
023 public ScorerParam parse(String v);
024
025 /**Use the supplied parameter if possible (correct name/type/bounds), else return the default; never null. */
026 public ScorerParam extract(ScorerParam p);
027
028 /**Returns true if the argument is signficantly different in value to this.
029 * The result is false if the argument is null or of a completely different parameter type;
030 * no ClassCastException should be thrown (ie behaves like equals() rather than compareTo()).
031 */
032 public boolean similar(ScorerParam p);
033 }