X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Ffunction%2FSingleNumericParameterFunction.java;fp=src%2Ftim%2Fprune%2Ffunction%2FSingleNumericParameterFunction.java;h=3f6062bc71df80838b18cbb775128679b3843cd2;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/function/SingleNumericParameterFunction.java b/src/tim/prune/function/SingleNumericParameterFunction.java new file mode 100644 index 0000000..3f6062b --- /dev/null +++ b/src/tim/prune/function/SingleNumericParameterFunction.java @@ -0,0 +1,36 @@ +package tim.prune.function; + +import tim.prune.App; +import tim.prune.GenericFunction; + +/** + * Abstract superclass of Functions which just take a + * single numeric parameter + */ +public abstract class SingleNumericParameterFunction extends GenericFunction +{ + /** Minimum and maximum allowed values */ + protected int _minAllowedValue, _maxAllowedValue; + + /** Constructor */ + public SingleNumericParameterFunction(App inApp, int inMinValue, int inMaxValue) + { + super(inApp); + _minAllowedValue = inMinValue; + _maxAllowedValue = inMaxValue; + } + + /** Get the current value for display in the dialog */ + public abstract int getCurrentParamValue(); + + /** Get the key for the description label */ + public abstract String getDescriptionKey(); + + /** Callback to trigger the rest of the function once the parameter has been chosen */ + public abstract void completeFunction(int inParam); + + /** @return minimum allowed value */ + public int getMinAllowedValue() {return _minAllowedValue;} + /** @return maximum allowed value */ + public int getMaxAllowedValue() {return _maxAllowedValue;} +}