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:
Jeff Moser
2010-10-02 21:15:47 -04:00
parent c22683ab33
commit fc6cd5c961
22 changed files with 145 additions and 70 deletions

View File

@ -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))
{