本文整理汇总了Java中org.apache.hadoop.examples.pi.Util类的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Util类属于org.apache.hadoop.examples.pi包,在下文中一共展示了Util类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.hadoop.examples.pi.Util; //导入依赖的package包/类
/** main */
public static void main(String[] args) throws IOException {
final Util.Timer t = new Util.Timer(false);
computePi(t, 0);
computePi(t, 1);
computePi(t, 2);
computePi(t, 3);
computePi(t, 4);
Util.printBitSkipped(1008);
computePi(t, 1008);
computePi(t, 1012);
long b = 10;
for(int i = 0; i < 7; i++) {
Util.printBitSkipped(b);
computePi(t, b - 4);
computePi(t, b);
computePi(t, b + 4);
b *= 10;
}
}
示例2: valueOf
import org.apache.hadoop.examples.pi.Util; //导入依赖的package包/类
/** Covert a String to a Summation. */
public static Summation valueOf(final String s) {
int i = 1;
int j = s.indexOf("; ", i);
if (j < 0)
throw new IllegalArgumentException("i=" + i + ", j=" + j + " < 0, s=" + s);
final ArithmeticProgression N = ArithmeticProgression.valueOf(s.substring(i, j));
i = j + 2;
j = s.indexOf("]", i);
if (j < 0)
throw new IllegalArgumentException("i=" + i + ", j=" + j + " < 0, s=" + s);
final ArithmeticProgression E = ArithmeticProgression.valueOf(s.substring(i, j));
final Summation sigma = new Summation(N, E);
i = j + 1;
if (s.length() > i) {
final String value = Util.parseStringVariable("value", s.substring(i));
sigma.setValue(value.indexOf('.') < 0?
Double.longBitsToDouble(Long.parseLong(value)):
Double.parseDouble(value));
}
return sigma;
}
示例3: getSums
import org.apache.hadoop.examples.pi.Util; //导入依赖的package包/类
/** Get the sums for the Bellard formula. */
public static <T extends Container<Summation>> Map<Parameter, Sum> getSums(
long b, int partsPerSum, Map<Parameter, List<T>> existing) {
final Map<Parameter, Sum> sums = new TreeMap<Parameter, Sum>();
for(Parameter p : Parameter.values()) {
final Sum s = new Sum(b, p, partsPerSum, existing.get(p));
Util.out.println("put " + s);
sums.put(p, s);
}
return sums;
}
示例4: valueOf
import org.apache.hadoop.examples.pi.Util; //导入依赖的package包/类
/** Convert a String to an ArithmeticProgression. */
static ArithmeticProgression valueOf(final String s) {
int i = 2;
int j = s.indexOf(",delta=");
final long value = Util.parseLongVariable("value", s.substring(2, j));
i = j + 1;
j = s.indexOf(",limit=");
final long delta = Util.parseLongVariable("delta", s.substring(i, j));
i = j + 1;
final long limit = Util.parseLongVariable("limit", s.substring(i));
return new ArithmeticProgression(s.charAt(0), value, delta, limit);
}