本文整理汇总了Java中it.unimi.dsi.fastutil.longs.LongArrayList.size方法的典型用法代码示例。如果您正苦于以下问题:Java LongArrayList.size方法的具体用法?Java LongArrayList.size怎么用?Java LongArrayList.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.longs.LongArrayList
的用法示例。
在下文中一共展示了LongArrayList.size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MultiThreadedPageRank
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
/**
* Constructs this object for running PageRank over a directed graph.
*
* @param graph the directed graph
* @param nodes nodes in the graph
* @param maxNodeId maximum node id
* @param dampingFactor damping factor
* @param maxIterations maximum number of iterations to run
* @param tolerance L1 norm threshold for convergence
* @param threads number of threads
*/
public MultiThreadedPageRank(OutIndexedDirectedGraph graph, LongArrayList nodes,
long maxNodeId, double dampingFactor, int maxIterations,
double tolerance, int threads) {
if (maxNodeId > Integer.MAX_VALUE) {
throw new UnsupportedOperationException("maxNodeId exceeds Integer.MAX_VALUE!");
}
this.graph = graph;
this.nodes = nodes;
this.maxNodeId = maxNodeId;
this.dampingFactor = dampingFactor;
this.nodeCount = nodes.size();
this.maxIterations = maxIterations;
this.tolerance = tolerance;
this.threads = threads;
}
示例2: encodeInProgress
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
@Override
protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress)
throws IOException {
if (!inProgress.isEmpty()) {
encoder.writeInt(inProgress.size());
for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) {
encoder.writeLong(entry.getKey()); // tx id
encoder.writeLong(entry.getValue().getExpiration());
encoder.writeLong(entry.getValue().getVisibilityUpperBound());
encoder.writeInt(entry.getValue().getType().ordinal());
// write checkpoint tx IDs
LongArrayList checkpointPointers = entry.getValue().getCheckpointWritePointers();
if (!checkpointPointers.isEmpty()) {
encoder.writeInt(checkpointPointers.size());
for (int i = 0; i < checkpointPointers.size(); i++) {
encoder.writeLong(checkpointPointers.getLong(i));
}
}
encoder.writeInt(0);
}
}
encoder.writeInt(0); // zero denotes end of list as per AVRO spec
}
示例3: ListIterator
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
private ListIterator(
final int listIndex,
final int valueBitSize,
final int minIntervalSize,
final InputBitStream inputBitStream,
final PebbleBytesStore bytesStore
) throws IOException {
super(listIndex, valueBitSize, minIntervalSize, inputBitStream, bytesStore);
final long offset = inputBitStream.position();
valuesMap = new LongArrayList();
long value;
while ((value = super.nextLong()) != -1) {
valuesMap.add(value);
}
inputBitStream.position(offset);
remainingElements = inputBitStream.readDelta() + valuesMap.size();
lastIndex = 0;
}
示例4: calculateConditions
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
public List<LongArrayList> calculateConditions(PositionListIndex partialUnique,
PositionListIndex PLICondition,
int frequency,
List<LongArrayList> unsatisfiedClusters) {
List<LongArrayList> result = new LinkedList<>();
Long2LongOpenHashMap uniqueHashMap = partialUnique.asHashMap();
LongArrayList touchedClusters = new LongArrayList();
nextCluster:
for (LongArrayList cluster : PLICondition.getClusters()) {
if (cluster.size() < frequency) {
continue;
}
int unsatisfactionCount = 0;
touchedClusters.clear();
for (long rowNumber : cluster) {
if (uniqueHashMap.containsKey(rowNumber)) {
if (touchedClusters.contains(uniqueHashMap.get(rowNumber))) {
unsatisfactionCount++;
} else {
touchedClusters.add(uniqueHashMap.get(rowNumber));
}
}
}
if (unsatisfactionCount == 0) {
result.add(cluster);
} else {
if ((cluster.size() - unsatisfactionCount) >= frequency) {
unsatisfiedClusters.add(cluster);
}
}
}
return result;
}
示例5: write
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
public void write(Way way) throws IOException {
writeString("<way id='");
writeLong(way.getId());
writeString("'>\n");
LongArrayList refs = way.getRefs();
for (int i = 0; i < refs.size(); i++) {
writeString("<nd ref='");
writeLong(refs.get(i));
writeString("'/>\n");
}
if (way.hasTags())
writeTags(way);
writeString("</way>\n");
}
示例6: InMemoryJoinHash
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
public InMemoryJoinHash(LongArrayList addresses, PagesHashStrategy pagesHashStrategy)
{
this.addresses = requireNonNull(addresses, "addresses is null");
this.pagesHashStrategy = requireNonNull(pagesHashStrategy, "pagesHashStrategy is null");
this.channelCount = pagesHashStrategy.getChannelCount();
// reserve memory for the arrays
int hashSize = HashCommon.arraySize(addresses.size(), 0.75f);
size = sizeOfIntArray(hashSize) + sizeOfBooleanArray(hashSize) + sizeOfIntArray(addresses.size())
+ sizeOf(addresses.elements()) + pagesHashStrategy.getSizeInBytes();
mask = hashSize - 1;
key = new int[hashSize];
Arrays.fill(key, -1);
this.positionLinks = new int[addresses.size()];
Arrays.fill(positionLinks, -1);
// index pages
for (int position = 0; position < addresses.size(); position++) {
int pos = getHashPosition(hashPosition(position), mask);
// look for an empty slot or a slot containing this key
while (key[pos] != -1) {
int currentKey = key[pos];
if (positionEqualsPosition(currentKey, position)) {
// found a slot for this key
// link the new key position to the current key position
positionLinks[position] = currentKey;
// key[pos] updated outside of this loop
break;
}
// increment position and mask to handler wrap around
pos = (pos + 1) & mask;
}
key[pos] = position;
}
}
示例7: countNotN
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
public static int countNotN(LongArrayList numbers, int numberNotToCount) {
return numbers.size() - countN(numbers, numberNotToCount);
}
示例8: ConditionEntry
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
public ConditionEntry(ColumnCombinationBitset condition, LongArrayList cluster) {
this.condition = new ColumnCombinationBitset(condition);
this.cluster = cluster.clone();
this.coverage = (float) ((cluster.size() * 100.0) / Dcucc.numberOfTuples);
}
示例9: main
import it.unimi.dsi.fastutil.longs.LongArrayList; //导入方法依赖的package包/类
public static void main(final String[] arg) throws JSAPException {
final SimpleJSAP jsap = new SimpleJSAP(TwoSizesLongBigListSpeedTest.class.getName(), "Tests the speed of rank/select implementations.",
new Parameter[] {
new UnflaggedOption("numElements", JSAP.INTSIZE_PARSER, "1Mi", JSAP.NOT_REQUIRED, JSAP.NOT_GREEDY, "The number of elements."),
new UnflaggedOption("density", JSAP.DOUBLE_PARSER, ".5", JSAP.NOT_REQUIRED, JSAP.NOT_GREEDY, "The density."),
new FlaggedOption("numPos", JSAP.INTSIZE_PARSER, "1Mi", JSAP.NOT_REQUIRED, 'p', "positions", "The number of positions to test"),
});
final JSAPResult jsapResult = jsap.parse(arg);
if (jsap.messagePrinted()) return;
final int numElements = jsapResult.getInt("numElements");
final double density = jsapResult.getDouble("density");
final int numPos = jsapResult.getInt("numPos");
final XoRoShiRo128PlusRandomGenerator random = new XoRoShiRo128PlusRandomGenerator(0);
final LongArrayList list = new LongArrayList(numElements);
for(long i = numElements; i-- != 0;) list.add(random.nextDouble() < density ? 0 : 100);
final int[] position = new int[numPos];
for(int i = numPos; i-- != 0;) position[i] = (random.nextInt() & 0x7FFFFFFF) % numElements;
final TwoSizesLongBigList twoSizes = new TwoSizesLongBigList(list);
final EliasFanoLongBigList eliasFano = new EliasFanoLongBigList(list);
final EliasFanoPrefixSumLongBigList eliasFanoPrefixSum = new EliasFanoPrefixSumLongBigList(list);
final long[] elements = list.elements();
for(int i = 1; i < list.size(); i++) elements[i] += elements[i - 1];
final EliasFanoMonotoneLongBigList monotone = new EliasFanoMonotoneLongBigList(list);
final EliasFanoMonotoneLongBigListTables tables = new EliasFanoMonotoneLongBigListTables(list);
long time;
for(int k = 10; k-- != 0;) {
System.out.println("=== LongArrayList === (" + list.size() * (long)Long.SIZE + " bits)");
time = - System.nanoTime();
for(int i = 0; i < numPos; i++) list.getLong(position[i]);
time += System.nanoTime();
System.err.println(time / 1E9 + "s, " + (double)time / numPos + " ns/get");
System.out.println("=== TwoSizesLongBigList === (" + twoSizes.numBits() + " bits)");
time = - System.nanoTime();
for(int i = 0; i < numPos; i++) twoSizes.getLong(position[i]);
time += System.nanoTime();
System.err.println(time / 1E9 + "s, " + (double)time / numPos + " ns/get");
System.out.println("=== EliasFanoPrefixSumLongBigList === (" + eliasFanoPrefixSum.numBits() + " bits)");
time = - System.nanoTime();
for(int i = 0; i < numPos; i++) eliasFanoPrefixSum.getLong(position[i]);
time += System.nanoTime();
System.err.println(time / 1E9 + "s, " + (double)time / numPos + " ns/get");
System.out.println("=== EliasFanoLongBigList === (" + eliasFano.numBits() + " bits)");
time = - System.nanoTime();
for(int i = 0; i < numPos; i++) eliasFano.getLong(position[i]);
time += System.nanoTime();
System.err.println(time / 1E9 + "s, " + (double)time / numPos + " ns/get");
System.out.println("=== EliasFanoMonotoneLongBigListTables === (" + tables.numBits() + " bits)");
time = - System.nanoTime();
for(int i = 0; i < numPos; i++) tables.getLong(position[i]);
time += System.nanoTime();
System.err.println(time / 1E9 + "s, " + (double)time / numPos + " ns/get");
System.out.println("=== EliasFanoMonotoneLongBigList === (" + monotone.numBits() + " bits)");
time = - System.nanoTime();
for(int i = 0; i < numPos; i++) monotone.getLong(position[i]);
time += System.nanoTime();
System.err.println(time / 1E9 + "s, " + (double)time / numPos + " ns/get");
}
}