本文整理汇总了Java中org.jruby.RubyArray.entry方法的典型用法代码示例。如果您正苦于以下问题:Java RubyArray.entry方法的具体用法?Java RubyArray.entry怎么用?Java RubyArray.entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.RubyArray
的用法示例。
在下文中一共展示了RubyArray.entry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.jruby.RubyArray; //导入方法依赖的package包/类
public IRubyObject get(ThreadContext context, int i) {
RubyArray node = arrayFor(i);
return node.entry(i & 0x01f);
}
示例2: extractDecls
import org.jruby.RubyArray; //导入方法依赖的package包/类
/**
* Recursively extract various DTD declarations and store them in
* the various collections.
*/
protected void extractDecls(ThreadContext context) {
Ruby runtime = context.getRuntime();
// initialize data structures
allDecls = RubyArray.newArray(runtime);
attributes = RubyHash.newHash(runtime);
elements = RubyHash.newHash(runtime);
entities = RubyHash.newHash(runtime);
notations = RubyHash.newHash(runtime);
contentModels = RubyHash.newHash(runtime);
children = runtime.getNil();
// recursively extract decls
if (node == null) return; // leave all the decl hash's empty
extractDecls(context, node.getFirstChild());
// convert allDecls to a NodeSet
children = XmlNodeSet.newXmlNodeSet(context, allDecls);
// add attribute decls as attributes to the matching element decl
RubyArray keys = attributes.keys();
for (int i = 0; i < keys.getLength(); ++i) {
IRubyObject akey = keys.entry(i);
IRubyObject val;
val = attributes.op_aref(context, akey);
if (val.isNil()) continue;
XmlAttributeDecl attrDecl = (XmlAttributeDecl) val;
IRubyObject ekey = attrDecl.element_name(context);
val = elements.op_aref(context, ekey);
if (val.isNil()) continue;
XmlElementDecl elemDecl = (XmlElementDecl) val;
elemDecl.appendAttrDecl(attrDecl);
}
// add content models to the matching element decl
keys = contentModels.keys();
for (int i = 0; i < keys.getLength(); ++i) {
IRubyObject key = keys.entry(i);
IRubyObject cm = contentModels.op_aref(context, key);
IRubyObject elem = elements.op_aref(context, key);
if (elem.isNil()) continue;
if (((XmlElementDecl)elem).isEmpty()) continue;
((XmlElementDecl) elem).setContentModel(cm);
}
}