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 />

All Index types support the same operators. Using the following Index3 definitions, the<br />

results of the various operations are listed.<br />

int i1 = 3;<br />

int j1 = 5;<br />

int k1 = 7;<br />

int i2 = 9;<br />

int j2 = 13;<br />

int k2 = 17;<br />

Index3 idx_1 = new Index3(i1, j1, k1);<br />

// Value for idx_1 is (3, 5, 7)<br />

Index3 idx_2 = new Index3(i2, j2, k2);<br />

// Value for idx_2 is (9, 13, 17)<br />

+ (addition)<br />

Index3 idx_add_idx = idx_1 + idx_2;<br />

// Value for idx_add_idx is (12, 18, 24) from 3+9, 5+13, 7+17<br />

Index3 idx_add_int = idx_1 + 5;<br />

// Value for idx_add_int is (8, 10, 12) from 3+5, 5+5, 7+5<br />

Index3 int_add_idx = 5 + idx_1;<br />

// Value for idx_add_int is (8, 10, 12) from 5+3, 5+5, 5+7<br />

- (subtraction)<br />

Index3 idx_sub_idx = idx_1 - idx_2;<br />

// Value for idx_sub_idx is (-6, -8, -10) from 3-9, 5-13, 7-17<br />

Index3 idx_sub_int = idx_1 – 5;<br />

// Value for idx_sub_int is (-2, 0, 2) from 3-5, 5-5, 7-5<br />

Index3 int_sub_idx = 5 – idx_1;<br />

// Value for int_sub_idx is (2, 0, -2) from 5-3, 5-5, 5-7<br />

Index3 sub_idx = -idx_1;<br />

// Value for sub_idx is (-3, -5, -7) from -1*3, -1*5, -1*7<br />

4-86 <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!