public Notification(
      @NotNull String groupDisplayId,
      @NotNull Icon icon,
      @Nullable String title,
      @Nullable String subtitle,
      @Nullable String content,
      @NotNull NotificationType type,
      @Nullable NotificationListener listener) {
    myGroupId = groupDisplayId;
    myTitle = StringUtil.notNullize(title);
    myContent = StringUtil.notNullize(content);
    myType = type;
    myListener = listener;
    myTimestamp = System.currentTimeMillis();

    myIcon = icon;
    mySubtitle = subtitle;

    LOG.assertTrue(
        isTitle() || isContent(),
        "Notification should have title: "
            + title
            + " and/or subtitle and/or content groupId: "
            + myGroupId);

    id =
        String.valueOf(System.currentTimeMillis())
            + "."
            + String.valueOf(System.identityHashCode(this));
  }
  void log(@NonNls String msg, Document document, boolean synchronously, @NonNls Object... args) {
    if (debug()) {
      @NonNls
      String s =
          (SwingUtilities.isEventDispatchThread() ? "-    " : "-")
              + msg
              + (synchronously ? " (sync)" : "")
              + (document == null
                  ? ""
                  : "; Document: "
                      + System.identityHashCode(document)
                      + "; stage: "
                      + getCommitStage(document))
              + "; my indic="
              + myProgressIndicator
              + " ||";

      for (Object arg : args) {
        s += "; " + arg;
      }
      System.out.println(s);
      synchronized (log) {
        log.append(s).append("\n");
        if (log.length() > 1000000) {
          log.delete(0, 1000000);
        }
      }
    }
  }
 @Override
 public String toString() {
   return "CompletionProgressIndicator[count="
       + myCount
       + ",phase="
       + CompletionServiceImpl.getCompletionPhase()
       + "]@"
       + System.identityHashCode(this);
 }
 @NonNls
 private static String describe(Thread o) {
   if (o == null) return "null";
   return o.toString() + " " + System.identityHashCode(o);
 }
Exemple #5
0
  /**
   * generatorMassData
   *
   * <p>Generiert Massendaten die durch "config" und "fileSize" definiert werden.
   *
   * @param config Massendaten Konfigurationsdatei
   * @param fileSize Größe der Nutzdaten in Byte
   * @return Protobuf Builder für Massendaten
   */
  public Massendaten generatorMassData(final MassenDef config, final int fileSize) {
    Massendaten mDaten;

    Massendaten.Builder massendatenBuilder = Massendaten.newBuilder();

    ProgressThread thread = new ProgressThread();
    thread.setPorgress(new AtomicInteger(0));
    thread.start();

    double pos = 0.0f;
    int typeSize = 11;

    int procent = 0;

    Massendaten.MassenInfo.Builder massenInfoBuilder = Massendaten.MassenInfo.newBuilder();
    Massendaten.MassenDef.Builder massenDefBuilder = Massendaten.MassenDef.newBuilder();

    for (Frequency f : config.getFrequencies()) {
      Massendaten.Frequency.Builder freqBuilder = Massendaten.Frequency.newBuilder();
      freqBuilder.setFrequency(f.getFrequency());
      freqBuilder.setAmplitude(f.getAmplitude());
      freqBuilder.setPhase(f.getPhase());
      massenDefBuilder.addFrequency(freqBuilder);
    }

    massenDefBuilder.setAbtastrate(config.getAbtastrate());
    massenInfoBuilder.setDef(massenDefBuilder);

    long longWert; // für progressbar
    double temp;

    // Schleife um die Daten zu generieren:
    for (int i = 0; i < fileSize / typeSize; i++) {

      double value = 0.0f;

      // Amplitude für diesen Schritt erzeugen
      for (Frequency f : config.getFrequencies()) {
        value += sin(f.getPhase() + f.getFrequency() * pos) * f.getAmplitude();
      }

      // Prozentanzeige wenn im DEBUG-Modus
      longWert = (long) (i) * 100;
      temp = longWert / (fileSize / typeSize);
      if (procent != temp) {
        thread.setPorgress(new AtomicInteger((int) temp));
        procent = (int) temp;
      }

      massendatenBuilder.addValue(Massendaten.Werte.newBuilder().setNumber(value));

      // erhöhen der Position der Abtastung
      pos += config.getAbtastrate();
    }

    // 1: einmal builden, um die serializedSize zu bekommen
    Massendaten tempMdaten = massendatenBuilder.build();

    // 2: serializedSize und id in info eintragen
    int hashID = System.identityHashCode(tempMdaten.getValueList());
    massenInfoBuilder.setId(hashID);
    massenInfoBuilder.setPaketGroesseKB(tempMdaten.getSerializedSize());
    Printer.println("size: " + tempMdaten.getSerializedSize());
    massendatenBuilder.setInfo(massenInfoBuilder);

    thread.setPorgress(new AtomicInteger(100));
    thread.killProgress();

    mDaten = massendatenBuilder.build();

    return mDaten;
  }