* Resize the map and get its first model * @this {!FieldModelMap} * @param {!number} size Size * @returns {[!FieldModel]} Base field model value
(size)
| 3002 | * @returns {[!FieldModel]} Base field model value |
| 3003 | */ |
| 3004 | resize (size) { |
| 3005 | let fbeMapSize = size * (this._modelKey.fbeSize + this._modelValue.fbeSize) |
| 3006 | let fbeMapOffset = this._buffer.allocate(4 + fbeMapSize) - this._buffer.offset |
| 3007 | console.assert(((fbeMapOffset > 0) && ((this._buffer.offset + fbeMapOffset + 4) <= this._buffer.size)), 'Model is broken!') |
| 3008 | |
| 3009 | this.writeUInt32(this.fbeOffset, fbeMapOffset) |
| 3010 | this.writeUInt32(fbeMapOffset, size) |
| 3011 | this.writeCount(fbeMapOffset + 4, 0, fbeMapSize) |
| 3012 | |
| 3013 | this._modelKey.fbeOffset = fbeMapOffset + 4 |
| 3014 | this._modelValue.fbeOffset = fbeMapOffset + 4 + this._modelKey.fbeSize |
| 3015 | return [this._modelKey, this._modelValue] |
| 3016 | } |
| 3017 | |
| 3018 | /** |
| 3019 | * Check if the map is valid |
no test coverage detected