本文整理汇总了Java中java.util.Deque.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Deque.addAll方法的具体用法?Java Deque.addAll怎么用?Java Deque.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Deque
的用法示例。
在下文中一共展示了Deque.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasMultipleSelectables
import java.util.Deque; //导入方法依赖的package包/类
private boolean hasMultipleSelectables(ElementNode.Description elementDescription) {
Deque<ElementNode.Description> toProcess = new ArrayDeque<>();
if (elementDescription != null) {
toProcess.add(elementDescription);
}
boolean selectableFound = false;
while (!toProcess.isEmpty()) {
ElementNode.Description d = toProcess.poll();
List<ElementNode.Description> subs = d.getSubs();
if (subs == null) {
if (d.isSelectable()) {
if (selectableFound) {
return true;
}
selectableFound = true;
}
} else {
toProcess.addAll(subs);
}
}
return false;
}
示例2: floodIndices
import java.util.Deque; //导入方法依赖的package包/类
private Set<Coordinate> floodIndices(final Coordinate coordinate) {
final Set<Coordinate> flood = new LinkedHashSet<>();
final Color floodColor = getColor(coordinate);
final Deque<Coordinate> queue = new LinkedList<>();
queue.add(coordinate);
while (!queue.isEmpty()) {
final Coordinate location = queue.pop();
flood.add(location);
queue.addAll(getNeighbors(location).stream()
.filter(neighbor -> floodColor.equals(getColor(neighbor)) && !flood.contains(neighbor))
.collect(Collectors.toList()));
}
return flood;
}
示例3: extract
import java.util.Deque; //导入方法依赖的package包/类
/**
* Attempts to extract all kernels from the given nested loop tree, according
* to judgements made by the given dependency checker.
*
* @param clazz Class concerned.
* @param loops Root level set of loop nestings.
* @param check Dependency checker.
* @return Number of kernels successfully extracted.
*/
public static int extract(ClassNode clazz, Set<Tree<TrivialLoop>> loops, DependencyCheck check) {
Deque<Tree<TrivialLoop>> consider = new LinkedList<Tree<TrivialLoop>>();
int count = 0;
consider.addAll(loops);
while(!consider.isEmpty()) {
Tree<TrivialLoop> level = consider.remove();
if(extract(clazz, level, check)) {
count++;
} else {
consider.addAll(level.getChildren());
}
}
return count;
}
示例4: setAncestorFilter
import java.util.Deque; //导入方法依赖的package包/类
private <U> void setAncestorFilter(StructuredQuery.Builder<U> queryBuilder) {
Datastore datastore = datastoreOptions.getService();
Deque<PathElement> ancestors = Context.getAncestors();
Deque<PathElement> init = new LinkedList<>();
init.addAll(ancestors);
PathElement last = init.pollLast();
if (last != null) {
KeyFactory keyFactory = datastore.newKeyFactory();
keyFactory.addAncestors(init).setKind(last.getKind());
Key key = last.hasId() ? keyFactory.newKey(last.getId())
: keyFactory.newKey(last.getName());
queryBuilder.setFilter(StructuredQuery.PropertyFilter.hasAncestor(key));
}
}
示例5: setAncestorFilter
import java.util.Deque; //导入方法依赖的package包/类
protected StructuredQuery.Filter setAncestorFilter(StructuredQuery.Filter filter) {
Datastore datastore = datastoreOptions.getService();
Deque<PathElement> ancestors = Context.getAncestors();
Deque<PathElement> init = new LinkedList<>();
init.addAll(ancestors);
PathElement last = init.pollLast();
if (last == null) {
return filter;
}
else {
KeyFactory keyFactory = datastore.newKeyFactory();
keyFactory.addAncestors(init).setKind(last.getKind());
Key key = last.hasId()
? keyFactory.newKey(last.getId()) : keyFactory.newKey(last.getName());
StructuredQuery.Filter ancestorFilter = StructuredQuery.PropertyFilter.hasAncestor(key);
if (filter == null) {
return ancestorFilter;
}
else {
return StructuredQuery.CompositeFilter.and(filter, ancestorFilter);
}
}
}
示例6: getAllModuleDependencies
import java.util.Deque; //导入方法依赖的package包/类
public Set<ResolvedDependency> getAllModuleDependencies() {
Set<ResolvedDependency> resolvedElements = new LinkedHashSet<ResolvedDependency>();
Deque<ResolvedDependency> workQueue = new LinkedList<ResolvedDependency>();
workQueue.addAll(loadTransientGraphResults(selectedArtifacts).getRootNode().getPublicView().getChildren());
while (!workQueue.isEmpty()) {
ResolvedDependency item = workQueue.removeFirst();
if (resolvedElements.add(item)) {
final Set<ResolvedDependency> children = item.getChildren();
if (children != null) {
workQueue.addAll(children);
}
}
}
return resolvedElements;
}
示例7: getImplementedInterfaces
import java.util.Deque; //导入方法依赖的package包/类
public static Set<Class<?>> getImplementedInterfaces(Class<?> cl){
Set<Class<?>> interfaces = new HashSet<Class<?>>();
Deque<Class<?>> classes = new ArrayDeque<Class<?>>();
classes.add(cl);
while (!classes.isEmpty()) {
Class<?> c = classes.pop();
interfaces.addAll(Arrays.asList(c.getInterfaces()));
if (c.getSuperclass() != null) {
classes.add(c.getSuperclass());
}
classes.addAll(Arrays.asList(c.getInterfaces()));
}
return interfaces;
}
示例8: extractClassNameToRuntimeBeanMap
import java.util.Deque; //导入方法依赖的package包/类
/**
* @return map containing all class names as key, extracted RuntimeBeans as
* values. If more than zero values is returned, exactly one
* RuntimeBeanEntry will have isRoot set to true, even if yang does
* not contain special configuration for it.
*/
public static Map<String, RuntimeBeanEntry> extractClassNameToRuntimeBeanMap(
final String packageName, final DataNodeContainer container,
final String moduleYangName, final TypeProviderWrapper typeProviderWrapper,
final String javaNamePrefix, final Module currentModule, final SchemaContext schemaContext) {
AttributesRpcsAndRuntimeBeans attributesRpcsAndRuntimeBeans = extractSubtree(
packageName, container, typeProviderWrapper, currentModule,
schemaContext);
Map<String, RuntimeBeanEntry> result = new HashMap<>();
List<AttributeIfc> attributes;
Set<Rpc> rpcs;
if (attributesRpcsAndRuntimeBeans.isEmpty() == false) {
attributes = attributesRpcsAndRuntimeBeans.getAttributes();
rpcs = attributesRpcsAndRuntimeBeans.getRpcs();
} else {
// create artificial root if not defined in yang
attributes = Collections.emptyList();
rpcs = Collections.emptySet();
}
RuntimeBeanEntry rootRuntimeBeanEntry = createRoot(packageName,
container, moduleYangName, attributes, javaNamePrefix,
attributesRpcsAndRuntimeBeans.getRuntimeBeanEntries(), rpcs);
Deque<RuntimeBeanEntry> stack = new LinkedList<>();
stack.add(rootRuntimeBeanEntry);
while (stack.isEmpty() == false) {
RuntimeBeanEntry first = stack.pollFirst();
if (result.containsKey(first.getJavaNameOfRuntimeMXBean())) {
throw new NameConflictException(
first.getJavaNameOfRuntimeMXBean(), null, null);
}
result.put(first.getJavaNameOfRuntimeMXBean(), first);
stack.addAll(first.getChildren());
}
return result;
}
示例9: setAnimation
import java.util.Deque; //导入方法依赖的package包/类
public void setAnimation(Animation animation)
{
this.animation = animation;
Deque<Node<?>> q = new ArrayDeque<Node<?>>(nodes.values());
while(!q.isEmpty())
{
Node<?> node = q.pop();
if(node.getAnimation() != null) continue;
node.setAnimation(animation);
q.addAll(node.getNodes().values());
}
}
示例10: startTree
import java.util.Deque; //导入方法依赖的package包/类
@Override
void startTree(Tree root, Map<Integer, int[]> allSelectedExamples, int[] selectedAttributes, int depth)
throws OperatorException {
NodeData rootNode = new NodeData(root, allSelectedExamples, selectedAttributes, depth);
Deque<NodeData> queue = new ArrayDeque<>();
queue.push(rootNode);
while (!queue.isEmpty()) {
queue.addAll(splitNode(queue.pop(), false));
}
}
示例11: testDescendingIteratorOrigin
import java.util.Deque; //导入方法依赖的package包/类
@Test
public void testDescendingIteratorOrigin() {
final Deque<Integer> queue = new ArrayDeque<Integer>();
queue.addAll(Arrays.asList(1, 2, 3));
assertThat(queue.descendingIterator()).containsExactly(3, 2, 1);
}
示例12: handleTestCaseStarted
import java.util.Deque; //导入方法依赖的package包/类
private void handleTestCaseStarted(final TestCaseStarted event) {
currentFeatureFile = event.testCase.getUri();
currentFeature = cucumberSourceUtils.getFeature(currentFeatureFile);
currentTestCase = event.testCase;
final Deque<PickleTag> tags = new LinkedList<>();
tags.addAll(event.testCase.getTags());
final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, event.testCase, tags);
final TestResult result = new TestResult()
.withUuid(getTestCaseUuid(event.testCase))
.withHistoryId(getHistoryId(event.testCase))
.withName(event.testCase.getName())
.withLabels(labelBuilder.getScenarioLabels())
.withLinks(labelBuilder.getScenarioLinks());
final ScenarioDefinition scenarioDefinition =
cucumberSourceUtils.getScenarioDefinition(currentFeatureFile, currentTestCase.getLine());
if (scenarioDefinition instanceof ScenarioOutline) {
result.withParameters(
getExamplesAsParameters((ScenarioOutline) scenarioDefinition)
);
}
if (currentFeature.getDescription() != null && !currentFeature.getDescription().isEmpty()) {
result.withDescription(currentFeature.getDescription());
}
lifecycle.scheduleTestCase(result);
lifecycle.startTestCase(getTestCaseUuid(event.testCase));
}
示例13: startOfScenarioLifeCycle
import java.util.Deque; //导入方法依赖的package包/类
@Override
public void startOfScenarioLifeCycle(final Scenario scenario) {
this.currentScenario = scenario;
final Deque<Tag> tags = new LinkedList<>();
tags.addAll(scenario.getTags());
if (SCENARIO_OUTLINE_KEYWORDS.contains(scenario.getKeyword())) {
synchronized (gherkinSteps) {
gherkinSteps.clear();
}
} else {
tags.addAll(currentFeature.getTags());
}
final LabelBuilder labelBuilder = new LabelBuilder(currentFeature, scenario, tags);
final TestResult result = new TestResult()
.withUuid(scenario.getId())
.withHistoryId(StepUtils.getHistoryId(scenario.getId()))
.withName(scenario.getName())
.withLabels(labelBuilder.getScenarioLabels())
.withLinks(labelBuilder.getScenarioLinks());
if (!currentFeature.getDescription().isEmpty()) {
result.withDescription(currentFeature.getDescription());
}
lifecycle.scheduleTestCase(result);
lifecycle.startTestCase(scenario.getId());
}
示例14: generatePath
import java.util.Deque; //导入方法依赖的package包/类
public Deque<DistanceFrom> generatePath() {
List<FutureTask<DistanceFrom>> effectiveDistanceFromStart = calculateDistanceFromStart(
initialPosition,
getInRange(
initialPosition,
MIN_DISTANCE_FIRST_HOP,
MAX_DISTANCE_FIRST_HOP
));
Collections.shuffle(effectiveDistanceFromStart); // Randomizing the points...
for (FutureTask<DistanceFrom> distanceFromFutureTask : effectiveDistanceFromStart) {
Deque<DistanceFrom> path = new ArrayDeque<>();
try {
DistanceFrom distance = distanceFromFutureTask.get();
Map<LatLng, Boolean> visitedTable = new HashMap<>();
visitedTable.put(distance.end, true);
path.addLast(distance);
path.addAll(pathChooser(distance,
maxDistance - (distance.distance/1000),
visitedTable,
5));
if (path.size() >= HOP_MIN_NUM) {
return path;
}
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
return new ArrayDeque<>();
}
示例15: visitNewArray
import java.util.Deque; //导入方法依赖的package包/类
@Override
public Void visitNewArray(NewArrayTree node, Void unused) {
if (node.getType() != null) {
builder.open(plusFour);
token("new");
builder.space();
TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
Tree base = extractedDims.node;
Deque<ExpressionTree> dimExpressions = new ArrayDeque<>(node.getDimensions());
Deque<List<AnnotationTree>> annotations = new ArrayDeque<>();
// TODO: 22-Jul-17 missing method java8
// annotations.add(ImmutableList.copyOf(node.getAnnotations()));
// annotations.addAll((List<List<AnnotationTree>>) node.getDimAnnotations());
annotations.addAll(extractedDims.dims);
scan(base, null);
builder.open(ZERO);
maybeAddDims(dimExpressions, annotations);
builder.close();
builder.close();
}
if (node.getInitializers() != null) {
if (node.getType() != null) {
builder.space();
}
visitArrayInitializer(node.getInitializers());
}
return null;
}