本文整理汇总了Java中org.jruby.RubyArray.size方法的典型用法代码示例。如果您正苦于以下问题:Java RubyArray.size方法的具体用法?Java RubyArray.size怎么用?Java RubyArray.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jruby.RubyArray
的用法示例。
在下文中一共展示了RubyArray.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTreeNodes
import org.jruby.RubyArray; //导入方法依赖的package包/类
private List<TreeNode> getTreeNodes(RubyArray allElements, UIElement root, String baseQuery, Set<UIElement> inspectedElements) throws CalabashException {
List<TreeNode> roots = new ArrayList<TreeNode>();
for (int i = allElements.size() - 1; i >= 0; i--) {
final String query = String.format(baseQuery + " index:%d", i);
RubyHash rubyElement = (RubyHash) allElements.get(i);
UIElement currentElement = new UIElement(rubyElement, query, calabashWrapper);
List<UIElement> uiElements = new ArrayList<UIElement>();
if (inspectedElements.contains(currentElement))
continue;
uiElements.add(currentElement);
uiElements.addAll(getAncestors(query, root));
merge(uiElements, roots);
inspectedElements.addAll(uiElements);
}
return roots;
}
示例2: UIElements
import org.jruby.RubyArray; //导入方法依赖的package包/类
public UIElements(RubyArray elements, String query, CalabashWrapper wrapper)
throws CalabashException {
query = query.trim();
Pattern pattern = Pattern.compile("^.+index:[0-9]+$");
Matcher matcher = pattern.matcher(query);
boolean indexedQuery = matcher.matches();
for (int i = 0; i < elements.size(); i++) {
try {
RubyHash object = (RubyHash) elements.get(i);
String q = query;
if (!indexedQuery)
q += " index:" + i;
this.add(new UIElement(object, q, wrapper));
} catch (Exception e) {
throw new CalabashException("Unsupported result format.\n" + elements.toString(), e);
}
}
}
示例3: addPatternDirToDC
import org.jruby.RubyArray; //导入方法依赖的package包/类
public static void addPatternDirToDC(Object array, JobConf conf) throws Exception {
if (!array.getClass().getName().equals("org.jruby.RubyArray")) {
throw new RuntimeException("Param is not RubyArray");
}
RubyArray rubyArray = (RubyArray) array;
int size = rubyArray.size();
for (int counter = 0; counter < size; counter++) {
// Adding the prefix "file://" because the user will use the same LogStash
// configuration file, and this configuration assumes that the additional
// patterns are in local file system
String path = "file://" + rubyArray.get(counter).toString();
List<Path> filesToExplore = new ArrayList<Path>();
try {
Path currentPath = new Path(path);
FileSystem fs = currentPath.getFileSystem(conf);
if (fs.isDirectory(currentPath)) {
filesToExplore = getAllSubPaths(currentPath, conf);
} else {
filesToExplore.add(currentPath);
}
} catch (Exception e) {
log.error("Error while reading path " + path, e);
}
for (Path cPath : filesToExplore) {
DistributedCacheHandler.addFileToCache(conf, cPath, cPath.toString());
String currentPaths = conf.get(GrokIngestMapper.ADDITIONAL_PATTERNS);
if (currentPaths != null) {
currentPaths += ";" + cPath;
} else {
currentPaths = cPath.toString();
}
conf.set(GrokIngestMapper.ADDITIONAL_PATTERNS, currentPaths);
}
}
}
示例4: convertToList
import org.jruby.RubyArray; //导入方法依赖的package包/类
private List<UIElement> convertToList(RubyArray ancestors, String baseQuery) {
List<UIElement> uiElements = new ArrayList<UIElement>();
for (int i = 0; i < ancestors.size(); i++) {
UIElement uiElement = new UIElement((RubyHash) ancestors.get(i), baseQuery + " index:" + i, calabashWrapper);
uiElements.add(uiElement);
}
return uiElements;
}
示例5: toJavaArray
import org.jruby.RubyArray; //导入方法依赖的package包/类
public static Object[] toJavaArray(RubyArray array) {
ArrayList<Object> result = new ArrayList<Object>();
for (int i = 0; i < array.size(); i++) {
Object rubyObject = array.get(i);
Object javaObject = toJavaObject(rubyObject);
result.add(javaObject);
}
return result.toArray();
}