mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	
		
			
	
	
		
			29 lines
		
	
	
		
			650 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			29 lines
		
	
	
		
			650 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?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
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								?>
							 |