Spaces:
Runtime error
Runtime error
File size: 2,446 Bytes
78c921d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
/**
* Exact decimal value represented as an integer value in two's
* complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers
* are used. The representation uses the endianness indicated
* in the Schema.
*/
export class Decimal {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Decimal {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsDecimal(bb:flatbuffers.ByteBuffer, obj?:Decimal):Decimal {
return (obj || new Decimal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsDecimal(bb:flatbuffers.ByteBuffer, obj?:Decimal):Decimal {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Decimal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
/**
* Total number of decimal digits
*/
precision():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
/**
* Number of digits after the decimal point "."
*/
scale():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
/**
* Number of bits per value. The only accepted widths are 128 and 256.
* We use bitWidth for consistency with Int::bitWidth.
*/
bitWidth():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 128;
}
static startDecimal(builder:flatbuffers.Builder) {
builder.startObject(3);
}
static addPrecision(builder:flatbuffers.Builder, precision:number) {
builder.addFieldInt32(0, precision, 0);
}
static addScale(builder:flatbuffers.Builder, scale:number) {
builder.addFieldInt32(1, scale, 0);
}
static addBitWidth(builder:flatbuffers.Builder, bitWidth:number) {
builder.addFieldInt32(2, bitWidth, 128);
}
static endDecimal(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createDecimal(builder:flatbuffers.Builder, precision:number, scale:number, bitWidth:number):flatbuffers.Offset {
Decimal.startDecimal(builder);
Decimal.addPrecision(builder, precision);
Decimal.addScale(builder, scale);
Decimal.addBitWidth(builder, bitWidth);
return Decimal.endDecimal(builder);
}
}
|