当前位置: 首页>>代码示例>>Java>>正文


Java NumberFormat.setMinimumIntegerDigits方法代码示例

本文整理汇总了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);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:SystemLoadPanel.java

示例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();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:StopWatch.java

示例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);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:FileOutputFormat.java

示例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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:15,代码来源:GraphEditorWindow.java

示例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();
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:40,代码来源:DailyCalendar.java

示例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);
}
 
开发者ID:gaochao2000,项目名称:redis_util,代码行数:12,代码来源:UUIDServiceRedisImpl.java

示例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);
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:8,代码来源:UtilAll.java

示例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);
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:12,代码来源:UtilAll.java

示例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;
}
 
开发者ID:marvinmalkowskijr,项目名称:applecommander,代码行数:42,代码来源:RdosFileEntry.java

示例10: initialValue

import java.text.NumberFormat; //导入方法依赖的package包/类
@Override
public NumberFormat initialValue() {
  NumberFormat fmt = NumberFormat.getInstance();
  fmt.setGroupingUsed(false);
  fmt.setMinimumIntegerDigits(4);
  return fmt;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ApplicationId.java

示例11: initialValue

import java.text.NumberFormat; //导入方法依赖的package包/类
@Override
public NumberFormat initialValue() {
  NumberFormat fmt = NumberFormat.getInstance();
  fmt.setGroupingUsed(false);
  fmt.setMinimumIntegerDigits(6);
  return fmt;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ApplicationAttemptId.java

示例12: getFireAtTime

import java.text.NumberFormat; //导入方法依赖的package包/类
/**
 * Returns the fire time for the <CODE>NthIncludedDayTrigger</CODE> as a
 * string with the format &quot;HH:MM[:SS]&quot;, 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);
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:21,代码来源:NthIncludedDayTrigger.java

示例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;
}
 
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:10,代码来源:NumberAnchorGenerator.java

示例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;
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:42,代码来源:PascalFileEntry.java

示例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);
}
 
开发者ID:variflight,项目名称:feeyo-redisproxy,代码行数:8,代码来源:Util.java


注:本文中的java.text.NumberFormat.setMinimumIntegerDigits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。