List of usage examples for java.text NumberFormat setMinimumIntegerDigits
public void setMinimumIntegerDigits(int newValue)
From source file:no.abmu.abmstatistikk.annualstatistic.service.MobilBibValidator.java
public void validate(Object obj, Errors errors) { NumberFormat fieldNameFormater = NumberFormat.getNumberInstance(); fieldNameFormater.setMinimumIntegerDigits(3); Set fieldKeys = new HashSet(); int i;/*from w w w . j a v a 2 s.c o m*/ setSchemaName("mobilBibSchema"); switch (pageNumber) { case 1: break; case 2: for (i = 13; i <= 14; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 16; i <= 17; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 19; i <= 20; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 22; i <= 23; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 31; i <= 32; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 34; i <= 35; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 37; i <= 38; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 40; i <= 41; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 46; i <= 47; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 49; i <= 50; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 58; i <= 59; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 383)); for (i = 385; i <= 387; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 3: fieldKeys.add(fieldNameFormater.format((long) 82)); for (i = 84; i <= 86; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 90)); for (i = 97; i <= 99; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 389; i <= 390; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 431; i <= 452; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 4: fieldKeys.add(fieldNameFormater.format((long) 137)); fieldKeys.add(fieldNameFormater.format((long) 140)); fieldKeys.add(fieldNameFormater.format((long) 143)); fieldKeys.add(fieldNameFormater.format((long) 146)); for (i = 169; i <= 179; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 371)); for (i = 392; i <= 394; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 403)); break; case 5: for (i = 205; i <= 210; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 215; i <= 218; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 223; i <= 224; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 381; i <= 382; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 401; i <= 402; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; default: break; } logger.debug("Keys to validate: " + fieldKeys); setValidateFieldKeys(fieldKeys); super.validate(obj, errors); }
From source file:com.attribyte.essem.model.index.IndexStats.java
private String asCount(final long val) { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(0);/*from w w w. j av a 2 s .co m*/ nf.setMaximumFractionDigits(0); nf.setMinimumIntegerDigits(1); return nf.format(val); }
From source file:com.attribyte.essem.model.index.IndexStats.java
private String asPercent(final double val) { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(2);/*from w w w . j a v a2 s . co m*/ nf.setMaximumFractionDigits(2); nf.setMinimumIntegerDigits(1); return nf.format(val * 100.0); }
From source file:no.abmu.abmstatistikk.annualstatistic.service.PasientBibValidator.java
public void validate(Object obj, Errors errors) { NumberFormat fieldNameFormater = NumberFormat.getNumberInstance(); fieldNameFormater.setMinimumIntegerDigits(3); Set fieldKeys = new HashSet(); int i;/* ww w .jav a2s. co m*/ setSchemaName("pasientBibSchema"); switch (pageNumber) { case 1: break; case 2: for (i = 13; i <= 14; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 16; i <= 17; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 19; i <= 20; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 22; i <= 23; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 31; i <= 32; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 34; i <= 35; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 37; i <= 38; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 40; i <= 41; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 46; i <= 47; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 49; i <= 50; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 58; i <= 59; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 385; i <= 386; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 3: for (i = 67; i <= 77; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 81; i <= 82; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 82)); for (i = 84; i <= 87; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 90)); for (i = 97; i <= 101; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 389; i <= 390; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 431; i <= 452; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 4: for (i = 102; i <= 107; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 117; i <= 119; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 147)); for (i = 151; i <= 160; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 162)); for (i = 205; i <= 210; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 223; i <= 224; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 401; i <= 402; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 5: fieldKeys.add(fieldNameFormater.format((long) 243)); fieldKeys.add(fieldNameFormater.format((long) 246)); fieldKeys.add(fieldNameFormater.format((long) 249)); fieldKeys.add(fieldNameFormater.format((long) 252)); for (i = 259; i <= 264; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 266)); fieldKeys.add(fieldNameFormater.format((long) 372)); for (i = 381; i <= 382; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; default: break; } logger.debug("Keys to validate: " + fieldKeys); setValidateFieldKeys(fieldKeys); super.validate(obj, errors); }
From source file:com.attribyte.essem.model.index.IndexStats.java
/** * Gets a value as KB.// w w w . ja v a 2 s.com * @param val The value. * @return The value as KB. */ private String asKB(final long val) { double valBytes = (double) val; NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(0); nf.setMaximumFractionDigits(0); nf.setMinimumIntegerDigits(1); return nf.format(valBytes / 1024.0); }
From source file:com.attribyte.essem.model.index.IndexStats.java
/** * Gets a value as MB./*from w w w . ja v a2s . c o m*/ * @param val The value. * @return The value as MB. */ private String asMB(final long val) { double valBytes = (double) val; NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(0); nf.setMaximumFractionDigits(0); nf.setMinimumIntegerDigits(1); return nf.format(valBytes / 1000 / 1000); }
From source file:no.abmu.abmstatistikk.annualstatistic.service.FylkesBibValidator.java
public void validate(Object obj, Errors errors) { NumberFormat fieldNameFormater = NumberFormat.getNumberInstance(); fieldNameFormater.setMinimumIntegerDigits(3); Set fieldKeys = new HashSet(); int i;/*from w w w . j a v a 2 s. com*/ setSchemaName("fylkesBibSchema"); switch (pageNumber) { case 1: break; case 2: for (i = 13; i <= 14; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 16; i <= 17; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 19; i <= 20; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 22; i <= 23; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 31; i <= 32; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 34; i <= 35; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 37; i <= 38; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 40; i <= 41; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 46; i <= 47; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 49; i <= 50; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 58; i <= 59; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 61; i <= 62; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 64; i <= 65; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 365; i <= 366; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 385; i <= 386; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 3: for (i = 276; i <= 343; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 344; i <= 355; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 362; i <= 364; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 481; i <= 483; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 485)); break; case 4: fieldKeys.add(fieldNameFormater.format((long) 122)); fieldKeys.add(fieldNameFormater.format((long) 125)); fieldKeys.add(fieldNameFormater.format((long) 143)); for (i = 146; i <= 147; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 268; i <= 275; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 367; i <= 370; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 392; i <= 394; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 404)); fieldKeys.add(fieldNameFormater.format((long) 484)); break; case 5: for (i = 205; i <= 210; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 215; i <= 216; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 219; i <= 224; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 381; i <= 382; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 401; i <= 402; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; default: break; } logger.debug("Keys to validate: " + fieldKeys); setValidateFieldKeys(fieldKeys); super.validate(obj, errors); }
From source file:StopWatch.java
/** * Return a string with a table describing all tasks performed. * For custom reporting, call getTaskInfo() and use the task info directly. *//* w ww. j av a2 s. c o m*/ public String prettyPrint() { StringBuffer sb = new StringBuffer(shortSummary()); sb.append('\n'); if (!this.keepTaskList) { sb.append("No task info kept"); } else { TaskInfo[] tasks = getTaskInfo(); sb.append("-----------------------------------------\n"); sb.append("ms % Task name\n"); sb.append("-----------------------------------------\n"); NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumIntegerDigits(5); nf.setGroupingUsed(false); NumberFormat pf = NumberFormat.getPercentInstance(); pf.setMinimumIntegerDigits(3); pf.setGroupingUsed(false); for (int i = 0; i < tasks.length; i++) { sb.append(nf.format(tasks[i].getTimeMillis()) + " "); sb.append(pf.format(tasks[i].getTimeSeconds() / getTotalTimeSeconds()) + " "); sb.append(tasks[i].getTaskName() + "\n"); } } return sb.toString(); }
From source file:no.abmu.abmstatistikk.annualstatistic.service.FengselBibValidator.java
public void validate(Object obj, Errors errors) { NumberFormat fieldNameFormater = NumberFormat.getNumberInstance(); fieldNameFormater.setMinimumIntegerDigits(3); Set fieldKeys = new HashSet(); int i;//from w w w .j ava2 s . c o m setSchemaName("fengselBibSchema"); switch (pageNumber) { case 1: break; case 2: for (i = 19; i <= 20; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 22; i <= 23; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 34; i <= 35; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 40; i <= 41; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 49; i <= 50; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 58; i <= 59; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 385; i <= 387; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 3: fieldKeys.add(fieldNameFormater.format((long) 82)); for (i = 84; i <= 86; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 90)); fieldKeys.add(fieldNameFormater.format((long) 97)); for (i = 99; i <= 100; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 258)); fieldKeys.add(fieldNameFormater.format((long) 374)); fieldKeys.add(fieldNameFormater.format((long) 389)); for (i = 435; i <= 438; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 441; i <= 442; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 445; i <= 446; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 449; i <= 452; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; case 4: for (i = 102; i <= 107; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 117; i <= 119; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 147)); fieldKeys.add(fieldNameFormater.format((long) 164)); for (i = 205; i <= 210; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 384)); for (i = 223; i <= 224; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 401; i <= 402; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 225)); break; case 5: for (i = 243; i <= 254; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } for (i = 259; i <= 264; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } fieldKeys.add(fieldNameFormater.format((long) 266)); for (i = 381; i <= 382; i++) { fieldKeys.add(fieldNameFormater.format((long) i)); } break; default: break; } if (logger.isDebugEnabled()) { logger.debug("Keys to validate: " + fieldKeys); } setValidateFieldKeys(fieldKeys); super.validate(obj, errors); }
From source file:org.asqatasun.webapp.command.factory.ChangeTestWeightCommandFactory.java
/** * //ww w . j a v a 2s . c om * @param user * @param locale * @param testList * @param referentialKey * @return * an initialised instance of ChangeTestWeightCommand */ public ChangeTestWeightCommand getChangeTestWeightCommand(User user, Locale locale, Collection<Test> testList, String referentialKey) { Map<String, String> userTestWeight = new HashMap<String, String>(); NumberFormat nf = NumberFormat.getNumberInstance(locale); nf.setMinimumFractionDigits(1); nf.setMaximumFractionDigits(1); nf.setMaximumIntegerDigits(1); nf.setMinimumIntegerDigits(1); for (OptionElement oe : optionElementDataService.getOptionElementFromUserAndFamilyCode(user, referentialKey + "_" + optionFamilyCodeStr)) { userTestWeight.put(oe.getOption().getCode(), nf.format(Double.valueOf(oe.getValue()))); } for (Test test : testList) { if (!userTestWeight.containsKey(test.getCode())) { userTestWeight.put(test.getCode(), ""); } } ChangeTestWeightCommand changeTestWeightCommand = new ChangeTestWeightCommand(); changeTestWeightCommand.setTestWeightMap(userTestWeight); return changeTestWeightCommand; }