02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Basics<br />

SmallerMultiple – This method takes two integer arguments, m and n, and computes<br />

the smaller (towards 0) increment of n after m. This is the opposite case of the<br />

LargerMultiple method. In this case we are looking for the multiple of “n” that is<br />

closest to “m” and between “m” and zero. So using our previous values of “m” as 3 and<br />

“n” as 2 we get a result of 2 and for “m” as -3 we get a result of -2.<br />

Algorithm.SmallerMultiple(3, 2);<br />

// result is 2<br />

Algorithm.SmallerMultiple(30, 10);<br />

// result is 20<br />

Algorithm.SmallerMultiple(-8, 5);<br />

// result is -5<br />

NearestMultiple – This method takes two integer arguments, m and n, and rounds m<br />

to the nearest multiple of n.<br />

Algorithm.NearestMultiple(13, 5);<br />

// result is 10<br />

Algorithm.NearestMultiple(4, 20);<br />

// result is 0<br />

NextMultiple – This method takes two integer arguments, m and n, and finds the next<br />

(towards +infinity) increment of n after m.<br />

Algorithm.NextMultiple(3, 2);<br />

// result is 4<br />

Algorithm.NextMultiple(10, 20);<br />

// result is 20<br />

PreviousMultiple - This method takes two integer arguments, m and n, and finds the<br />

previous (towards -infinity) increment of n before m.<br />

Algorithm.PreviousMultiple(7, 2);<br />

// result is 6<br />

Algorithm.PreviousMultiple(15, 4);<br />

// result is 12<br />

SignInterval– This method takes three arguments: x, low, and high. It returns a 32-bit<br />

signed integer that indicates the relative order of the objects being compared. If the<br />

4-130 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!