package za.redbridge.experiment.NEATM.sensor;

import za.redbridge.experiment.NEATM.sensor.parameter.SensorParameterSpec.BearingSpec;
import za.redbridge.experiment.NEATM.sensor.parameter.SensorParameterSpec.FieldOfViewSpec;
import za.redbridge.experiment.NEATM.sensor.parameter.SensorParameterSpec.OrientationSpec;
import za.redbridge.experiment.NEATM.sensor.parameter.SensorParameterSpec.RangeSpec;
import za.redbridge.experiment.NEATM.sensor.parameter.SensorParameterSpecSet;


import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Initializers.copyExistingOrRandom;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Initializers.random;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Limiters.clamp;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Limiters.wrap;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Ranges.exclusiveRange;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Ranges.plusMinusHalfPi;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Ranges.plusMinusPi;
import static za.redbridge.experiment.NEATM.sensor.parameter.spec.Ranges.zeroToPi;

/**
 * Contains the definitions of the valid parameters for each sensor type.
 *
 * Created by jamie on 2014/09/19.
 */
public enum SensorType {

    /**
     * new Spec(initial value, valid range, limiter)
     */

    BOTTOM_PROXIMITY(null),

    PROXIMITY(new SensorParameterSpecSet(
            new BearingSpec(random(), plusMinusPi(), wrap()),
            new OrientationSpec(random(), plusMinusHalfPi(), clamp()),
            // TODO: query environment size for range value
            new RangeSpec(copyExistingOrRandom(), exclusiveRange(0, 40), clamp()),
            new FieldOfViewSpec(copyExistingOrRandom(), zeroToPi(), clamp()))),

    ULTRASONIC(new SensorParameterSpecSet(
            new BearingSpec(random(), plusMinusPi(), wrap()),
            new OrientationSpec(random(), plusMinusHalfPi(), clamp()),
            // TODO: query environment size for range value
            new RangeSpec(copyExistingOrRandom(), exclusiveRange(0, 40), clamp()),
            new FieldOfViewSpec(copyExistingOrRandom(), zeroToPi(), clamp())));

    private final SensorParameterSpecSet defaultSpecSet;

    SensorType(SensorParameterSpecSet defaultSpecSet) {
        this.defaultSpecSet = defaultSpecSet;
    }

    public boolean isConfigurable() {
        return defaultSpecSet != null;
    }

    public SensorParameterSpecSet getDefaultSpecSet() {
        return defaultSpecSet;
    }

}

@@ -40,16 +40,53 @@
 ensor;%0A%0A
+import org.jbox2d.common.MathUtils;%0A%0A
 import z
@@ -509,16 +509,82 @@
 pecSet;%0A
+import za.redbridge.experiment.NEATM.sensor.parameter.spec.Range;%0A
 %0A%0Aimport
@@ -1815,32 +1815,36 @@
 exclusiveRange(0
+.01f
 , 40), clamp()),
@@ -1896,35 +1896,86 @@
 OrRandom(), 
-zeroToPi(),
+new Range(0.1f, MathUtils.PI, true, true),%0A                   
  clamp()))),
@@ -2278,16 +2278,20 @@
 eRange(0
+.01f
 , 40), c
@@ -2359,19 +2359,70 @@
 (), 
-zeroToPi(),
+new Range(0.1f, MathUtils.PI, true, true),%0A                   
  cla

Increase minimum values for FoV and range