本文整理汇总了Java中java.text.NumberFormat.setMinimumIntegerDigits方法的典型用法代码示例。如果您正苦于以下问题:Java NumberFormat.setMinimumIntegerDigits方法的具体用法?Java NumberFormat.setMinimumIntegerDigits怎么用?Java NumberFormat.setMinimumIntegerDigits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.text.NumberFormat
的用法示例。
在下文中一共展示了NumberFormat.setMinimumIntegerDigits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setNumberOfAgents
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Sets the number of agents.
* @param noAgents the new number of agents
*/
public void setNumberOfAgents(Integer noAgents) {
String displayText = null;
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(5);
nf.setMaximumIntegerDigits(5);
nf.setGroupingUsed(false);
if (noAgents==null) {
displayText = " " + nf.format(0) + " " + Language.translate("Agenten") + " ";
} else {
displayText = " " + nf.format(noAgents) + " " + Language.translate("Agenten") + " ";
}
jLabelAgentCount.setText(displayText);
}
示例2: prettyPrint
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Return a string with a table describing all tasks performed.
* For custom reporting, call getTaskInfo() and use the task info directly.
*/
public String prettyPrint() {
StringBuilder sb = new StringBuilder(shortSummary());
sb.append('\n');
if (!this.keepTaskList) {
sb.append("No task info kept");
} else {
sb.append("-----------------------------------------\n");
sb.append("ms % Task name\n");
sb.append("-----------------------------------------\n");
NumberFormat nf = NumberFormat.getNumberInstance(Locale.ROOT);
nf.setMinimumIntegerDigits(5);
nf.setGroupingUsed(false);
NumberFormat pf = NumberFormat.getPercentInstance(Locale.ROOT);
pf.setMinimumIntegerDigits(3);
pf.setGroupingUsed(false);
for (TaskInfo task : taskInfo()) {
sb.append(nf.format(task.getTime().millis())).append(" ");
sb.append(pf.format(task.getTime().secondsFrac() / totalTime().secondsFrac())).append(" ");
sb.append(task.getTaskName()).append("\n");
}
}
return sb.toString();
}
示例3: getUniqueName
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Helper function to generate a name that is unique for the task.
*
* <p>The generated name can be used to create custom files from within the
* different tasks for the job, the names for different tasks will not collide
* with each other.</p>
*
* <p>The given name is postfixed with the task type, 'm' for maps, 'r' for
* reduces and the task partition number. For example, give a name 'test'
* running on the first map o the job the generated name will be
* 'test-m-00000'.</p>
*
* @param conf the configuration for the job.
* @param name the name to make unique.
* @return a unique name accross all tasks of the job.
*/
public static String getUniqueName(JobConf conf, String name) {
int partition = conf.getInt(JobContext.TASK_PARTITION, -1);
if (partition == -1) {
throw new IllegalArgumentException(
"This method can only be called from within a Job");
}
String taskType = conf.getBoolean(JobContext.TASK_ISMAP,
JobContext.DEFAULT_TASK_ISMAP) ? "m" : "r";
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumIntegerDigits(5);
numberFormat.setGroupingUsed(false);
return name + "-" + taskType + "-" + numberFormat.format(partition);
}
示例4: convertFloat
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Convert a float to a string format
*
* @param f The float to convert
* @return The string formatted from the float
*/
private String convertFloat(float f) {
NumberFormat format = NumberFormat.getInstance();
format.setMinimumFractionDigits(2);
format.setMaximumFractionDigits(2);
format.setMinimumIntegerDigits(1);
format.setMaximumIntegerDigits(5);
return format.format(f);
}
示例5: toString
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Returns a string representing the properties of the
* <CODE>DailyCalendar</CODE>
*
* @return the properteis of the DailyCalendar in a String format
*/
public String toString() {
NumberFormat numberFormatter = NumberFormat.getNumberInstance();
numberFormatter.setMaximumFractionDigits(0);
numberFormatter.setMinimumIntegerDigits(2);
StringBuffer buffer = new StringBuffer();
buffer.append("base calendar: [");
if (getBaseCalendar() != null) {
buffer.append(getBaseCalendar().toString());
} else {
buffer.append("null");
}
buffer.append("], time range: '");
buffer.append(numberFormatter.format(rangeStartingHourOfDay));
buffer.append(":");
buffer.append(numberFormatter.format(rangeStartingMinute));
buffer.append(":");
buffer.append(numberFormatter.format(rangeStartingSecond));
buffer.append(":");
numberFormatter.setMinimumIntegerDigits(3);
buffer.append(numberFormatter.format(rangeStartingMillis));
numberFormatter.setMinimumIntegerDigits(2);
buffer.append(" - ");
buffer.append(numberFormatter.format(rangeEndingHourOfDay));
buffer.append(":");
buffer.append(numberFormatter.format(rangeEndingMinute));
buffer.append(":");
buffer.append(numberFormatter.format(rangeEndingSecond));
buffer.append(":");
numberFormatter.setMinimumIntegerDigits(3);
buffer.append(numberFormatter.format(rangeEndingMillis));
buffer.append("', inverted: " + invertTimeRange + "]");
return buffer.toString();
}
示例6: createUUID
import java.text.NumberFormat; //导入方法依赖的package包/类
private Long createUUID(Long num, String day, Integer length) {
String id = String.valueOf(num);
if (id.length() < length) {
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
nf.setMaximumIntegerDigits(length);
nf.setMinimumIntegerDigits(length);
id = nf.format(num);
}
return Long.parseLong(day + id);
}
示例7: offset2FileName
import java.text.NumberFormat; //导入方法依赖的package包/类
public static String offset2FileName(final long offset) {
final NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(20);
nf.setMaximumFractionDigits(0);
nf.setGroupingUsed(false);
return nf.format(offset);
}
示例8: offset2FileName
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* 将offset转化成字符串形式<br>
* 左补零对齐至20位
*/
public static String offset2FileName(final long offset) {
final NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(20);
nf.setMaximumFractionDigits(0);
nf.setGroupingUsed(false);
return nf.format(offset);
}
示例9: getFileColumnData
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Get the standard file column header information.
* This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk.
*/
public List getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance();
List list = new ArrayList();
switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(getFiletype());
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getSizeInBlocks()));
list.add(getFilename());
numberFormat.setMinimumIntegerDigits(1);
list.add(numberFormat.format(getSize()));
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getStartingBlock()));
break;
case FormattedDisk.FILE_DISPLAY_DETAIL:
list.add(getFiletype());
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getSizeInBlocks()));
list.add(getFilename());
numberFormat.setMinimumIntegerDigits(1);
list.add(numberFormat.format(getSize()));
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getStartingBlock()));
list.add("$" + AppleUtil.getFormattedWord(getAddress())); //$NON-NLS-1$
list.add(isDeleted() ? textBundle.get("Deleted") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
default: // FILE_DISPLAY_STANDARD
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;
}
示例10: initialValue
import java.text.NumberFormat; //导入方法依赖的package包/类
@Override
public NumberFormat initialValue() {
NumberFormat fmt = NumberFormat.getInstance();
fmt.setGroupingUsed(false);
fmt.setMinimumIntegerDigits(4);
return fmt;
}
示例11: initialValue
import java.text.NumberFormat; //导入方法依赖的package包/类
@Override
public NumberFormat initialValue() {
NumberFormat fmt = NumberFormat.getInstance();
fmt.setGroupingUsed(false);
fmt.setMinimumIntegerDigits(6);
return fmt;
}
示例12: getFireAtTime
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Returns the fire time for the <CODE>NthIncludedDayTrigger</CODE> as a
* string with the format "HH:MM[:SS]", with HH representing the
* 24-hour clock hour of the fire time. Seconds are optional and their
* inclusion depends on whether or not they were provided to
* {@link #setFireAtTime(String)}.
*
* @return the fire time for the trigger
* @see #setFireAtTime(String)
*/
public String getFireAtTime() {
NumberFormat format = NumberFormat.getNumberInstance();
format.setMaximumIntegerDigits(2);
format.setMinimumIntegerDigits(2);
format.setMaximumFractionDigits(0);
return format.format(this.fireAtHour) + ":" +
format.format(this.fireAtMinute) + ":" +
format.format(this.fireAtSecond);
}
示例13: nextAnchor
import java.text.NumberFormat; //导入方法依赖的package包/类
public String nextAnchor(Node node) {
this.lastAnchorId++;
NumberFormat format = NumberFormat.getNumberInstance();
format.setMinimumIntegerDigits(3);
format.setMaximumFractionDigits(0);// issue 172
format.setGroupingUsed(false);
String anchorId = format.format(this.lastAnchorId);
return "id" + anchorId;
}
示例14: getFileColumnData
import java.text.NumberFormat; //导入方法依赖的package包/类
/**
* Get the standard file column header information.
* This default implementation is intended only for standard mode.
* displayMode is specified in FormattedDisk.
*/
public List<String> getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat(
textBundle.get("PascalFileEntry.PascalDateFormat")); //$NON-NLS-1$
List<String> list = new ArrayList<>();
switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(dateFormat.format(getModificationDate()));
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getBlocksUsed()));
list.add(getFiletype());
list.add(getFilename());
break;
case FormattedDisk.FILE_DISPLAY_DETAIL:
list.add(dateFormat.format(getModificationDate()));
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getBlocksUsed()));
numberFormat.setMinimumIntegerDigits(1);
list.add(numberFormat.format(getBytesUsedInLastBlock()));
list.add(numberFormat.format(getSize()));
list.add(getFiletype());
list.add(getFilename());
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getFirstBlock()));
list.add(numberFormat.format(getLastBlock()-1));
break;
default: // FILE_DISPLAY_STANDARD
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;
}
示例15: offset2FileName
import java.text.NumberFormat; //导入方法依赖的package包/类
public static String offset2FileName(final long offset) {
final NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(20);
nf.setMaximumFractionDigits(0);
nf.setGroupingUsed(false);
return nf.format(offset);
}