mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 20:34:28 +00:00
Naming tweak
This commit is contained in:
32
Skills/FactorGraphs/VariableFactory.php
Normal file
32
Skills/FactorGraphs/VariableFactory.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Moserware\Skills\FactorGraphs;
|
||||
|
||||
require_once(dirname(__FILE__) . "/Variable.php");
|
||||
|
||||
class VariableFactory
|
||||
{
|
||||
// using a Func<TValue> to encourage fresh copies in case it's overwritten
|
||||
private $_variablePriorInitializer;
|
||||
|
||||
public function __construct($variablePriorInitializer)
|
||||
{
|
||||
$this->_variablePriorInitializer = &$variablePriorInitializer;
|
||||
}
|
||||
|
||||
public function &createBasicVariable($name)
|
||||
{
|
||||
$initializer = $this->_variablePriorInitializer;
|
||||
$newVar = new Variable($name, $initializer());
|
||||
return $newVar;
|
||||
}
|
||||
|
||||
public function &createKeyedVariable(&$key, $name)
|
||||
{
|
||||
$initializer = $this->_variablePriorInitializer;
|
||||
$newVar = new KeyedVariable($key, $name, $initializer());
|
||||
return $newVar;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user