本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntSet.clear方法的典型用法代码示例。如果您正苦于以下问题:Java IntSet.clear方法的具体用法?Java IntSet.clear怎么用?Java IntSet.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.IntSet
的用法示例。
在下文中一共展示了IntSet.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public void compute() {
ProgressLogger pl = new ProgressLogger(LOGGER, "pages");
pl.expectedUpdates = page2cat.size();
pl.start("Moving old categories to closest milestones...");
for (IntSet entry : page2cat.values()) {
IntSet newCategories = new IntOpenHashSet();
int milestone;
for (int cat : entry) {
milestone = closestMilestones[cat];
if (milestone != -1)
newCategories.add(milestone);
}
entry.clear();
entry.addAll(newCategories);
pl.lightUpdate();
}
pl.done();
}
示例2: phase1
import it.unimi.dsi.fastutil.ints.IntSet; //导入方法依赖的package包/类
public List<String> phase1(int id, String name, int numJCLThreads) {
Int2LongMap values = new Int2LongOpenHashMap(1000000);
long totalF = 0;
System.err.println("file: " + name);
try {
File f = new File("../" + name + "/" + name + ".bin");
InputStream in = new BufferedInputStream(new FileInputStream(f));
FastBufferedInputStream fb = new FastBufferedInputStream(in);
byte[] i = new byte[4];
while (fb.read(i) == 4) {
int k = java.nio.ByteBuffer.wrap(i).getInt();
if (!values.containsKey(k))
values.put(k, 1);
else {
long aux = values.get(k);
aux++;
values.put(k, aux);
}
totalF++;
}
fb.close();
in.close();
// primeira modificacao
//for (long v : values.values())
// totalF += v;
IntSet sorted = new IntAVLTreeSet(values.keySet());
long acumula = 0;
int b = 0;
List<String> result = new LinkedList<>();
long blinha = 0;
int last = 0;
for (int ac : sorted) {
blinha = values.get(ac);
acumula += blinha;
if (acumula > (totalF / (numJCLThreads))) {
b = ac;
result.add(b + ":" + acumula);
acumula = 0;
}
last = ac;
}
// segunda modificacao
if(acumula != 0) result.add(last + ":" + acumula);
JCL_facade jcl = JCL_FacadeImpl.getInstanceLambari();
jcl.instantiateGlobalVar(id, values);
sorted.clear();
sorted = null;
return result;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}