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

com.mayabot.nlp.common.IntArray Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package com.mayabot.nlp.common;

/**
 * @author jimichan
 */
public class IntArray {

    public final int[] data;
    final int size;

    IntArray(int[] data, int size) {
        this.data = data;
        this.size = size;
    }

    public boolean isEmpty() {
        return size == 0;
    }

    public int size() {
        return size;
    }

    public int get(int idx) {
        if (idx >= size) {
            throw new ArrayIndexOutOfBoundsException(idx);
        }
        return data[idx];
    }

    public void put(int idx, int value) {
        if (idx >= size) {
            throw new ArrayIndexOutOfBoundsException(idx);
        }
        data[idx] = value;
    }

    public int[] getBuffer() {
        return data;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy