agents.context

## Class Range

- java.lang.Object
- - agents.context.Range

All Implemented Interfaces:
  java.io.Serializable, java.lang.Comparable

    public class Range
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Comparable

The Class Range.

See Also:
  Serialized Form

### Field Summary

Fields
`int` `id` The id.
`static int` `maxid` The maxid.
`static double` `mininimalRange` The Constant mininimalRange.
`static double` `percent_down` The percent down.
`static double` `percent_up` The percent up.

### Constructor Summary

Constructors
Constructor and Description
`Range(Context context, double start, double end, double extendedrangeatcreation, boolean start_inclu, boolean end_inclu, Percept p)` Instantiates a new range.
`Range(Range r)` Instantiates a new range.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `adapt(Context c, double oracleValue, Percept p)` Method called by the context agent.
`int` `compareTo(java.lang.Object o)`
`int` `compareTo(Range i)` Compare to.
`int` `contains(java.lang.Double d)` Contains.
`int` `contains(java.lang.Double min, java.lang.Double max)` Contains.
`double` `getAlphaFactor()` Gets the alpha factor.
`double` `getAVTwillToReduce(boolean max)` Gets the AV twill to reduce.
`Context` `getContext()` Gets the context.
`double` `getDistanceFromNearestLimit(double d)` Return the distance from given value to the nearest limit.
`double` `getEnd()` Gets the end.
`double` `getLenght()` Gets the lenght.
`boolean` `getNearestLimit(double d)` Gets the nearest limit.
`double` `getOldValue()` Gets the old value.
`double` `getStart()` Gets the start.
`double` `getValue()` Gets the value.
`boolean` `isEnd_inclu()` Checks if is end inclu.
`boolean` `isPerceptEnum()` Checks if is percept enum.
`boolean` `isStart_inclu()` Checks if is start inclu.
`boolean` `isTooSmall()` Check if the ranges is too small according to strategy.
`void` `matchBorderWith(Context c)` Match border with.
`void` `setAlphaFactor(double alphaFactor)` Sets the alpha factor.
`void` `setContext(Context context)` Sets the context.
`void` `setEnd_inclu(boolean end_inclu)` Sets the end inclu.
`void` `setMinimumSize(Percept v)` Sets the minimum size.
`void` `setOldValue(double oldValue)` Sets the old value.
`void` `setStart_inclu(boolean start_inclu)` Sets the start inclu.
`void` `setValue(double value)` Sets the value.
`double` `simulateNegativeAVTFeedbackMax(double oracleValue)` Simulate negative AVT feedback max.
`double` `simulateNegativeAVTFeedbackMin(double oracleValue)` Simulate negative AVT feedback min.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### maxid

    public static int maxid

The maxid.

#### id

    public int id

The id.

#### mininimalRange

    public static final double mininimalRange

The Constant mininimalRange.

See Also:
  Constant Field Values

#### percent_up

    public static double percent_up

The percent up.

#### percent_down

    public static double percent_down

The percent down.

### Constructor Detail

#### Range

    public Range(Context context,
                 double start,
                 double end,
                 double extendedrangeatcreation,
                 boolean start_inclu,
                 boolean end_inclu,
                 Percept p)

Instantiates a new range.

Parameters:
  `context` - the context
  `start` - the start
  `end` - the end
  `extendedrangeatcreation` - the extendedrangeatcreation
  `start_inclu` - the start inclu
  `end_inclu` - the end inclu
  `p` - the p

#### Range

    public Range(Range r)

Instantiates a new range.

Parameters:
  `r` - the r

### Method Detail

#### adapt

    public void adapt(Context c,
                      double oracleValue,
                      Percept p)

Method called by the context agent. Allow the range to adapt itself.

Parameters:
  `c` - : the associated Context.
  `oracleValue` - the oracle value
  `p` - the p

#### simulateNegativeAVTFeedbackMin

    public double simulateNegativeAVTFeedbackMin(double oracleValue)

Simulate negative AVT feedback min.

Parameters:
  `oracleValue` - the oracle value
Returns:
  the double

#### simulateNegativeAVTFeedbackMax

    public double simulateNegativeAVTFeedbackMax(double oracleValue)

Simulate negative AVT feedback max.

Parameters:
  `oracleValue` - the oracle value
Returns:
  the double

#### isTooSmall

    public boolean isTooSmall()

Check if the ranges is too small according to strategy.

Returns:
  boolean representing if the range is too small.

#### getOldValue

    public double getOldValue()

Gets the old value.

Returns:
  the old value

#### setOldValue

    public void setOldValue(double oldValue)

Sets the old value.

Parameters:
  `oldValue` - the new old value

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### getContext

    public Context getContext()

Gets the context.

Returns:
  the context

#### setContext

    public void setContext(Context context)

Sets the context.

Parameters:
  `context` - the new context

#### getAVTwillToReduce

    public double getAVTwillToReduce(boolean max)

Gets the AV twill to reduce.

Parameters:
  `max` - the max
Returns:
  the AV twill to reduce

#### matchBorderWith

    public void matchBorderWith(Context c)

Match border with.

Parameters:
  `c` - the c

#### contains

    public int contains(java.lang.Double d)

Contains.

Parameters:
  `d` - : the value to test
Returns:
  -1 if lower, +1 if higher, 0 if contained

#### contains

    public int contains(java.lang.Double min,
                        java.lang.Double max)

Contains.

Parameters:
  `min` - the min
  `max` - the max
Returns:
  the int

#### compareTo

    public int compareTo(Range i)

Compare to.

Parameters:
  `i` - the i
Returns:
  the int

#### getAlphaFactor

    public double getAlphaFactor()

Gets the alpha factor.

Returns:
  the alpha factor

#### setAlphaFactor

    public void setAlphaFactor(double alphaFactor)

Sets the alpha factor.

Parameters:
  `alphaFactor` - the new alpha factor

#### isEnd_inclu

    public boolean isEnd_inclu()

Checks if is end inclu.

Returns:
  true, if is end inclu

#### setEnd_inclu

    public void setEnd_inclu(boolean end_inclu)

Sets the end inclu.

Parameters:
  `end_inclu` - the new end inclu

#### isStart_inclu

    public boolean isStart_inclu()

Checks if is start inclu.

Returns:
  true, if is start inclu

#### setStart_inclu

    public void setStart_inclu(boolean start_inclu)

Sets the start inclu.

Parameters:
  `start_inclu` - the new start inclu

#### getLenght

    public double getLenght()

Gets the lenght.

Returns:
  length of the range.

#### setMinimumSize

    public void setMinimumSize(Percept v)

Sets the minimum size.

Parameters:
  `v` - the new minimum size

#### getDistanceFromNearestLimit

    public double getDistanceFromNearestLimit(double d)

Return the distance from given value to the nearest limit.

Parameters:
  `d` - : value used to compute distance.
Returns:
  distance between v and the nearest limit.

#### getNearestLimit

    public boolean getNearestLimit(double d)

Gets the nearest limit.

Parameters:
  `d` - the d
Returns:
  max is true, min is false

#### getStart

    public double getStart()

Gets the start.

Returns:
  the start

#### getEnd

    public double getEnd()

Gets the end.

Returns:
  the end

#### getValue

    public double getValue()

Gets the value.

Returns:
  the value

#### setValue

    public void setValue(double value)

Sets the value.

Parameters:
  `value` - the new value

#### isPerceptEnum

    public boolean isPerceptEnum()

Checks if is percept enum.

Returns:
  true, if is percept enum

#### compareTo

    public int compareTo(java.lang.Object o)

Specified by:
  `compareTo` in interface `java.lang.Comparable`