001 /* Generated By:JJTree: Do not edit this line. ASTparse.java */
002
003 package net.sourceforge.javajson.parser;
004
005 import net.sourceforge.javajson.JsonArray;
006 import net.sourceforge.javajson.JsonObject;
007
008 public class ASTparse extends SimpleNode {
009 JsonObject val;
010 JsonArray arr;
011
012 public ASTparse(int id) {
013 super(id);
014 }
015
016 public ASTparse(JsonParser p, int id) {
017 super(p, id);
018 }
019
020 public JsonObject getJsonObject() {
021 interpret();
022 return val;
023 }
024
025 public JsonArray getJsonArray() {
026 interpret();
027 return arr;
028 }
029
030 @Override
031 protected void interpret() {
032 for (int i = 0; i < children.length; i++) {
033 if (children[i] instanceof SimpleNode) {
034 ((SimpleNode) children[i]).interpret();
035 }
036 }
037 }
038
039 @Override
040 protected void push(Object o) {
041 if (o instanceof JsonObject)
042 val = (JsonObject) o;
043 else if (o instanceof JsonArray)
044 arr = (JsonArray) o;
045 }
046 }