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

Public Member Functions

 reset ()
 
 getConstantValue ()
 
 getConstantRepresentation ()
 
- Public Member Functions inherited from Hoa\Realdom\RealdomArray
 reset ()
 
- 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 = 'constarray'
 
- Public Attributes inherited from Hoa\Realdom\RealdomArray
const NAME = 'array'
 
- 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\RealdomArray
 construct ()
 
 _predicate ($q)
 
 _sample (Math\Sampler $sampler)
 
 _propagateConstraints ($type, $index, Array &$constraints)
 
 adjustLength ()
 
- 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\RealdomArray
 $_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: constarray.

Definition at line 49 of file Constarray.php.

Member Function Documentation

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

Predicate whether the sampled value belongs to the realistic domains.

Parameters
mixed$qSampled value.
Returns
boolean

Definition at line 105 of file Constarray.php.

106  {
107  if (!is_array($q)) {
108  return false;
109  }
110 
111  $count = count($q);
112 
113  if (false === $this['length']->predicate($count)) {
114  return false;
115  }
116 
117  $pairs = $this['pairs'];
118 
119  foreach ($q as $_key => $_value) {
120  $out = false;
121 
122  foreach ($pairs as $pair) {
123  $key = $pair[0];
124  $value = $pair[1];
125 
126  if (false === $key->predicate($_key)) {
127  continue;
128  }
129 
130  if (false === $value->predicate($_value)) {
131  continue;
132  }
133 
134  $out = true;
135 
136  break;
137  }
138 
139  if (false === $out) {
140  return false;
141  }
142  }
143 
144  return $out;
145  }

Here is the call graph for this function:

Hoa\Realdom\Constarray::_sample ( Math\Sampler  $sampler)
protected

Sample one new value.

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

Definition at line 153 of file Constarray.php.

154  {
155  $out = [];
156 
157  foreach ($this['pairs'] as $pair) {
158  if (!isset($pair[1])) {
159  $out[] = $pair[0]->sample($sampler);
160 
161  continue;
162  }
163 
164  $key = $pair[0]->sample($sampler);
165  $value = $pair[1]->sample($sampler);
166  $out[$key] = $value;
167  }
168 
169  return $out;
170  }
Hoa\Realdom\Constarray::construct ( )
protected

Construct a realistic domain.

Returns
void

Definition at line 74 of file Constarray.php.

75  {
76  $this['length'] = new Constinteger(count($this['pairs']));
77 
78  return;
79  }

Here is the call graph for this function:

Hoa\Realdom\Constarray::getConstantRepresentation ( )

Get representation of the realistic domain.

Returns
string

Implements Hoa\Realdom\IRealdom\Constant.

Definition at line 187 of file Constarray.php.

188  {
189  $handle = [];
190 
191  foreach ($this['pairs'] as $pair) {
192  $_handle = null;
193 
194  foreach ($pair as $_pair) {
195  if (null === $_handle) {
196  $_handle = isset($pair[1]) ? 'from ' : 'to ';
197  } else {
198  $_handle .= ' to ';
199  }
200 
201  if (null !== $holder = $_pair->getHolder()) {
202  $_handle .= $holder->getName();
203  } else {
204  $_handle .= $this->getPraspelVisitor()->visit($_pair);
205  }
206  }
207 
208  $handle[] = $_handle;
209  }
210 
211  return '[' . implode(', ', $handle) . ']';
212  }

Here is the call graph for this function:

Hoa\Realdom\Constarray::getConstantValue ( )

Get constant value.

Returns
float

Implements Hoa\Realdom\IRealdom\Constant.

Definition at line 177 of file Constarray.php.

178  {
179  return $this['pairs'];
180  }
Hoa\Realdom\Constarray::reset ( )

Reset realistic domain.

Returns
void

Definition at line 86 of file Constarray.php.

87  {
88  foreach ($this['pairs'] as $pair) {
89  $pair[0]->reset();
90 
91  if (isset($pair[1])) {
92  $pair[1]->reset();
93  }
94  }
95 
96  return;
97  }

Member Data Documentation

Hoa\Realdom\Constarray::$_arguments
protected
Initial value:
= [
'pairs'
]

Definition at line 63 of file Constarray.php.

const Hoa\Realdom\Constarray::NAME = 'constarray'

Realistic domain name.

string

Definition at line 56 of file Constarray.php.


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