+ offsets.length + " subtrees"); for (int j = 0; j < offsets.length; j++) { long skipVal = offsetsMap.get(offsets[j]); if (skipTiles != null && skipVal != -1) { int dzoom = ZOOM_TO_SKIP_FILTER_READ - ZOOM_TO_SKIP_FILTER;
int contOffset = (int) mp.get(offset); codedIS.seek(contOffset); int len = codedIS.readRawVarint32();
@Override public long get(int key) { if (key < 0 || key >= length) throw new IndexOutOfBoundsException(Integer.toString(key)); return data.get(key); }
private void startQueryFor(int k) { final double width = 1d / (5d*64d); final double dev = width/2d; final double mass = k * width + dev; final Set<MolecularFormula> formulas = query.findMolecularFormulasByMass(mass, dev + 1e-5); LoggerFactory.getLogger(this.getClass()).error("START QUERY FROM " + (mass-dev) + " TO " + (mass+dev)); shortLock.startWriting(); covered.put(k/64, covered.get(k/64) | (1l<<(k%64))); ++changes; try { for (MolecularFormula f : formulas) { known.add(f); } } finally { shortLock.finishWriting(); } }
private void checkMass(double mass) { final int k = (int)Math.floor(mass*5d*64d); final long mask = 1l<<(k%64); final int slot = k/64; boolean isCovered; while (true) { final long locked = shortLock.startReading(); isCovered = ((covered.get(slot) & mask) != 0); if (shortLock.canFinishReading(locked)) break; } if (!isCovered) { checkMassRange(mass, new Deviation(10)); } }
public void finish() throws IOException { body.close(); info("wrote " + bodyOffset + " bytes in body of matrix"); // write offset file info("generating header"); int sizeHeader = 16 + rowOffsets.size() * (4 + 8); body = new BufferedOutputStream(new FileOutputStream(path)); body.write(intToBytes(SparseMatrix.FILE_HEADER)); body.write(floatToBytes(vconf.minScore)); body.write(floatToBytes(vconf.maxScore)); body.write(intToBytes(rowOffsets.size())); // Next write row indexes in sorted order (4 bytes per row) int sortedIndexes[] = rowIndexes.toArray(); Arrays.sort(sortedIndexes); for (int rowIndex : sortedIndexes) { body.write(intToBytes(rowIndex)); } // Next write offsets for sorted indexes. (8 bytes per row) for (int rowIndex : sortedIndexes) { long rowOffset = rowOffsets.get(rowIndex); body.write(longToBytes(rowOffset + sizeHeader)); } InputStream r = new FileInputStream(bodyPath); // append other file IOUtils.copyLarge(r, body); r.close(); body.flush(); body.close(); info("wrote " + FileUtils.sizeOf(path) + " bytes to " + path); }
final long lastPressTime = keyPressTimes.get( e.getKeyCode() ); if ( lastPressTime != -1 && ( e.getWhen() - lastPressTime ) < DOUBLE_CLICK_INTERVAL ) doubleClick = true;
Long lastCheckTime = rootCheckTimeMap.get(r.getId()); if (null == lastCheckTime || lastCheckTime <= now - (checkPeriod * 1000)) { result.add(r);
public void finish() throws IOException { body.close(); info("wrote " + bodyOffset + " bytes in body of matrix"); // write offset file info("generating header"); int sizeHeader = 16 + rowOffsets.size() * (4 + 8); body = new BufferedOutputStream(new FileOutputStream(path)); body.write(intToBytes(SparseMatrix.FILE_HEADER)); body.write(floatToBytes(vconf.minScore)); body.write(floatToBytes(vconf.maxScore)); body.write(intToBytes(rowOffsets.size())); // Next write row indexes in sorted order (4 bytes per row) int sortedIndexes[] = rowIndexes.toArray(); Arrays.sort(sortedIndexes); for (int rowIndex : sortedIndexes) { body.write(intToBytes(rowIndex)); } // Next write offsets for sorted indexes. (8 bytes per row) for (int rowIndex : sortedIndexes) { long rowOffset = rowOffsets.get(rowIndex); body.write(longToBytes(rowOffset + sizeHeader)); } InputStream r = new FileInputStream(bodyPath); // append other file IOUtils.copyLarge(r, body); r.close(); body.flush(); body.close(); info("wrote " + FileUtils.sizeOf(path) + " bytes to " + path); }
long rowOffset = rowOffsets.get(rowIndex); body.write(longToBytes(rowOffset + sizeHeader));
long rowOffset = rowOffsets.get(rowIndex); body.write(longToBytes(rowOffset + sizeHeader));
shortLock.startWriting(); try { if (currentSlot>=0) covered.put(currentSlot, covered.get(currentSlot)|currentSlotValue); currentSlot = slot; currentSlotValue = covered.get(slot); if (currentSlotValue == -1l) { k = (slot+1)*64; covered.put(currentSlot, covered.get(currentSlot) | currentSlotValue); shortLock.finishWriting();
private boolean jumpedRecently(EntityPlayer player) { return lastJumpTracker.containsKey(player.getEntityId()) && player.getEntityWorld().getTotalWorldTime() - lastJumpTracker.get(player.getEntityId()) < 5; }