mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-26 11:08:01 +00:00
It gets a result... unfortunately it's wrong. But hey, that's progress :) Lots of debugging code left in to make up for a less than ideal debugger
This commit is contained in:
@ -7,29 +7,31 @@ class HashMap
|
||||
private $_hashToValue = array();
|
||||
private $_hashToKey = array();
|
||||
|
||||
public function &getValue($key)
|
||||
public function &getValue(&$key)
|
||||
{
|
||||
$hash = self::getHash($key);
|
||||
$hashValue = &$this->_hashToValue[$hash];
|
||||
return $hashValue;
|
||||
}
|
||||
|
||||
public function setValue($key, $value)
|
||||
public function setValue(&$key, &$value)
|
||||
{
|
||||
$hash = self::getHash($key);
|
||||
$this->_hashToKey[$hash] = $key;
|
||||
$this->_hashToValue[$hash] = $value;
|
||||
$this->_hashToKey[$hash] = &$key;
|
||||
$this->_hashToValue[$hash] = &$value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllKeys()
|
||||
public function &getAllKeys()
|
||||
{
|
||||
return \array_values($this->_hashToKey);
|
||||
$keys = &\array_values($this->_hashToKey);
|
||||
return $keys;
|
||||
}
|
||||
|
||||
public function getAllValues()
|
||||
{
|
||||
return \array_values($this->_hashToValue);
|
||||
$values = &\array_values($this->_hashToValue);
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function count()
|
||||
@ -37,7 +39,7 @@ class HashMap
|
||||
return \count($this->_hashToKey);
|
||||
}
|
||||
|
||||
private static function getHash($key)
|
||||
private static function getHash(&$key)
|
||||
{
|
||||
if(\is_object($key))
|
||||
{
|
||||
|
Reference in New Issue
Block a user