當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。