src/ADT/Tree/BinaryNode.php
public function add( $value )
	{
		if( !isset( $this->value ) )
			return $this->value = $value;
		if( $value == $this->value)
			return -1;
		if( $value < $this->value )
		{
			if( $this->left )
				$this->left->add( $value );
			else
				$this->left = new ADT_Tree_BinaryNode( $value );
		}
		else if( $value > $this->value )
		{
			if( $this->right )
				$this->right->add( $value );
			else
				$this->right = new ADT_Tree_BinaryNode( $value );
		}
	}
public function add( $value )
	{
		if( !isset( $this->value ) )
			return $this->value = $value;
		if( $value == $this->value)
			return -1;
		if( $value < $this->value )
		{
			if( $this->left )
				$this->left->add( $value );
			else
				$this->left = new ADT_Tree_BinaryNode( $value );
		}
		else if( $value > $this->value )
		{
			if( $this->right )
				$this->right->add( $value );
			else
				$this->right = new ADT_Tree_BinaryNode( $value );
		}
	}
public function add ( $ value ) { if ( ! isset ( $ this -> value ) ) return $ this -> value = $ value ; if ( $ value == $ this -> value ) return - 1 ; if ( $ value < $ this -> value ) { if ( $ this -> left ) $ this -> left -> add ( $ value ) ; else $ this -> left = new ADT_Tree_BinaryNode ( $ value ) ; } else if ( $ value > $ this -> value ) { if ( $ this -> right ) $ this -> right -> add ( $ value ) ; else $ this -> right = new ADT_Tree_BinaryNode ( $ value ) ; } }
Adds a Node to the Tree.
@access		public
@param		mixed		$value		Value to be added to the Tree
@return		void
Adds a Node to the Tree .