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


Java PrintTools.sprintf方法代码示例

本文整理汇总了Java中io.github.htools.lib.PrintTools.sprintf方法的典型用法代码示例。如果您正苦于以下问题:Java PrintTools.sprintf方法的具体用法?Java PrintTools.sprintf怎么用?Java PrintTools.sprintf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.github.htools.lib.PrintTools的用法示例。


在下文中一共展示了PrintTools.sprintf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOutfile

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public static String getOutfile(Context context) {
    try {
        if (HashPartitioner.class.isAssignableFrom(context.getPartitionerClass())) {
            String outpath = context.getConfiguration().get(HPCONFIG);
            if (outpath != null) {
            int partition = Job.getReducerId(context);
            return PrintTools.sprintf("%s/partition.%5d", outpath, partition);
            } else {
                log.info("must use setOutPath on HashPartitioner");
            }
        }
    } catch (ClassNotFoundException ex) {
        log.exception(ex, "HashPartitioner");
    }
    throw new RuntimeException("fatal");
}
 
开发者ID:htools,项目名称:htools,代码行数:17,代码来源:HashPartitioner.java

示例2: list

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public static void list(ModelSpeed f, String settings[]) {
   f.openRead();
   ArrayMap<Integer, String> sorted = new ArrayMap();
   NOTOK:
   for (Record r : f.getKeys()) {
      String qid = PrintTools.sprintf("%.6f", r.time);
      if (settings != null) {
      OK:
      for (String s : settings) {
         if (s.equals(Integer.toString(r.query))) {
            continue OK;
         }
         if (s.equals(r.strategy))
               continue OK;
         }
         continue NOTOK;
      
      }
      sorted.add(r.query, r.time + " " + r.strategy);
   }
   for (Map.Entry<Integer,String> e : sorted.ascending()) {
      log.printf("%03d %s", e.getKey(), e.getValue());
   }
}
 
开发者ID:repir,项目名称:repirproximity,代码行数:25,代码来源:listspeed.java

示例3: remove

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public static void remove(ModelParameters f, String settings[]) {
   f.openRead();
   ArrayList<Record> sorted = new ArrayList<Record>();
   NOTOK:
   for (Record r : f.getKeys()) {
      String map = PrintTools.sprintf("%.6f", r.map);
      OK:
      for (String s : settings) {
         if (map.equalsIgnoreCase(s)) {
            continue OK;
         }
         for (Map.Entry<String, String> e : r.parameters.entrySet()) {
            if (e.getKey().equals(s) || e.getValue().equals(s)) {
               continue OK;
            }
         }
         continue NOTOK;
      }
      sorted.add(r);
   }
   f.remove(sorted);
}
 
开发者ID:repir,项目名称:repirproximity,代码行数:23,代码来源:rmtune.java

示例4: waitForUnlock

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public void waitForUnlock() {
    if (lockIsMine) {
        throw new RuntimeException(PrintTools.sprintf("Cannot wait for unlock I have: %s", this.filename));
    }
    if (this.fs != null) {
        HDFSOut.waitForUnlock(fs, filename, lockfile);
    } else {
        FSFileOutBuffer.waitForUnlock(filename, lockfile);
    }
}
 
开发者ID:htools,项目名称:htools,代码行数:11,代码来源:Datafile.java

示例5: printf

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public void printf(String format, Object... args) {
    if (!isWriteOpen()) {
        this.openWrite();
    }
    String s = PrintTools.sprintf(format, args);
    //log.info("printf( %s )", s);
    rwbuffer.print(s);
}
 
开发者ID:htools,项目名称:htools,代码行数:9,代码来源:Datafile.java

示例6: openRead

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
@Override
public void openRead() throws FileIntegrityException {
   if (residenttable == null) {
      if (super.getLength() > 0) {
         R closingrecord = closingRecord();
         boolean isproperlyclosed = false;
         int attempt = 0;
         do {
            if (residenttable != null) {
               log.sleep(RandomTools.getInt(10000));
            }
            residenttable = new HashMap<R, R>();
            super.openRead();
            if (isReadOpen()) {
               setOffset(0);
               while (nextRecord()) {
                  R r = newRecord();
                  r.read(this);
                  if (r.equals(closingrecord)) {
                     isproperlyclosed = true;
                  } else {
                     residenttable.put(r, r);
                     isproperlyclosed = false;
                  }
               }
            }
            super.closeRead();
         } while (attempt++ <= 20 && !isproperlyclosed);
         if (!isproperlyclosed) {
            throw new FileIntegrityException(PrintTools.sprintf("File integrity, file not ended properly: %s", this.getDatafile().getCanonicalPath()));
         }
      } else {
         residenttable = new HashMap<R, R>();
      }
   }
}
 
开发者ID:htools,项目名称:htools,代码行数:37,代码来源:StructuredFileKeyValue.java

示例7: unlock

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public void unlock() {
    if (!lockIsMine) {
        throw new RuntimeException(PrintTools.sprintf("Cannot unlock a file I havnt locked: %s", this.filename));
    }
    if (this.fs != null) {
        HDFSOut.unlock(fs, lockfile);
    } else {
        FSFileOutBuffer.unlock(lockfile);
    }
    lockIsMine = false;
}
 
开发者ID:htools,项目名称:htools,代码行数:12,代码来源:Datafile.java

示例8: openRead

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
@Override
public void openRead() {
   if (residenttable == null) {
      if (super.getLength() > 0) {
         R closingrecord = closingRecord();
         boolean isproperlyclosed = false;
         boolean containsdata = false;
         //for (int attempt = 0; !isclosed && attempt < 10; attempt++) {
         int attempt = 0;
         do {
            if (residenttable != null) {
               log.sleep(RandomTools.getInt(10000));
            }
            residenttable = new HashMap<R, R>();
            super.openRead();
            if (isReadOpen()) {
               setOffset(0);
               while (nextRecord()) {
                  containsdata = true;
                  R r = newRecord();
                  r.read(this);
                  if (r.equals(closingrecord)) {
                     isproperlyclosed = true;
                  } else {
                     residenttable.put(r, r);
                     isproperlyclosed = false;
                  }
               }
            }
            super.closeRead();
         } while (attempt++ <= 20 && !isproperlyclosed);
         if (containsdata && !isproperlyclosed) {
            throw new FileIntegrityException(PrintTools.sprintf("File integrity, file not ended properly: %s", this.getDatafile().getCanonicalPath()));
         }
      } else {
         residenttable = new HashMap<R, R>();
      }
      datastorage = createDatafile(new Datafile(getDatafile().getSubFile(".data")));
   }
}
 
开发者ID:htools,项目名称:htools,代码行数:41,代码来源:StructuredFileKey.java

示例9: openAppend

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
@Override
public void openAppend() {
   if (!getDatafile().hasLock())
      throw new RuntimeException(PrintTools.sprintf("Should lock file before append: %s", getDatafile().getName()));
   if (residenttable == null) {
      openRead();
   }
   this.resetNextField();
   datastorage.openAppend();
}
 
开发者ID:htools,项目名称:htools,代码行数:11,代码来源:StructuredFileKey.java

示例10: lock

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public boolean lock() {
    if (lockIsMine) {
        throw new RuntimeException(PrintTools.sprintf("Cannot Double lock a file: %s", this.filename));
    }
    if (this.fs != null) {
        lockIsMine = HDFSOut.lock(fs, filename, lockfile);
    } else {
        lockIsMine = FSFileOutBuffer.lock(filename, lockfile);
    }
    return lockIsMine;
}
 
开发者ID:htools,项目名称:htools,代码行数:12,代码来源:Datafile.java

示例11: postReform

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
/**
 * Unless set manually, phrases need a pre-pass to determine their corpus
 * statistics, in the reformulation the obtained corpus statistics are
 * included in the query. If the obtained cf is 0, the featureproximity is
 * left out.
 * <p/>
 * @return
 */
@Override
public String postReform() {
   String rf = postReformUnweighted();
   if (queryweight != 1 && queryweight != 0) {
      return PrintTools.sprintf("%s#%e", rf, queryweight);
   } else {
      return rf;
   }
}
 
开发者ID:repir,项目名称:repir,代码行数:18,代码来源:ProximityOperator.java

示例12: postReform

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
@Override
public String postReform() {
   String rf = postReformUnweighted();
   if (getQueryWeight() != 1 && getQueryWeight() != 0) {
      return PrintTools.sprintf("%s#%e", rf, getQueryWeight());
   } else
      return rf;
}
 
开发者ID:repir,项目名称:repir,代码行数:9,代码来源:SynonymOperator.java

示例13: reformulate

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public static String reformulate(Operator r) {
   String rf = reformulateUnweighted(r);
   if (r.getQueryWeight() != 1 && r.getQueryWeight() != 0) {
      rf = PrintTools.sprintf("%s#%g", rf, r.getQueryWeight());
   }
   return rf;
}
 
开发者ID:repir,项目名称:repir,代码行数:8,代码来源:GraphRoot.java

示例14: getStoredFeatureFile

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public Datafile getStoredFeatureFile(int segment) {
   if (segment == -1)
      log.crash();
   Datafile datafile;
   String name = getCanonicalName();
   name = name.replaceFirst(":", ".");
   String path = repository.configuredString(name.toLowerCase() + ".path");
   if (path != null && path.length() > 0)
      datafile = new Datafile( repository.fs, PrintTools.sprintf("%s.%04d", path, segment));
   else
      datafile = repository.basedir.getFile(PrintTools.sprintf("%s/%s.%s.%04d", getFeatureFolder(), repository.getPrefix(), getFileNameSuffix(), segment));
   return datafile;
}
 
开发者ID:repir,项目名称:repir,代码行数:14,代码来源:StoredFeature.java

示例15: reportString

import io.github.htools.lib.PrintTools; //导入方法依赖的package包/类
public String reportString() {
    return PrintTools.sprintf("Section( content %s start %d innerstart %d innerend %d end %d endreached %b found %b)",
            ByteTools.toString(haystack, start, end), start, innerstart, innerend, end, endreached, found());
}
 
开发者ID:htools,项目名称:htools,代码行数:5,代码来源:ByteSearchSection.java


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