Refine search
public void prepare() throws InterruptedException { for (int i = this.currentSize; i < batchFileSize && !binlogList.isEmpty(); i++) { BinlogFile binlogFile = null; while (!binlogList.isEmpty()) { binlogFile = binlogList.poll(); if (!binlogFile.getHostInstanceID().equalsIgnoreCase(hostId)) { continue; } break; } if (binlogFile == null) { break; } this.downloadQueue.put(binlogFile); this.lastDownload = "mysql-bin." + binlogFile.getFileName(); this.currentSize++; } }
private static List<Class<?>> getInterfaces(Class<?> testClass) { LinkedList<Class<?>> queue = new LinkedList<Class<?>>(); queue.add(testClass); Set<Class<?>> visited = new HashSet<Class<?>>(); visited.add(testClass); List<Class<?>> results = new ArrayList<Class<?>>(); while (!queue.isEmpty()) { Class<?> anInterface = queue.poll(); results.add(anInterface); Class<?>[] parentInterfaces = anInterface.getInterfaces(); for (Class<?> parentInterface : parentInterfaces) { if (!visited.contains(parentInterface)) { visited.add(parentInterface); queue.add(parentInterface); } } } return results; } }
public ASTNode depthFirstSearch(ASTNode ast, int token) { searchQueue.clear(); searchQueue.add(ast); while (!searchQueue.isEmpty()) { ASTNode next = searchQueue.poll(); if (next.getType() == token) return next; for (int j = 0; j < next.getChildCount(); ++j) { searchQueue.add((ASTNode) next.getChild(j)); } } return null; }
private static List<Class<?>> getInterfaces(Class<?> testClass) { LinkedList<Class<?>> queue = new LinkedList<>(); queue.add(testClass); Set<Class<?>> visited = new HashSet<>(); visited.add(testClass); List<Class<?>> results = new ArrayList<>(); while (!queue.isEmpty()) { Class<?> anInterface = queue.poll(); results.add(anInterface); Class<?>[] parentInterfaces = anInterface.getInterfaces(); for (Class<?> parentInterface : parentInterfaces) { if (!visited.contains(parentInterface)) { visited.add(parentInterface); queue.add(parentInterface); } } } return results; } }
public ASTNode simpleBreadthFirstSearchAny(ASTNode ast, int... tokens) { searchQueue.clear(); searchQueue.add(ast); while (!searchQueue.isEmpty()) { ASTNode next = searchQueue.poll(); for (int i = 0; i < tokens.length; ++i) { if (next.getType() == tokens[i]) return next; } for (int i = 0; i < next.getChildCount(); ++i) { searchQueue.add((ASTNode) next.getChild(i)); } } return null; }
/** * Get the ancestors of a given set of {@link DagNode}s in the {@link Dag}. * @param dagNodes set of nodes in the {@link Dag}. * @return the union of all ancestors of dagNodes in the dag. */ private Set<DagNode<T>> getAncestorNodes(Set<DagNode<T>> dagNodes) { Set<DagNode<T>> ancestorNodes = new HashSet<>(); for (DagNode<T> dagNode : dagNodes) { LinkedList<DagNode<T>> nodesToExpand = Lists.newLinkedList(this.getParents(dagNode)); while (!nodesToExpand.isEmpty()) { DagNode<T> nextNode = nodesToExpand.poll(); ancestorNodes.add(nextNode); nodesToExpand.addAll(this.getParents(nextNode)); } } return ancestorNodes; }
public static void main(String args[]) throws IOException{ FileGroupReader fgr = new FileGroupReader("F:\\媒体 学习\\研一(下)\\cc"); EntityGroup eg=null;Instance in = null;int i = 0;int j = 0; while(!fgr.list.isEmpty()) { in= fgr.list.poll();eg=(EntityGroup) in.getData(); if(in.getTarget().toString().equals("1")){i++; } else j++; } System.out.print(i); System.out.print("\n"); System.out.print(j); } }
public ASTNode depthFirstSearch(ASTNode ast, int token) { searchQueue.clear(); searchQueue.add(ast); while (!searchQueue.isEmpty()) { ASTNode next = searchQueue.poll(); if (next.getType() == token) return next; for (int j = 0; j < next.getChildCount(); ++j) { searchQueue.add((ASTNode) next.getChild(j)); } } return null; }
g.hasTwin = true; goldMentionHeadPositions.get(g.headIndex).remove(g); if(goldMentionHeadPositions.get(g.headIndex).isEmpty()) { goldMentionHeadPositions.remove(g.headIndex); Mention g = goldMentionHeadPositions.get(r.headIndex).poll(); r.mentionID = g.mentionID; r.hasTwin = true; g.hasTwin = true; if(goldMentionHeadPositions.get(g.headIndex).isEmpty()) { goldMentionHeadPositions.remove(g.headIndex);
/** * Attempts to satisfy some or all of the already-issued futures from the local buffer. If the * buffer is empty or there are no futures, this method won't do anything. */ private void satisfyFuturesFromBuffer() { synchronized (futures) { synchronized (finishedTasks) { // attempt to satisfy futures until we run out of either futures or // finished tasks while ((!futures.isEmpty()) && (!finishedTasks.isEmpty())) { // Remove any expired tasks before attempting to fufill the future pruneExpiredTasks(); // Fufill the future from a non expired task if there is one. There is still a // slight chance that the first task could have expired between the time we // pruned and the time we fufill the future if (!finishedTasks.isEmpty()) { fufillFuture(futures.poll()); } } } } }
g.twinless = false; goldMentionHeadPositions.get(g.headIndex).remove(g); if(goldMentionHeadPositions.get(g.headIndex).isEmpty()) { goldMentionHeadPositions.remove(g.headIndex); Mention g = goldMentionHeadPositions.get(r.headIndex).poll(); r.mentionID = g.mentionID; r.twinless = false; g.twinless = false; if(goldMentionHeadPositions.get(g.headIndex).isEmpty()) { goldMentionHeadPositions.remove(g.headIndex);
private void setUpAcls(String path) throws Exception { List<ACL> acls = createSecureAcls(); LinkedList<String> paths = new LinkedList<>(); paths.add(path); while (!paths.isEmpty()) { String currentPath = paths.poll(); List<String> children = zooKeeperClient.getChildren().forPath(currentPath); if (children != null) { for (String child : children) { paths.add(currentPath + "/" + child); } } zooKeeperClient.setACL().withACL(acls).forPath(currentPath); } }
public ASTNode simpleBreadthFirstSearchAny(ASTNode ast, int... tokens) { searchQueue.clear(); searchQueue.add(ast); while (!searchQueue.isEmpty()) { ASTNode next = searchQueue.poll(); for (int i = 0; i < tokens.length; ++i) { if (next.getType() == tokens[i]) return next; } for (int i = 0; i < next.getChildCount(); ++i) { searchQueue.add((ASTNode) next.getChild(i)); } } return null; }
if(opts.isEmpty()){ opts.addFirst(current); return; while(!opts.isEmpty() && !(opts.peek() instanceof LBracketOpt)){ rpn.add(opts.poll()); opts.poll(); return; if(!opts.isEmpty() && opts.peek().fetchPriority() > current.fetchPriority()){ opts.addFirst(current); return; rpn.add(opts.poll()); break; rpn.add(opts.poll());
/** * Decomposes the provided {@code query} into terms with the exception of {@link PhraseQuery}. Is useful when * determining which terms should not be suggested. {@link PhraseQuery} is exempted because not suggesting some * term which were contained in it is invalid. * @param query query to decompose * @return terms that were in the {@code query} */ public static List<Term> intoTermsExceptPhraseQuery(final Query query) { if (query == null) { return Collections.emptyList(); } List<Term> terms = new LinkedList<>(); LinkedList<Query> queue = new LinkedList<>(); queue.add(query); while (!queue.isEmpty()) { Query q = queue.poll(); if (q instanceof BooleanQuery) { for (BooleanClause bc : ((BooleanQuery) q).clauses()) { queue.add(bc.getQuery()); } } else if (q instanceof TermQuery) { terms.add(((TermQuery) q).getTerm()); } } return terms; }
/** * Decomposes the provided {@code query} into terms. * @param query query to decompose * @return terms that were in the {@code query} */ public static List<Term> intoTerms(final Query query) { if (query == null) { return Collections.emptyList(); } List<Term> terms = new LinkedList<>(); LinkedList<Query> queue = new LinkedList<>(); queue.add(query); while (!queue.isEmpty()) { Query q = queue.poll(); if (q instanceof BooleanQuery) { for (BooleanClause bc : ((BooleanQuery) q).clauses()) { queue.add(bc.getQuery()); } } else if (q instanceof TermQuery) { terms.add(((TermQuery) q).getTerm()); } else if (q instanceof PhraseQuery) { terms.addAll(Arrays.asList(((PhraseQuery) q).getTerms())); } } return terms; }