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


Java Deque.add方法代码示例

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


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

示例1: enumerateAndMark

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Enumerates graph starting with provided vertexes. All vertexes that are reachable from the provided ones are
 * marked
 *
 * @param markedParents provided vertexes
 * @param markVertex    lambda which marks vertexes
 */
public static void enumerateAndMark(Deque<Object[]> markedParents,
                                    Consumer<Object[]> markVertex) {
    Map<Object[], Boolean> isVisited = new HashMap<>();
    while (!markedParents.isEmpty()) {
        Object[] vertex = markedParents.pop();
        if (vertex == null || isVisited.containsKey(vertex)) {
            continue;
        }
        isVisited.put(vertex, true);
        markVertex.accept(vertex);

        for (int i = 0; i < vertex.length; ++i) {
            if (vertex[i] == null) {
                break;
            }
            markedParents.add((Object[]) vertex[i]);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:ObjectGraph.java

示例2: getBinaryName

import java.util.Deque; //导入方法依赖的package包/类
private static String getBinaryName(Class<?> clz) {
    StringBuilder sb = new StringBuilder();
    sb.append(clz.getPackage().getName());
    if (sb.length() > 0) {
        sb.append('.'); //NOI18N
    }
    final Deque<Class<?>> clzs = new ArrayDeque<>();
    for (; clz != null; clz = clz.getEnclosingClass()) {
        clzs.add(clz);
    }
    while (!clzs.isEmpty()) {
        sb.append(clzs.removeLast().getSimpleName());
        if (!clzs.isEmpty()) {
            sb.append('$'); //NOI18N
        }
    }
    return sb.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:LibrariesTestUtil.java

示例3: listChildrenBFSAndWatchThem

import java.util.Deque; //导入方法依赖的package包/类
/**
 * BFS Traversal of all the children under path, with the entries in the list,
 * in the same order as that of the traversal.
 * Lists all the children and set watches on to them.
 *
 * @param zkw
 *          - zk reference
 * @param znode
 *          - path of node
 * @return list of children znodes under the path
 * @throws KeeperException
 *           if unexpected ZooKeeper exception
 */
private static List<String> listChildrenBFSAndWatchThem(ZooKeeperWatcher zkw, final String znode)
    throws KeeperException {
  Deque<String> queue = new LinkedList<String>();
  List<String> tree = new ArrayList<String>();
  queue.add(znode);
  while (true) {
    String node = queue.pollFirst();
    if (node == null) {
      break;
    }
    List<String> children = listChildrenAndWatchThem(zkw, node);
    if (children == null) {
      continue;
    }
    for (final String child : children) {
      final String childPath = node + "/" + child;
      queue.add(childPath);
      tree.add(childPath);
    }
  }
  return tree;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:ZKUtil.java

示例4: walkFields

import java.util.Deque; //导入方法依赖的package包/类
private void walkFields(Deque stack, Object current, Class[] skip)
{
    ClassInfo classInfo = getClassInfo(current.getClass(), skip);

    for (Field field : classInfo._refFields)
    {
        try
        {
            Object value = field.get(current);
            if (value == null || value.getClass().isPrimitive())
            {
                continue;
            }
            stack.add(value);
        }
        catch (IllegalAccessException ignored) { }
    }
}
 
开发者ID:lbovet,项目名称:super-machine,代码行数:19,代码来源:Traverser.java

示例5: testPass

import java.util.Deque; //导入方法依赖的package包/类
@Test(timeout = 1000)
public void testPass() throws IOException {
  And and = new And();

  PathData pathData = mock(PathData.class);

  Expression first = mock(Expression.class);
  when(first.apply(pathData, -1)).thenReturn(Result.PASS);

  Expression second = mock(Expression.class);
  when(second.apply(pathData, -1)).thenReturn(Result.PASS);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  assertEquals(Result.PASS, and.apply(pathData, -1));
  verify(first).apply(pathData, -1);
  verify(second).apply(pathData, -1);
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:TestAnd.java

示例6: testPrepare

import java.util.Deque; //导入方法依赖的package包/类
@Test(timeout = 1000)
public void testPrepare() throws IOException {
  And and = new And();
  Expression first = mock(Expression.class);
  Expression second = mock(Expression.class);

  Deque<Expression> children = new LinkedList<Expression>();
  children.add(second);
  children.add(first);
  and.addChildren(children);

  and.prepare();
  verify(first).prepare();
  verify(second).prepare();
  verifyNoMoreInteractions(first);
  verifyNoMoreInteractions(second);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:18,代码来源:TestAnd.java

示例7: listChildrenBFSNoWatch

import java.util.Deque; //导入方法依赖的package包/类
/**
 * BFS Traversal of all the children under path, with the entries in the list,
 * in the same order as that of the traversal. Lists all the children without
 * setting any watches.
 *
 * @param zkw
 *          - zk reference
 * @param znode
 *          - path of node
 * @return list of children znodes under the path
 * @throws KeeperException
 *           if unexpected ZooKeeper exception
 */
private static List<String> listChildrenBFSNoWatch(ZooKeeperWatcher zkw,
    final String znode) throws KeeperException {
  Deque<String> queue = new LinkedList<String>();
  List<String> tree = new ArrayList<String>();
  queue.add(znode);
  while (true) {
    String node = queue.pollFirst();
    if (node == null) {
      break;
    }
    List<String> children = listChildrenNoWatch(zkw, node);
    if (children == null) {
      continue;
    }
    for (final String child : children) {
      final String childPath = node + "/" + child;
      queue.add(childPath);
      tree.add(childPath);
    }
  }
  return tree;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:ZKUtil.java

示例8: toStyleProcessorDistance

import java.util.Deque; //导入方法依赖的package包/类
@Test
public void toStyleProcessorDistance() {
	final Deque<Object> contextData = new ArrayDeque<>();
	final SlaData data = new SlaData();
	data.setRevisedDueDateDistance(0L); // Perfect distance
	contextData.add(data);
	Assert.assertEquals("normal", resource.toStyleProcessorDistance("normal", "invalid").getValue(contextData));
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:9,代码来源:JiraExportPluginResourceTest.java

示例9: addModelParentLocation

import java.util.Deque; //导入方法依赖的package包/类
private void addModelParentLocation(Deque<ResourceLocation> p_188633_1_, Set<ResourceLocation> p_188633_2_, ModelBlock p_188633_3_)
{
    ResourceLocation resourcelocation = p_188633_3_.getParentLocation();

    if (resourcelocation != null && !p_188633_2_.contains(resourcelocation))
    {
        p_188633_1_.add(resourcelocation);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:ModelBakery.java

示例10: toStyleProcessorDistanceLate

import java.util.Deque; //导入方法依赖的package包/类
@Test
public void toStyleProcessorDistanceLate() {
	final Deque<Object> contextData = new ArrayDeque<>();
	final SlaData data = new SlaData();
	data.setRevisedDueDateDistance(-1L); // Negative distance, late
	contextData.add(data);
	Assert.assertEquals("invalid", resource.toStyleProcessorDistance("normal", "invalid").getValue(contextData));
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:9,代码来源:JiraExportPluginResourceTest.java

示例11: getValue

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Simple test of a valid property.
 */
@Test
public void getValue() {
	final Deque<Object> contextData = new LinkedList<>();
	final SystemUser systemUser = new SystemUser();
	systemUser.setLogin("any");
	contextData.add(systemUser);
	Assert.assertEquals("any", new BeanProcessor<>(SystemUser.class, "login").getValue(contextData));
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:12,代码来源:BeanProcessorTest.java

示例12: getAllParentPaths

import java.util.Deque; //导入方法依赖的package包/类
private static Deque<String> getAllParentPaths(String baseDBPath) {
    Deque<String> params = new ArrayDeque<String>();
    Pattern compile = Pattern.compile("/[^/]*$");
    String current = trimSuffix(baseDBPath, "/");
    while( true ) {
        current = compile.matcher(current).replaceFirst("");
        if( current.isEmpty() ) {
            break;
        }
        params.add(current+"/");
    }
    return  params;
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:14,代码来源:SqlJsonDB.java

示例13: stringToDumpFileHistory

import java.util.Deque; //导入方法依赖的package包/类
public static Deque<File> stringToDumpFileHistory(String preference, boolean allowDirs) {
    String[] coordStrings = preference.split(DbInfo.DELIM_ENTRY);
    Deque<File> paths = new LinkedList<>();
    for (String path : coordStrings){
        File f = new File(path);
        if (f.exists() && !paths.contains(f) && (allowDirs || !f.isDirectory())) {
            paths.add(f);
        }
    }
    return paths;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:12,代码来源:DbStorePicker.java

示例14: testGetWrappedValue

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Simple wrapping test of not null valued data.
 */
@Test
public void testGetWrappedValue() {
	final SystemUser systemUser = new SystemUser();
	systemUser.setLogin("any");

	final SystemRoleAssignment roleAssignment = new SystemRoleAssignment();
	roleAssignment.setUser(systemUser);

	final Deque<Object> contextData = new LinkedList<>();
	contextData.add(roleAssignment);
	Assert.assertEquals("any",
			new BeanProcessor<>(SystemUser.class, "login", new BeanProcessor<>(SystemRoleAssignment.class, "user")).getValue(contextData));
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:17,代码来源:ProcessorTest.java

示例15: processBlock

import java.util.Deque; //导入方法依赖的package包/类
@SuppressWarnings("try")
private void processBlock(AbstractBlockBase<?> block, Deque<AbstractBlockBase<?>> worklist) {
    DebugContext debug = lir.getDebug();
    if (updateOutBlock(block)) {
        try (Indent indent = debug.logAndIndent("handle block %s", block)) {
            ArrayList<LIRInstruction> instructions = lir.getLIRforBlock(block);
            // get out set and mark intervals
            BitSet outSet = liveOutMap.get(block);
            markOutInterval(outSet, getBlockEnd(instructions));
            printLiveSet("liveOut", outSet);

            // process instructions
            BlockClosure closure = new BlockClosure((BitSet) outSet.clone());
            for (int i = instructions.size() - 1; i >= 0; i--) {
                LIRInstruction inst = instructions.get(i);
                closure.processInstructionBottomUp(inst);
            }

            // add predecessors to work list
            for (AbstractBlockBase<?> b : block.getPredecessors()) {
                worklist.add(b);
            }
            // set in set and mark intervals
            BitSet inSet = closure.getCurrentSet();
            liveInMap.put(block, inSet);
            markInInterval(inSet, getBlockBegin(instructions));
            printLiveSet("liveIn", inSet);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:FixPointIntervalBuilder.java


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