Created
February 22, 2015 22:18
-
-
Save sjrd/a4ca0f83b208ed29cc5c to your computer and use it in GitHub Desktop.
Translation to JS of Scala.js' TypedArrayFloatBuffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype = new ScalaJS.h.Ljava_nio_FloatBuffer(); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.constructor = ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer; | |
/** @constructor */ | |
ScalaJS.h.Ljava_nio_TypedArrayFloatBuffer = (function() { | |
/*<skip>*/ | |
}); | |
ScalaJS.h.Ljava_nio_TypedArrayFloatBuffer.prototype = ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype; | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.slice__Ljava_nio_FloatBuffer = (function() { | |
var slicedTypedArray = this.$$undtypedArray$3["subarray"](this.java$nio$Buffer$$$undposition$1, this.$$undlimit$1); | |
var initialLimit = ScalaJS.uI(slicedTypedArray["length"]); | |
var readOnly = this.$$undreadOnly$3; | |
return new ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer().init___sjs_js_typedarray_Float32Array__I__I__Z(slicedTypedArray, 0, initialLimit, readOnly) | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.get__F = (function() { | |
var p = this.java$nio$Buffer$$$undposition$1; | |
if ((p === this.$$undlimit$1)) { | |
throw new ScalaJS.c.Ljava_nio_BufferUnderflowException().init___() | |
}; | |
this.java$nio$Buffer$$$undposition$1 = ((1 + p) | 0); | |
return ScalaJS.uF(this.$$undtypedArray$3[p]) | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.get__I__F = (function(index) { | |
if (((index < 0) || (index >= this.$$undlimit$1))) { | |
throw new ScalaJS.c.jl_IndexOutOfBoundsException().init___() | |
}; | |
return ScalaJS.uF(this.$$undtypedArray$3[index]) | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.asReadOnlyBuffer__Ljava_nio_FloatBuffer = (function() { | |
var typedArray = this.$$undtypedArray$3; | |
var initialPosition = this.java$nio$Buffer$$$undposition$1; | |
var initialLimit = this.$$undlimit$1; | |
var result = new ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer().init___sjs_js_typedarray_Float32Array__I__I__Z(typedArray, initialPosition, initialLimit, true); | |
result.$$undmark$1 = this.$$undmark$1; | |
return result | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.order__Ljava_nio_ByteOrder = (function() { | |
return ScalaJS.m.Ljava_nio_ByteOrder$().nativeOrder__Ljava_nio_ByteOrder() | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.load__I__F = (function(index) { | |
return ScalaJS.uF(this.$$undtypedArray$3[index]) | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.put__AF__I__I__Ljava_nio_FloatBuffer = (function(src, offset, length) { | |
if (this.$$undreadOnly$3) { | |
throw new ScalaJS.c.Ljava_nio_ReadOnlyBufferException().init___() | |
}; | |
if ((((offset < 0) || (length < 0)) || (offset > ((src.u["length"] - length) | 0)))) { | |
throw new ScalaJS.c.jl_IndexOutOfBoundsException().init___() | |
}; | |
var p = this.java$nio$Buffer$$$undposition$1; | |
var newPos = ((p + length) | 0); | |
if ((newPos > this.$$undlimit$1)) { | |
throw new ScalaJS.c.Ljava_nio_BufferOverflowException().init___() | |
}; | |
this.java$nio$Buffer$$$undposition$1 = newPos; | |
var selfPos = p; | |
var endPos = ((selfPos + length) | 0); | |
var arrayIndex = offset; | |
while ((selfPos !== endPos)) { | |
var index = selfPos; | |
var elem = src.u[arrayIndex]; | |
this.$$undtypedArray$3[index] = elem; | |
selfPos = ((1 + selfPos) | 0); | |
arrayIndex = ((1 + arrayIndex) | 0) | |
}; | |
return this | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.put__I__F__Ljava_nio_FloatBuffer = (function(index, c) { | |
if (this.$$undreadOnly$3) { | |
throw new ScalaJS.c.Ljava_nio_ReadOnlyBufferException().init___() | |
}; | |
if (((index < 0) || (index >= this.$$undlimit$1))) { | |
throw new ScalaJS.c.jl_IndexOutOfBoundsException().init___() | |
}; | |
this.$$undtypedArray$3[index] = c; | |
return this | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.duplicate__Ljava_nio_FloatBuffer = (function() { | |
var typedArray = this.$$undtypedArray$3; | |
var initialPosition = this.java$nio$Buffer$$$undposition$1; | |
var initialLimit = this.$$undlimit$1; | |
var readOnly = this.$$undreadOnly$3; | |
var result = new ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer().init___sjs_js_typedarray_Float32Array__I__I__Z(typedArray, initialPosition, initialLimit, readOnly); | |
result.$$undmark$1 = this.$$undmark$1; | |
return result | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.isReadOnly__Z = (function() { | |
return this.$$undreadOnly$3 | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.get__AF__I__I__Ljava_nio_FloatBuffer = (function(dst, offset, length) { | |
if ((((offset < 0) || (length < 0)) || (offset > ((dst.u["length"] - length) | 0)))) { | |
throw new ScalaJS.c.jl_IndexOutOfBoundsException().init___() | |
}; | |
var p = this.java$nio$Buffer$$$undposition$1; | |
var newPos = ((p + length) | 0); | |
if ((newPos > this.$$undlimit$1)) { | |
throw new ScalaJS.c.Ljava_nio_BufferUnderflowException().init___() | |
}; | |
this.java$nio$Buffer$$$undposition$1 = newPos; | |
var selfPos = p; | |
var endPos = ((selfPos + length) | 0); | |
var arrayIndex = offset; | |
while ((selfPos !== endPos)) { | |
var jsx$1 = arrayIndex; | |
var index = selfPos; | |
dst.u[jsx$1] = ScalaJS.uF(this.$$undtypedArray$3[index]); | |
selfPos = ((1 + selfPos) | 0); | |
arrayIndex = ((1 + arrayIndex) | 0) | |
}; | |
return this | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.init___sjs_js_typedarray_Float32Array__I__I__Z = (function(_typedArray, _initialPosition, _initialLimit, _readOnly) { | |
this.$$undtypedArray$3 = _typedArray; | |
this.$$undreadOnly$3 = _readOnly; | |
ScalaJS.c.Ljava_nio_FloatBuffer.prototype.init___I__AF__I.call(this, ScalaJS.uI(_typedArray["length"]), null, (-1)); | |
this.position__I__Ljava_nio_Buffer(_initialPosition); | |
this.limit__I__Ljava_nio_Buffer(_initialLimit); | |
return this | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.compact__Ljava_nio_FloatBuffer = (function() { | |
if (this.$$undreadOnly$3) { | |
throw new ScalaJS.c.Ljava_nio_ReadOnlyBufferException().init___() | |
}; | |
var typedArray = this.$$undtypedArray$3; | |
var pos = this.java$nio$Buffer$$$undposition$1; | |
var lim = this.$$undlimit$1; | |
typedArray["set"](typedArray["subarray"](pos, lim)); | |
this.$$undmark$1 = (-1); | |
this.limit__I__Ljava_nio_Buffer(this.$$undcapacity$1); | |
this.position__I__Ljava_nio_Buffer(((lim - pos) | 0)); | |
return this | |
}); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.put__F__Ljava_nio_FloatBuffer = (function(c) { | |
if (this.$$undreadOnly$3) { | |
throw new ScalaJS.c.Ljava_nio_ReadOnlyBufferException().init___() | |
}; | |
var p = this.java$nio$Buffer$$$undposition$1; | |
if ((p === this.$$undlimit$1)) { | |
throw new ScalaJS.c.Ljava_nio_BufferOverflowException().init___() | |
}; | |
this.java$nio$Buffer$$$undposition$1 = ((1 + p) | 0); | |
this.$$undtypedArray$3[p] = c; | |
return this | |
}); | |
ScalaJS.d.Ljava_nio_TypedArrayFloatBuffer = new ScalaJS.ClassTypeData({ | |
Ljava_nio_TypedArrayFloatBuffer: 0 | |
}, false, "java.nio.TypedArrayFloatBuffer", { | |
Ljava_nio_TypedArrayFloatBuffer: 1, | |
Ljava_nio_FloatBuffer: 1, | |
Ljava_nio_Buffer: 1, | |
O: 1, | |
jl_Comparable: 1 | |
}, ScalaJS.d.Ljava_nio_FloatBuffer); | |
ScalaJS.c.Ljava_nio_TypedArrayFloatBuffer.prototype.$classData = ScalaJS.d.Ljava_nio_TypedArrayFloatBuffer; | |
/** @constructor */ | |
ScalaJS.c.Ljava_nio_TypedArrayIntBuffer = (function() { | |
ScalaJS.c.Ljava_nio_IntBuffer.call(this); | |
this.$$undtypedArray$3 = null; | |
this.$$undreadOnly$3 = false | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment