mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
32 lines
755 B
PHP
32 lines
755 B
PHP
<?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()
|
|
{
|
|
$newVar = new Variable($this->_variablePriorInitializer());
|
|
return $newVar;
|
|
}
|
|
|
|
public function createKeyedVariable($key)
|
|
{
|
|
$initializer = $this->_variablePriorInitializer;
|
|
$newVar = new KeyedVariable($key, "key variable", $initializer());
|
|
return $newVar;
|
|
}
|
|
}
|
|
|
|
?>
|