Example usage for java.text NumberFormat setMaximumFractionDigits

List of usage examples for java.text NumberFormat setMaximumFractionDigits

Introduction

In this page you can find the example usage for java.text NumberFormat setMaximumFractionDigits.

Prototype

public void setMaximumFractionDigits(int newValue) 

Source Link

Document

Sets the maximum number of digits allowed in the fraction portion of a number.

Usage

From source file:LabelXYToolTipGenerator.java

private String format(double num, int minDecimalPlaces, int maxDecimalPlaces) {
    NumberFormat format = NumberFormat.getInstance();
    format.setMinimumFractionDigits(minDecimalPlaces);
    format.setMaximumFractionDigits(maxDecimalPlaces);
    return (format.format(num));
}

From source file:com.bdb.weather.display.day.DayRainPane.java

/**
 * Constructor.// w w  w.j  a va  2s  .c  o  m
 */
public DayRainPane() {
    setPrefSize(400, 300);
    chart = ChartFactory.createBarChart("Water Cycle", "Hour", "", null, PlotOrientation.VERTICAL, true, true,
            false);

    chartViewer = new ChartViewer(chart);

    rainPlot = (CategoryPlot) chart.getPlot();
    rainPlot.setNoDataMessage("There is no data for the specified day");

    BarRenderer renderer = (BarRenderer) rainPlot.getRenderer();
    renderer.setBasePaint(Color.BLUE);
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesItemLabelGenerator(0, new RainItemLabelGenerator(
            StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, Depth.getDefaultFormatter()));
    StandardCategoryToolTipGenerator ttgen = new StandardCategoryToolTipGenerator(
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, Depth.getDefaultFormatter());
    rainPlot.getRenderer().setSeriesToolTipGenerator(0, ttgen);

    NumberFormat etFormatter = (NumberFormat) Depth.getDefaultFormatter().clone();
    etFormatter.setMaximumFractionDigits(etFormatter.getMaximumFractionDigits() + 1);
    renderer.setSeriesItemLabelGenerator(1, new RainItemLabelGenerator(
            StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, etFormatter));
    ttgen = new StandardCategoryToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            etFormatter);
    rainPlot.getRenderer().setSeriesToolTipGenerator(1, ttgen);

    rainPlot.setRangeAxis(valueAxis);
    rainPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_90);

    dataTable = new TableView();

    TableColumn<RainItem, Integer> hourColumn = new TableColumn<>(HOUR_ROW_KEY);
    hourColumn.setCellValueFactory(new PropertyValueFactory(HOUR_ROW_KEY));
    dataTable.getColumns().add(hourColumn);

    TableColumn<RainItem, Depth> rainfallColumn = new TableColumn<>("Rainfall");
    rainfallColumn.setCellValueFactory(new PropertyValueFactory(RAIN_ROW_KEY));
    dataTable.getColumns().add(rainfallColumn);

    TableColumn<RainItem, Depth> etColumn = new TableColumn<>(ET_ROW_KEY);
    etColumn.setCellValueFactory(new PropertyValueFactory(ET_ROW_KEY));
    dataTable.getColumns().add(etColumn);

    this.setTabContents(chartViewer, dataTable);
}

From source file:com.mongodb.hadoop.examples.wordcount.split.WordCountSplitTest.java

@Override
public int run(String[] args) throws Exception {
    final Configuration conf = getConf();
    boolean useQuery = false;
    for (int i = 0; i < args.length; i++) {
        final String argi = args[i];
        if (argi.equals("--use-query"))
            useQuery = true;/*w  ww. j av  a2s. c  o  m*/
        else {
            throw new IllegalArgumentException(argi);
        }
    }

    if (useQuery) {
        //NOTE: must do this BEFORE Job is created
        final MongoConfig mongo_conf = new MongoConfig(conf);
        com.mongodb.BasicDBObject query = new com.mongodb.BasicDBObject();
        query.put("num", new com.mongodb.BasicDBObject(Collections.singletonMap("$mod", new int[] { 2, 0 })));
        System.out.println(" --- setting query on num");
        mongo_conf.setQuery(query);
        System.out.println(" --- query is: " + mongo_conf.getQuery());
    }

    final com.mongodb.MongoURI outputUri = MongoConfigUtil.getOutputURI(conf);
    if (outputUri == null)
        throw new IllegalStateException("output uri is not set");
    if (MongoConfigUtil.getInputURI(conf) == null)
        throw new IllegalStateException("input uri is not set");
    final String outputCollectionName = outputUri.getCollection();

    final Job job = new Job(conf, "word count " + outputCollectionName);

    job.setJarByClass(WordCountSplitTest.class);

    job.setMapperClass(TokenizerMapper.class);

    job.setCombinerClass(IntSumReducer.class);
    job.setReducerClass(IntSumReducer.class);

    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);

    job.setInputFormatClass(MongoInputFormat.class);
    job.setOutputFormatClass(MongoOutputFormat.class);

    final long start = System.currentTimeMillis();
    System.out
            .println(" ----------------------- running test " + outputCollectionName + " --------------------");
    try {
        boolean result = job.waitForCompletion(true);
        System.out.println("job.waitForCompletion( true ) returned " + result);
    } catch (Exception e) {
        System.err.println("job.waitForCompletion( true ) threw Exception");
        e.printStackTrace();
        return 1;
    }
    final long end = System.currentTimeMillis();
    final float seconds = ((float) (end - start)) / 1000;
    java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
    nf.setMaximumFractionDigits(3);
    System.out.println("finished run in " + nf.format(seconds) + " seconds");

    com.mongodb.Mongo m = new com.mongodb.Mongo(outputUri);
    com.mongodb.DB db = m.getDB(outputUri.getDatabase());
    com.mongodb.DBCollection coll = db.getCollection(outputCollectionName);
    com.mongodb.BasicDBObject query = new com.mongodb.BasicDBObject();
    query.put("_id", "the");
    com.mongodb.DBCursor cur = coll.find(query);
    if (!cur.hasNext())
        System.out.println("FAILURE: could not find count of \'the\'");
    else
        System.out.println("'the' count: " + cur.next());

    return 0; //is the return value supposed to be the program exit code?

    //        if (! result)
    //           System.exit(  1 );
}

From source file:org.sonar.core.i18n.DefaultI18n.java

@Override
public String formatDouble(Locale locale, Double value) {
    NumberFormat format = DecimalFormat.getNumberInstance(locale);
    format.setMinimumFractionDigits(1);/*from  w  w  w .  ja v  a 2s  .co m*/
    format.setMaximumFractionDigits(1);
    return format.format(value);
}

From source file:edu.cornell.med.icb.geo.tools.CalculateRanks.java

private void postProcess(final FileReader inputReader, final PrintWriter outputWriter,
        final PrintWriter talliesWriter) throws IOException {
    final BufferedReader br = new BufferedReader(inputReader);
    String line;//from www .j  a va2  s . co  m
    final Vector<ClassificationResults> allResults = new Vector<ClassificationResults>();
    final Map<String, List<ClassificationResults>> organizer = new HashMap<String, List<ClassificationResults>>();

    final Comparator<ClassificationResults> looAccuracyComparator = new Comparator<ClassificationResults>() {
        public int compare(final ClassificationResults o1, final ClassificationResults o2) {
            return (int) Math
                    .round(o2.getLooPerformance().getAccuracy() - o1.getLooPerformance().getAccuracy());
        }
    };

    // read stats from input file:
    while ((line = br.readLine()) != null) {
        if (line.startsWith("Dataset\t")) {

            continue; // skip headers.
        }

        final ClassificationResults result = ClassificationResults.create(line);
        if (filterWithShuffleTest) {
            if (result.getShuffleGEP() < 5) {
                allResults.add(result);
            }
        } else {
            allResults.add(result);
        }

        geneListNames.add(result.getGeneListName());
        final String key = result.getClassificationUnique();

        List<ClassificationResults> resultForClassification = organizer.get(key);
        if (resultForClassification == null) {
            resultForClassification = new Vector<ClassificationResults>();
        }
        resultForClassification.add(result);
        organizer.put(key, resultForClassification);
    }

    final NumberFormat formatter = new DecimalFormat();
    formatter.setMaximumFractionDigits(2);

    // calculate ranks and output:
    {
        ClassificationResults.writeHeader(outputWriter, filterWithShuffleTest);
        final Iterator<List<ClassificationResults>> iterator = organizer.values().iterator();
        while (iterator.hasNext()) {
            final List<ClassificationResults> resultsForClassification = iterator.next();
            // first sort by accuracy:
            Collections.sort(resultsForClassification, looAccuracyComparator);
            // then, iterate the list and assign ranks:
            int rank = 0;
            double previousPerformanceValue = -1;
            for (final ClassificationResults singleResult : resultsForClassification) {
                final double currentPerformanceValue = singleResult.getLooPerformance().getAccuracy();
                if (currentPerformanceValue != previousPerformanceValue) {
                    rank++;
                    previousPerformanceValue = currentPerformanceValue;
                }
                singleResult.setRank(rank);
                singleResult.write(outputWriter, formatter);
            }
        }
    }
    // tally ranks per gene list:
    if (talliesWriter != null) {
        talliesWriter.write("Gene List\tRank\tTally\n");
        for (final String geneListName : geneListNames) {
            System.out.println(geneListName + " gene list:");
            final Int2IntMap rankTallies = new Int2IntOpenHashMap();

            final Iterator<ClassificationResults> iterator = allResults.iterator();
            while (iterator.hasNext()) {
                final ClassificationResults classificationResults = iterator.next();
                if (!classificationResults.getGeneListName().equals(geneListName)) {
                    continue;
                }

                int tally = rankTallies.get(classificationResults.getRank());
                tally++;
                rankTallies.put(classificationResults.getRank(), tally);

            }

            final Set<Map.Entry<Integer, Integer>> entries = rankTallies.entrySet();
            for (final Map.Entry<Integer, Integer> entry : entries) {
                final Object rank = entry.getKey();
                final Object tally = entry.getValue();
                System.out.println("rank: " + rank + " tally: " + tally);
                if (talliesWriter != null) {
                    talliesWriter.write(geneListName);
                    talliesWriter.write("\t");
                    talliesWriter.write(rank.toString());
                    talliesWriter.write("\t");
                    talliesWriter.write(tally.toString());
                    talliesWriter.write("\n");
                }
            }

        }
    }
}

From source file:ro.expectations.expenses.ui.accounts.AccountsAdapter.java

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    mCursor.moveToPosition(position);/*  ww  w  .  ja v a 2s  . co m*/

    // Set the row background
    ListHelper.setItemBackground(mContext, holder.itemView, isItemSelected(position),
            holder.mAccountIconBackground, holder.mSelectedIconBackground);

    // Set the icon
    String type = mCursor.getString(mCursor.getColumnIndex(ExpensesContract.Accounts.TYPE));
    AccountType accountType = AccountType.valueOf(type);
    if (accountType == AccountType.CREDIT_CARD || accountType == AccountType.DEBIT_CARD) {
        String issuer = mCursor.getString(mCursor.getColumnIndex(ExpensesContract.Accounts.SUBTYPE));
        CardIssuer cardIssuer;
        if (issuer == null) {
            cardIssuer = CardIssuer.OTHER;
        } else {
            try {
                cardIssuer = CardIssuer.valueOf(issuer);
            } catch (final IllegalArgumentException ex) {
                cardIssuer = CardIssuer.OTHER;
            }
        }
        holder.mAccountIcon
                .setImageDrawable(DrawableHelper.tint(mContext, cardIssuer.iconId, R.color.colorWhite));
    } else if (accountType == AccountType.ELECTRONIC) {
        String paymentType = mCursor.getString(mCursor.getColumnIndex(ExpensesContract.Accounts.SUBTYPE));
        ElectronicPaymentType electronicPaymentType;
        if (paymentType == null) {
            electronicPaymentType = ElectronicPaymentType.OTHER;
        } else {
            try {
                electronicPaymentType = ElectronicPaymentType.valueOf(paymentType);
            } catch (IllegalArgumentException ex) {
                electronicPaymentType = ElectronicPaymentType.OTHER;
            }
        }
        holder.mAccountIcon.setImageDrawable(
                DrawableHelper.tint(mContext, electronicPaymentType.iconId, R.color.colorWhite));
    } else {
        holder.mAccountIcon
                .setImageDrawable(DrawableHelper.tint(mContext, accountType.iconId, R.color.colorWhite));
    }

    // Set the icon background color
    GradientDrawable bgShape = (GradientDrawable) holder.mAccountIconBackground.getBackground();
    bgShape.setColor(0xFF000000 | ContextCompat.getColor(mContext, accountType.colorId));

    // Set the description
    holder.mAccountDescription.setText(accountType.titleId);

    // Set the title
    String title = mCursor.getString(mCursor.getColumnIndex(ExpensesContract.Accounts.TITLE));
    holder.mAccountTitle.setText(title);

    // Set the date
    long now = System.currentTimeMillis();
    long lastTransactionAt = mCursor
            .getLong(mCursor.getColumnIndex(ExpensesContract.Accounts.LAST_TRANSACTION_AT));
    if (lastTransactionAt == 0) {
        lastTransactionAt = mCursor.getLong(mCursor.getColumnIndex(ExpensesContract.Accounts.CREATED_AT));
    }
    holder.mAccountLastTransactionAt
            .setText(DateUtils.getRelativeTimeSpanString(lastTransactionAt, now, DateUtils.DAY_IN_MILLIS));

    // Set the account balance
    double balance = NumberUtils.roundToTwoPlaces(
            mCursor.getLong(mCursor.getColumnIndex(ExpensesContract.Accounts.BALANCE)) / 100.0);
    String currencyCode = mCursor.getString(mCursor.getColumnIndex(ExpensesContract.Accounts.CURRENCY));
    Currency currency = Currency.getInstance(currencyCode);
    NumberFormat format = NumberFormat.getCurrencyInstance();
    format.setCurrency(currency);
    format.setMaximumFractionDigits(currency.getDefaultFractionDigits());
    holder.mAccountBalance.setText(format.format(balance));
    if (balance > 0) {
        holder.mAccountBalance.setTextColor(ContextCompat.getColor(mContext, R.color.colorGreen700));
    } else if (balance < 0) {
        holder.mAccountBalance.setTextColor(ContextCompat.getColor(mContext, R.color.colorRed700));
    }
}

From source file:chibi.gemmaanalysis.OutlierDetectionTestCli.java

/*** Write results to the output file; file name must be given as argument ***/
private void writeResultsToFileByMedian(BufferedWriter bw, ExpressionExperiment ee,
        OutlierDetectionTestDetails testDetails) {
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(4);
    try {//  w  w w . ja  v  a 2  s.co  m
        // Get information about the experiment:
        ee = this.eeService.thawLite(ee);
        System.out.println("Writing results to file for " + ee.getShortName());
        bw.write(ee.getShortName());
        bw.write("\t" + getPlatforms(ee));
        bw.write("\t" + testDetails.getNumExpFactors());
        if (useRegression) {
            bw.write("\t" + testDetails.getNumSigFactors());
        }
        bw.write("\t" + ee.getBioAssays().size());
        bw.write("\t" + testDetails.getNumOutliers());
        // Get information about each of the outliers (should be in sorted order since outliers is a sorted list):
        for (OutlierDetails outlier : testDetails.getOutliers()) {
            bw.write("\t" + outlier.getBioAssay().getName());
            bw.write("\t" + nf.format(outlier.getFirstQuartile()) + "/"
                    + nf.format(outlier.getMedianCorrelation()) + "/" + nf.format(outlier.getThirdQuartile()));
        }
        if (useRegression) {
            for (ExperimentalFactor factor : testDetails.getSignificantFactors()) {
                bw.write("\t" + factor.getName());
            }
        }
        bw.newLine();

    } catch (IOException e) {
        throw new RuntimeException(e);
    }

}

From source file:chibi.gemmaanalysis.OutlierDetectionTestCli.java

/*** Write results to the output file; file name must be given as argument ***/
private void writeResultsToFileCombined(BufferedWriter bw, ExpressionExperiment ee,
        OutlierDetectionTestDetails testDetails) {
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(4);
    try {/*from  w w  w .j a va 2 s .c  o  m*/
        // Get information about the experiment:
        ee = this.eeService.thawLite(ee);
        System.out.println("Writing results to file for " + ee.getShortName());
        bw.write(ee.getShortName());
        bw.write("\t" + getPlatforms(ee));
        bw.write("\t" + testDetails.getNumExpFactors());
        if (useRegression) {
            bw.write("\t" + testDetails.getNumSigFactors());
        }
        bw.write("\t" + ee.getBioAssays().size());
        bw.write("\t" + testDetails.getNumRemoved());
        bw.write("\t" + testDetails.getNumOutliersBasicAlgorithm());
        bw.write("\t" + testDetails.getNumOutliersByMedian());
        bw.write("\t" + testDetails.getNumOutliers());
        // Get information about each of the outliers
        for (OutlierDetails outlier : testDetails.getOutliers()) {
            bw.write("\t" + outlier.getBioAssay().getName());
        }
        if (useRegression) {
            for (ExperimentalFactor factor : testDetails.getSignificantFactors()) {
                bw.write("\t" + factor.getName());
            }
        }
        bw.newLine();

    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:chibi.gemmaanalysis.OutlierDetectionTestCli.java

/*** Write results to the output file; file name must be given as argument ***/
private void writeResultsToFileBasic(BufferedWriter bw, ExpressionExperiment ee,
        OutlierDetectionTestDetails testDetails) {
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(4);
    try {/*from w  w w .j  a  va  2s. c  o m*/
        // Get information about the experiment:
        ee = this.eeService.thawLite(ee);
        System.out.println("Writing results to file for " + ee.getShortName());
        bw.write(ee.getShortName());
        bw.write("\t" + getPlatforms(ee));
        bw.write("\t" + testDetails.getNumExpFactors());
        if (useRegression) {
            bw.write("\t" + testDetails.getNumSigFactors());
        }
        bw.write("\t" + ee.getBioAssays().size());
        bw.write("\t" + testDetails.getNumOutliers());
        // Get information about each of the outliers:
        for (OutlierDetails outlier : testDetails.getOutliers()) {
            bw.write("\t" + outlier.getBioAssay().getName());
            bw.write("\t" + nf.format(outlier.getThresholdCorrelation()));
            bw.write("\t" + nf.format(outlier.getScore()));
        }
        bw.write("\tlast threshold: " + nf.format(testDetails.getLastThreshold()));
        if (useRegression) {
            for (ExperimentalFactor factor : testDetails.getSignificantFactors()) {
                bw.write("\t" + factor.getName());
            }
        }
        bw.newLine();

    } catch (IOException e) {
        throw new RuntimeException(e);
    }

}

From source file:handlers.voicedcommands.WhoAmI.java

/**
 * Method useVoicedCommand./*ww w  .ja  v  a  2 s . c o m*/
 * @param command String
 * @param player Player
 * @param args String
 * @return boolean
 * @see lineage2.gameserver.handlers.IVoicedCommandHandler#useVoicedCommand(String, Player, String)
 */
@Override
public boolean useVoicedCommand(String command, Player player, String args) {
    Creature target = null;
    double hpRegen = Formulas.calcHpRegen(player);
    double cpRegen = Formulas.calcCpRegen(player);
    double mpRegen = Formulas.calcMpRegen(player);
    double hpDrain = player.calcStat(Stats.ABSORB_DAMAGE_PERCENT, 0., target, null);
    double mpDrain = player.calcStat(Stats.ABSORB_DAMAGEMP_PERCENT, 0., target, null);
    double hpGain = player.calcStat(Stats.HEAL_EFFECTIVNESS, 100., target, null);
    double mpGain = player.calcStat(Stats.MANAHEAL_EFFECTIVNESS, 100., target, null);
    double critPerc = 2 * player.calcStat(Stats.CRITICAL_DAMAGE, target, null);
    double critStatic = player.calcStat(Stats.CRITICAL_DAMAGE_STATIC, target, null);
    double mCritDmg = player.calcStat(Stats.MCRITICAL_DAMAGE, target, null);
    double blowRate = player.calcStat(Stats.FATALBLOW_RATE, target, null);
    ItemInstance shld = player.getSecondaryWeaponInstance();
    boolean shield = (shld != null) && (shld.getItemType() == WeaponType.NONE);
    double shieldDef = shield
            ? player.calcStat(Stats.SHIELD_DEFENCE, player.getTemplate().getBaseShldDef(), target, null)
            : 0.;
    double shieldRate = shield ? player.calcStat(Stats.SHIELD_RATE, target, null) : 0.;
    double xpRate = player.getRateExp();
    double spRate = player.getRateSp();
    double dropRate = player.getRateItems();
    double adenaRate = player.getRateAdena();
    double spoilRate = player.getRateSpoil();
    double fireResist = player.calcStat(Element.FIRE.getDefence(), 0., target, null);
    double windResist = player.calcStat(Element.WIND.getDefence(), 0., target, null);
    double waterResist = player.calcStat(Element.WATER.getDefence(), 0., target, null);
    double earthResist = player.calcStat(Element.EARTH.getDefence(), 0., target, null);
    double holyResist = player.calcStat(Element.HOLY.getDefence(), 0., target, null);
    double unholyResist = player.calcStat(Element.UNHOLY.getDefence(), 0., target, null);
    double bleedPower = player.calcStat(Stats.BLEED_POWER, target, null);
    double bleedResist = player.calcStat(Stats.BLEED_RESIST, target, null);
    double poisonPower = player.calcStat(Stats.POISON_POWER, target, null);
    double poisonResist = player.calcStat(Stats.POISON_RESIST, target, null);
    double stunPower = player.calcStat(Stats.STUN_POWER, target, null);
    double stunResist = player.calcStat(Stats.STUN_RESIST, target, null);
    double rootPower = player.calcStat(Stats.ROOT_POWER, target, null);
    double rootResist = player.calcStat(Stats.ROOT_RESIST, target, null);
    double sleepPower = player.calcStat(Stats.SLEEP_POWER, target, null);
    double sleepResist = player.calcStat(Stats.SLEEP_RESIST, target, null);
    double paralyzePower = player.calcStat(Stats.PARALYZE_POWER, target, null);
    double paralyzeResist = player.calcStat(Stats.PARALYZE_RESIST, target, null);
    double mentalPower = player.calcStat(Stats.MENTAL_POWER, target, null);
    double mentalResist = player.calcStat(Stats.MENTAL_RESIST, target, null);
    double debuffPower = player.calcStat(Stats.DEBUFF_POWER, target, null);
    double debuffResist = player.calcStat(Stats.DEBUFF_RESIST, target, null);
    double cancelPower = player.calcStat(Stats.CANCEL_POWER, target, null);
    double cancelResist = player.calcStat(Stats.CANCEL_RESIST, target, null);
    double swordResist = 100. - player.calcStat(Stats.SWORD_WPN_VULNERABILITY, target, null);
    double dualResist = 100. - player.calcStat(Stats.DUAL_WPN_VULNERABILITY, target, null);
    double bluntResist = 100. - player.calcStat(Stats.BLUNT_WPN_VULNERABILITY, target, null);
    double daggerResist = 100. - player.calcStat(Stats.DAGGER_WPN_VULNERABILITY, target, null);
    double bowResist = 100. - player.calcStat(Stats.BOW_WPN_VULNERABILITY, target, null);
    double crossbowResist = 100. - player.calcStat(Stats.CROSSBOW_WPN_VULNERABILITY, target, null);
    double poleResist = 100. - player.calcStat(Stats.POLE_WPN_VULNERABILITY, target, null);
    double fistResist = 100. - player.calcStat(Stats.FIST_WPN_VULNERABILITY, target, null);
    double critChanceResist = 100. - player.calcStat(Stats.CRIT_CHANCE_RECEPTIVE, target, null);
    double critDamResistStatic = player.calcStat(Stats.CRIT_DAMAGE_RECEPTIVE, target, null);
    double critDamResist = 100.
            - (100 * (player.calcStat(Stats.CRIT_DAMAGE_RECEPTIVE, 1., target, null) - critDamResistStatic));
    String dialog = HtmCache.getInstance().getNotNull("command/whoami.htm", player);
    NumberFormat df = NumberFormat.getInstance(Locale.ENGLISH);
    df.setMaximumFractionDigits(1);
    df.setMinimumFractionDigits(1);
    StrBuilder sb = new StrBuilder(dialog);
    sb.replaceFirst("%hpRegen%", df.format(hpRegen));
    sb.replaceFirst("%cpRegen%", df.format(cpRegen));
    sb.replaceFirst("%mpRegen%", df.format(mpRegen));
    sb.replaceFirst("%hpDrain%", df.format(hpDrain));
    sb.replaceFirst("%mpDrain%", df.format(mpDrain));
    sb.replaceFirst("%hpGain%", df.format(hpGain));
    sb.replaceFirst("%mpGain%", df.format(mpGain));
    sb.replaceFirst("%critPerc%", df.format(critPerc));
    sb.replaceFirst("%critStatic%", df.format(critStatic));
    sb.replaceFirst("%mCritDmg%", df.format(mCritDmg));
    sb.replaceFirst("%blowRate%", df.format(blowRate));
    sb.replaceFirst("%shieldDef%", df.format(shieldDef));
    sb.replaceFirst("%shieldRate%", df.format(shieldRate));
    sb.replaceFirst("%xpRate%", df.format(xpRate));
    sb.replaceFirst("%spRate%", df.format(spRate));
    sb.replaceFirst("%dropRate%", df.format(dropRate));
    sb.replaceFirst("%adenaRate%", df.format(adenaRate));
    sb.replaceFirst("%spoilRate%", df.format(spoilRate));
    sb.replaceFirst("%fireResist%", df.format(fireResist));
    sb.replaceFirst("%windResist%", df.format(windResist));
    sb.replaceFirst("%waterResist%", df.format(waterResist));
    sb.replaceFirst("%earthResist%", df.format(earthResist));
    sb.replaceFirst("%holyResist%", df.format(holyResist));
    sb.replaceFirst("%darkResist%", df.format(unholyResist));
    sb.replaceFirst("%bleedPower%", df.format(bleedPower));
    sb.replaceFirst("%bleedResist%", df.format(bleedResist));
    sb.replaceFirst("%poisonPower%", df.format(poisonPower));
    sb.replaceFirst("%poisonResist%", df.format(poisonResist));
    sb.replaceFirst("%stunPower%", df.format(stunPower));
    sb.replaceFirst("%stunResist%", df.format(stunResist));
    sb.replaceFirst("%rootPower%", df.format(rootPower));
    sb.replaceFirst("%rootResist%", df.format(rootResist));
    sb.replaceFirst("%sleepPower%", df.format(sleepPower));
    sb.replaceFirst("%sleepResist%", df.format(sleepResist));
    sb.replaceFirst("%paralyzePower%", df.format(paralyzePower));
    sb.replaceFirst("%paralyzeResist%", df.format(paralyzeResist));
    sb.replaceFirst("%mentalPower%", df.format(mentalPower));
    sb.replaceFirst("%mentalResist%", df.format(mentalResist));
    sb.replaceFirst("%debuffPower%", df.format(debuffPower));
    sb.replaceFirst("%debuffResist%", df.format(debuffResist));
    sb.replaceFirst("%cancelPower%", df.format(cancelPower));
    sb.replaceFirst("%cancelResist%", df.format(cancelResist));
    sb.replaceFirst("%swordResist%", df.format(swordResist));
    sb.replaceFirst("%dualResist%", df.format(dualResist));
    sb.replaceFirst("%bluntResist%", df.format(bluntResist));
    sb.replaceFirst("%daggerResist%", df.format(daggerResist));
    sb.replaceFirst("%bowResist%", df.format(bowResist));
    sb.replaceFirst("%crossbowResist%", df.format(crossbowResist));
    sb.replaceFirst("%fistResist%", df.format(fistResist));
    sb.replaceFirst("%poleResist%", df.format(poleResist));
    sb.replaceFirst("%critChanceResist%", df.format(critChanceResist));
    sb.replaceFirst("%critDamResist%", df.format(critDamResist));
    NpcHtmlMessage msg = new NpcHtmlMessage(0);
    msg.setHtml(Strings.bbParse(sb.toString()));
    player.sendPacket(msg);
    return true;
}