当前位置: 首页>>代码示例>>Java>>正文


Java JSType.toInt32方法代码示例

本文整理汇总了Java中jdk.nashorn.internal.runtime.JSType.toInt32方法的典型用法代码示例。如果您正苦于以下问题:Java JSType.toInt32方法的具体用法?Java JSType.toInt32怎么用?Java JSType.toInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.nashorn.internal.runtime.JSType的用法示例。


在下文中一共展示了JSType.toInt32方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: expandEventQueueCapacity

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
/**
 * Expands the event queue capacity, or truncates if capacity is lower than
 * current capacity. Then only the newest entries are kept
 * @param self self reference
 * @param newCapacity new capacity
 */
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static void expandEventQueueCapacity(final Object self, final Object newCapacity) {
    final LinkedList<RuntimeEvent<?>> q = getEventQueue(self);
    final int nc = JSType.toInt32(newCapacity);
    while (q.size() > nc) {
        q.removeFirst();
    }
    setEventQueueCapacity(self, nc);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:NativeDebug.java

示例2: constructor

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
/**
 * Constructor
 * @param newObj is this invoked with new
 * @param self   self reference
 * @param args   arguments to constructor
 * @return new NativeArrayBuffer
 */
@Constructor(arity = 1)
public static NativeArrayBuffer constructor(final boolean newObj, final Object self, final Object... args) {
    if (!newObj) {
        throw typeError("constructor.requires.new", "ArrayBuffer");
    }

    if (args.length == 0) {
        return new NativeArrayBuffer(0);
    }

    final Object arg0 = args[0];
    if (arg0 instanceof ByteBuffer) {
        return new NativeArrayBuffer((ByteBuffer)arg0);
    } else {
        return new NativeArrayBuffer(JSType.toInt32(arg0));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:NativeArrayBuffer.java

示例3: getEventQueueCapacity

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
/**
 * Get the capacity of the event queue
 * @param self self reference
 * @return capacity of event queue as an integer
 */
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static Object getEventQueueCapacity(final Object self) {
    final ScriptObject sobj = (ScriptObject)self;
    Integer cap;
    if (sobj.has(EVENT_QUEUE_CAPACITY)) {
        cap = JSType.toInt32(sobj.get(EVENT_QUEUE_CAPACITY));
    } else {
        setEventQueueCapacity(self, cap = RuntimeEvent.RUNTIME_EVENT_QUEUE_SIZE);
    }
    return cap;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:NativeDebug.java

示例4: constructor

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
/**
 * Constructor
 * @param newObj is this invoked with new
 * @param self   self reference
 * @param args   arguments to constructor
 * @return new NativeArrayBuffer
 */
@Constructor(arity = 1)
public static NativeArrayBuffer constructor(final boolean newObj, final Object self, final Object... args) {
    if (!newObj) {
        throw typeError("constructor.requires.new", "ArrayBuffer");
    }

    if (args.length == 0) {
        throw new RuntimeException("missing length argument");
    }

    return new NativeArrayBuffer(JSType.toInt32(args[0]));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:NativeArrayBuffer.java

示例5: getInt

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
@Override
public int getInt(final int index) {
    if (index >= length()) {
        return JSType.toInt32(get(index));
    }
    return underlying.getInt(index);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:LengthNotWritableFilter.java

示例6: set

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
@Override
public ArrayData set(final int index, final long value, final boolean strict) {
    if (JSType.isRepresentableAsInt(value)) {
        array[index] = JSType.toInt32(value);
        setLength(Math.max(index + 1, length()));
        return this;
    }

    return convert(Long.class).set(index, value, strict);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:IntArrayData.java

示例7: getInt

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
@Override
public int getInt(final int index) {
    if (index >= 0 && index < maxDenseLength) {
        return underlying.getInt(index);
    }
    return JSType.toInt32(sparseMap.get(indexToKey(index)));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:SparseArrayData.java

示例8: constructor

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
/**
 * Create a new DataView object using the passed ArrayBuffer for its
 * storage. Optional byteOffset and byteLength can be used to limit the
 * section of the buffer referenced. The byteOffset indicates the offset in
 * bytes from the start of the ArrayBuffer, and the byteLength is the number
 * of bytes from the offset that this DataView will reference. If both
 * byteOffset and byteLength are omitted, the DataView spans the entire
 * ArrayBuffer range. If the byteLength is omitted, the DataView extends from
 * the given byteOffset until the end of the ArrayBuffer.
 *
 * If the given byteOffset and byteLength references an area beyond the end
 * of the ArrayBuffer an exception is raised.

 * @param newObj if this constructor was invoked with 'new' or not
 * @param self   constructor function object
 * @param args   arguments to the constructor
 * @return newly constructed DataView object
 */
@Constructor(arity = 1)
public static NativeDataView constructor(final boolean newObj, final Object self, final Object... args) {
    if (args.length == 0 || !(args[0] instanceof NativeArrayBuffer)) {
        throw typeError("not.an.arraybuffer.in.dataview");
    }

    final NativeArrayBuffer arrBuf = (NativeArrayBuffer)args[0];
    switch (args.length) {
    case 1:
        return new NativeDataView(arrBuf);
    case 2:
        return new NativeDataView(arrBuf, JSType.toInt32(args[1]));
    default:
        return new NativeDataView(arrBuf, JSType.toInt32(args[1]), JSType.toInt32(args[2]));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:NativeDataView.java

示例9: toInt32

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private static int toInt32(final JSObject obj) {
    return JSType.toInt32(toNumber(obj));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:JSObjectLinker.java

示例10: getInt

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
@Override
public int getInt(final int index) {
    return JSType.toInt32(array[index]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ObjectArrayData.java

示例11: getInt32

import jdk.nashorn.internal.runtime.JSType; //导入方法依赖的package包/类
/**
 * Fetch int32 value of node.
 *
 * @return Int32 value of node.
 */
public int getInt32() {
    return JSType.toInt32(value);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:LiteralNode.java


注:本文中的jdk.nashorn.internal.runtime.JSType.toInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。