Tabnine Logo
NumberFormatter
Code IndexAdd Tabnine to your IDE (free)

How to use
NumberFormatter
in
rocks.inspectit.ui.rcp.formatter

Best Java code snippets using rocks.inspectit.ui.rcp.formatter.NumberFormatter (Showing top 20 results out of 315)

origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected String valueToHumanReadableImpl(double value) {
  return NumberFormatter.humanReadableByteCount((long) (value * MEGABYTE_BYTE_COUNT));
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void addPages() {
  String title = getWindowTitle();
  long totalSize = 0;
  for (IStorageDataProvider storageDataProvider : storageDataProviders) {
    totalSize += storageDataProvider.getStorageData().getDiskSize();
  }
  StringBuilder message = new StringBuilder("Options for downloading ");
  if (storageDataProviders.size() == 1) {
    StorageData storageData = storageDataProviders.iterator().next().getStorageData();
    message.append("the storage '");
    message.append(storageData.getName());
    message.append("' (size: ");
    message.append(NumberFormatter.formatBytesToMBytes(storageData.getDiskSize()));
    message.append(')');
  } else {
    message.append(storageDataProviders.size());
    message.append(" storages (total size: ");
    message.append(NumberFormatter.formatBytesToMBytes(totalSize));
    message.append(')');
  }
  storageCompressionWizardPage = new StorageCompressionWizardPage(title, message.toString());
  addPage(storageCompressionWizardPage);
}
origin: inspectIT/inspectIT

/**
 * Returns string representation of count and percentage.
 *
 * @param count
 *            Count.
 * @param totalCount
 *            Total count.
 * @return {@link String} representation.
 */
private String getCountAndPercentage(int count, int totalCount) {
  if (0 == totalCount) {
    return "0(0%)";
  }
  return count + "(" + NumberFormatter.formatDouble(((double) count / totalCount) * 100, 0) + "%)";
}
origin: inspectIT/inspectIT

stringBuilder.append(files.size());
stringBuilder.append(" (");
stringBuilder.append(NumberFormatter.humanReadableByteCount(totalBytesTransfered));
if (!gzipCompression) {
  stringBuilder.append(" out of ");
  stringBuilder.append(NumberFormatter.humanReadableByteCount(totalSize));
stringBuilder.append(NumberFormatter.humanReadableByteCount((long) getAverageTransferRate()));
stringBuilder.append("/s) Remaining time: ");
if (gzipCompression) {
stringBuilder.append(NumberFormatter.humanReadableMillisCount(millisLeft, true));
subMonitor.subTask(stringBuilder.toString());
origin: inspectIT/inspectIT

int occupancy = (int) ((100 * Math.round(bufferCurrentOccupancy)) / Math.round(bufferMaxOccupancy));
String occMb = NumberFormatter.humanReadableByteCount(cmrStatusData.getCurrentBufferSize());
String maxMb = NumberFormatter.humanReadableByteCount(cmrStatusData.getMaxBufferSize());
String string = occupancy + "% (" + occMb + " / " + maxMb + ")";
bufferSize.setText(string);
  bufferDate.setText(NumberFormatter.formatTime(oldestDataDate.getTime()));
} else {
  bufferDate.setText("-");
StringBuilder spaceLeftStringBuilder = new StringBuilder(String.valueOf(spaceOccupancy));
spaceLeftStringBuilder.append("% (");
spaceLeftStringBuilder.append(NumberFormatter.humanReadableByteCount(cmrStatusData.getStorageDataSpaceLeft()));
spaceLeftStringBuilder.append(" / ");
spaceLeftStringBuilder.append(NumberFormatter.humanReadableByteCount(cmrStatusData.getStorageMaxDataSpace()));
spaceLeftStringBuilder.append(')');
spaceLeftLabel.setText(spaceLeftStringBuilder.toString());
StringBuilder uptimeText = new StringBuilder(NumberFormatter.humanReadableMillisCount(uptimeMillis, true));
uptimeText.append(" (started ");
uptimeText.append(NumberFormatter.formatTime(started));
uptimeText.append(')');
uptimeLabel.setText(uptimeText.toString());
  databaseSizeLabel.setText(NumberFormatter.humanReadableByteCount(databaseSize.longValue()));
} else {
  databaseSizeLabel.setText("n/a");
origin: inspectIT/inspectIT

    return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp()));
  } else {
    return emptyStyledString;
  return new StyledString(Long.toString(data.getCount()));
case AVERAGE:
  return new StyledString(NumberFormatter.formatDouble(data.getAverage()));
case MIN:
  return new StyledString(NumberFormatter.formatDouble(data.getMin()));
case MAX:
  return new StyledString(NumberFormatter.formatDouble(data.getMax()));
case DURATION:
  return new StyledString(NumberFormatter.formatDouble(data.getDuration()));
case PREPARED:
  if (rawMode) {
origin: inspectIT/inspectIT

  return TextFormatter.getSpanOriginStyled(span, cachedDataService.getPlatformIdentForId(span.getPlatformIdent()));
case TIME:
  return new StyledString(NumberFormatter.formatTimeWithMillis(span.getTimeStamp()));
case DURATION:
  StyledString durationString = new StyledString(NumberFormatter.formatDouble(span.getDuration(), timeDecimalPlaces));
  if (InvocationTreeUtil.isConsideredAsync(ite)) {
    durationString.append(TextFormatter.getWarningSign());
case EXCLUSIVE:
  StyledString exclusive = new StyledString();
  exclusive.append(NumberFormatter.formatDouble(InvocationTreeUtil.calculateSpanExclusiveDuration(ite), timeDecimalPlaces));
  exclusive.append(" (", StyledString.COUNTER_STYLER);
  int percentage = Math.round((float) InvocationTreeUtil.calculateSpanExclusivePercentage(ite) * 100);
  exclusive.append(NumberFormatter.formatInteger(percentage), StyledString.COUNTER_STYLER);
  exclusive.append("%)", StyledString.COUNTER_STYLER);
  if (InvocationTreeUtil.isConsideredAsync(ite)) {
origin: inspectIT/inspectIT

  return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp()));
case METHOD:
  return TextFormatter.getStyledMethodString(methodIdent);
case DURATION:
  if (InvocationSequenceDataHelper.hasTimerData(data)) {
    return new StyledString(NumberFormatter.formatDouble(data.getTimerData().getDuration()));
  } else {
    return new StyledString(NumberFormatter.formatDouble(data.getDuration()));
  return new StyledString(NumberFormatter.formatLong(data.getChildCount()));
case URL:
  if (InvocationSequenceDataHelper.hasHttpTimerData(data)) {
origin: inspectIT/inspectIT

DetailsCellContent[] total = new DetailsCellContent[] { new DetailsCellContent(NumberFormatter.formatLong(timerData.getCount())),
    new DetailsCellContent(NumberFormatter.formatDouble(timerData.getAverage())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getMin())),
    new DetailsCellContent(NumberFormatter.formatDouble(timerData.getMax())) };
table.addContentRow("Total:", null, total);
  DetailsCellContent[] cpu = new DetailsCellContent[] { new DetailsCellContent(NumberFormatter.formatLong(timerData.getCount())),
      new DetailsCellContent(NumberFormatter.formatDouble(timerData.getCpuAverage())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getCpuMin())),
      new DetailsCellContent(NumberFormatter.formatDouble(timerData.getCpuMax())) };
  table.addContentRow("CPU:", null, cpu);
  DetailsCellContent[] exclusive = new DetailsCellContent[] { new DetailsCellContent(NumberFormatter.formatLong(timerData.getCount())),
      new DetailsCellContent(NumberFormatter.formatDouble(timerData.getExclusiveAverage())), new DetailsCellContent(NumberFormatter.formatDouble(timerData.getExclusiveMin())),
      new DetailsCellContent(NumberFormatter.formatDouble(timerData.getExclusiveMax())) };
  table.addContentRow("Exclusive:", null, exclusive);
origin: inspectIT/inspectIT

/**
 * Formats the time to a String value.
 *
 * @param time
 *            The time as long value.
 * @return The formatted string.
 */
public static String formatTime(long time) {
  return formatTime(new Date(time));
}
origin: inspectIT/inspectIT

  uptime.setText(NumberFormatter.millisecondsToString(runtimeData.getUptime()));
} else {
  uptime.setText("");
connectionTimeStamp.setText(NumberFormatter.formatTime(agentStatusData.getConnectionTimestamp()));
lastKeepAliveTimeStamp.setText(NumberFormatter.formatTime(agentStatusData.getLastKeepAliveTimestamp()));
origin: inspectIT/inspectIT

case TIMESTAMP:
  if (rawMode) {
    return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp()));
  } else {
    return emptyStyledString;
case CREATED:
  if (!rawMode && (data instanceof AggregatedExceptionSensorData)) {
    return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getCreated()));
  } else if (ExceptionEvent.CREATED.equals(data.getExceptionEvent())) {
    return new StyledString("Yes");
    return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getPassed()));
  } else if (ExceptionEvent.PASSED.equals(data.getExceptionEvent())) {
    return new StyledString("Yes");
    return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getHandled()));
  } else if (ExceptionEvent.HANDLED.equals(data.getExceptionEvent())) {
    return new StyledString("Yes");
origin: inspectIT/inspectIT

addItemToSection(toolkit, SECTION_MEMORY, "Max heap size: ", minTitleColumnWidth);
if (data.getMaxHeapMemorySize() > 0) {
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getMaxHeapMemorySize()), minInformationColumnWidth);
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth);
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getMaxNonHeapMemorySize()), minInformationColumnWidth);
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth);
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getTotalPhysMemory()), minInformationColumnWidth);
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth);
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(data.getTotalSwapSpace()), minInformationColumnWidth);
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE, minInformationColumnWidth);
addItemToSection(toolkit, SECTION_OS, "Available processors: ", minTitleColumnWidth);
if (data.getAvailableProcessors() > 0) {
  addItemToSection(toolkit, SECTION_OS, NumberFormatter.formatInteger(data.getAvailableProcessors()), minInformationColumnWidth);
} else {
  addItemToSection(toolkit, SECTION_OS, NOT_AVAILABLE, minInformationColumnWidth);
origin: inspectIT/inspectIT

  /**
   * {@inheritDoc}
   */
  @Override
  protected void showDefaultValue() {
    text.setText(NumberFormatter.formatLong(property.getDefaultValue().longValue()));
  }
}
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
protected String valueToHumanReadableImpl(double value) {
  return NumberFormatter.formatDoubleToPercent(value / 100D);
}
origin: inspectIT/inspectIT

/**
 * Formats the time to a String value with milliseconds.
 *
 * @param time
 *            The time as long value.
 * @return The formatted string.
 */
public static String formatTimeWithMillis(long time) {
  return formatTimeWithMillis(new Date(time));
}
origin: inspectIT/inspectIT

      styledString.append("Connected :: Last data sent " + NumberFormatter.humanReadableMillisCount(millis, true) + " ago", StyledString.DECORATIONS_STYLER);
    } else if (agentStatusData.getInstrumentationStatus() == InstrumentationStatus.NO_CLASS_CACHE_AVAILABLE) {
      styledString.append("Connected :: Sending data :: No class cache available", StyledString.DECORATIONS_STYLER);
case NO_KEEP_ALIVE:
  long timeSinceLastKeepAlive = System.currentTimeMillis() - agentStatusData.getLastKeepAliveTimestamp();
  styledString.append("No keep-alive signal for " + NumberFormatter.humanReadableMillisCount(timeSinceLastKeepAlive, true), StyledString.DECORATIONS_STYLER);
  break;
case DISCONNECTED:
origin: inspectIT/inspectIT

  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getMaxHeapMemorySize()));
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE);
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getMaxNonHeapMemorySize()));
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE);
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getTotalPhysMemory()));
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE);
  addItemToSection(toolkit, SECTION_MEMORY, NumberFormatter.formatBytesToKBytes(systemData.getTotalSwapSpace()));
} else {
  addItemToSection(toolkit, SECTION_MEMORY, NOT_AVAILABLE);
origin: inspectIT/inspectIT

case TIMESTAMP:
  if (rawMode) {
    return new StyledString(NumberFormatter.formatTimeWithMillis(data.getTimeStamp()));
  } else {
    return emptyStyledString;
    return new StyledString(NumberFormatter.formatDouble(data.getAverage()));
  } else {
    return emptyStyledString;
    return new StyledString(NumberFormatter.formatDouble(data.getMin()));
  } else {
    return emptyStyledString;
    return new StyledString(NumberFormatter.formatDouble(data.getMax()));
  } else {
    return emptyStyledString;
    return new StyledString(NumberFormatter.formatDouble(data.getDuration()));
  } else {
    return emptyStyledString;
    return new StyledString(NumberFormatter.formatDouble(data.getCpuAverage()));
  } else {
    return emptyStyledString;
    return new StyledString(NumberFormatter.formatDouble(data.getCpuMin()));
  } else {
    return emptyStyledString;
origin: inspectIT/inspectIT

  return new StyledString(NumberFormatter.formatLong(delta));
case DURATION:
  styledString = new StyledString();
  double duration = InvocationSequenceDataHelper.calculateDuration(data, spanService);
  if (-1.0d != duration) {
    styledString.append(NumberFormatter.formatDouble(duration));
  styledString = new StyledString();
  if (InvocationSequenceDataHelper.hasTimerData(data) && data.getTimerData().isCpuMetricDataAvailable()) {
    styledString.append(NumberFormatter.formatDouble(data.getTimerData().getCpuDuration()));
    styledString.append(NumberFormatter.formatDouble(exclusiveTime));
rocks.inspectit.ui.rcp.formatterNumberFormatter

Javadoc

This class is for formatting some output.

Most used methods

  • humanReadableByteCount
    Returns the human readable bytes number with the specified amount of decimal places.IMPORTANT: The m
  • formatBytesToKBytes
    Formats bytes to kiloBytes.
  • formatBytesToMBytes
    Formats bytes to megaBytes.
  • formatDouble
    Formats a double value based on the number of decimal places.
  • formatDoubleToPercent
    Converts a double into a percentage string. For example: input = 0.1525 / output = 15.25 %
  • formatInteger
    Formats an integer value. For example: input = 1234567 / output = 1,234,567.
  • formatLong
    Formats a long value. For example: input = 1234567 / output = 1,234,567.
  • formatTime
    Formats the time to a String value.
  • formatTimeWithMillis
    Formats the time to a String value with milliseconds.
  • humanReadableMillisCount
    Returns the human readable millis count. If shortDescription is true then the format will be: x days
  • millisecondsToString
    Converts time in milliseconds to a String in the format HH:mm:ss.
  • millisecondsToString

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now