@Override public void run( ) { if ( showLineCount ) { final float percentComplete = ( float ) exportLineCounter / ( float ) totalLines; final String percentStr = DecimalFormat.getPercentInstance().format( percentComplete ); writeStringToOut( debugOutput, "exported " + exportLineCounter + " records, " + percentStr + " complete" ); } else { writeStringToOut( debugOutput, "exported " + exportLineCounter + " records" ); } } }, 30 * 1000, 30 * 1000 );
public static String formatPercent(final float usage) { final NumberFormat formatter = DecimalFormat.getPercentInstance(); formatter.setMaximumFractionDigits(2); return formatter.format(usage); }
private String addStatWithMultiplyInfo(String statName, Object value, double multiply, String units) { String info = String.format("%s: %s%s", statName, TextFormatting.DARK_AQUA, value); if (!units.isEmpty()) { info += " " + units; } if (multiply != 1) { if (multiply > 1) { info += TextFormatting.DARK_GREEN; } else { info += TextFormatting.DARK_RED; } info += String.format(" (%s) %s", DecimalFormat.getPercentInstance().format(multiply), TextFormatting.RESET); } return info; }
/** * Gets percent format. * * @return percent format */ public NumberFormat getPercentFormat() { return DecimalFormat.getPercentInstance(asLocale()); }
public static NumberFormat getPercentFormat() { if (percentFormat == null) { percentFormat = DecimalFormat.getPercentInstance(getLocale()); } return percentFormat; }
@Override public String getName() { return itemStack.getDisplayName() + " +" + DecimalFormat.getPercentInstance().format(progress / 100f); }
private int getWidthIconWithPercent(double amount, int iconWidth) { return getWidthIconWithInfo(DecimalFormat.getPercentInstance().format(amount), iconWidth); }
public String getChargingLevelAsString() { return DecimalFormat.getPercentInstance().format(getChargingLevel()); }
@Override public void run() { NumberFormat percent = DecimalFormat.getPercentInstance(Locale.getDefault()); first.setText(percent.format(layout.getSplitterPositionPercent())); second.setText(percent.format(1f - layout.getSplitterPositionPercent())); } });
@Override public void onSplitterPositionChanged(SplitPaneLayout splitPaneLayout, boolean fromUser) { NumberFormat percent = DecimalFormat.getPercentInstance(Locale.getDefault()); first.setText(percent.format(layout.getSplitterPositionPercent())); second.setText(percent.format(1f - layout.getSplitterPositionPercent())); } });
void log(final Logger logger) { final NumberFormat percentFormat = (NumberFormat) DecimalFormat.getPercentInstance().clone(); percentFormat.setMinimumFractionDigits(2); percentFormat.setMaximumFractionDigits(2); final NumberFormat numberFormat = (NumberFormat) DecimalFormat.getNumberInstance().clone(); logger.info(() -> "Global time (ms): " + global_time); logger.info(() -> "Instrumented methods: " + instrumented_methods); logger.info(() -> "Evaluated methods: " + evaluated_methods); logger.info(() -> "Found methods: " + found_methods); if (methods != null && !methods.isEmpty()) { logger.info("Method name => Percent time - Call count - Total time - Avg time"); methods.forEach(result -> logger.info( () -> result.method + " => " + percentFormat.format(result.percent_time) + " - " + result.invocations + " - " + result.total_time + " - " + numberFormat.format(result.mean_time))); } } }
@Override public String getDetails(int level) { return MOStringHelper.translateToLocal(getUnlocalizedDetails(), TextFormatting.GREEN + DecimalFormat.getPercentInstance().format(COOLDOWN_CHANGE) + TextFormatting.GRAY, TextFormatting.YELLOW + (ENERGY_PER_COOLDOWN + MOEnergyHelper.ENERGY_UNIT) + TextFormatting.GRAY); }
public String getDetails(int level) { return MOStringHelper.translateToLocal(getUnlocalizedDetails(), TextFormatting.GREEN + DecimalFormat.getPercentInstance().format(level * 0.5f) + TextFormatting.GRAY); }
@Override public String getDetails(int level) { return MOStringHelper.translateToLocal(getUnlocalizedDetails(), TextFormatting.GREEN + DecimalFormat.getPercentInstance().format(getDamageNegate(level)) + TextFormatting.GRAY); }
@Override public String getDetails(int level) { return MOStringHelper.translateToLocal(getUnlocalizedDetails(), TextFormatting.GREEN + DecimalFormat.getPercentInstance().format(getAttackPower(level)) + TextFormatting.GRAY); }
private int renderIconWithPercent(String icon, double amount, int x, int y, int iconOffsetX, int iconOffsetY, boolean leftSided, Color fromColor, Color toColor, int iconWidth, int iconHeight) { return this.renderIconWithInfo(icon, DecimalFormat.getPercentInstance().format(amount), RenderUtils.lerp(fromColor, toColor, MathHelper.clamp((float) amount, 0, 1)), x, y, iconOffsetX, iconOffsetY, leftSided, iconWidth, iconHeight); }
@SideOnly(Side.CLIENT) public void addDetails(ItemStack itemstack, EntityPlayer player, @Nullable World worldIn, List<String> infos) { super.addDetails(itemstack, player, worldIn, infos); Multimap<String, AttributeModifier> multimap = getModifiers(MOPlayerCapabilityProvider.GetAndroidCapability(player), itemstack); if (multimap != null) { multimap.values() .forEach(modifier -> { switch (modifier.getOperation()) { case 0: infos.add(TextFormatting.GREEN + String.format("%s: +%s", modifier.getName(), modifier.getAmount())); break; case 1: infos.add(TextFormatting.GREEN + String.format("%s: %s", modifier.getName(), (modifier.getAmount() >= 0 ? "+" : "") + DecimalFormat.getPercentInstance().format(modifier.getAmount()))); break; default: infos.add(TextFormatting.GREEN + String.format("%s: %s", modifier.getName(), DecimalFormat.getPercentInstance().format(modifier.getAmount() + 1))); } }); } }
public PageIcon(){ super(new BorderLayout()); content.setVerticalAlignment(SwingConstants.TOP); content.setHorizontalAlignment(SwingConstants.LEFT); content.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); content.addMouseMotionListener(this); add(content,BorderLayout.CENTER); JFormattedTextField scaler=new JFormattedTextField(DecimalFormat.getPercentInstance()); scaler.setValue(1.0); scaler.addActionListener((e)->{ setScale(((Number)scaler.getValue()).doubleValue()); }); add(scaler,BorderLayout.SOUTH); } public PageIcon(BufferedImage page,IconPaint painter){
private int getAmmoBoxWidth(AndroidPlayer androidPlayer) { if (androidPlayer.getPlayer() != null && androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND) != null && androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IWeapon) { float percent = (float) ((IWeapon) androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem()).getAmmo(androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND)) / (float) ((IWeapon) androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem()).getMaxAmmo(androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND)); int energyPackCount = getEnergyPackCount(androidPlayer.getPlayer()); return getWidthIconWithInfo(DecimalFormat.getPercentInstance().format(percent) + " | " + Integer.toString(energyPackCount), 18); } return 0; }
private int renderAmmoBox(AndroidPlayer androidPlayer, int x, int y, boolean leftSided, Color baseColor) { if (androidPlayer.getPlayer() != null && androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND) != null && androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IWeapon) { float percent = (float) ((IWeapon) androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem()).getAmmo(androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND)) / (float) ((IWeapon) androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem()).getMaxAmmo(androidPlayer.getPlayer().getHeldItem(EnumHand.MAIN_HAND)); int energyPackCount = getEnergyPackCount(androidPlayer.getPlayer()); return renderIconWithInfo("ammo", DecimalFormat.getPercentInstance().format(percent) + " | " + Integer.toString(energyPackCount), RenderUtils.lerp(Reference.COLOR_HOLO_RED, baseColor, percent), x, y, 0, 0, leftSided, 18, 18); } return 0; }