use of com.taobao.weex.el.parse.ArrayStack in project incubator-weex by apache.
the class FailedCaseTest method testVElseIf0.
public void testVElseIf0() {
JSONObject data = new JSONObject();
JSONObject item = new JSONObject();
item.put("number", 0.0);
data.put("item", item);
ArrayStack stack = new ArrayStack();
stack.push(data);
Token token = Parser.parse("!(item.number%3 === 0) && (item.number%3 === 1)");
System.out.println(token.toString() + " " + token.execute(stack));
Token if2 = Parser.parse("!(!(item.number%3 === 0) && (item.number%3 === 1))");
System.out.println(if2 + " " + if2.execute(stack));
}
use of com.taobao.weex.el.parse.ArrayStack in project incubator-weex by apache.
the class WXRecyclerTemplateList method doRenderTemplate.
/**
* create code context for render component and do render
*/
private List<WXComponent> doRenderTemplate(WXCell cell, int position) {
this.cellRenderContext.clear();
Object item = cellDataManager.listData.get(position);
CellRenderState cellRenderState = cellDataManager.getRenderState(position);
cellRenderContext.renderState = cellRenderState;
cellRenderContext.templateList = this;
cellRenderContext.position = position;
ArrayStack stack = cellRenderContext.stack;
Map map = cellRenderContext.map;
if (cellDataManager.listData != null) {
stack.push(map);
map.put(listDataKey, cellDataManager.listData);
if (!TextUtils.isEmpty(listDataIndexKey)) {
map.put(listDataIndexKey, new PositionRef(cellRenderState));
}
if (!TextUtils.isEmpty(listDataItemKey)) {
map.put(listDataItemKey, item);
} else {
stack.push(item);
}
}
if (cellRenderState.itemId <= 0) {
getItemId(position);
}
List<WXComponent> updates = Statements.doRender(cell, this.cellRenderContext);
if (cellRenderState.isDirty()) {
cellRenderState.resetDirty();
}
return updates;
}
use of com.taobao.weex.el.parse.ArrayStack in project incubator-weex by apache.
the class WXRecyclerTemplateList method copyStack.
public ArrayStack copyStack(CellRenderContext context, ArrayStack stack) {
ArrayStack onceStack = new ArrayStack();
for (int index = 0; index < stack.size(); index++) {
Object value = stack.get(index);
if (value instanceof Map) {
value = new HashMap((Map) value);
}
onceStack.push(value);
}
return onceStack;
}
use of com.taobao.weex.el.parse.ArrayStack in project incubator-weex by apache.
the class StatementTest method createContext.
private CellRenderContext createContext(int count) {
JSONObject data = new JSONObject();
data.put("item", new JSONObject());
data.getJSONObject("item").put("name", "hello world");
List<String> datas = new ArrayList<>();
for (int i = 0; i < count; i++) {
datas.add("hello" + count);
}
data.getJSONObject("item").put("list", datas);
data.put("dataList", datas);
ArrayStack context = new ArrayStack();
context.push(data);
CellRenderContext cellRenderContext = new CellRenderContext();
cellRenderContext.stack = context;
return cellRenderContext;
}
use of com.taobao.weex.el.parse.ArrayStack in project incubator-weex by apache.
the class IfStatementTest method createContext.
private ArrayStack createContext() {
JSONObject data = new JSONObject();
data.put("item", new JSONObject());
data.put("index", 20);
data.put("source", true);
data.getJSONObject("item").put("name", "hello world");
ArrayStack context = new ArrayStack();
context.push(data);
return context;
}
Aggregations