public boolean isEmpty() { return scriptable.getIds().length == 0; }
public int size() { return scriptable.getIds().length; }
public TemplateCollectionModel keys() throws TemplateModelException { return (TemplateCollectionModel) wrapper.wrap(scriptable.getIds()); }
public TemplateCollectionModel values() throws TemplateModelException { Object[] ids = scriptable.getIds(); Object[] values = new Object[ids.length]; for (int i = 0; i < values.length; i++) { Object id = ids[i]; if (id instanceof Number) { values[i] = ScriptableObject.getProperty(scriptable, ((Number) id).intValue()); } else { values[i] = ScriptableObject.getProperty(scriptable, String.valueOf(id)); } } return (TemplateCollectionModel) wrapper.wrap(values); }
/** * @see org.mozilla.javascript.Scriptable#getIds */ public Object[] getIds() { return obj.getIds(); } /**
public ScriptableIterator(Scriptable scope) { this.scope = scope; this.ids = scope.getIds(); this.index = 0; }
/** * @see org.mozilla.javascript.Scriptable#getIds */ public Object[] getIds() { return obj.getIds(); } /**
/** * @see org.mozilla.javascript.Scriptable#getIds */ public Object[] getIds() { return obj.getIds(); } /**
/** * @see org.mozilla.javascript.Scriptable#getIds */ public Object[] getIds() { return obj.getIds(); } /**
/** * @see org.mozilla.javascript.Scriptable#getIds */ public Object[] getIds() { return obj.getIds(); } /**
@Override public Object[] getIds() { return child.getIds(); }
/** * @see org.mozilla.javascript.Scriptable#getIds */ public Object[] getIds() { return obj.getIds(); } /**
public Object[] getIds() { return prototype.getIds(); }
public Object[] getIds() { return prototype.getIds(); }
public int size() { return scriptable.getIds().length; }
public Object[] getIds(PageLocal local) { Scriptable obj = resolve(local); return obj.getIds(); }
private Object[] compileScript(Context cx, String scriptStr, Scriptable scriptScope, File f) { int opt = cx.getOptimizationLevel(); cx.setOptimizationLevel(-1); Script script = cx.compileString(scriptStr, f.getName(), 1, null); script.exec(cx, scriptScope); Object[] ids = scriptScope.getIds(); cx.setOptimizationLevel(opt); script = cx.compileString(scriptStr, f.getName(), 1, null); script.exec(cx, scriptScope); return ids; }
private Object[] compileScript(Context cx, String scriptStr, Scriptable scriptScope, File f) { int opt = cx.getOptimizationLevel(); cx.setOptimizationLevel(-1); Script script = cx.compileString(scriptStr, f.getName(), 1, null); script.exec(cx, scriptScope); Object[] ids = scriptScope.getIds(); cx.setOptimizationLevel(opt); script = cx.compileString(scriptStr, f.getName(), 1, null); script.exec(cx, scriptScope); return ids; }
private DataBag jsToPigBag(Scriptable array, Schema schema, int depth) throws FrontendException, ExecException { debugConvertJSToPig(depth, "Bag", array, schema); if (schema.size() == 1 && schema.getField(0).type == DataType.TUPLE) { schema = schema.getField(0).schema; } List<Tuple> bag = new ArrayList<Tuple>(); for (Object id : array.getIds()) { Scriptable arrayValue = (Scriptable)array.get(((Integer)id).intValue(), null); bag.add(jsToPigTuple(arrayValue, schema, depth + 1)); } DataBag result = BagFactory.getInstance().newDefaultBag(bag); debugReturn(depth, result); return result; }