本文整理了Java中org.jruby.Ruby.newIndexError
方法的一些代码示例,展示了Ruby.newIndexError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newIndexError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newIndexError
暂无
代码示例来源:origin: org.jruby/jruby-core
private int subpatSetCheck(Ruby runtime, int nth, Region regs) {
int numRegs = regs == null ? 1 : regs.numRegs;
if (nth < numRegs) {
if (nth < 0) {
if (-nth < numRegs) return nth + numRegs;
} else {
return nth;
}
}
throw runtime.newIndexError("index " + nth + " out of regexp");
}
代码示例来源:origin: org.jruby/jruby-complete
private int subpatSetCheck(Ruby runtime, int nth, Region regs) {
int numRegs = regs == null ? 1 : regs.numRegs;
if (nth < numRegs) {
if (nth < 0) {
if (-nth < numRegs) return nth + numRegs;
} else {
return nth;
}
}
throw runtime.newIndexError("index " + nth + " out of regexp");
}
代码示例来源:origin: org.jruby/jruby-complete
public static final void checkBounds(Ruby runtime, long size, long off, long len) {
if ((off | len | (off + len) | (size - (off + len))) < 0) {
throw runtime.newIndexError("Memory access offset="
+ off + " size=" + len + " is out of bounds");
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private int endCommon(Ruby runtime, int i) {
check();
if (i < 0 || (regs == null ? 1 : regs.numRegs) <= i) throw runtime.newIndexError("index " + i + " out of matches");
return regs == null ? end : regs.end[i];
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private int endCommon(Ruby runtime, int i) {
check();
if (i < 0 || (regs == null ? 1 : regs.numRegs) <= i) throw runtime.newIndexError("index " + i + " out of matches");
return regs == null ? end : regs.end[i];
}
代码示例来源:origin: org.jruby/jruby-complete
final IRubyObject aref(int idx) {
int newIdx = idx < 0 ? values.length + idx : idx;
if (newIdx < 0) {
throw getRuntime().newIndexError("offset " + idx + " too small for struct(size:" + values.length + ")");
}
if (newIdx >= values.length) {
throw getRuntime().newIndexError("offset " + idx + " too large for struct(size:" + values.length + ")");
}
return values[newIdx];
}
代码示例来源:origin: org.jruby/jruby-core
private IRubyObject aset(int idx, IRubyObject value) {
int newIdx = idx < 0 ? values.length + idx : idx;
if (newIdx < 0) {
throw getRuntime().newIndexError("offset " + idx + " too small for struct(size:" + values.length + ")");
} else if (newIdx >= values.length) {
throw getRuntime().newIndexError("offset " + idx + " too large for struct(size:" + values.length + ")");
}
modify();
return values[newIdx] = value;
}
代码示例来源:origin: org.jruby/jruby-complete
private IRubyObject aset(int idx, IRubyObject value) {
int newIdx = idx < 0 ? values.length + idx : idx;
if (newIdx < 0) {
throw getRuntime().newIndexError("offset " + idx + " too small for struct(size:" + values.length + ")");
} else if (newIdx >= values.length) {
throw getRuntime().newIndexError("offset " + idx + " too large for struct(size:" + values.length + ")");
}
modify();
return values[newIdx] = value;
}
代码示例来源:origin: org.jruby/jruby-complete
private void insert(long pos, IRubyObject val) {
if (pos == -1) pos = realLength;
else if (pos < 0) {
long minpos = -realLength - 1;
if (pos < minpos) {
throw getRuntime().newIndexError("index " + pos + " too small for array; minimum: " + minpos);
}
pos++;
}
spliceOne(pos, val); // rb_ary_new4
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "[]")
public final IRubyObject aref(ThreadContext context, IRubyObject indexArg) {
final int index = RubyNumeric.num2int(indexArg);
final int offset = index * typeSize;
if (offset >= size) {
throw context.runtime.newIndexError(String.format("Index %d out of range", index));
}
return slice(context.runtime, offset);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "[]")
public final IRubyObject aref(ThreadContext context, IRubyObject indexArg) {
final int index = RubyNumeric.num2int(indexArg);
final int offset = index * typeSize;
if (offset >= size) {
throw context.runtime.newIndexError(String.format("Index %d out of range", index));
}
return slice(context.runtime, offset);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "[]")
public final IRubyObject aref(ThreadContext context, IRubyObject indexArg) {
final int index = RubyNumeric.num2int(indexArg);
final int offset = index * typeSize;
if (offset >= size) {
throw context.runtime.newIndexError(String.format("Index %d out of range", index));
}
return slice(context.runtime, offset);
}
代码示例来源:origin: org.jruby/jruby-core
public int getNameToBackrefNumber(String name) {
try {
byte[] bytes = name.getBytes();
return getPattern().nameToBackrefNumber(bytes, 0, bytes.length, regs);
} catch (JOniException je) {
throw getRuntime().newIndexError(je.getMessage());
}
}
代码示例来源:origin: org.jruby/jruby-complete
public int getNameToBackrefNumber(String name) {
try {
byte[] bytes = name.getBytes();
return getPattern().nameToBackrefNumber(bytes, 0, bytes.length, regs);
} catch (JOniException je) {
throw getRuntime().newIndexError(je.getMessage());
}
}
代码示例来源:origin: org.jruby/jruby-complete
private static int nameToBackrefNumber(Ruby runtime, Regex pattern, Region regs, ByteListHolder str) {
if (pattern == null) {
throw runtime.newIndexError("undefined group name reference: " + str);
}
ByteList value = str.getByteList();
try {
return pattern.nameToBackrefNumber(value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize(), regs);
} catch (JOniException je) {
throw runtime.newIndexError(je.getMessage());
}
}
代码示例来源:origin: org.jruby/jruby-core
private static int nameToBackrefNumber(Ruby runtime, Regex pattern, Region regs, ByteListHolder str) {
if (pattern == null) {
throw runtime.newIndexError("undefined group name reference: " + str);
}
ByteList value = str.getByteList();
try {
return pattern.nameToBackrefNumber(value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize(), regs);
} catch (JOniException je) {
throw runtime.newIndexError(je.getMessage());
}
}
代码示例来源:origin: org.jruby/jruby-complete
private long getOffset(int index) {
if (index < 0 || (index >= arrayType.length() && arrayType.length() > 0)) {
throw getRuntime().newIndexError("index " + index + " out of bounds");
}
return index * (long) arrayType.getComponentType().getNativeSize();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private final long getOffset(int index) {
if (index < 0 || (index >= arrayType.length() && arrayType.length() > 0)) {
throw getRuntime().newIndexError("index " + index + " out of bounds");
}
return (long) (index * arrayType.getComponentType().getNativeSize());
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private final long getOffset(int index) {
if (index < 0 || (index >= arrayType.length() && arrayType.length() > 0)) {
throw getRuntime().newIndexError("index " + index + " out of bounds");
}
return (long) (index * arrayType.getComponentType().getNativeSize());
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private int nameToBackrefNumber(RubyString str) {
ByteList value = str.getByteList();
try {
return pattern.nameToBackrefNumber(value.getUnsafeBytes(), value.getBegin(), value.getBegin() + value.getRealSize(), regs);
} catch (JOniException je) {
throw getRuntime().newIndexError(je.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!