private boolean contains(final BaseRowSnapshot row) { return this.rowSet.contains(row); }
public boolean isVisible( Entity entity ) { return Objects.equals( entity, this.player ) || this.visible.contains( entity ); }
/** Returns true if the URI should be crawled. For this to happen, the URI must * not have been already visited, its extension * must be <samp>.html</samp>, <samp>.html</samp> or <samp>.php</samp>, it * must be absolute, and its host must end with {@link #domain}. * * @param uri a URI to check. * @return true if it should be crawled. */ private boolean accept( final URI uri ) { return ( uri.isAbsolute() && ( uri.getPath() == null || uri.getPath().endsWith( ".html" ) || uri.getPath().endsWith( ".htm" ) || uri.getPath().endsWith( ".php" ) || uri.getPath().endsWith( "/" ) ) && ( uri.getHost() != null && uri.getHost().endsWith( domain ) ) && ! visitedURIs.contains( uri ) ); }
private CountsReader getCountsReader(String chr) throws IOException { if (ids.contains(chr)) { return counts.getCountReader(chr); } if (!someIdsStartWithChr) { CountsReader reader = counts.getCountReader(chr.replaceFirst("chr", "")); if (reader != null) return reader; } return counts.getCountReader(chr); }
/** * Determine the length of this segment between start and end position, including the number of afterRecord * included in the range. * * @param startPosition start position, inclusive * @param endPosition end position, inclusive * @return the number of records such that startPosition<=record.position=endPosition */ public int actualLength(int startPosition, int endPosition) { int count = 0; for (BaseInformationRecords.BaseInformation record : recordList) { if (record.getPosition() >= startPosition && record.getPosition() <= endPosition) { if (!getHiddenRecords().contains(record)) { count += 1; } count += getAfterRecords().getOrDefault(record, Collections.emptyList()).size(); } } return count; }
/** * Returns the complete list of records, including those interleaved with genomic positions (for insertion/deletion). * * @return */ public Iterable<BaseInformationRecords.BaseInformation> getAllRecords(int startPosition, int endPosition) { ObjectArrayList<BaseInformationRecords.BaseInformation> list = new ObjectArrayList(); for (BaseInformationRecords.BaseInformation record : recordList) { if (record.getPosition() >= startPosition && record.getPosition() < endPosition) { if (!getHiddenRecords().contains(record)) { list.add(record); } list.addAll(getAfterRecords().getOrDefault(record, Collections.emptyList())); } } return list; }
@Override public boolean retainAll(final Collection<?> c) { checkCollection(c); if (!c.isEmpty()) { ObjectSet<NodeImpl> set = new ObjectOpenHashSet(c.size()); for (Object o : c) { checkNonNullObject(o); checkNodeExists((NodeImpl) o); set.add((NodeImpl) o); } boolean changed = false; NodeStoreIterator itr = iterator(); while (itr.hasNext()) { NodeImpl e = itr.next(); if (!set.contains(e)) { itr.remove(); changed = true; } } return changed; } else { clear(); } return false; }
@Override public boolean retainAll(Collection<?> c) { checkCollection(c); if (!c.isEmpty()) { ObjectSet<EdgeImpl> set = new ObjectOpenHashSet(c.size()); for (Object o : c) { checkNonNullObject(o); checkEdgeExists((EdgeImpl) o); set.add((EdgeImpl) o); } boolean changed = false; EdgeStoreIterator itr = iterator(); while (itr.hasNext()) { EdgeImpl e = itr.next(); if (!set.contains(e)) { itr.remove(); changed = true; } } return changed; } else { clear(); } return false; }
/** * Returns the complete list of records, including those interleaved with genomic positions (for insertion/deletion). * * @return */ @Override public Iterable<BaseInformationRecords.BaseInformation> getAllRecords(int startPosition, int endPosition) { ObjectArrayList<BaseInformationRecords.BaseInformation> list = new ObjectArrayList(this.actualLength() * 3 / 2); for (BaseInformationRecords.BaseInformation record : parent.recordList) { if (record.getPosition() >= startPosition && record.getPosition() <= endPosition) { if (!getHiddenRecords().contains(record)) { list.add(record); } list.addAll(getAfterRecords().getOrDefault(record, Collections.emptyList())); } } return list; } @Override
public void addEntity( Entity entity ) { if ( !this.visible.contains( entity ) && !this.player.equals( entity ) ) { LOGGER.debug( "Spawning entity {} for {}", entity, this.player.getName() ); io.gomint.server.entity.Entity implEntity = (io.gomint.server.entity.Entity) entity; implEntity.preSpawn( this.player.getConnection() ); this.player.getConnection().addToSendQueue( implEntity.createSpawnPacket( this.player ) ); implEntity.postSpawn( this.player.getConnection() ); implEntity.attach( this.player ); this.visible.add( entity ); } }
@Override public boolean retainAll(Collection<?> c) { checkCollection(c); if (!c.isEmpty()) { ObjectSet<EdgeImpl> set = new ObjectOpenHashSet(c.size()); for (Object o : c) { checkNonNullObject(o); checkEdgeExists((EdgeImpl) o); set.add((EdgeImpl) o); } boolean changed = false; EdgeStoreIterator itr = iterator(); while (itr.hasNext()) { EdgeImpl e = itr.next(); if (!set.contains(e)) { itr.remove(); changed = true; } } return changed; } else { clear(); } return false; }
@Override public boolean retainAll(final Collection<?> c) { checkCollection(c); if (!c.isEmpty()) { ObjectSet<NodeImpl> set = new ObjectOpenHashSet(c.size()); for (Object o : c) { checkNonNullObject(o); checkNodeExists((NodeImpl) o); set.add((NodeImpl) o); } boolean changed = false; NodeStoreIterator itr = iterator(); while (itr.hasNext()) { NodeImpl e = itr.next(); if (!set.contains(e)) { itr.remove(); changed = true; } } return changed; } else { clear(); } return false; }
for (int n = 1; n <= carousel.maxNGram(); n++) { final NGram ngram = carousel.ngram(n); if (referenceNGrams.contains(ngram)) { if (counts.containsKey(ngram)) { counts.put(ngram, counts.getDouble(ngram) + 1.0);
if (keyMetadataPairSet.contains(pair)) { return false; } else {
private int visit(final Node<T> n, final Node<T> parent, final long nameLength, final int depth, ObjectOpenHashSet<Node<T>> nodes, ObjectOpenHashSet<Leaf<T>> leaves, ObjectOpenHashSet<T> references) { if (n == null) return 0; if (DEBUG) { for(int i = depth; i-- != 0;) System.err.print('\t'); System.err.println("Node " + n + " (name length: " + nameLength + ")" + (n.isInternal() ? " Jump left: " + ((InternalNode<T>)n).jumpLeft + " Jump right: " + ((InternalNode<T>)n).jumpRight : "")); } assert parent == null || parent.extent(transform).equals(n.extent(transform).subVector(0, ((InternalNode<T>)parent).extentLength)); assert nameLength <= n.extentLength(transform); assert n.nameLength == nameLength : n.nameLength + " != " + nameLength + " " + n; if (n.isInternal()) { assert references.add(((InternalNode<T>)n).reference.key); assert nodes.remove(n) : n; assert handle2Node.keySet().contains(n.handle(transform)) : n; /* Check that jumps are correct. */ final long jumpLength = ((InternalNode<T>)n).jumpLength(); Node<T> jumpLeft = ((InternalNode<T>)n).left; while(jumpLeft.isInternal() && jumpLength > ((InternalNode<T>)jumpLeft).extentLength) jumpLeft = ((InternalNode<T>)jumpLeft).left; assert jumpLeft == ((InternalNode<T>)n).jumpLeft : jumpLeft + " != " + ((InternalNode<T>)n).jumpLeft + " (node: " + n + ")"; Node<T> jumpRight = ((InternalNode<T>)n).right; while(jumpRight.isInternal() && jumpLength > ((InternalNode<T>)jumpRight).extentLength) jumpRight = ((InternalNode<T>)jumpRight).right; assert jumpRight == ((InternalNode<T>)n).jumpRight : jumpRight + " != " + ((InternalNode<T>)n).jumpRight + " (node: " + n + ")"; return 1 + visit(((InternalNode<T>)n).left, n, ((InternalNode<T>)n).extentLength + 1, depth + 1, nodes, leaves, references) + visit(((InternalNode<T>)n).right, n, n.extentLength(transform) + 1, depth + 1, nodes, leaves, references); } else { assert leaves.add((Leaf<T>)n); assert n.extentLength(transform) == n.key(transform).length(); return 1; } }
assertFalse("Chromosomes should occur in blocks." + " A chromosome that was used in a previous block of entry cannot occur again.", chromosomeSeen.contains(a.getChr())); previousChr = a.getChr(); chromosomeSeen.add(a.getChr());