public boolean isEmpty() { return eventQueue.isEmpty(); }
public boolean isEmpty() { return eventQueue.isEmpty(); }
public boolean isContextNodeStackEmpty() { return contextNodeStack.isEmpty(); }
public boolean isContextNodeStackEmpty() { return contextNodeStack.isEmpty(); }
/** * Get the context node * * @return */ public SilkNode getContextNode() { if (contextNodeStack.isEmpty()) return null; else return contextNodeStack.getLast().contextNode; }
/** * Get the context node * * @return */ public SilkNode getContextNode() { if (contextNodeStack.isEmpty()) return null; else return contextNodeStack.getLast().contextNode; }
public String getContextNodeName() { if (nodeNameStack.isEmpty()) return null; else { String str = nodeNameStack.getLast(); if (str == EMPTY_STRING) return null; else return str; } }
public String getContextNodeName() { if (nodeNameStack.isEmpty()) return null; else { String str = nodeNameStack.getLast(); if (str == EMPTY_STRING) return null; else return str; } }
private boolean hasNext() throws XerialException { if (eventQueue.isEmpty()) { TreeEvent e = walker.next(); if (e == null) return false; eventQueue.addLast(e); return true; } else return true; }
public TreeEvent next() throws XerialException { if (!eventQueue.isEmpty()) return eventQueue.pop(); if (contextStack.isEmpty()) return null; if (!contextStack.isEmpty()) { Context context = contextStack.getLast(); if (context.hasFinished()) { contextStack.removeLast(); return next(); } parse(context); } return next(); }
public TreeEvent peekNext() throws XerialException { if (!eventQueue.isEmpty()) { return eventQueue.peekFirst(); } if (contextStack.isEmpty()) return null; if (!contextStack.isEmpty()) { Context context = contextStack.getLast(); if (context.hasFinished()) { contextStack.removeLast(); return peekNext(); } parse(context); } return peekNext(); }
public void visitNode(String nodeName, String immediateNodeValue, TreeWalker walker) throws XerialException { JSONObject newContext = new JSONObject(); if (contextStack.isEmpty()) { JSONObject childOfRoot = new JSONObject(); childOfRoot.put(nodeName, newContext); root.add(childOfRoot); contextStack.addLast(childOfRoot); // additional object } contextStack.addLast(newContext); textStack.addLast(ZERO_CAPACITY_BUFFER); if (immediateNodeValue != null) getTextBuilder().append(immediateNodeValue); }
public void visitNode(String nodeName, String immediateNodeValue, TreeWalker walker) throws XerialException { JSONObject newContext = new JSONObject(); if (contextStack.isEmpty()) { JSONObject childOfRoot = new JSONObject(); childOfRoot.put(nodeName, newContext); root.add(childOfRoot); contextStack.addLast(childOfRoot); // additional object } contextStack.addLast(newContext); textStack.addLast(ZERO_CAPACITY_BUFFER); if (immediateNodeValue != null) getTextBuilder().append(immediateNodeValue); }
public State transit(Symbol input) { State current = getCurrentState(); switch (input) { case At: stateStack.addLast(current); break; case EnterParen: if (current != State.OUT_VALUE) stateStack.addLast(current); break; case LeaveParen: if (current != State.OUT_VALUE) { if (!stateStack.isEmpty()) { State prevState = stateStack.removeLast(); cursor.reset(prevState); return prevState; } } break; } return cursor.transit(input); }
public State transit(Symbol input) { State current = getCurrentState(); switch (input) { case At: stateStack.addLast(current); break; case EnterParen: if (current != State.OUT_VALUE) stateStack.addLast(current); break; case LeaveParen: if (current != State.OUT_VALUE) { if (!stateStack.isEmpty()) { State prevState = stateStack.removeLast(); cursor.reset(prevState); return prevState; } } break; } return cursor.transit(input); }