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


Java Deque.removeLast方法代码示例

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


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

示例1: visitDepthFirst

import java.util.Deque; //导入方法依赖的package包/类
private void visitDepthFirst(AST ast) {
	if ( ast == null ) {
		return;
	}
	Deque<AST> stack = new ArrayDeque<AST>();
	stack.addLast( ast );
	while ( !stack.isEmpty() ) {
		ast = stack.removeLast();
		strategy.visit( ast );
		if ( ast.getNextSibling() != null ) {
			stack.addLast( ast.getNextSibling() );
		}
		if ( ast.getFirstChild() != null ) {
			stack.addLast( ast.getFirstChild() );
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:NodeTraverser.java

示例2: chooseDbSource

import java.util.Deque; //导入方法依赖的package包/类
public static File chooseDbSource(Shell shell, IPreferenceStore prefStore, boolean dir) {
    String pathToDump = dir ? getDirPath(shell, prefStore) : getFilePath(shell, prefStore);
    if (pathToDump == null) {
        return null;
    }

    File dumpFile = new File(pathToDump);
    Deque<File> dumpHistory = stringToDumpFileHistory(prefStore.getString(PREF.DB_STORE_FILES));
    dumpHistory.addFirst(dumpFile);
    while (dumpHistory.size() > MAX_FILES_HISTORY) {
        dumpHistory.removeLast();
    }
    prefStore.setValue(PREF.DB_STORE_FILES, dumpFileHistoryToPreference(dumpHistory));
    prefStore.setValue(PREF.LAST_OPENED_LOCATION,
            dir ? dumpFile.getAbsolutePath() : dumpFile.getParent());
    return dumpFile;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:18,代码来源:DbStorePicker.java

示例3: visit

import java.util.Deque; //导入方法依赖的package包/类
@NonNull
private static List<JavaFileObject> visit(
        @NonNull final File folder,
        @NonNull final File root,
        @NonNull final Charset encoding,
        @NullAllowed final JavaFileFilterImplementation filter,
        final boolean recursive,
        @NonNull Function<File,JavaFileObject.Kind> accept) {
    final List<JavaFileObject> res = new ArrayList<>();
    final Deque<File> todo = new ArrayDeque<>();
    todo.offer(folder);
    while (!todo.isEmpty()) {
        final File active = todo.removeLast();  //DFS
        final File[] content = active.listFiles();
        if (content != null) {
            for (File f : content) {
                final JavaFileObject.Kind fKind = accept.apply(f);
                if (fKind != null) {
                    res.add(FileObjects.fileFileObject(
                        f,
                        root,
                        filter,
                        fKind == JavaFileObject.Kind.CLASS ?
                                UNKNOWN_CHARSET :
                                encoding));
                } else if (recursive && f.isDirectory()) {
                    todo.offer(f);
                }
            }
        }
    }
    return Collections.unmodifiableList(res);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:FolderArchive.java

示例4: close

import java.util.Deque; //导入方法依赖的package包/类
@Override
public void close() {
	Deque<PathElement> ancestors = getAncestors();
	for (int i = 0; i < this.count; i++) {
		ancestors.removeLast();
	}
}
 
开发者ID:tkob,项目名称:spring-data-gclouddatastore,代码行数:8,代码来源:Context.java

示例5: writeItem

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Write a collection item.
 */
private void writeItem(final Writer writer, final Map<String, Processor<?>> tags, final TagContext tagContext, final int end,
		final Deque<Object> contextData, final Object value) throws IOException {
	contextData.add(value);
	write(writer, tags, tagContext.cursor + tagContext.tag.length() + 4, end, contextData);
	contextData.removeLast();
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:10,代码来源:Template.java

示例6: newLogger

import java.util.Deque; //导入方法依赖的package包/类
private TransformerLogger<String> newLogger(final AtomicInteger numberOfMessagesToAdd,
        TransformerDebug transformerDebug, TransformerConfig transformerConfig)
{
    TransformerLogger<String> log = new TransformerLogger<String>()
    {
        @Override
        protected void addOrModify(Deque<String> entries, Object message)
        {
            int i = numberOfMessagesToAdd.get();
            if (i > 0)
            {
                for (; i > 0; i--)
                {
                    entries.add((String)message);
                }
            }
            else if (i < 0)
            {
                for (; i < 0; i++)
                {
                    entries.removeLast();
                }
            }
            else
            {
                entries.removeLast();
                entries.add((String)message);
            }
        }

        @Override
        protected int getUpperMaxEntries()
        {
            return 176;
        }

        @Override
        protected String getPropertyName()
        {
            return "property.name";
        }
    };
    log.setTransformerDebug(transformerDebug);
    log.setTransformerConfig(transformerConfig);
    return log;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:47,代码来源:TransformerLoggerTest.java

示例7: getScriptContext

import java.util.Deque; //导入方法依赖的package包/类
/**
 * @return null if there is no staging folder
 */
private ScriptContext getScriptContext(SectionInfo info, boolean request, boolean clientSide)
{
	final Map<String, Object> extra = new HashMap<String, Object>();
	extra.put(AdvancedScriptWebControlConstants.PREFIX, getFormName());
	if( clientSide )
	{
		final RenderContext context = (RenderContext) info;
		final ScriptVariable thisVar = new ScriptVariable("this");
		final OverrideHandler submitHandler = new OverrideHandler(HANDLE_SUBMIT_FUNCTION, thisVar, submitFunction);
		extra.put(AdvancedScriptWebControlConstants.SUBMIT_JS,
			submitHandler.getStatements(context) + " return false;");
		// required!
		context.preRender(submitHandler);
	}
	if( request )
	{
		Map<Object, Object> paramMap = new HashMap<>();
		paramMap.putAll(info.getRequest().getParameterMap());
		String submitter = info.getAttribute(SUBMITTER_NAME_KEY);
		if( !Check.isEmpty(submitter) )
		{
			paramMap.put(submitter, info.getAttribute(SUBMITTER_VALUE_KEY));
		}
		extra.put(AdvancedScriptWebControlConstants.REQUEST_MAP, paramMap);
	}
	final WebRepository repo = (WebRepository) getRepository();
	extra.put(AdvancedScriptWebControlConstants.WIZARD_ID, repo.getWizid());

	// add the magic 'attributes' bag (this passes data between
	// scripts/templates)
	final String attributesKey = repo.getWizid() + "_" + getFormName() + "_attributes";
	XmlScriptType att = sessionService.getAttribute(attributesKey);
	if( att == null )
	{
		att = new PropBagWrapper(new PropBagEx());

	}
	sessionService.setAttribute(attributesKey, att);
	extra.put(AdvancedScriptWebControlConstants.ATTRIBUTES, att);

	final WizardState wizState = repo.getState();
	final ScriptContext scriptContext = wizardService.createScriptContext(wizState, storageControl.getWizardPage(),
		storageControl, extra);

	scriptContext.setLogger(logger);

	PropBagWrapper xml = scriptContext.getXml();
	xml.clearOverrides();
	Deque<Pair<String, Integer>> pathOverrides = wizState.getPathOverrides();
	while( !pathOverrides.isEmpty() )
	{
		Pair<String, Integer> override = pathOverrides.removeLast();
		xml.pushOverride(override.getFirst(), override.getSecond());
	}

	return scriptContext;
}
 
开发者ID:equella,项目名称:Equella,代码行数:61,代码来源:AdvancedScriptWebControl.java

示例8: findPaths

import java.util.Deque; //导入方法依赖的package包/类
/**
 * Returns all paths reachable from the given targets.
 */
private Set<Deque<Archive>> findPaths(Graph<Archive> graph, Archive target) {

    // path is in reversed order
    Deque<Archive> path = new LinkedList<>();
    path.push(target);

    Set<Edge<Archive>> visited = new HashSet<>();

    Deque<Edge<Archive>> deque = new LinkedList<>();
    deque.addAll(graph.edgesFrom(target));
    if (deque.isEmpty()) {
        return makePaths(path).collect(Collectors.toSet());
    }

    Set<Deque<Archive>> allPaths = new HashSet<>();
    while (!deque.isEmpty()) {
        Edge<Archive> edge = deque.pop();

        if (visited.contains(edge))
            continue;

        Archive node = edge.v;
        path.addLast(node);
        visited.add(edge);

        Set<Edge<Archive>> unvisitedDeps = graph.edgesFrom(node)
                .stream()
                .filter(e -> !visited.contains(e))
                .collect(Collectors.toSet());

        trace("visiting %s %s (%s)%n", edge, path, unvisitedDeps);
        if (unvisitedDeps.isEmpty()) {
            makePaths(path).forEach(allPaths::add);
            path.removeLast();
        }

        // push unvisited adjacent edges
        unvisitedDeps.stream().forEach(deque::push);


        // when the adjacent edges of a node are visited, pop it from the path
        while (!path.isEmpty()) {
            if (visited.containsAll(graph.edgesFrom(path.peekLast())))
                path.removeLast();
            else
                break;
        }
    }

   return allPaths;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:55,代码来源:InverseDepsAnalyzer.java


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