19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

40.1.12 update(j:IndexInt, v: T): LinearSequenceT, n throws { IndexOutOfBoundsException }<br />

40.1.13 updatenat k(j:IntegerStatick, v: T):LinearSequenceT, n where { k < n }<br />

This is a functional version of subscripted value object assignment: element j of the result is the same as the given<br />

value v , and all other elements are the same as before. Indexing is zero-origin; an IndexOutOfBoundsException is<br />

thrown unless 0 ≤ j < n , where n is the length of the linear sequence. If the subscript is a static expression, then its<br />

validity is checked statically, and no exception will occur at run time.<br />

40.1.14 updatenat m(r:RangeOfStaticSizeIndexInt, m, v:LinearSequenceT, m):<br />

LinearSequenceT, n<br />

throws { IndexOutOfBoundsException } where { m ≤ n }<br />

40.1.15 updateint a,nat m,int c(r:StaticRangea, m, c, v:LinearSequenceT, m):<br />

LinearSequenceT, n<br />

where { 0 ≤ a < n, 0 ≤ a + m · c < n }<br />

This is a functional version of subscripted value object assignment: elements of the result selected by r are the same as<br />

corresponding elements of v , and all other elements are the same as before; specifically, element r.lowerBound + k × r.stride<br />

of the result is the same as element k of v , for all 0 ≤ k < m . Indexing is zero-origin; an IndexOutOfBoundsException<br />

is thrown unless 0 ≤ j < n , where n is the length of the linear sequence. If the subscript is a static range, then its<br />

validity is checked statically, and no exception will occur at run time.<br />

40.1.16 opr ‖ nat m(self,other: LinearSequenceT, m):LinearSequenceT, n + m<br />

<strong>The</strong> result is a linear sequence whose length is equal to the sum of the lengths of this linear sequence and the other<br />

linear sequence. Element k of the result is the same as element k of this linear sequence if 0 ≤ k < n , and is the<br />

same as element k − n of the other linear sequence if n ≤ k < n + m .<br />

40.1.17 getter reverse():LinearSequenceT, n<br />

<strong>The</strong> result is a linear sequence such that element k of the result is the same as element n − 1 − k of this linear<br />

sequence, for all 0 ≤ k < n .<br />

40.1.18 getter littleEndiannat b():BinaryLinearEndianSequenceb, n,false<br />

where { T extends BinaryWordb }<br />

40.1.19 getter bigEndiannat b():BinaryLinearEndianSequenceb, n,true<br />

where { T extends BinaryWordb }<br />

40.1.20 getter littleEndiannat b,bool bigEndianBytes,bool bigEndianBits():<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits, n,false<br />

where { T extends BinaryEndianWordb,bigEndianBytes,bigEndianBits }<br />

40.1.21 getter bigEndiannat b,bool bigEndianBytes,bool bigEndianBits():<br />

BinaryEndianLinearEndianSequenceb,bigEndianBytes,bigEndianBits, n,true<br />

where { T extends BinaryEndianWordb,bigEndianBytes,bigEndianBits }<br />

<strong>The</strong>se conversion getters allow a linear sequence of (possibly endian) binary words to be treated as a specifically<br />

little-endian or specifically big-endian linear sequence. This is especially useful just before invoking an endiannessdependent<br />

method, for example s.littleEndian.countLeadingZeroBits() .<br />

275

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

Saved successfully!

Ooh no, something went wrong!