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


Java LinkedList.push方法代码示例

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


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

示例1: open

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Opens a Gui to a player, adding it to the stack. If the closeOthers parameter is specified it will removeHotbar the stack first
 *
 * @param player      the player that is opening the api
 * @param gui         the gui to be opened
 * @param closeOthers if give to true the GUI histories would be cleaned
 */
public void open(Player player, Gui gui, boolean closeOthers) {
    if (called) return;
    called = true;
    try {
        LinkedList<Gui> g = getOrCreate(player);
        Gui oldGui = g.peek();
        GuiOpenEvent e = new GuiOpenEvent(player, gui, oldGui);
        e.setCloseOthers(closeOthers);
        Bukkit.getPluginManager().callEvent(e);
        if (e.isCancelled()) {
            if (g.isEmpty())
                histories.remove(player);
            return;
        }
        closeOthers = e.isCloseOthers();
        if (oldGui != null)
            oldGui.onClose(player);
        if (closeOthers)
            g.clear();

        gui.onOpen(player);
        gui.show(player);
        g.push(gui);
    } finally {
        called = false;
    }
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:35,代码来源: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: 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

示例4: chooseIntentions

import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList<Action> chooseIntentions(
        MentalState.Desire goal, Set<Action> actionsPossible
) {
    LinkedList<Action> intentions = new LinkedList<>();

    // Ramasse les bijoux avant d'aspirer
    if (actionsPossible.contains(Action.GATHER_JEWELRY))
        intentions.push(Action.GATHER_JEWELRY);

    else if (actionsPossible.contains(Action.VACUUM_DUST))
        intentions.push(Action.VACUUM_DUST);

    else {
        // A random move
        ThreadLocalRandom random = ThreadLocalRandom.current();
        int countPossibleActions = actionsPossible.size();
        int actionNumber = random.nextInt(countPossibleActions);

        intentions.push((Action) (actionsPossible.toArray())[actionNumber]);
    }

    return intentions;
}
 
开发者ID:KevinSeroux,项目名称:AspirobotT-0.1,代码行数:24,代码来源:Robot.java

示例5: getCollisions

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public List<RayCastResult> getCollisions( StraightLine3D ray, double minDistanceSquare, double maxDistanceSquare, ArrayList<Triangle> data ) {
	LinkedList<RayCastResult> retval = new LinkedList<RayCastResult>();
	
	// now let's examine the ray's collisions with triangles
	for(Triangle triangle : data) {

		SimplePlanarPolygon3D trianglePolygon = triangle.planarPolygon;
		Plane3D trianglePlane = trianglePolygon.getPlane();
		Double intersectionParameter = ray.getPlaneIntersectionParametric(trianglePlane);
		if ( Double.isInfinite(intersectionParameter) || intersectionParameter < 0 || intersectionParameter > 1 ) {
			// no intersection or intersection in wrong direction or past the point
			continue;
		}

		Point3D intersection = ray.getPoint(intersectionParameter);
		double intersectionDistanceSquare = ray.getOrigin().getDistanceSquare(intersection);
		
		if ( intersectionDistanceSquare < minDistanceSquare || maxDistanceSquare < intersectionDistanceSquare ) {
			continue;
		}
		
		Point2D intersection2D = trianglePlane.getCoordinateSubsystem().project( intersection );
		SimplePolygon2D polygon2D = trianglePolygon.getPolygonIn2d();

		if ( !polygon2D.contains( intersection2D, triangle.signedAreaIn2dProjection ) ) {
			// intersection is outside the polygon
			continue;
		}

		Location intersectionLocation = new Location(intersection);
		retval.push( new RayCastResult( ray, intersectionLocation, trianglePlane.getNormalVector(), Math.sqrt(intersectionDistanceSquare), triangle ) );
	}

	Collections.sort( retval, hitDistanceComparator );

	return retval;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:39,代码来源:RayCaster.java

示例6: createWordsPermutation

import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList<String> createWordsPermutation(List<String> words, int i, Ending ending) {
    LinkedList<String> currPermutation = Lists.newLinkedList(words);
    for (int k = 0; k < i; k++) {
        if (ending == Ending.HEAD || ending == Ending.BOTH) {
            String currHeadPwd = Strings.padEnd(HEAD_ELEMENT, i - k, HEAD_ELEMENT.charAt(0));
            currPermutation.push(currHeadPwd);
        }
        if (ending == Ending.TAIL || ending == Ending.BOTH) {
            String currTailPwd = Strings.padEnd(TAIL_ELEMENT, k, TAIL_ELEMENT.charAt(0));
            currPermutation.add(currTailPwd);
        }
    }
    return currPermutation;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:15,代码来源:WordsPermutationUtil.java

示例7: wrapExistingMembers

import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList<RecipientWrapper> wrapExistingMembers(Collection<Recipient> recipients) {
  final LinkedList<RecipientWrapper> wrapperList = new LinkedList<>();
  RecipientWrapper wrapper;
  for (Recipient recipient : recipients) {
    wrapper = new RecipientWrapper(recipient, false, true,
            isOwnerNumber(recipient.getNumber()), isAdminNumber(recipient.getNumber()));
    if(Util.isOwnNumber(context, recipient.getNumber())) {
      wrapperList.push(wrapper);
    } else {
      wrapperList.add(wrapper);
    }
  }
  return wrapperList;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:15,代码来源:SelectedRecipientsAdapter.java

示例8: travelDFS

import java.util.LinkedList; //导入方法依赖的package包/类
public LinkedList<T> travelDFS(T vertex, boolean isAscending) {
	LinkedList<T> results = new LinkedList<>();
	
	HashSet<T> checkVisitSet = new HashSet<>();
	
	LinkedList<T> stack = new LinkedList<>();

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

			T linkedVertex = edge.getToVertex();
			
			if(!checkVisitSet.contains(linkedVertex)) {
				checkVisitSet.add(linkedVertex);
				stack.push(linkedVertex);
			}
		}
	}
	
	return results;
}
 
开发者ID:xeyez,项目名称:StationGraph,代码行数:32,代码来源:AbstractGraph.java

示例9: select

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public CoinSelection select(Coin target, List<TransactionOutput> candidates) {
    try {
        LinkedList<TransactionOutput> gathered = Lists.newLinkedList();
        Coin valueGathered = Coin.ZERO;
        for (TransactionOutput output : candidates) {
            if (ignorePending && !isConfirmed(output))
                continue;
            // Find the key that controls output, assuming it's a regular pay-to-pubkey or pay-to-address output.
            // We ignore any other kind of exotic output on the assumption we can't spend it ourselves.
            final Script scriptPubKey = output.getScriptPubKey();
            ECKey controllingKey;
            if (scriptPubKey.isSentToRawPubKey()) {
                controllingKey = wallet.findKeyFromPubKey(scriptPubKey.getPubKey());
            } else if (scriptPubKey.isSentToAddress()) {
                controllingKey = wallet.findKeyFromPubHash(scriptPubKey.getPubKeyHash());
            } else {
                log.info("Skipping tx output {} because it's not of simple form.", output);
                continue;
            }
            checkNotNull(controllingKey, "Coin selector given output as candidate for which we lack the key");
            if (controllingKey.getCreationTimeSeconds() >= unixTimeSeconds) continue;
            // It's older than the cutoff time so select.
            valueGathered = valueGathered.add(output.getValue());
            gathered.push(output);
            if (gathered.size() >= MAX_SIMULTANEOUS_INPUTS) {
                log.warn("Reached {} inputs, going further would yield a tx that is too large, stopping here.", gathered.size());
                break;
            }
        }
        return new CoinSelection(valueGathered, gathered);
    } catch (ScriptException e) {
        throw new RuntimeException(e);  // We should never have problems understanding scripts in our wallet.
    }
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:36,代码来源:KeyTimeCoinSelector.java

示例10: push

import java.util.LinkedList; //导入方法依赖的package包/类
public void push(Object v) {
    LinkedList lastStack = getLastStack();
    if (lastStack != null && lastStack.size() != capacity) {
        lastStack.push(v);
    } else {
        LinkedList newStack = new LinkedList();
        newStack.push(v);
        stacks.add(newStack);
    }
}
 
开发者ID:xy1m,项目名称:PlayGround,代码行数:11,代码来源:Q3_03_SetOfStacks.java

示例11: handleObjectAnnotation

import java.util.LinkedList; //导入方法依赖的package包/类
/*******************
 * Handle an objectAnnotation element, extracting the object endpoint
 * details if found.
 * 
 * @param obj The RMIObject to populate with class names.
 * @param dataStack The remaining data in the ReplyData packet.
 ******************/
private void handleObjectAnnotation(RMIObject obj, LinkedList<Byte> dataStack) throws BaRMIeInvalidReplyDataPacketException {
	byte b;
	
	//Read elements from the stream until a TC_ENDBLOCKDATA element is read
	while((b = dataStack.pop()) != ObjectStreamConstants.TC_ENDBLOCKDATA) {
		//Handle the annotation
		switch(b) {
			//Look for object endpoint details in block data elements
			case ObjectStreamConstants.TC_BLOCKDATA:
				//Push the block type back on to the stack and extract endpoint details if found
				dataStack.push(ObjectStreamConstants.TC_BLOCKDATA);
				this.extractObjectEndpointFromBlockData(obj, dataStack);
				break;
				
			//Skip over object annotations
			case ObjectStreamConstants.TC_OBJECT:
				this.handleNewObjectElement(obj, dataStack);
				break;
				
			//Ignore null annotations...
			case ObjectStreamConstants.TC_NULL:
				break;
				
			//Unknown annotation type
			default:
				throw new BaRMIeInvalidReplyDataPacketException("Unknown classAnnotation element type (0x" + String.format("%02x", b) + ").");
		}
	}
}
 
开发者ID:NickstaDB,项目名称:BaRMIe,代码行数:37,代码来源:RMIReplyDataParser.java

示例12: equateIntervals

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * computes whether the test interval list is equivalent to master.  To be equivalent, test must
 * contain GenomeLocs covering every base in master, exactly once.  Note that this algorithm
 * assumes that master genomelocs are all discontiguous (i.e., we don't have locs like 1-3 and 4-6 but
 * rather just 1-6).  In order to use this algorithm with contiguous genomelocs first merge them.  The algorithm
 * doesn't assume that test has discontinuous genomelocs.
 *
 * Returns a null string if there are no differences, otherwise returns a string describing the difference
 * (useful for UnitTests).  Assumes both lists are sorted
 *
 * @param masterArg sorted master genome locs
 * @param testArg sorted test genome locs
 * @return null string if there are no difference, otherwise a string describing the difference
 */
public static String equateIntervals(List<GenomeLoc> masterArg, List<GenomeLoc> testArg) {
    LinkedList<GenomeLoc> master = new LinkedList<GenomeLoc>(masterArg);
    LinkedList<GenomeLoc> test = new LinkedList<GenomeLoc>(testArg);

    while ( ! master.isEmpty() ) { // there's still unchecked bases in master
        final GenomeLoc masterHead = master.pop();
        final GenomeLoc testHead = test.pop();

        if ( testHead.overlapsP(masterHead) ) {
            // remove the parts of test that overlap master, and push the remaining
            // parts onto master for further comparison.
            for ( final GenomeLoc masterPart : Utils.reverse(masterHead.subtract(testHead)) ) {
                master.push(masterPart);
            }
        } else {
            // testHead is incompatible with masterHead, so we must have extra bases in testHead
            // that aren't in master
            return "Incompatible locs detected masterHead=" + masterHead + ", testHead=" + testHead;
        }
    }

    if ( test.isEmpty() ) // everything is equal
        return null; // no differences
    else
        return "Remaining elements found in test: first=" + test.peek();
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:41,代码来源:IntervalUtils.java

示例13: setCurrentHelper

import java.util.LinkedList; //导入方法依赖的package包/类
protected void setCurrentHelper(OnlineSectioningHelper helper) {
	LinkedList<OnlineSectioningHelper> h = sHelper.get();
	if (h == null) {
		h = new LinkedList<OnlineSectioningHelper>();
		sHelper.set(h);
	}
	h.push(helper);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:9,代码来源:AbstractServer.java

示例14: bubbleUpNodeTable

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Propagates node table of given DAG to all of it ancestors.
 */
private void bubbleUpNodeTable(DAGraph<DataT, NodeT> from, LinkedList<String> path) {
    if (path.contains(from.rootNode.key())) {
        path.push(from.rootNode.key()); // For better error message
        throw new IllegalStateException("Detected circular dependency: " + StringUtils.join(path, " -> "));
    }
    path.push(from.rootNode.key());
    for (DAGraph<DataT, NodeT> to : from.parentDAGs) {
        this.merge(from.nodeTable, to.nodeTable);
        this.bubbleUpNodeTable(to, path);
    }
    path.pop();
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:16,代码来源:DAGraph.java

示例15: addFieldToStack

import java.util.LinkedList; //导入方法依赖的package包/类
private static void addFieldToStack(String prefix, Object val, LinkedList<Map<String, Object>> stack,
		List<Map<String, Object>> keysAndValues) {
	if (val instanceof Map) {
		// flatten all nested objects
		stack.push(Collections.singletonMap(prefix, val));
	} else if (val instanceof List) {
		// input array: key: [value1, value2] - [{k: key-0, v: value1}, {k: key-1, v: value2}]
		for (int i = 0; i < ((List) val).size(); i++) {
			stack.push(Collections.singletonMap(prefix + "-" + String.valueOf(i), ((List) val).get(i)));
		}
	} else {
		keysAndValues.add(getKeyValueField(prefix, val));
	}
}
 
开发者ID:Erudika,项目名称:para-search-elasticsearch,代码行数:15,代码来源:ElasticSearchUtils.java


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