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

Public Member Functions

 reset ()
 
 discredit ($value)
 
 getSize ()
 
- 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 = 'natural'
 
- Public Attributes inherited from Hoa\Realdom\Integer
const NAME = 'integer'
 
- Public Attributes inherited from Hoa\Realdom\Realdom
const NAME = '(null)'
 

Protected Member Functions

 _predicate ($q)
 
 _sample (Math\Sampler $sampler)
 
- Protected Member Functions inherited from Hoa\Realdom\Integer
 _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
 
 $_discredited = []
 
- 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: natural.

Definition at line 49 of file Natural.php.

Member Function Documentation

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

Predicate whether the sampled value belongs to the realistic domains.

Parameters
mixed$qSampled value.
Returns
boolean

Definition at line 99 of file Natural.php.

100  {
101  $q -= $this['start']->getConstantValue();
102 
103  return 0 === $q % $this['step']->getConstantValue();
104  }
Hoa\Realdom\Natural::_sample ( Math\Sampler  $sampler)
protected

Sample one new value.

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

Definition at line 112 of file Natural.php.

113  {
114  $sampled = $this->getValue();
115 
116  do {
117  if (null === $sampled) {
118  $sampled = $this['start']->getConstantValue();
119  } else {
120  $sampled += $this['step']->getConstantValue();
121  }
122  } while (true === in_array($sampled, $this->_discredited));
123 
124  return $sampled;
125  }

Here is the call graph for this function:

Hoa\Realdom\Natural::discredit (   $value)

Discredit a value.

Parameters
mixed$valueValue to discredit.
Returns

Implements Hoa\Realdom\IRealdom\Nonconvex.

Definition at line 133 of file Natural.php.

134  {
135  if (true === in_array($value, $this->_discredited) ||
136  false === $this->predicate($value)) {
137  return $this;
138  }
139 
140  $this->_discredited[] = $value;
141 
142  return $this;
143  }

Here is the call graph for this function:

Hoa\Realdom\Natural::getSize ( )

Get size of the domain.

Returns
int

Implements Hoa\Realdom\IRealdom\Finite.

Definition at line 150 of file Natural.php.

151  {
152  return PHP_INT_MAX;
153  }
Hoa\Realdom\Natural::reset ( )

Reset the realistic domain.

Returns
void

Definition at line 85 of file Natural.php.

86  {
87  $this->setValue(null);
88  $this->_discredited = [];
89 
90  return;
91  }
setValue($sampled)
Definition: Realdom.php:577

Here is the call graph for this function:

Member Data Documentation

Hoa\Realdom\Natural::$_arguments
protected
Initial value:
= [
'Constinteger start' => 0

Definition at line 66 of file Natural.php.

Hoa\Realdom\Natural::$_discredited = []
protected

Definition at line 76 of file Natural.php.

const Hoa\Realdom\Natural::NAME = 'natural'

Realistic domain name.

string

Definition at line 59 of file Natural.php.


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