@Override public ReflexValue readContent(ReflexStreamValue file, IReflexIOHandler ioHandler) { // The file is one big JSON document, and in fact is an array, so // convert it to an array ReflexValue content = ioHandler.getContent(file); List<?> ret = JacksonUtil.objectFromJson(content.toString(), List.class); return new ReflexValue(ret); }
@Override public ReflexValue evaluate(IReflexDebugger debugger, Scope scope) { debugger.stepStart(this, scope); ReflexValue retVal = new ReflexNullValue(); ReflexValue rv = portExpr.evaluate(debugger, scope); String encoded = RaptureURLCoder.encode(rv.toString()); retVal = new ReflexValue(encoded); debugger.stepEnd(this, retVal, scope); return retVal; }
@Override public ReflexValue evaluate(IReflexDebugger debugger, Scope scope) { debugger.stepStart(this, scope); ReflexValue value = expression.evaluate(debugger, scope); debugger.recordMessage("Sleeping "); if (value.isNumber()) { try { Thread.sleep(value.asLong()); } catch (InterruptedException e) { } } debugger.stepEnd(this, new ReflexVoidValue(lineNumber), scope); return new ReflexVoidValue(lineNumber); }
public void addValue(ReflexValue value) { Object aspect = value.asObject(); if (counts.containsKey(aspect)) { int newValue = counts.get(aspect).intValue() + 1; counts.put(aspect, Integer.valueOf(newValue)); } else { counts.put(aspect, Integer.valueOf(1)); } }
@Override public ReflexValue evaluate(IReflexDebugger debugger, Scope scope) { debugger.stepStart(this, scope); String channel = null; if (expression != null) { ReflexValue value = expression.evaluate(debugger, scope); channel = value.asString(); } String value = handler.getInputHandler().read(channel); ReflexValue retValue; if (value == null) { retValue = new ReflexNullValue(lineNumber); } else { retValue = new ReflexValue(lineNumber, value); } debugger.stepEnd(this, retValue, scope); return retValue; }
@Override public ReflexValue evaluate(IReflexDebugger debugger, Scope scope) { debugger.stepStart(this, scope); ReflexValue a = lhs.evaluate(debugger, scope); boolean ret = false; if (a.isBoolean() && a.asBoolean() == true) { ret = true; } else { ReflexValue b = rhs.evaluate(debugger, scope); if (b.isBoolean()) { ret = b.asBoolean(); } else { throwError("both must be boolean", lhs, rhs, a, b); } } ReflexValue retVal = new ReflexValue(lineNumber, ret); debugger.stepEnd(this, retVal, scope); return retVal; }