mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-31 13:14:02 +00:00
Start of factor graph port. Things don't work yet, but a lot of syntax updates towards PHP
This commit is contained in:
28
PHPSkills/FactorGraphs/VariableFactory.php
Normal file
28
PHPSkills/FactorGraphs/VariableFactory.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Moserware\Skills\FactorGraphs;
|
||||
|
||||
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)
|
||||
{
|
||||
$newVar = new KeyedVariable($key, $this->_variablePriorInitializer());
|
||||
return $newVar;
|
||||
}
|
||||
}s
|
||||
|
||||
?>
|
Reference in New Issue
Block a user