@Override
	public void setValue(double value) {
		if (numberOfIterations < 2) {
			/**
			 * Initially fill values
			 */
			values[numberOfIterations] = value;

			if (numberOfIterations < 1) {
				nextPoint = points[numberOfIterations + 1];
			} else {
				nextPoint = (points[1] + points[0]) / 2.0;
				/**
				 * @todo Check if values[0]*values[1] < 0 here
				 */
			}
		}
		else {
			/**
			 * Bisection search update rule
			 */

			if (values[1] * value > 0) {
				/*
				 * Throw away right point. Replace with current point.
				 */
				points[1] = nextPoint;		// This is the current point. New next point calculated below.
				values[1] = value;
			} else {
				/*
				 * Throw away left point. Replace with current point.
				 */
				points[0] = nextPoint;		// This is the current point. New next point calculated below.
				values[0] = value;
			}

			// Calculate new next point (bisection)
			nextPoint = (points[1] + points[0]) / 2.0;

			// Savety belt: check if still improve or if we have reached machine accuracy
			if(points[1]-points[0] >= accuracy) {
				isDone = true;
			}

			// Update accuracy
			accuracy = points[1]-points[0];
		}

		numberOfIterations++;
	}
@ Override public void setValue ( double value ) { if ( numberOfIterations < 2 ) { values [ numberOfIterations ] = value ; if ( numberOfIterations < 1 ) { nextPoint = points [ numberOfIterations + 1 ] ; } else { nextPoint = ( points [ 1 ] + points [ 0 ] ) / 2.0 ; } } else { if ( values [ 1 ] * value > 0 ) { points [ 1 ] = nextPoint ; values [ 1 ] = value ; } else { points [ 0 ] = nextPoint ; values [ 0 ] = value ; } nextPoint = ( points [ 1 ] + points [ 0 ] ) / 2.0 ; if ( points [ 1 ] - points [ 0 ] >= accuracy ) { isDone = true ; } accuracy = points [ 1 ] - points [ 0 ] ; } numberOfIterations ++ ; }
@param value Value corresponding to point returned by previous <code>getNextPoint</code> call.