weka.core.Utils.padLeft()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中weka.core.Utils.padLeft()方法的一些代码示例,展示了Utils.padLeft()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.padLeft()方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:padLeft

Utils.padLeft介绍

[英]Pads a string to a specified length, inserting spaces on the left as required. If the string is too long, characters are removed (from the right).
[中]将字符串填充到指定长度,根据需要在左侧插入空格。如果字符串太长,将删除字符(从右侧)。

代码示例

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * returns a string representation (#RGB) of the given color
 */
protected String colorToString(Color c) {
 String result;
 result = "#" + Utils.padLeft(Integer.toHexString(c.getRed()), 2)
  + Utils.padLeft(Integer.toHexString(c.getGreen()), 2)
  + Utils.padLeft(Integer.toHexString(c.getBlue()), 2);
 result = result.replaceAll("\\ ", "0").toUpperCase();
 return result;
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * returns a string representation (#RGB) of the given color
 */
protected String colorToString(Color c) {
 String result;
 result = "#" + Utils.padLeft(Integer.toHexString(c.getRed()), 2)
  + Utils.padLeft(Integer.toHexString(c.getGreen()), 2)
  + Utils.padLeft(Integer.toHexString(c.getBlue()), 2);
 result = result.replaceAll("\\ ", "0").toUpperCase();
 return result;
}

代码示例来源:origin: nz.ac.waikato.cms.weka/meka

public static String hashmapToString(HashMap<?,?> hm) {
  StringBuilder sb = new StringBuilder();
  for (Object k : hm.keySet()) {
    sb.append(Utils.padLeft(k.toString(),20)).append(" : ").append(hm.get(k)).append('\n');
  }
  return sb.toString();
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

private static void printPackageInfo(Map<?, ?> packageProps) {
 Set<?> keys = packageProps.keySet();
 Iterator<?> i = keys.iterator();
 while (i.hasNext()) {
  Object key = i.next();
  Object value = packageProps.get(key);
  System.out.println(Utils.padLeft(key.toString(), 11) + ":\t"
   + value.toString());
 }
}

代码示例来源:origin: Waikato/weka-trunk

private static void printPackageInfo(Map<?, ?> packageProps) {
 Set<?> keys = packageProps.keySet();
 Iterator<?> i = keys.iterator();
 while (i.hasNext()) {
  Object key = i.next();
  Object value = packageProps.get(key);
  System.out.println(Utils.padLeft(key.toString(), 11) + ":\t"
   + value.toString());
 }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/meka

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();  
  for (String v : output.keySet()) {
    sb.append(Utils.padLeft(v,20));
    sb.append(" : ");
    sb.append(Utils.doubleToString(output.get(v),5,3));
    sb.append('\n');
  }
  return MLUtils.hashmapToString(info) + "\n" + sb.toString() + "\n" + MLUtils.hashmapToString(vals);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

sb.append(Utils.padLeft("Type", 4)).append(Utils.padLeft("Nom", 5));
sb.append(Utils.padLeft("Int", 5)).append(Utils.padLeft("Real", 5));
sb.append(Utils.padLeft("Missing", 12));
sb.append(Utils.padLeft("Unique", 12));
sb.append(Utils.padLeft("Dist", 6));
if (nominalCounts != null) {
 sb.append(' ');
 for (int i = 0; i < nominalCounts.length; i++) {
  sb.append(Utils.padLeft("C[" + i + "]", 5));
percent = Math.round(100.0 * intCount / totalCount);
if (nominalCounts != null) {
 sb.append(Utils.padLeft("Nom", 4)).append(' ');
 sb.append(Utils.padLeft("" + percent, 3)).append("% ");
 sb.append(Utils.padLeft("" + 0, 3)).append("% ");
} else {
 sb.append(Utils.padLeft("Num", 4)).append(' ');
 sb.append(Utils.padLeft("" + 0, 3)).append("% ");
 sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + missingCount, 5)).append(" /");
percent = Math.round(100.0 * missingCount / totalCount);
sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + uniqueCount, 5)).append(" /");
percent = Math.round(100.0 * uniqueCount / totalCount);
sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + distinctCount, 5)).append(' ');
if (nominalCounts != null) {

代码示例来源:origin: Waikato/weka-trunk

sb.append(Utils.padLeft("Type", 4)).append(Utils.padLeft("Nom", 5));
sb.append(Utils.padLeft("Int", 5)).append(Utils.padLeft("Real", 5));
sb.append(Utils.padLeft("Missing", 12));
sb.append(Utils.padLeft("Unique", 12));
sb.append(Utils.padLeft("Dist", 6));
if (nominalCounts != null) {
 sb.append(' ');
 for (int i = 0; i < nominalCounts.length; i++) {
  sb.append(Utils.padLeft("C[" + i + "]", 5));
percent = Math.round(100.0 * intCount / totalCount);
if (nominalCounts != null) {
 sb.append(Utils.padLeft("Nom", 4)).append(' ');
 sb.append(Utils.padLeft("" + percent, 3)).append("% ");
 sb.append(Utils.padLeft("" + 0, 3)).append("% ");
} else {
 sb.append(Utils.padLeft("Num", 4)).append(' ');
 sb.append(Utils.padLeft("" + 0, 3)).append("% ");
 sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + missingCount, 5)).append(" /");
percent = Math.round(100.0 * missingCount / totalCount);
sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + uniqueCount, 5)).append(" /");
percent = Math.round(100.0 * uniqueCount / totalCount);
sb.append(Utils.padLeft("" + percent, 3)).append("% ");
sb.append(Utils.padLeft("" + distinctCount, 5)).append(' ');
if (nominalCounts != null) {

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

width = Math.max(2 + (int) (Math.log(biggest) / Math.log(10)),
 ">-<".length());
result = Utils.padLeft(">-<", width) + ' ' + Utils.padLeft(">", width)
 + ' ' + Utils.padLeft("<", width) + " Resultset\n";
 result += Utils.padLeft("" + m_RankingDiff[curr], width) + ' '
  + Utils.padLeft("" + m_RankingWins[curr], width) + ' '
  + Utils.padLeft("" + m_RankingLosses[curr], width) + ' '
  + removeFilterName(m_ColNames[curr]) + '\n';

代码示例来源:origin: Waikato/weka-trunk

width = Math.max(2 + (int) (Math.log(biggest) / Math.log(10)),
 ">-<".length());
result = Utils.padLeft(">-<", width) + ' ' + Utils.padLeft(">", width)
 + ' ' + Utils.padLeft("<", width) + " Resultset\n";
 result += Utils.padLeft("" + m_RankingDiff[curr], width) + ' '
  + Utils.padLeft("" + m_RankingWins[curr], width) + ' '
  + Utils.padLeft("" + m_RankingLosses[curr], width) + ' '
  + removeFilterName(m_ColNames[curr]) + '\n';

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

+ Utils.padLeft("" + m_RankingDiff[curr], width) 
+ " & " + Utils.padLeft("" + m_RankingWins[curr], width)
+ " & " + Utils.padLeft("" + m_RankingLosses[curr], width)
+ "\\\\\n";

代码示例来源:origin: Waikato/weka-trunk

+ Utils.padLeft("" + m_RankingDiff[curr], width) 
+ " & " + Utils.padLeft("" + m_RankingWins[curr], width)
+ " & " + Utils.padLeft("" + m_RankingLosses[curr], width)
+ "\\\\\n";

代码示例来源:origin: Waikato/weka-trunk

result.append(Utils.padLeft(m_data.classAttribute().value(i), 11))
 .append("\t");
  result.append("<laplace=1>\t");
 } else {
  result.append(Utils.padLeft(Double.toString(c.m_count), 11)).append(
   "\t");

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

result.append(Utils.padLeft(m_data.classAttribute().value(i), 11))
 .append("\t");
  result.append("<laplace=1>\t");
 } else {
  result.append(Utils.padLeft(Double.toString(c.m_count), 11)).append(
   "\t");

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

+ Utils.padLeft("" + getSummaryTitle(i), resultsetLength * 2 + 3);
 result += Utils.padLeft("-", resultsetLength * 2 + 3);
} else {
 result += Utils.padLeft("" + m_NonSigWins[i][j] + " (" + m_Wins[i][j]
  + ")", resultsetLength * 2 + 3);

代码示例来源:origin: Waikato/weka-trunk

+ Utils.padLeft("" + getSummaryTitle(i), resultsetLength * 2 + 3);
 result += Utils.padLeft("-", resultsetLength * 2 + 3);
} else {
 result += Utils.padLeft("" + m_NonSigWins[i][j] + " (" + m_Wins[i][j]
  + ")", resultsetLength * 2 + 3);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

content = Utils.padLeft("-", resultsetLength * 2 + 3);
else
 content = Utils.padLeft("" + m_NonSigWins[i][j] 
               + " (" + m_Wins[i][j] + ")",
       resultsetLength * 2 + 3);

代码示例来源:origin: Waikato/weka-trunk

content = Utils.padLeft("-", resultsetLength * 2 + 3);
else
 content = Utils.padLeft("" + m_NonSigWins[i][j] 
               + " (" + m_Wins[i][j] + ")",
       resultsetLength * 2 + 3);

代码示例来源:origin: Waikato/weka-trunk

titles += ' ' + Utils.padLeft("" + getSummaryTitle(i),
       resultsetLength * 2 + 3);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

titles += ' ' + Utils.padLeft("" + getSummaryTitle(i),
       resultsetLength * 2 + 3);

相关文章

微信公众号

最新文章

更多