mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-29 04:13:22 +00:00
More debugging and realizing how PHP does references
This commit is contained in:
@ -36,12 +36,12 @@ abstract class Factor
|
||||
return count($this->_messages);
|
||||
}
|
||||
|
||||
protected function getVariables()
|
||||
protected function &getVariables()
|
||||
{
|
||||
return $this->_variables;
|
||||
}
|
||||
|
||||
protected function getMessages()
|
||||
protected function &getMessages()
|
||||
{
|
||||
return $this->_messages;
|
||||
}
|
||||
@ -77,11 +77,11 @@ abstract class Factor
|
||||
return $this->sendMessageVariable($message, $variable);
|
||||
}
|
||||
|
||||
protected abstract function sendMessageVariable(Message $message, Variable $variable);
|
||||
protected abstract function sendMessageVariable(Message &$message, Variable &$variable);
|
||||
|
||||
public abstract function createVariableToMessageBinding(Variable $variable);
|
||||
public abstract function createVariableToMessageBinding(Variable &$variable);
|
||||
|
||||
protected function createVariableToMessageBindingWithMessage(Variable $variable, Variable $message)
|
||||
protected function createVariableToMessageBindingWithMessage(Variable &$variable, Variable &$message)
|
||||
{
|
||||
$index = count($this->_messages);
|
||||
$this->_messages[] = $message;
|
||||
|
@ -5,14 +5,14 @@ class FactorGraph
|
||||
{
|
||||
private $_variableFactory;
|
||||
|
||||
public function getVariableFactory()
|
||||
public function &getVariableFactory()
|
||||
{
|
||||
return $this->_variableFactory;
|
||||
}
|
||||
|
||||
public function setVariableFactory($factory)
|
||||
public function setVariableFactory(&$factory)
|
||||
{
|
||||
$this->_variableFactory = $factory;
|
||||
$this->_variableFactory = &$factory;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Moserware\Skills\FactorGraphs;
|
||||
|
||||
require_once(dirname(__FILE__) . "/FactorGraph.php");
|
||||
require_once(dirname(__FILE__) . "/Schedule.php");
|
||||
|
||||
abstract class FactorGraphLayer
|
||||
@ -10,44 +11,44 @@ abstract class FactorGraphLayer
|
||||
private $_inputVariablesGroups = array();
|
||||
private $_parentFactorGraph;
|
||||
|
||||
protected function __construct($parentGraph)
|
||||
protected function __construct(FactorGraph &$parentGraph)
|
||||
{
|
||||
$this->_parentFactorGraph = $parentGraph;
|
||||
$this->_parentFactorGraph = &$parentGraph;
|
||||
}
|
||||
|
||||
protected function getInputVariablesGroups()
|
||||
protected function &getInputVariablesGroups()
|
||||
{
|
||||
return $this->_inputVariablesGroups;
|
||||
}
|
||||
|
||||
// HACK
|
||||
|
||||
public function getParentFactorGraph()
|
||||
public function &getParentFactorGraph()
|
||||
{
|
||||
return $this->_parentFactorGraph;
|
||||
}
|
||||
|
||||
public function getOutputVariablesGroups()
|
||||
public function &getOutputVariablesGroups()
|
||||
{
|
||||
return $this->_outputVariablesGroups;
|
||||
}
|
||||
|
||||
public function getLocalFactors()
|
||||
public function &getLocalFactors()
|
||||
{
|
||||
return $this->_localFactors;
|
||||
}
|
||||
|
||||
public function setInputVariablesGroups($value)
|
||||
public function &setInputVariablesGroups(&$value)
|
||||
{
|
||||
$this->_inputVariablesGroups = $value;
|
||||
}
|
||||
|
||||
protected function scheduleSequence($itemsToSequence)
|
||||
protected function scheduleSequence(&$itemsToSequence)
|
||||
{
|
||||
return new ScheduleSequence("TODO", $itemsToSequence);
|
||||
}
|
||||
|
||||
protected function addLayerFactor($factor)
|
||||
protected function addLayerFactor(&$factor)
|
||||
{
|
||||
$this->_localFactors[] = $factor;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class FactorList
|
||||
return count($this->_list);
|
||||
}
|
||||
|
||||
public function addFactor(Factor $factor)
|
||||
public function addFactor(Factor &$factor)
|
||||
{
|
||||
$this->_list[] = $factor;
|
||||
return $factor;
|
||||
|
@ -14,12 +14,12 @@ class Variable
|
||||
$this->resetToPrior();
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
public function &getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
public function setValue(&$value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user