private void fillData(@Nullable Intent intent, @NonNull TextView textView) {
    Uri data = intent == null ? null : intent.getData();
    if (data == null) {
      textView.setText(Printer.EMPTY);
      return;
    }

    Truss truss = new Truss();
    Printer.append(truss, "raw", data);
    Printer.append(truss, "scheme", data.getScheme());
    Printer.append(truss, "host", data.getHost());
    Printer.append(truss, "port", data.getPort());
    Printer.append(truss, "path", data.getPath());
    Printer.appendKey(truss, "query");
    boolean query = false;
    if (data.isHierarchical()) {
      for (String queryParameterName : data.getQueryParameterNames()) {
        Printer.appendSecondary(
            truss, queryParameterName, data.getQueryParameter(queryParameterName));
        query = true;
      }
    }
    if (!query) {
      Printer.appendValue(truss, null);
    }
    Printer.append(truss, "fragment", data.getFragment());
    textView.setText(truss.build());
  }
  private static void fillExtras(@Nullable Intent intent, @NonNull TextView textView) {
    Bundle extras = intent == null ? null : intent.getExtras();
    if (extras == null) {
      textView.setText(Printer.EMPTY);
      return;
    }

    Truss truss = new Truss();
    for (String key : extras.keySet()) {
      Printer.appendWithClass(truss, key, extras.get(key));
    }
    textView.setText(truss.build());
  }
Пример #3
0
  public static void main(String args[]) {
    Node n1, n2, n3;
    n1 = new Node(0, 0, NodeType.PinnedFree);
    n2 = new Node(3, 0);
    n3 = new Node(3, 4);

    Member m1, m2;
    m1 = new Member(n1, n2);
    m2 = new Member(n1, n3);

    t = new Truss();
    t.addNode(n1);
    t.addNode(n2);
    t.addNode(n3);
    t.addMember(m1);
    t.addMember(m2);
    t.addForce(new Force(n1, 0, -2000));

    TrussAnalyser.solve(t, false);

    bi = new BitInfo(50, 1, 5);
    bj = new BitInfo(500, 250, 3);

    b1 = new Bit(10, bi);
    b2 = new Bit(2, bj);
    b3 = new Bit(5, bi);
    b4 = new Bit(6, bj);
    b5 = new Bit(3, bi);
    b6 = new Bit(1, bj);

    Bit[] ba;
    ba = new Bit[4];

    ba[0] = b1;
    ba[1] = b2;
    ba[2] = b3;
    ba[3] = b4;

    bs1 = new BitString(ba);
    bs1.randomize();

    GATruss gat;
    gat = new GATruss();
    gat.init(t, 50, 12, 0.01, 0.9);
    gat.doGA();
  }
 private void fillIntent(@Nullable Intent intent, @NonNull TextView textView) {
   if (intent == null) {
     textView.setText(Printer.EMPTY);
     return;
   }
   Truss truss = new Truss();
   Printer.append(truss, "action", intent.getAction());
   Printer.append(truss, "categories", intent.getCategories());
   Printer.append(truss, "type", intent.getType());
   Printer.append(truss, "flags", Flags.decode(intent.getFlags()));
   Printer.append(truss, "package", intent.getPackage());
   Printer.append(truss, "component", intent.getComponent());
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
     Printer.append(truss, "referrer", getReferrer());
   }
   textView.setText(truss.build());
 }