当前位置: 首页>>代码示例>>Java>>正文


Java Queue.addAll方法代码示例

本文整理汇总了Java中java.util.Queue.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Queue.addAll方法的具体用法?Java Queue.addAll怎么用?Java Queue.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Queue的用法示例。


在下文中一共展示了Queue.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillQueueForKey

import java.util.Queue; //导入方法依赖的package包/类
@Override
public void fillQueueForKey(String keyName,
    Queue<EncryptedKeyVersion> keyQueue, int numEKVs) throws IOException {
  checkNotNull(keyName, "keyName");
  Map<String, String> params = new HashMap<String, String>();
  params.put(KMSRESTConstants.EEK_OP, KMSRESTConstants.EEK_GENERATE);
  params.put(KMSRESTConstants.EEK_NUM_KEYS, "" + numEKVs);
  URL url = createURL(KMSRESTConstants.KEY_RESOURCE, keyName,
      KMSRESTConstants.EEK_SUB_RESOURCE, params);
  HttpURLConnection conn = createConnection(url, HTTP_GET);
  conn.setRequestProperty(CONTENT_TYPE, APPLICATION_JSON_MIME);
  List response = call(conn, null,
      HttpURLConnection.HTTP_OK, List.class);
  List<EncryptedKeyVersion> ekvs =
      parseJSONEncKeyVersion(keyName, response);
  keyQueue.addAll(ekvs);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:KMSClientProvider.java

示例2: addFirst

import java.util.Queue; //导入方法依赖的package包/类
@Override
public ReceivePipelineCondition<T> addFirst(final OnReceiveTriple<T> pipelineService) {
	final PipelineReceiver<T> pipelineReceiver = new PipelineReceiver<>(pipelineService);

	if (isClosed()) {
		falseAdd(pipelineService);
	} else {
		final Queue<PipelineReceiver<T>> newCore = new LinkedList<>();
		newCore.add(pipelineReceiver);
		synchronized (core) {
			newCore.addAll(core);
			core.clear();
			core.addAll(newCore);
		}
		pipelineService.onRegistration();
	}

	return new ReceivePipelineConditionImpl<>(pipelineReceiver);
}
 
开发者ID:ThorbenKuck,项目名称:NetCom2,代码行数:20,代码来源:QueuedReceivePipeline.java

示例3: createCh

import java.util.Queue; //导入方法依赖的package包/类
/**
 * Take a competence node that is connected to the triggered action
 * that is associated with this widget and create children so it looks
 * like this widget is root of competence.
 *
 * In most widgets, one widget is representing one node.
 * This one is representing competence and this function is regenerating competence structure to widgets.
 */
private void createCh() {
    Queue<PoshElement> fringe = new LinkedList<PoshElement>();
    fringe.add(this.compNode);

    while (!fringe.isEmpty()) {
        PoshElement head = fringe.poll();

        Set<PoshElementListener> listeners = head.getElementListeners();

        for (PoshElementListener listener : listeners) {
            if (listener instanceof PoshWidget) {
                PoshWidget widget = (PoshWidget) listener;
                if (widget.isAncestor(this)) {
                    for (PoshElement child : head.getChildDataNodes()) {
                        widget.nodeChanged(PoshTreeEvent.NEW_CHILD_NODE, child);
                    }
                }
            }
        }

        fringe.addAll(head.getChildDataNodes());
    }

}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:33,代码来源:SimpleRoleCompetenceWidget.java

示例4: createConnectedComponent

import java.util.Queue; //导入方法依赖的package包/类
private static List<Integer> createConnectedComponent(HashMap<Integer, List<Integer>> graph, int root) {
	
	Queue<Integer> q = new ArrayDeque<>(); // next nodes to visit
	List<Integer> visited = new ArrayList<>(); // connected component so far
	q.add(root); // init queue

	while (!q.isEmpty()) {
		Integer poll = q.poll(); // get next node
		if (!visited.contains(poll)) { // if it's not already visited
			visited.add(poll); // visit it
			q.addAll(graph.get(poll)); // and put its neighbourhood in the queue
		}
	}
	visited.forEach(v -> graph.remove(v)); // removes the connected component from the graph
	return visited;
	
}
 
开发者ID:if0nz,项目名称:advent-of-code-2017,代码行数:18,代码来源:Day12.java

示例5: parse

import java.util.Queue; //导入方法依赖的package包/类
public Queue<Token> parse(String text) {
    final Queue<Token> tokens = new ArrayDeque<>();

    if (text != null) {
        text = text.trim();
        if (!text.isEmpty()) {
            boolean matchFound = false;
            for (InfoWrapper iw : infos) {
                final Matcher matcher = iw.pattern.matcher(text);
                if (matcher.find()) {
                    matchFound = true;
                    String match = matcher.group().trim();
                    tokens.add(iw.info.getToken(match));
                    tokens.addAll(parse(text.substring(match.length())));
                    break;
                }
            }
            if (!matchFound) {
                throw new DateCalcException("Could not parse the expression: " + text);
            }
        }
    }

    return tokens;
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:26,代码来源:DateCalcExpressionParser.java

示例6: deliverOutstandingMessages

import java.util.Queue; //导入方法依赖的package包/类
@DatabaseExecutor
private void deliverOutstandingMessages(ClientId c) {
	try {
		Queue<MessageId> pending = new LinkedList<MessageId>();
		Transaction txn = db.startTransaction(true);
		try {
			pending.addAll(db.getPendingMessages(txn, c));
			db.commitTransaction(txn);
		} finally {
			db.endTransaction(txn);
		}
		deliverNextPendingMessageAsync(pending);
	} catch (DbException e) {
		if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:17,代码来源:ValidationManagerImpl.java

示例7: gatherProcessInfo

import java.util.Queue; //导入方法依赖的package包/类
@Override
public void gatherProcessInfo(HtmlSection section, long pid) {
    Queue<Long> pids = new LinkedList<>();
    pids.add(pid);
    for (Long p = pids.poll(); p != null; p = pids.poll()) {
        HtmlSection pidSection = section.createChildren("" + p);
        for (ActionSet set : actions) {
            set.gatherProcessInfo(pidSection, p);
        }
        List<Long> children = helper.getChildren(pidSection, p);
        if (!children.isEmpty()) {
            HtmlSection s = pidSection.createChildren("children");
            for (Long c : children) {
                s.link(section, c.toString(), c.toString());
            }
            pids.addAll(children);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ToolKit.java

示例8: getListeners

import java.util.Queue; //导入方法依赖的package包/类
@Override
public Queue<AbstractEventListener> getListeners(EventType type)
{
	final Queue<AbstractEventListener> objectListenres = super.getListeners(type);
	final Queue<AbstractEventListener> templateListeners = getTemplate().getListeners(type);
	final Queue<AbstractEventListener> globalListeners = isNpc() && !isMonster() ? Containers.Npcs().getListeners(type) : isMonster() ? Containers.Monsters().getListeners(type) : isPlayer() ? Containers.Players().getListeners(type) : EmptyQueue.emptyQueue();
	
	// Attempt to do not create collection
	if (objectListenres.isEmpty() && templateListeners.isEmpty() && globalListeners.isEmpty())
	{
		return EmptyQueue.emptyQueue();
	}
	else if (!objectListenres.isEmpty() && templateListeners.isEmpty() && globalListeners.isEmpty())
	{
		return objectListenres;
	}
	else if (!templateListeners.isEmpty() && objectListenres.isEmpty() && globalListeners.isEmpty())
	{
		return templateListeners;
	}
	else if (!globalListeners.isEmpty() && objectListenres.isEmpty() && templateListeners.isEmpty())
	{
		return globalListeners;
	}
	
	final Queue<AbstractEventListener> both = new LinkedBlockingDeque<>(objectListenres.size() + templateListeners.size() + globalListeners.size());
	both.addAll(objectListenres);
	both.addAll(templateListeners);
	both.addAll(globalListeners);
	return both;
}
 
开发者ID:rubenswagner,项目名称:L2J-Global,代码行数:32,代码来源:L2Character.java

示例9: createCh

import java.util.Queue; //导入方法依赖的package包/类
/**
 * Create children of AP. In most widgets, one widget is representing one
 * node. This one is representing AP and this function is regenerating AP
 * structure to widgets.
 */
private void createCh() {
    Queue<PoshWidget<? extends PoshElement>> fringe = new LinkedList<PoshWidget<? extends PoshElement>>(createWidgetChildren(this, apNode));

    while (!fringe.isEmpty()) {
        PoshWidget<? extends PoshElement> headWidget = fringe.poll();
        PoshElement headDataNode = headWidget.getDataNode();

        if (!(headDataNode instanceof TriggeredAction)) {
            fringe.addAll(createWidgetChildren(headWidget, headDataNode));
        }
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:18,代码来源:SimpleRoleActionPatternWidget.java

示例10: fillQueueForKey

import java.util.Queue; //导入方法依赖的package包/类
@Override
public void fillQueueForKey(String keyName,
    Queue<EncryptedKeyVersion> keyQueue, int numKeys) throws IOException {
  List<EncryptedKeyVersion> retEdeks =
      new LinkedList<EncryptedKeyVersion>();
  for (int i = 0; i < numKeys; i++) {
    try {
      retEdeks.add(keyProviderCryptoExtension.generateEncryptedKey(
          keyName));
    } catch (GeneralSecurityException e) {
      throw new IOException(e);
    }
  }
  keyQueue.addAll(retEdeks);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:16,代码来源:EagerKeyGeneratorKeyProviderCryptoExtension.java

示例11: collectNodes

import java.util.Queue; //导入方法依赖的package包/类
private ImmutableSet<ColumnIdentifier> collectNodes(
        ColumnIdentifier node, int nodeIndex,Function<ColumnIdentifier, Set<ColumnIdentifier>> getSuccessor) {
    Set<ColumnIdentifier> results = new HashSet<>();
    Queue<ColumnIdentifier> queue = new LinkedList<>();
    queue.add(node);
    while (!queue.isEmpty()) {
        ColumnIdentifier nextNode = queue.remove();
        ImmutableSet<ColumnIdentifier> nodes = getSuccessor.apply(nextNode).stream()
                .filter(column -> getCandidateIndex(column) > nodeIndex)
                .collect(toImmutableSet());
        queue.addAll(Sets.difference(nodes, results));
        results.addAll(nodes);
    }
    return ImmutableSet.copyOf(results);
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:16,代码来源:IndGraph.java

示例12: expandsExactlyOneContent

import java.util.Queue; //导入方法依赖的package包/类
/**
 * Expands content of 'EXACTLY_ONE' node. Direct 'EXACTLY_ONE' child nodes are dissolved in the process.
 */
private Collection<ModelNode> expandsExactlyOneContent(final Collection<ModelNode> content) throws PolicyException {
    final Collection<ModelNode> result = new LinkedList<ModelNode>();

    final Queue<ModelNode> eoContentQueue = new LinkedList<ModelNode>(content);
    ModelNode node;
    while ((node = eoContentQueue.poll()) != null) {
        // dissolving direct 'EXACTLY_ONE' child nodes
        switch (node.getType()) {
            case POLICY :
            case ALL :
            case ASSERTION :
                result.add(node);
                break;
            case POLICY_REFERENCE :
                result.add(getReferencedModelRootNode(node));
                break;
            case EXACTLY_ONE :
                eoContentQueue.addAll(node.getChildren());
                break;
            default :
                throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0001_UNSUPPORTED_MODEL_NODE_TYPE(node.getType())));
        }
    }

    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:PolicyModelTranslator.java

示例13: decompose

import java.util.Queue; //导入方法依赖的package包/类
/**
 * Decomposes the unprocessed alternative content into two different collections:
 * <p/>
 * Content of 'EXACTLY_ONE' child nodes is expanded and placed in one list and
 * 'ASSERTION' nodes are placed into other list. Direct 'ALL' and 'POLICY' child nodes are 'dissolved' in the process.
 *
 * Method reuses precreated ContentDecomposition object, which is reset before reuse.
 */
private void decompose(final Collection<ModelNode> content, final ContentDecomposition decomposition) throws PolicyException {
    decomposition.reset();

    final Queue<ModelNode> allContentQueue = new LinkedList<ModelNode>(content);
    ModelNode node;
    while ((node = allContentQueue.poll()) != null) {
        // dissolving direct 'POLICY', 'POLICY_REFERENCE' and 'ALL' child nodes
        switch (node.getType()) {
            case POLICY :
            case ALL :
                allContentQueue.addAll(node.getChildren());
                break;
            case POLICY_REFERENCE :
                allContentQueue.addAll(getReferencedModelRootNode(node).getChildren());
                break;
            case EXACTLY_ONE :
                decomposition.exactlyOneContents.add(expandsExactlyOneContent(node.getChildren()));
                break;
            case ASSERTION :
                decomposition.assertions.add(node);
                break;
            default :
                throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0007_UNEXPECTED_MODEL_NODE_TYPE_FOUND(node.getType())));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:PolicyModelTranslator.java

示例14: searchFoldersInFolder

import java.util.Queue; //导入方法依赖的package包/类
public List<PhotatoFolder> searchFoldersInFolder(String folder, String searchQuery) {
    // Search for a folder with the correct name. This is just a recursive exploration since we suppose the number of folders will be low enough and thus we would be able to "bruteforce" it
    List<String> searchQuerySplit = SearchQueryHelper.getSplittedTerms(searchQuery);
    List<PhotatoFolder> result = new ArrayList<>();

    if (!searchQuerySplit.isEmpty()) {
        PhotatoFolder currentFolder = isVirtualFolder(folder) ? this.albumsManager.getCurrentFolder(folder) : this.getCurrentFolder(this.rootFolder.fsPath.resolve(folder));

        Queue<PhotatoFolder> queue = new LinkedList<>();
        queue.add(currentFolder);

        while (!queue.isEmpty()) {
            currentFolder = queue.remove();
            queue.addAll(currentFolder.subFolders.values());

            if (!currentFolder.isEmpty()) {
                List<String> currentFolderCleanedFilename = SearchQueryHelper.getSplittedTerms(currentFolder.filename);
                boolean ok = searchQuerySplit.stream().allMatch((s) -> (currentFolderCleanedFilename.stream().anyMatch((String t) -> (prefixOnlyMode && t.startsWith(s)) || (!prefixOnlyMode && t.contains(s)))));

                if (ok) {
                    result.add(currentFolder);
                }
            }
        }
    }

    return result;
}
 
开发者ID:trebonius0,项目名称:Photato,代码行数:29,代码来源:PhotatoFilesManager.java

示例15: isHomogeneous

import java.util.Queue; //导入方法依赖的package包/类
/**
 * Check if the table contains homogenenous files that can be read by Drill. Eg: parquet, json csv etc.
 * However if it contains more than one of these formats or a totally different file format that Drill cannot
 * understand then we will raise an exception.
 * @param tableName - name of the table to be checked for homogeneous property
 * @return
 * @throws IOException
 */
private boolean isHomogeneous(String tableName) throws IOException {
  FileSelection fileSelection = FileSelection.create(fs, config.getLocation(), tableName);

  if (fileSelection == null) {
    throw UserException
        .validationError()
        .message(String.format("Table [%s] not found", tableName))
        .build(logger);
  }

  FormatMatcher matcher = null;
  Queue<FileStatus> listOfFiles = new LinkedList<>();
  listOfFiles.addAll(fileSelection.getFileStatusList(fs));

  while (!listOfFiles.isEmpty()) {
    FileStatus currentFile = listOfFiles.poll();
    if (currentFile.isDirectory()) {
      listOfFiles.addAll(fs.list(true, currentFile.getPath()));
    } else {
      if (matcher != null) {
        if (!matcher.isFileReadable(fs, currentFile)) {
          return false;
        }
      } else {
        matcher = findMatcher(currentFile);
        // Did not match any of the file patterns, exit
        if (matcher == null) {
          return false;
        }
      }
    }
  }
  return true;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:43,代码来源:WorkspaceSchemaFactory.java


注:本文中的java.util.Queue.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。