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

Public Member Functions

 samplePattern (Math\Sampler $sampler)
 
- Public Member Functions inherited from Hoa\Realdom\RealdomString
 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 = 'color'
 
const REGEX = '#^\#[a-f0-9]{3}([a-f0-9]{3})?$#i'
 
- Public Attributes inherited from Hoa\Realdom\RealdomString
const NAME = 'string'
 
- 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\RealdomString
 construct ()
 
 _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 = null
 
- Protected Attributes inherited from Hoa\Realdom\RealdomString
 $_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: color.

Definition at line 49 of file Color.php.

Member Function Documentation

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

Predicate whether the sampled value belongs to the realistic domains.

Parameters
mixed$qSampled value.
Returns
boolean

Definition at line 89 of file Color.php.

90  {
91  return 0 !== preg_match(static::REGEX, $q, $m);
92  }
Hoa\Realdom\Color::_sample ( Math\Sampler  $sampler)
protected

Sample one new value.

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

Definition at line 100 of file Color.php.

101  {
102  if (0 === $sampler->getInteger(0, 1)) {
103  return '#' . sprintf(
104  '%02' . implode('%02', $this->samplePattern($sampler)),
105  $sampler->getInteger(0, 255),
106  $sampler->getInteger(0, 255),
107  $sampler->getInteger(0, 255)
108  );
109  }
110 
111  return '#' . sprintf(
112  '%' . implode('%', $this->samplePattern($sampler)),
113  $sampler->getInteger(0, 15),
114  $sampler->getInteger(0, 15),
115  $sampler->getInteger(0, 15)
116  );
117  }
samplePattern(Math\Sampler $sampler)
Definition: Color.php:125

Here is the call graph for this function:

Hoa\Realdom\Color::construct ( )
protected

Construct a realistic domain.

Returns
void

Definition at line 78 of file Color.php.

79  {
80  return;
81  }
Hoa\Realdom\Color::samplePattern ( Math\Sampler  $sampler)

Sample patterns.

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

Definition at line 125 of file Color.php.

126  {
127  switch ($sampler->getInteger(0, 2)) {
128  case 0:
129  return ['x', 'x', 'x'];
130 
131  case 1:
132  return ['X', 'X', 'X'];
133 
134  case 2:
135  return [
136  0 === $sampler->getInteger(0, 1) ? 'x' : 'X',
137  0 === $sampler->getInteger(0, 1) ? 'x' : 'X',
138  0 === $sampler->getInteger(0, 1) ? 'x' : 'X',
139  ];
140  }
141  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Realdom\Color::$_arguments = null
protected

Definition at line 69 of file Color.php.

const Hoa\Realdom\Color::NAME = 'color'

Realistic domain name.

string

Definition at line 56 of file Color.php.

const Hoa\Realdom\Color::REGEX = '#^\#[a-f0-9]{3}([a-f0-9]{3})?$#i'

Regular expression to represent a valid simple color.

string

Definition at line 63 of file Color.php.


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