Package com.google.json.serialization

Examples of com.google.json.serialization.JsonValue


      public void postProcess() {
      }

      public void visit(JsonObject node) throws JsonException {
        JsonValue valueNode = node.get("value");
        assertNotNull(valueNode);
        long value = valueNode.asNumber().getInteger();
        assertEquals(curr + 1, value);
        curr++;
      }
    });
  }
View Full Code Here


      public void postProcess() {
      }

      public void visit(JsonObject node) throws JsonException {
        JsonValue valueNode = node.get("value");
        assertNotNull(valueNode);
        long value = valueNode.asNumber().getInteger();
        assertEquals(curr + 1, value);
        curr++;
      }
    });
  }
View Full Code Here

      public void postProcess() {
      }

      public double visit(JsonObject node, List<Double> values)
          throws JsonException {
        JsonValue valueNode = node.get("value");
        assertNotNull(valueNode);
        long value = valueNode.asNumber().getInteger();
        assertEquals(curr + 1, value);
        curr++;
        if (values.size() > 0) {
          double sum = 0;
          for (double childValue : values) {
View Full Code Here

    double childTime = 0;
    for (double value : values) {
      childTime += value;
    }
    double duration = 0;
    JsonValue durationNode = node.get("duration");
    if (durationNode != JsonValue.NULL) {
      duration = durationNode.asNumber().getDecimal();
    }
    double selfTime = duration - childTime;
    node.put("selfTime", selfTime);
    return duration;
  }
View Full Code Here

      JsonVisitor postOrderVisitor) throws JsonException {
    if (preOrderVisitor != null) {
      preOrderVisitor.visit(node);
    }

    JsonValue childNode = node.get("children");
    if (childNode != JsonValue.NULL) {
      JsonArray children = childNode.asArray();

      for (int i = 0, n = children.getLength(); i < n; i++) {
        traverseImpl(children.get(i).asObject(), preOrderVisitor,
            postOrderVisitor);
      }
View Full Code Here

  }

  private double traverseImpl(JsonObject node,
      JsonVisitorDouble postOrderVisitor) throws JsonException {
    List<Double> values = new ArrayList<Double>();
    JsonValue childNode = node.get("children");
    if (childNode != JsonValue.NULL) {
      JsonArray children = childNode.asArray();
      for (int i = 0, n = children.getLength(); i < n; i++) {
        values.add(traverseImpl(children.get(i).asObject(), postOrderVisitor));
      }
    }
    return postOrderVisitor.visit(node, values);
View Full Code Here

    if (pageActions.size() > 0) {
      config.put("page_actions", createPageActionsArray(pageActions));
    }

    if (browserActions.size() > 0) {
      JsonValue browserAction = createBrowserAction(browserActions);
      if (browserAction != null) {
        config.put("browser_action", browserAction);
      }
    }
View Full Code Here

        JsonObject data = topLevelRec.get("data").asObject();
        if (data == JsonValue.NULL) {
          throw new AnalyzeException(
              "Expected data object in RESOURCE_SEND_REQUEST");
        }
        JsonValue isMainResource = data.get("isMainResource");
        JsonValue identifier = data.get("identifier");
        if (isMainResource != null && isMainResource != JsonValue.NULL
            && identifier != null && identifier != JsonValue.NULL) {
          this.mainResourceIdentfier = identifier.asNumber().getInteger();
          this.mainResourceStartTime = topLevelRec.get("time").asNumber().getDecimal();
          // System.out.println("Found: " + data);
          return i;
        }
      }
View Full Code Here

      List<JsonObject> results) throws JsonException {
    long type = record.get("type").asNumber().getInteger();
    if (type == queryType) {
      results.add(record);
    }
    JsonValue childNode = record.get("children");
    if (childNode != JsonValue.NULL) {
      JsonArray children = childNode.asArray();
      for (int i = 0, length = children.getLength(); i < length; ++i) {
        findRecordsByTypeRecursive(children.get(i).asObject(), queryType,
            results);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.json.serialization.JsonValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.