_steckers=array(); } public function setStecker($from,$to) { if(!(preg_match('/^[A-Z]$/',$from) && preg_match('/^[A-Z]$/',$to))) { throw new Exception("Invalid stecker pair $from-$to"); } if(isset($_this->_steckers[$from])) { throw new Exception("Stecker socket $from already used"); } if(isset($_this->_steckers[$to])) { throw new Exception("Stecker socket $to already used"); } $this->_steckers[$from]=$to; $this->_steckers[$to]=$from; } public function setSteckers($assocArray) { $this->clearAllSteckers(); foreach($assocArray as $from=>$to) { $this->setStecker($from,$to); } } public function getOutputCharacterForInputCharacter ($inputCharacter) { if(isset($this->_steckers[$inputCharacter])) { $char=$this->_steckers[$inputCharacter]; } else { $char=$inputCharacter; } return $char; } }