Hoa central
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Hoa\Realdom\Boundfloat Class Reference
Inheritance diagram for Hoa\Realdom\Boundfloat:

Public Member Functions

 getLowerBound ()
 
 getUpperBound ()
 
 reduceRightTo ($value)
 
 reduceLeftTo ($value)
 
- Public Member Functions inherited from Hoa\Realdom\Realdom
 __construct ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getArguments ()
 
 count ()
 
 getName ()
 
 setSampler (Math\Sampler $sampler)
 
 getSampler ()
 
 getValue ()
 
 reset ()
 
 predicate ($q)
 
 sample (Math\Sampler $sampler=null)
 
 intersectWith (Realdom $realdom)
 
 setConstraints (Array &$constraints)
 
 propagateConstraints ($type, $index)
 
 is ($qualifier)
 
 setHolder (IRealdom\Holder $holder)
 
 getHolder ()
 
 setPraspelVisitor (Visitor\Visit $visitor)
 
 getPraspelVisitor ()
 
 accept (Visitor\Visit $visitor, &$handle=null, $eldnah=null)
 
- Public Member Functions inherited from Hoa\Visitor\Element
 accept (Visit $visitor, &$handle=null, $eldnah=null)
 

Public Attributes

const NAME = 'boundfloat'
 
- Public Attributes inherited from Hoa\Realdom\RealdomFloat
const NAME = 'float'
 
- Public Attributes inherited from Hoa\Realdom\Realdom
const NAME = '(null)'
 

Protected Member Functions

 construct ()
 
 _predicate ($q)
 
 _sample (Math\Sampler $sampler)
 
- Protected Member Functions inherited from Hoa\Realdom\RealdomFloat
 _predicate ($q)
 
 _sample (Math\Sampler $sampler)
 
- Protected Member Functions inherited from Hoa\Realdom\Realdom
 construct ()
 
 setValue ($sampled)
 
 resetArguments ()
 
 _predicate ($q)
 
 _sample (Math\Sampler $sampler)
 
getConstraints ()
 
 _propagateConstraints ($type, $index, Array &$constraints)
 

Protected Attributes

 $_arguments
 
- Protected Attributes inherited from Hoa\Realdom\Realdom
 $_arguments = null
 
 $arguments = null
 
 $__sampler = null
 
 $_value = null
 
 $_constraints = null
 
 $_holder = null
 
 $_constructed = false
 
 $_praspelVisitor = null
 

Additional Inherited Members

- Static Public Member Functions inherited from Hoa\Realdom\Realdom
static autoBoxing (Array &$arguments, Realdom $self=null)
 
static setDefaultSampler (Math\Sampler $sampler)
 
static getDefaultSampler ()
 
static setMaxTry ($maxtry)
 
static getMaxTry ()
 
static setDefaultPraspelVisitor (Visitor\Visit $visitor)
 
static getDefaultPraspelVisitor ()
 
- Static Protected Attributes inherited from Hoa\Realdom\Realdom
static $_sampler = null
 
static $_maxtry = 64
 
static $_defaultPraspelVisitor = null
 

Detailed Description

Class .

Realistic domain: boundfloat.

Definition at line 49 of file Boundfloat.php.

Member Function Documentation

Hoa\Realdom\Boundfloat::_predicate (   $q)
protected

Predicate whether the sampled value belongs to the realistic domains.

Parameters
mixed$qSampled value.
Returns
boolean

Definition at line 95 of file Boundfloat.php.

96  {
97  return
98  parent::_predicate($q) &&
99  $q >= $this['lower']->getConstantValue() &&
100  $q <= $this['upper']->getConstantValue();
101  }
Hoa\Realdom\Boundfloat::_sample ( Math\Sampler  $sampler)
protected

Sample one new value.

Parameters
\Hoa\Math\Sampler$samplerSampler.
Returns
mixed

Definition at line 109 of file Boundfloat.php.

110  {
111  return $sampler->getFloat(
112  $this['lower']->sample($sampler),
113  $this['upper']->sample($sampler)
114  );
115  }
sample(Math\Sampler $sampler=null)
Definition: Realdom.php:686

Here is the call graph for this function:

Hoa\Realdom\Boundfloat::construct ( )
protected

Construct a realistic domain.

Returns
void

Definition at line 75 of file Boundfloat.php.

76  {
77  $lower = $this['lower']->getConstantValue();
78  $upper = $this['upper']->getConstantValue();
79 
80  if ($lower > $upper) {
81  throw new Exception\InvalidArgument(
82  '$lower must be strictly lower than $upper; given %d and %d.',
83  0,
84  [$lower, $upper]
85  );
86  }
87  }
Hoa\Realdom\Boundfloat::getLowerBound ( )

Get lower bound of the domain.

Returns

Implements Hoa\Realdom\IRealdom\Interval.

Definition at line 122 of file Boundfloat.php.

123  {
124  return $this['lower']->getConstantValue();
125  }
Hoa\Realdom\Boundfloat::getUpperBound ( )

Get upper bound of the domain.

Returns

Implements Hoa\Realdom\IRealdom\Interval.

Definition at line 132 of file Boundfloat.php.

133  {
134  return $this['upper']->getConstantValue();
135  }
Hoa\Realdom\Boundfloat::reduceLeftTo (   $value)

Reduce the upper bound.

Parameters
int$valueValue.
Returns
bool

Implements Hoa\Realdom\IRealdom\Interval.

Definition at line 163 of file Boundfloat.php.

164  {
165  $lower = max($this['lower']->getConstantValue(), $value);
166  $upper = $this['upper']->getConstantValue();
167 
168  if ($lower > $upper) {
169  return false;
170  }
171 
172  $this['lower'] = new Constinteger($value);
173 
174  return true;
175  }
Hoa\Realdom\Boundfloat::reduceRightTo (   $value)

Reduce the lower bound.

Parameters
mixed$valueValue.
Returns
bool

Implements Hoa\Realdom\IRealdom\Interval.

Definition at line 143 of file Boundfloat.php.

144  {
145  $lower = $this['lower']->getConstantValue();
146  $upper = min($this['upper']->getConstantValue(), $value);
147 
148  if ($lower > $upper) {
149  return false;
150  }
151 
152  $this['upper'] = new Constinteger($value);
153 
154  return true;
155  }

Member Data Documentation

Hoa\Realdom\Boundfloat::$_arguments
protected
Initial value:
= [
'Constfloat lower' => PHP_FLOAT_MIN

Definition at line 63 of file Boundfloat.php.

const Hoa\Realdom\Boundfloat::NAME = 'boundfloat'

Realistic domain name.

string

Definition at line 56 of file Boundfloat.php.


The documentation for this class was generated from the following file: