Java Code Examples for jdk.nashorn.internal.runtime.ScriptRuntime#EMPTY

The following examples show how to use jdk.nashorn.internal.runtime.ScriptRuntime#EMPTY . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
NativeArray(final Object[] array) {
    this(ArrayData.allocate(array.length));

    ArrayData arrayData = this.getArray();

    for (int index = 0; index < array.length; index++) {
        final Object value = array[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        } else {
            arrayData = arrayData.set(index, value, false);
        }
    }

    this.setArray(arrayData);
}
 
Example 2
NativeArray(final Object[] array) {
    this(ArrayData.allocate(array.length));

    ArrayData arrayData = this.getArray();
    arrayData.ensure(array.length - 1);

    for (int index = 0; index < array.length; index++) {
        final Object value = array[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        } else {
            arrayData = arrayData.set(index, value, false);
        }
    }

    this.setArray(arrayData);
}
 
Example 3
NativeArray(final Object[] array) {
    this(ArrayData.allocate(array.length));

    ArrayData arrayData = this.getArray();

    for (int index = 0; index < array.length; index++) {
        final Object value = array[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        } else {
            arrayData = arrayData.set(index, value, false);
        }
    }

    this.setArray(arrayData);
}
 
Example 4
NativeArray(final Object[] array) {
    this(ArrayData.allocate(array.length));

    ArrayData arrayData = this.getArray();

    for (int index = 0; index < array.length; index++) {
        final Object value = array[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        } else {
            arrayData = arrayData.set(index, value, false);
        }
    }

    this.setArray(arrayData);
}
 
Example 5
NativeArray(final Object[] array) {
    this(ArrayData.allocate(array.length));

    ArrayData arrayData = this.getArray();

    for (int index = 0; index < array.length; index++) {
        final Object value = array[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        } else {
            arrayData = arrayData.set(index, value, false);
        }
    }

    this.setArray(arrayData);
}
 
Example 6
@Override
public Object fastPopObject() {
    if (length() == 0) {
        return ScriptRuntime.UNDEFINED;
    }
    final int newLength = (int)decreaseLength();
    final Object elem = array[newLength];
    array[newLength] = ScriptRuntime.EMPTY;
    return elem;
}
 
Example 7
/**
 * Allocate a new object array.
 *
 * @param initial object values.
 * @return the new array
 */
public static NativeArray allocate(final Object[] initial) {
    ArrayData arrayData = ArrayData.allocate(initial);

    for (int index = 0; index < initial.length; index++) {
        final Object value = initial[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        }
    }

    return new NativeArray(arrayData);
}
 
Example 8
@Override
public Object fastPopObject() {
    if (length() == 0) {
        return ScriptRuntime.UNDEFINED;
    }
    final int newLength = (int)decreaseLength();
    final Object elem = array[newLength];
    array[newLength] = ScriptRuntime.EMPTY;
    return elem;
}
 
Example 9
@Override
public Object fastPopObject() {
    if (length() == 0) {
        return ScriptRuntime.UNDEFINED;
    }
    final int newLength = (int)decreaseLength();
    final Object elem = array[newLength];
    array[newLength] = ScriptRuntime.EMPTY;
    return elem;
}
 
Example 10
/**
 * Allocate a new object array.
 *
 * @param initial object values.
 * @return the new array
 */
public static NativeArray allocate(final Object[] initial) {
    ArrayData arrayData = ArrayData.allocate(initial);

    for (int index = 0; index < initial.length; index++) {
        final Object value = initial[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        }
    }

    return new NativeArray(arrayData);
}
 
Example 11
/**
 * Allocate a new object array.
 *
 * @param initial object values.
 * @return the new array
 */
public static NativeArray allocate(final Object[] initial) {
    ArrayData arrayData = ArrayData.allocate(initial);

    for (int index = 0; index < initial.length; index++) {
        final Object value = initial[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        }
    }

    return new NativeArray(arrayData);
}
 
Example 12
Source Project: hottub   File: Global.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Allocate a new object array.
 *
 * @param initial object values.
 * @return the new array
 */
public static NativeArray allocate(final Object[] initial) {
    ArrayData arrayData = ArrayData.allocate(initial);

    for (int index = 0; index < initial.length; index++) {
        final Object value = initial[index];

        if (value == ScriptRuntime.EMPTY) {
            arrayData = arrayData.delete(index);
        }
    }

    return new NativeArray(arrayData);
}
 
Example 13
@Override
public Object fastPopObject() {
    if (length() == 0) {
        return ScriptRuntime.UNDEFINED;
    }
    final int newLength = (int)decreaseLength();
    final Object elem = array[newLength];
    array[newLength] = ScriptRuntime.EMPTY;
    return elem;
}
 
Example 14
@Override
public Object fastPopObject() {
    if (length() == 0) {
        return ScriptRuntime.UNDEFINED;
    }
    final int newLength = (int)decreaseLength();
    final Object elem = array[newLength];
    array[newLength] = ScriptRuntime.EMPTY;
    return elem;
}
 
Example 15
@Override
public ArrayData setEmpty(final int index) {
    array[index] = ScriptRuntime.EMPTY;
    return this;
}
 
Example 16
@Override
public ArrayData setEmpty(final int index) {
    array[index] = ScriptRuntime.EMPTY;
    return this;
}
 
Example 17
@Override
public ArrayData setEmpty(final int index) {
    array[index] = ScriptRuntime.EMPTY;
    return this;
}
 
Example 18
@Override
public ArrayData setEmpty(final int index) {
    array[index] = ScriptRuntime.EMPTY;
    return this;
}
 
Example 19
@Override
public ArrayData setEmpty(final int index) {
    array[index] = ScriptRuntime.EMPTY;
    return this;
}
 
Example 20
@Override
public ArrayData setEmpty(final int index) {
    array[index] = ScriptRuntime.EMPTY;
    return this;
}