本文整理汇总了Java中jdk.nashorn.internal.runtime.arrays.ContinuousArrayData类的典型用法代码示例。如果您正苦于以下问题:Java ContinuousArrayData类的具体用法?Java ContinuousArrayData怎么用?Java ContinuousArrayData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContinuousArrayData类属于jdk.nashorn.internal.runtime.arrays包,在下文中一共展示了ContinuousArrayData类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: concat
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
/**
* ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
*
* @param self self reference
* @param arg argument
* @return resulting NativeArray
*/
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final Object arg) {
//arg is [NativeArray] of same type.
final ContinuousArrayData selfData = getContinuousArrayDataCCE(self);
final ContinuousArrayData newData;
if (arg instanceof NativeArray) {
final ContinuousArrayData argData = (ContinuousArrayData)((NativeArray)arg).getArray();
if (argData.isEmpty()) {
newData = selfData.copy();
} else if (selfData.isEmpty()) {
newData = argData.copy();
} else {
final Class<?> widestElementType = selfData.widest(argData).getBoxedElementType();
newData = ((ContinuousArrayData)selfData.convert(widestElementType)).fastConcat((ContinuousArrayData)argData.convert(widestElementType));
}
} else {
newData = getContinuousArrayDataCCE(self, Object.class).copy();
newData.fastPush(arg);
}
return new NativeArray(newData);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:NativeArray.java
示例2: canLink
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
@Override
public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) {
final Object[] args = request.getArguments();
if (args.length != 3) { //single argument check
return false;
}
final ContinuousArrayData selfData = getContinuousArrayData(self);
if (selfData == null) {
return false;
}
final Object arg = args[2];
//args[2] continuousarray or non arraydata, let past non array datas
if (arg instanceof NativeArray) {
final ContinuousArrayData argData = getContinuousArrayData(arg);
if (argData == null) {
return false;
}
}
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:NativeArray.java
示例3: canLink
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
@Override
public boolean canLink(final Object self, final CallSiteDescriptor desc, final LinkRequest request) {
final Object[] args = request.getArguments();
if (args.length != 3) { //single argument check
return false;
}
final ContinuousArrayData selfData = getContinuousArrayData(self);
if (selfData == null) {
return false;
}
final Object arg = args[2];
// The generic version uses its own logic and ArrayLikeIterator to decide if an object should
// be iterated over or added as single element. To avoid duplication of code and err on the safe side
// we only use the specialized version if arg is either a continuous array or a JS primitive.
if (arg instanceof NativeArray) {
return (getContinuousArrayData(arg) != null);
}
return JSType.isPrimitive(arg);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:NativeArray.java
示例4: getContinuousArrayData
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
protected static ContinuousArrayData getContinuousArrayData(final Object self) {
try {
//cast to NativeArray, to avoid cases like x = {0:0, 1:1}, x.length = 2, where we can't use the array push/pop
return (ContinuousArrayData)((NativeArray)self).getArray();
} catch (final Exception e) {
return null;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:NativeArray.java
示例5: getContinuousNonEmptyArrayData
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
private static ContinuousArrayData getContinuousNonEmptyArrayData(final Object self) {
final ContinuousArrayData data = getContinuousArrayData(self);
if (data != null) {
return data.length() == 0 ? null : data;
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:NativeArray.java
示例6: getContinuousNonEmptyArrayDataCCE
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
private static final <T> ContinuousArrayData getContinuousNonEmptyArrayDataCCE(final Object self, final Class<T> clazz) {
try {
@SuppressWarnings("unchecked")
final ContinuousArrayData data = (ContinuousArrayData)(T)((NativeArray)self).getArray();
if (data.length() != 0L) {
return data; //if length is 0 we cannot pop and have to relink, because then we'd have to return an undefined, which is a wider type than e.g. int
}
} catch (final NullPointerException e) {
//fallthru
}
throw new ClassCastException();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:NativeArray.java
示例7: getContinuousArrayDataCCE
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
private static final ContinuousArrayData getContinuousArrayDataCCE(final Object self) {
try {
return (ContinuousArrayData)((NativeArray)self).getArray();
} catch (final NullPointerException e) {
throw new ClassCastException();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:NativeArray.java
示例8: getContinuousNonEmptyArrayDataCCE
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
private static <T> ContinuousArrayData getContinuousNonEmptyArrayDataCCE(final Object self, final Class<T> clazz) {
try {
@SuppressWarnings("unchecked")
final ContinuousArrayData data = (ContinuousArrayData)(T)((NativeArray)self).getArray();
if (data.length() != 0L) {
return data; //if length is 0 we cannot pop and have to relink, because then we'd have to return an undefined, which is a wider type than e.g. int
}
} catch (final NullPointerException e) {
//fallthru
}
throw new ClassCastException();
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:NativeArray.java
示例9: getContinuousArrayDataCCE
import jdk.nashorn.internal.runtime.arrays.ContinuousArrayData; //导入依赖的package包/类
private static ContinuousArrayData getContinuousArrayDataCCE(final Object self) {
try {
return (ContinuousArrayData)((NativeArray)self).getArray();
} catch (final NullPointerException e) {
throw new ClassCastException();
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:NativeArray.java
注:本文中的jdk.nashorn.internal.runtime.arrays.ContinuousArrayData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论