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


Java LinkedList.pop方法代码示例

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


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

示例1: change

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Changes the last Gui in the player's stack (if any) with the one specified in the arguments, this could be thought as backGui + openGui
 *
 * @param player the player
 * @param gui    the Gui that will be appended instead of the last one
 */
public void change(Player player, Gui gui) {
    if (called) return;
    called = true;
    try {
        LinkedList<Gui> g = getOrCreate(player);
        Gui oldGui;
        if (!g.isEmpty())
            oldGui = g.pop();
        else oldGui = null;

        GuiChangeEvent e = new GuiChangeEvent(player, gui, oldGui);
        Bukkit.getPluginManager().callEvent(e);
        if (e.isCancelled()) {
            if (oldGui != null)
                g.push(oldGui);
            return;
        }
        if (oldGui != null)
            oldGui.onClose(player);
        g.push(gui);
        gui.onOpen(player);
        gui.show(player);
    } finally {
        called = false;
    }
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:33,代码来源:GuiManager.java

示例2: transferThroughList

import java.util.LinkedList; //导入方法依赖的package包/类
private String transferThroughList(String in, int index) {
    LinkedList<String> list = new LinkedList<String>();
    list.add(System.getenv("")); // taints the list
    list.clear(); // makes the list safe again
    list.add(1, "xx");
    list.addFirst(in); // can taint the list
    list.addLast("yy");
    list.push(in);
    return list.element() + list.get(index) + list.getFirst() + list.getLast()
            + list.peek() + list.peekFirst() + list.peekLast() + list.poll()
            + list.pollFirst() + list.pollLast() + list.pop() + list.remove()
            + list.remove(index) + list.removeFirst() + list.removeLast()
            + list.set(index, "safe") + list.toString();
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:15,代码来源:CommandInjection.java

示例3: initScienceProjects

import java.util.LinkedList; //导入方法依赖的package包/类
private void initScienceProjects() {
    LinkedList<ScienceProject> scienceProjectPool;
    scienceProjectPool = new LinkedList<>();
    scienceProjectPool.add(new ScienceProject(new int[]{3, 3, 0, 0, 3}));
    scienceProjectPool.add(new ScienceProject(new int[]{0, 3, 3, 3, 0}));
    scienceProjectPool.add(new ScienceProject(new int[]{3, 0, 0, 3, 3}));
    scienceProjectPool.add(new ScienceProject(new int[]{0, 0, 4, 4, 0}));
    scienceProjectPool.add(new ScienceProject(new int[]{0, 4, 4, 0, 0}));
    scienceProjectPool.add(new ScienceProject(new int[]{0, 0, 0, 4, 4}));
    scienceProjectPool.add(new ScienceProject(new int[]{4, 0, 0, 0, 4}));
    scienceProjectPool.add(new ScienceProject(new int[]{3, 3, 3, 0, 0}));
    scienceProjectPool.add(new ScienceProject(new int[]{0, 0, 3, 3, 3}));
    scienceProjectPool.add(new ScienceProject(new int[]{4, 4, 0, 0, 0}));
    Collections.shuffle(scienceProjectPool, random);

    scienceProjects = new ArrayList<>(SCIENCE_PROJECTS_BY_LEAGUE_LEVEL[LEAGUE_LEVEL]);
    for (int i = 0; i < SCIENCE_PROJECTS_BY_LEAGUE_LEVEL[LEAGUE_LEVEL]; ++i) {
        ScienceProject project = scienceProjectPool.pop();
        project.index = i;
        scienceProjects.add(project);
    }
}
 
开发者ID:KevinBusse,项目名称:cg-referee-code4life,代码行数:23,代码来源:Referee.java

示例4: unregisterComponent

import java.util.LinkedList; //导入方法依赖的package包/类
public void unregisterComponent ( final LinkedList<String> prefix, final Component component )
{
    // first get the name
    final String next = prefix.pop ();

    logger.debug ( "Checking: {}", next );

    if ( prefix.isEmpty () )
    {
        remove ( next, component );
    }
    else
    {
        logger.debug ( "Passing to sub node" );
        final ComponentNode node = this.nodes.get ( next );
        if ( node == null )
        {
            logger.debug ( "Sub node not found" );
            return;
        }
        node.unregisterComponent ( prefix, component );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ComponentNode.java

示例5: handleClassDescInfo

import java.util.LinkedList; //导入方法依赖的package包/类
/*******************
 * Handle a classDescInfo element and add the class name and any string
 * annotations to the object description.
 * 
 * @param obj The RMIObject to populate with class names.
 * @param dataStack The remaining data in the ReplyData packet.
 * @param className The class name that was read prior to reading this classDescInfo element.
 ******************/
private void handleClassDescInfo(RMIObject obj, LinkedList<Byte> dataStack, String className) throws BaRMIeInvalidReplyDataPacketException {
	ArrayList<String> stringAnnotations;
	byte classDescFlags;
	int i;
	
	//Read the class desc flags
	classDescFlags = dataStack.pop();
	
	//Read the field data
	this.handleFields(obj, dataStack, classDescFlags);
	
	//Read the class annotations
	stringAnnotations = this.handleClassAnnotation(obj, dataStack);
	
	//Add the class to the object description along with any string annotations
	if(this._recordClasses) {
		obj.addClass(className);
		for(String annotation: stringAnnotations) {
			obj.addStringAnnotation(className, annotation);
		}
	}
	
	//Read the super class description
	this.handleClassDesc(obj, dataStack);
}
 
开发者ID:NickstaDB,项目名称:BaRMIe,代码行数:34,代码来源:RMIReplyDataParser.java

示例6: run

import java.util.LinkedList; //导入方法依赖的package包/类
default String run( LinkedList<StackItem> items ) {
    if ( items.size() < 2 ) {
        return "<Not enough inputs in the stack>";
    }

    StackItem item2 = items.pop();
    StackItem item1 = items.pop();

    if ( item1 instanceof Numeric && item2 instanceof Numeric ) {
        Numeric result = new Numeric( apply( ( ( Numeric ) item1 ).value, ( ( Numeric ) item2 ).value ) );
        items.push( result );
        return result.name();
    } else {
        items.push( item1 );
        items.push( item2 );
        return "<" + name() + " error - stack does not contain two numbers at the top>";
    }
}
 
开发者ID:renatoathaydes,项目名称:jgrab,代码行数:19,代码来源:Calc.java

示例7: pop

import java.util.LinkedList; //导入方法依赖的package包/类
public static TraverseStackNode pop(LinkedList<TraverseStackNode> stack) throws CompileException {
  if (stack == null) {
    throw new CompileException("frame stack is not initialized");
  }

  if (stack.size() == 0) {
    return null;
  }

  return (TraverseStackNode) stack.pop();
}
 
开发者ID:Samsung,项目名称:MeziLang,代码行数:12,代码来源:TraverseStackNode.java

示例8: setFullLock

import java.util.LinkedList; //导入方法依赖的package包/类
public void setFullLock(boolean incr) {
	if (!state.equals(TreeState.PARTIALLY_LOCKED)) {
		for (LockTree p = parent; p != null; p = p.parent) {
			assert (!p.state.equals(TreeState.FULLY_LOCKED));
			assert(p.locks >= 0);
			if (incr) {
				p.setState(TreeState.PARTIALLY_LOCKED);
				p.locks++;
			} else {
				p.locks--;
				if (p.locks == 0)
					p.setState(TreeState.UNLOCKED);
			}
		}
		LinkedList<LockTree> queue = new LinkedList<LockTree>();
		queue.add(this);
		while (!queue.isEmpty()) {
			LockTree c = queue.pop();
			assert (!c.state.equals(TreeState.PARTIALLY_LOCKED) && c.locks == 0);
			if (incr) {
				c.setState(TreeState.FULLY_LOCKED);
			} else {
				c.setState(TreeState.UNLOCKED);
			}
			Collection<LockTree> children = c.getChildren();
			if (children != null) {
				for (LockTree child : children) {
					queue.add(child);
				}
			}
		}
	}

}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:35,代码来源:LockTree.java

示例9: findClusterCandidates

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public Collection<ClusterHead> findClusterCandidates(final VirtualNetwork vNetwork, ClusterHead orig) {

	LinkedList<FullKnowledgeClusterHead> result = new LinkedList<FullKnowledgeClusterHead>();
	LinkedList<LockTree> queue = new LinkedList<LockTree>();
	
	if (!subLockTree.isFullyLocked()) {
		queue.add(subLockTree);
	}

	while (!queue.isEmpty()) {
		LockTree current = queue.pop();
		if (current.getChildren() != null) {
			for (LockTree t : current.getChildren()) {
				//TODO: Here we got Information of Children without sending a message!
				if (estimationAlgorithm.estimate(
						((FullKnowledgeClusterHead) t.getClusterHead()).getCluster(), vNetwork) >= 1.0d) {
					if (t.isUnLocked()) {
						queue.addLast(t);
					}
				}
			}
		}
		if (current.getClusterHead() != orig) {
			result.add((FullKnowledgeClusterHead) current.getClusterHead());
		}
	}

	Collections.sort(result, new Comparator<FullKnowledgeClusterHead>() {
		@Override
		public int compare(FullKnowledgeClusterHead o1, FullKnowledgeClusterHead o2) {
			
			double i1 = estimationAlgorithm.estimate(o1.getCluster(), vNetwork);
			double i2 = estimationAlgorithm.estimate(o2.getCluster(), vNetwork);
			
			if (i1 < i2) {
				return -1;
			}
			if (i1 > i2) {
				return 1;
			}
			
			return 0;
		}
	});

	return new LinkedList<ClusterHead>(result);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:49,代码来源:FullKnowledgeClusterHead.java

示例10: extractInt

import java.util.LinkedList; //导入方法依赖的package包/类
/*******************
 * Read an int from the data stack.
 * 
 * @param dataStack The remaining data from the RMI ReplyData packet.
 * @return The int extracted from the serialisation data.
 ******************/
private int extractInt(LinkedList<Byte> dataStack) {
	//Read four bytes from the stack and bit-shift/mask them into an int
	return (int)(
			((dataStack.pop() << 24) & 0xff000000) +
			((dataStack.pop() << 16) &   0xff0000) +
			((dataStack.pop() <<  8) &     0xff00) +
			( dataStack.pop()        &       0xff)
	);
}
 
开发者ID:NickstaDB,项目名称:BaRMIe,代码行数:16,代码来源:RMIReplyDataParser.java

示例11: getMap

import java.util.LinkedList; //导入方法依赖的package包/类
private static BiMap<String, GraphQLType> getMap(
    List<FileDescriptor> fileDescriptors,
    List<Descriptor> descriptors,
    List<EnumDescriptor> enumDescriptors,
    GraphQLInterfaceType nodeInterface) {
  HashBiMap<String, GraphQLType> mapping = HashBiMap.create(getEnumMap(enumDescriptors));
  LinkedList<Descriptor> loop = new LinkedList<>(descriptors);

  Set<FileDescriptor> fileDescriptorSet = extractDependencies(fileDescriptors);

  for (FileDescriptor fileDescriptor : fileDescriptorSet) {
    loop.addAll(fileDescriptor.getMessageTypes());
    mapping.putAll(getEnumMap(fileDescriptor.getEnumTypes()));
  }

  while (!loop.isEmpty()) {
    Descriptor descriptor = loop.pop();
    if (!mapping.containsKey(descriptor.getFullName())) {
      mapping.put(
          ProtoToGql.getReferenceName(descriptor),
          ProtoToGql.convert(descriptor, nodeInterface));
      GqlInputConverter inputConverter =
          GqlInputConverter.newBuilder().add(descriptor.getFile()).build();
      mapping.put(
          GqlInputConverter.getReferenceName(descriptor),
          inputConverter.getInputType(descriptor));
      loop.addAll(descriptor.getNestedTypes());

      mapping.putAll(getEnumMap(descriptor.getEnumTypes()));
    }
  }
  return ImmutableBiMap.copyOf(mapping);
}
 
开发者ID:google,项目名称:rejoiner,代码行数:34,代码来源:ProtoRegistry.java

示例12: loadImages

import java.util.LinkedList; //导入方法依赖的package包/类
private void loadImages() {
    if (!isExternalStorageReadable()) {
        finish();
    }

    File externalStorage = android.os.Environment.getExternalStorageDirectory();

    ArrayList<Image> images = new ArrayList<>(MAX_FILES);
    LinkedList<File> files = new LinkedList<>();
    files.add(externalStorage);


    while (!files.isEmpty() && images.size() < MAX_FILES) {
        File file = files.pop();
        if (file.isDirectory()) {
            // Read the contents of all directories and add them to the list.
            files.addAll(Arrays.asList(file.listFiles(mPngFilter)));
        } else {
            // Read in the file and add it to the list
            Bitmap b = ImageUtils.decodeSampledBitmapFromFile(file.getAbsolutePath(), 200, 200);
            images.add(new Image(file.getAbsolutePath(), b));
        }
    }

    showList(images);

}
 
开发者ID:googlecodelabs,项目名称:android-storage-permissions,代码行数:28,代码来源:ImageImportActivity.java

示例13: travelDFS

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public LinkedList<StationGraphVO> travelDFS(StationGraphVO vertex, boolean isAscending) {
	if(!checkLineNum(vertex.getLineNum()))
		throw new IllegalArgumentException("Unavailable lineNum");
	
	LinkedList<StationGraphVO> results = new LinkedList<>();
	
	HashSet<StationGraphVO> checkVisitSet = new HashSet<>();
	LinkedList<StationGraphVO> stack = new LinkedList<>();

	//첫 번째 Node 방문
	StationGraphVO firstVertex = vertex;
	stack.push(firstVertex);
	checkVisitSet.add(firstVertex);
	
	while(!stack.isEmpty()) {
		StationGraphVO poppedVertex = stack.pop();
		results.add(poppedVertex);
		
		sort(edgesByVertices.get(poppedVertex), !isAscending);
		
		for(Edge edge : edgesByVertices.get(poppedVertex)) {

			StationGraphVO linkedVertex = edge.getToVertex();
			linkedVertex = edgesByVertices.ceilingKey(linkedVertex); //추가
			
			if(!checkVisitSet.contains(linkedVertex)) {
				checkVisitSet.add(linkedVertex);
				stack.push(linkedVertex);
			}
		}
	}
	
	return results;
}
 
开发者ID:xeyez,项目名称:StationGraph,代码行数:36,代码来源:StationGraph.java

示例14: pop

import java.util.LinkedList; //导入方法依赖的package包/类
public Object pop() {
    LinkedList last = getLastStack();
    if (last == null) throw new RuntimeException("Trying to pop from empty chapter03_stack_queues");
    Object v = last.pop();
    if (last.isEmpty()) {
        stacks.remove(stacks.size() - 1);
    }
    return v;
}
 
开发者ID:xy1m,项目名称:PlayGround,代码行数:10,代码来源:Q3_03_SetOfStacks.java

示例15: evaluate

import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public boolean evaluate() {
    switch( token.sequence ) {

        case "0":
            return negated;

        case "1":

            return !negated;

        case "&":
            boolean accumulator1 = true;
            LinkedList<ExpressionTree> stack1 = new LinkedList<>();
            stack1.addAll( children );
            while( !stack1.isEmpty() ) {
                accumulator1 = accumulator1 && stack1.getFirst().evaluate();
                stack1.pop();
            }
            if( negated ) {
                return !accumulator1;
            }
            return accumulator1;

        case "|":
            for( ExpressionTree c : children ) {
                if( c.evaluate() ) {
                    return !negated;
                }
            }
            return negated;

        case "->":
            boolean accumulator2 = true;
            LinkedList<ExpressionTree> stack2 = new LinkedList<>();
            stack2.addAll( children );
            while( !stack2.isEmpty() ) {
                accumulator2 = !accumulator2 || stack2.getFirst().evaluate();
                stack2.pop();
            }
            if( negated ) {
                return !accumulator2;
            }
            return accumulator2;

        default:
            throw new IllegalStateException("Valid token expected, but " +token.sequence+ " found instead");
    }
}
 
开发者ID:jp-richter,项目名称:logibear,代码行数:50,代码来源:ExpressionTree.java


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