19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

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.

40.9 <strong>The</strong> Trait <strong>Fortress</strong>.Core.BinaryLinearEndianSequence<br />

trait BinaryLinearEndianSequencenat b,nat n,bool bigEndianSequence<br />

extends { BasicBinaryOperationsBinaryLinearEndianSequenceb, n,bigEndianSequence }<br />

where { b ≤ maxBinaryWordBitLog }<br />

coercion nat b ′ ,bool bigEndianBytes,bool bigEndianBits<br />

(x:BinaryEndianWordb ′ ,bigEndianBytes,bigEndianBits)<br />

where {bigEndianBytes = bigEndianSequence, 2 b′ = n · 2 b }<br />

coercion nat m,nat radix,nat q,nat k,nat v(x:NaturalNumeralm,radix, v)<br />

where {radix = 2 q , q · m = n · 2 bk }<br />

opr [j: IndexInt] : BinaryWordb<br />

throws { IndexOutOfBoundsException }<br />

opr nat k[j: IntegerStatick] : BinaryWordb where { k < n }<br />

opr nat m[r: RangeOfStaticSizeIndexInt, m] :<br />

BinaryLinearEndianSequenceb, m,bigEndianSequence<br />

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

opr int a,nat m,int c[r:StaticRangea, m, c] :<br />

BinaryLinearEndianSequenceb, m,bigEndianSequence<br />

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

opr [j: IndexInt] := (v: BinaryWordb):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

opr nat k[j: IntegerStatick] := (v: BinaryWordb):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence where { k < n }<br />

opr nat m[r: RangeOfStaticSizeIndexInt, m] :=<br />

(v: BinaryLinearEndianSequenceb, m,bigEndianSequence):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

opr int a,nat m,int c[r:StaticRangea, m, c] :=<br />

(v: BinaryLinearEndianSequenceb, m,bigEndianSequence):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence<br />

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

update(j:IndexInt, v: BinaryWordb):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

updatenat k(j: IntegerStatick, v: BinaryWordb):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence where { k < n }<br />

updatenat m(r:RangeOfStaticSizeIndexInt, m,<br />

v: BinaryLinearEndianSequenceb, m,bigEndianSequence):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence<br />

throws { IndexOutOfBoundsException }<br />

updateint a,nat m,int c(r:StaticRangea, m, c,<br />

v: BinaryLinearEndianSequenceb, m,bigEndianSequence):<br />

BinaryLinearEndianSequenceb, n,bigEndianSequence<br />

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

opr ‖ nat m(self,other: BinaryLinearEndianSequenceb, m,bigEndianSequence):<br />

BinaryLinearEndianSequenceb, n + m,bigEndianSequence<br />

opr ‖ nat m,nat radix,nat q,nat k,nat v(self,other: NaturalNumeralm,radix, v):<br />

LinearSequenceBinaryWordb, n + k where {radix = 2 q , q · m = k · 2 b }<br />

opr ‖ nat m,nat radix,nat q,nat k,nat v(other: NaturalNumeralm,radix, v,self):<br />

LinearSequenceBinaryWordb, n + k where {radix = 2 q , q · m = k · 2 b }<br />

294

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

Saved successfully!

Ooh no, something went wrong!