All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.teavm.classlib.java.nio.ShortBufferOverArrayEmu Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package org.teavm.classlib.java.nio;

import com.github.xpenatan.gdx.backends.teavm.dom.typedarray.ArrayBufferViewWrapper;
import com.github.xpenatan.gdx.backends.teavm.dom.typedarray.Int16ArrayWrapper;
import com.github.xpenatan.gdx.backends.teavm.dom.typedarray.TypedArrays;
import com.github.xpenatan.gdx.backends.teavm.gen.Emulate;

@Emulate(valueStr = "java.nio.TShortBufferOverArray", updateCode = true)
public abstract class ShortBufferOverArrayEmu extends TShortBufferOverArray implements HasArrayBufferView {

    @Emulate
    Int16ArrayWrapper backupArray;
    @Emulate
    int positionCache;
    @Emulate
    int remainingCache;

    public ShortBufferOverArrayEmu(int start, int capacity, short[] array, int position, int limit, boolean readOnly) {
        super(start, capacity, array, position, limit, readOnly);
    }

    @Override
    @Emulate
    public ArrayBufferViewWrapper getArrayBufferView() {
        Int16ArrayWrapper originalBuffer = (Int16ArrayWrapper)getOriginalArrayBufferView();
        int position1 = position();
        int remaining1 = remaining();
        if(backupArray == null || positionCache != position1 || remaining1 != remainingCache) {
            positionCache = position1;
            remainingCache = remaining1;
            backupArray = originalBuffer.subarray(position1, remaining1);
        }
        return backupArray;
    }

    @Override
    @Emulate
    public ArrayBufferViewWrapper getOriginalArrayBufferView() {
        return TypedArrays.getTypedArray(array);
    }

    @Override
    @Emulate
    public int getElementSize() {
        return 2;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy