/**
   * used to print the queue content
   *
   * @return
   */
  public String getPrintableString() {

    StringBuilder res = new StringBuilder();
    for (EventType e : this.queue) {

      res.append(e.toString());
    }
    return res.toString();
  }
  public static EventType parse(String value) {
    EventType[] v = EventType.values();
    for (EventType val : v) {
      if (val.toString().equals(value)) {
        return val;
      }
    }

    return null;
  }
 public JSONObject toJSON() {
   try {
     JSONObject o = new JSONObject();
     o.put("type", mEventType.toString());
     o.put("ms", getDuration());
     o.put("orientation", mOrientation.toString());
     o.put("pages", PageflipUtils.join(",", mPages));
     o.put("view_session", mViewSession);
     return o;
   } catch (JSONException e) {
     SgnLog.d(TAG, e.getMessage(), e);
   }
   return new JSONObject();
 }
Beispiel #4
0
  public void activateMetrics() {
    // Activate Plugin Metrics
    try {
      Metrics metrics = new Metrics(this);

      metrics.addCustomData(
          new Metrics.Plotter("Total Number of Server Rules") {
            @Override
            public int getValue() {
              return ruleset.ruleCount();
            }
          });

      Metrics.Graph graph = metrics.createGraph("Rules by Event");

      for (final EventType r : EventType.values()) {
        graph.addPlotter(
            new Metrics.Plotter(r.toString()) {
              @Override
              public int getValue() {
                return ruleset.ruleCount(r); // Number of rules for this event type
              }
            });
      }

      Metrics.Graph matchGraph = metrics.createGraph("Matches");
      matchTracker = new Tracker("Matches");

      matchGraph.addPlotter(matchTracker);

      metrics.start();

    } catch (IOException e) {
      logger.fine(e.getMessage());
    }
  }
Beispiel #5
0
 @Override
 public String toString() {
   return type.toString() + "[" + param.toString() + "]";
 }