Moved files to their right spot

This commit is contained in:
Jeff Moser
2010-09-18 21:22:00 -04:00
parent f2eca28f29
commit 99e1adf7df
2 changed files with 0 additions and 0 deletions

46
PHPSkills/HashMap.php Normal file
View File

@ -0,0 +1,46 @@
<?php
class HashMap
{
private $_hashToValue = array();
private $_hashToKey = array();
public function getValue($key)
{
return $this->_hashToValue[self::getHash($key)];
}
public function setValue($key, $value)
{
$hash = self::getHash($key);
$this->_hashToKey[$hash] = $key;
$this->_hashToValue[$hash] = $value;
return $this;
}
public function getAllKeys()
{
return \array_values($this->_hashToKey);
}
public function getAllValues()
{
return \array_values($this->_hashToValue);
}
public function count()
{
return \count($this->_hashToKey);
}
private static function getHash($key)
{
if(\is_object($key))
{
return \spl_object_hash($key);
}
return $key;
}
}
?>

30
PHPSkills/PartialPlay.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace Moserware\Skills;
require_once(dirname(__FILE__) . "/ISupportPartialPlay.php");
class PartialPlay
{
public static function getPartialPlayPercentage($player)
{
// If the player doesn't support the interface, assume 1.0 == 100%
$supportsPartialPlay = $player instanceof ISupportPartialPlay;
if (!$supportsPartialPlay)
{
return 1.0;
}
$partialPlayPercentage = $partialPlay->getPartialPlayPercentage();
// HACK to get around bug near 0
$smallestPercentage = 0.0001;
if ($partialPlayPercentage < $smallestPercentage)
{
$partialPlayPercentage = $smallestPercentage;
}
return $partialPlayPercentage;
}
}
?>