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


Java Deque.remove方法代码示例

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


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

示例1: findAncestor

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Traverse ancestors of the given type, in the same order as {@link #ancestors(Class, boolean)},
 * and return the first ancestor for which the given predicate returns true.
 */
public static @Nullable <U> Class<? extends U> findAncestor(Class<? extends U> type, Class<U> upperBound, java.util.function.Predicate<Class<?>> pred) {
    Deque<Class<? extends U>> queue = new ArrayDeque<>();
    queue.add(type);
    while(!queue.isEmpty()) {
        final Class<? extends U> t = queue.remove();
        if(pred.test(t)) return t;

        if(t.getSuperclass() != null && upperBound.isAssignableFrom(t.getSuperclass())) {
            queue.add((Class<? extends U>) t.getSuperclass());
        }

        for(Class<?> iface : t.getInterfaces()) {
            if(upperBound.isAssignableFrom(iface)) {
                queue.add((Class<? extends U>) iface);
            }
        }
    }
    return null;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:24,代码来源:Types.java

示例2: 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;
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:29,代码来源:CLKernelExtractor.java

示例3: abortUndrainedBatches

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Abort any batches which have not been drained
 */
void abortUndrainedBatches(RuntimeException reason) {
    for (ProducerBatch batch : incomplete.copyAll()) {
        Deque<ProducerBatch> dq = getDeque(batch.topicPartition);
        boolean aborted = false;
        synchronized (dq) {
            if (!batch.isClosed()) {
                aborted = true;
                batch.abortRecordAppends();
                dq.remove(batch);
            }
        }
        if (aborted) {
            batch.abort(reason);
            deallocate(batch);
        }
    }
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:21,代码来源:RecordAccumulator.java

示例4: finished

import java.util.Deque; //导入方法依赖的package包/类
private <T> void finished(Deque<T> calls, T call, boolean promoteCalls) {
  int runningCallsCount;
  Runnable idleCallback;
  synchronized (this) {
    if (!calls.remove(call)) throw new AssertionError("Call wasn't in-flight!");
    if (promoteCalls) promoteCalls();
    runningCallsCount = runningCallsCount();
    idleCallback = this.idleCallback;
  }

  if (runningCallsCount == 0 && idleCallback != null) {
    idleCallback.run();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:Dispatcher.java

示例5: findForAncestor

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Traverse ancestors of the given type, in the same order as {@link #ancestors(Class, boolean)},
 * applying the given function to each ancestor, and return the first non-null result, or null
 * if the function returns null for all ancestors.
 */
public static @Nullable <T, R> R findForAncestor(Class<T> type, Function<Class<? super T>, R> func) {
    Deque<Class<? super T>> queue = new ArrayDeque<>();
    queue.add(type);
    while(!queue.isEmpty()) {
        final Class<? super T> t = queue.remove();
        final R result = func.apply(t);
        if(result != null) return result;
        if(t.getSuperclass() != null) queue.add(t.getSuperclass());
        Collections.addAll(queue, (Class<? super T>[]) t.getInterfaces());
    }
    return null;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:18,代码来源:Types.java

示例6: abortBatches

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Abort all incomplete batches (whether they have been sent or not)
 */
void abortBatches(final RuntimeException reason) {
    for (ProducerBatch batch : incomplete.copyAll()) {
        Deque<ProducerBatch> dq = getDeque(batch.topicPartition);
        synchronized (dq) {
            batch.abortRecordAppends();
            dq.remove(batch);
        }
        batch.abort(reason);
        deallocate(batch);
    }
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:15,代码来源:RecordAccumulator.java

示例7: updateRegionLoad

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Store the current region loads.
 */
private synchronized void updateRegionLoad() {
  // We create a new hashmap so that regions that are no longer there are removed.
  // However we temporarily need the old loads so we can use them to keep the rolling average.
  Map<String, Deque<RegionLoad>> oldLoads = loads;
  loads = new HashMap<String, Deque<RegionLoad>>();

  for (ServerName sn : clusterStatus.getServers()) {
    ServerLoad sl = clusterStatus.getLoad(sn);
    if (sl == null) {
      continue;
    }
    for (Entry<byte[], RegionLoad> entry : sl.getRegionsLoad().entrySet()) {
      Deque<RegionLoad> rLoads = oldLoads.get(Bytes.toString(entry.getKey()));
      if (rLoads == null) {
        // There was nothing there
        rLoads = new ArrayDeque<RegionLoad>();
      } else if (rLoads.size() >= numRegionLoadsToRemember) {
        rLoads.remove();
      }
      rLoads.add(entry.getValue());
      loads.put(Bytes.toString(entry.getKey()), rLoads);

    }
  }

  for(CostFromRegionLoadFunction cost : regionLoadFunctions) {
    cost.setLoads(loads);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:StochasticLoadBalancer.java

示例8: LabelBuilder

import java.util.Deque; //导入方法依赖的package包/类
LabelBuilder(final Feature feature, final TestCase scenario, final Deque<PickleTag> tags) {
    final TagParser tagParser = new TagParser(feature, scenario);

    getScenarioLabels().add(createFeatureLabel(feature.getName()));
    getScenarioLabels().add(createStoryLabel(scenario.getName()));

    while (tags.peek() != null) {
        final PickleTag tag = tags.remove();

        final String tagString = tag.getName();

        if (tagString.contains(COMPOSITE_TAG_DELIMITER)) {

            final String[] tagParts = tagString.split(COMPOSITE_TAG_DELIMITER, 2);
            if (StringUtils.isEmpty(tagParts[1])) {
                // skip empty tags, e.g. '@tmsLink=', to avoid formatter errors
                continue;
            }

            final String tagKey = tagParts[0].toUpperCase();
            final String tagValue = tagParts[1];

            // Handle composite named links
            if (tagKey.startsWith(PLAIN_LINK + ".")) {
                tryHandleNamedLink(tagString);
                continue;
            }

            switch (tagKey) {
                case SEVERITY:
                    getScenarioLabels().add(createSeverityLabel(tagValue.toLowerCase()));
                    break;
                case TMS_LINK:
                    getScenarioLinks().add(createTmsLink(tagValue));
                    break;
                case ISSUE_LINK:
                    getScenarioLinks().add(createIssueLink(tagValue));
                    break;
                case PLAIN_LINK:
                    getScenarioLinks().add(createLink(null, tagValue, tagValue, null));
                    break;
                default:
                    LOGGER.warn("Composite tag {} is not supported. adding it as RAW", tagKey);
                    getScenarioLabels().add(getTagLabel(tag));
                    break;
            }
        } else if (tagParser.isPureSeverityTag(tag)) {
            getScenarioLabels().add(createSeverityLabel(tagString.substring(1)));
        } else if (!tagParser.isResultTag(tag)) {
            getScenarioLabels().add(getTagLabel(tag));
        }
    }

    getScenarioLabels().add(new Label().withName("host").withValue(getHostName()));
    getScenarioLabels().add(new Label().withName("package").withValue(feature.getName()));
    getScenarioLabels().add(new Label().withName("suite").withValue(feature.getName()));
    getScenarioLabels().add(new Label().withName("testClass").withValue(scenario.getName()));
    getScenarioLabels().add(new Label().withName("thread").withValue(getThreadName()));

}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:61,代码来源:LabelBuilder.java

示例9: LabelBuilder

import java.util.Deque; //导入方法依赖的package包/类
LabelBuilder(final Feature feature, final Scenario scenario, final Deque<Tag> tags) {
    final TagParser tagParser = new TagParser(feature, scenario);

    getScenarioLabels().add(createFeatureLabel(feature.getName()));
    getScenarioLabels().add(createStoryLabel(scenario.getName()));

    while (tags.peek() != null) {
        final Tag tag = tags.remove();

        final String tagString = tag.getName();

        if (tagString.contains(COMPOSITE_TAG_DELIMITER)) {

            final String[] tagParts = tagString.split(COMPOSITE_TAG_DELIMITER, 2);
            if (StringUtils.isEmpty(tagParts[1])) {
                // skip empty tags, e.g. '@tmsLink=', to avoid formatter errors
                continue;
            }

            final String tagKey = tagParts[0].toUpperCase();
            final String tagValue = tagParts[1];

            // Handle composite named links
            if (tagKey.startsWith(PLAIN_LINK + ".")) {
                tryHandleNamedLink(tagString);
                continue;
            }

            switch (tagKey) {
                case SEVERITY:
                    getScenarioLabels().add(createSeverityLabel(tagValue.toLowerCase()));
                    break;
                case TMS_LINK:
                    getScenarioLinks().add(ResultsUtils.createTmsLink(tagValue));
                    break;
                case ISSUE_LINK:
                    getScenarioLinks().add(ResultsUtils.createIssueLink(tagValue));
                    break;
                case PLAIN_LINK:
                    getScenarioLinks().add(ResultsUtils.createLink(null, tagValue, tagValue, null));
                    break;
                default:
                    LOGGER.warn("Composite tag {} is not supported. adding it as RAW", tagKey);
                    getScenarioLabels().add(getTagLabel(tag));
                    break;
            }
        } else if (tagParser.isPureSeverityTag(tag)) {
            getScenarioLabels().add(createSeverityLabel(tagString.substring(1)));
        } else if (!tagParser.isResultTag(tag)) {
            getScenarioLabels().add(getTagLabel(tag));
        }
    }

    getScenarioLabels().add(new Label().withName("host").withValue(getHostName()));
    getScenarioLabels().add(new Label().withName("package").withValue(feature.getName()));
    getScenarioLabels().add(new Label().withName("suite").withValue(feature.getName()));
    getScenarioLabels().add(new Label().withName("testClass").withValue(scenario.getName()));
    getScenarioLabels().add(new Label().withName("thread").withValue(getThreadName()));

}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:61,代码来源:LabelBuilder.java


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