Entry 3612

T9 abstract class

   

Submitted by anonymous on April 22, 2010 at 3:13 p.m.
Language: PHP. Code size: 1.0 KB.

<?php
class T9
{
	/**
	 * $dictionary format:
	 * array(
	 *	Word Object#0 (
	 *		spelling => 'hello',
	 *		digits => 43556,
	 *		code => '4433555 555666'
	 *	),
	 *	Word Object#1 (
	 *		spelling => 'bacon',
	 *		digits => 22266,
	 *		code => '22 2 222666 66'
	 *	),
	 *	Word Object#2 (...),
	 *	...
	 * )
	 */
	private $dictionary = array();
	
	
	public function __construct() {}
	public function __destruct() {}

	/**
	 * Creates a binary-word dictionary from array of words. Returns False on error, True on success.
	 *
	 * @param array $words Array of words
	 * @return boolean
	 */	
	public function createDictionary($words) {
		// Это ваша домашняя работа!
	}

	/**
	 * Search nearest to $inputDigits word from T9::$dictionary. Returns index of found array item or false on error (word not found, for example).
	 *
	 * @param string $inputDigits String of inputed digits (f.e. "43556")
	 * @return mixed
	 */
	public function searchWordIndex($inputDigits) {
		// Это ваша домашняя работа!
	}
}
?>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).