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


Java LinkedList.get方法代码示例

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


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

示例1: getRemovedSymmetryGraph2

import java.util.LinkedList; //导入方法依赖的package包/类
public LinkedList<Edge> getRemovedSymmetryGraph2() {
	LinkedList<Edge> list = new LinkedList<>();
	for(LinkedList<Edge> edges : edgesByVertices.values()) {
		list.addAll(edges);
	}
	
	if(graphType != GraphType.UNDIRECTED)
		return list;
	
	for(int i=0 ; i<list.size() ; i++) {
		Edge e1 = list.get(i);
		
		for(int j=0 ; j<list.size() ; j++) {
			Edge e2 = list.get(j);
			
			if(e1.checkSymmetry(e2))
				list.remove(j);
		}
	}
	
	return list;
}
 
开发者ID:xeyez,项目名称:StationGraph,代码行数:23,代码来源:AbstractGraph.java

示例2: removeEdge

import java.util.LinkedList; //导入方法依赖的package包/类
public void removeEdge(String fromStationName, String toStationName, String lineNum) {
	LinkedList<Edge> edges = edgesByVertices.get(new StationGraphVO(fromStationName, lineNum, Identifier.CURRENT));

	int result = Integer.MIN_VALUE;
	
	for(int i=0 ; i<edges.size() ; i++) {
		AbstractGraph<StationGraphVO>.Edge e = edges.get(i);
		
		if(e.toVertex.getStationName().equals(toStationName) && e.toVertex.getLineNum().equals(lineNum)) {
			result = i;
			break;
		}			
	}
	
	if(result < 0)
		throw new NullPointerException("Not found");
	
	edges.remove(result);
}
 
开发者ID:xeyez,项目名称:StationGraph,代码行数:20,代码来源:StationGraph.java

示例3: setPlayerTwoHand

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Sets the hand of the second player by retrieving the first few cards of
 * the deck and sending a message to the client containing all the needed
 * information for setting up the hand as the client.
 */
public void setPlayerTwoHand() {
	LinkedList<Card> cards = table.getDeck().getNewHand();

	table.getPlayerTwoHand().setHand(cards);

	StringBuilder message = new StringBuilder();
	message.append(EMessage.S2C_OWN_HAND_UPDATE.ordinal() + "\t\t");
	// x \t y \t identifier \t type

	for (int i = 0; i < cards.size(); i++) {
		Card card = cards.get(i);
		message.append(
				card.getIdentifier().toString() + "\t" + card.getType().toString() + "\t" + card.getID() + "\t\t");
	}
	playerTwo.send(message.toString());
	playerOne.send(EMessage.S2C_OPPONENT_HAND_UPDATE.ordinal() + "\t\t" + cards.size());

}
 
开发者ID:Ativelox,项目名称:Rummy,代码行数:24,代码来源:RummyGame.java

示例4: getAggregationID

import java.util.LinkedList; //导入方法依赖的package包/类
public int getAggregationID(ConsoleAccess telnet, String ifName)
        throws IOException, ConsoleException, AbortedException {
    int port = ifNameToIfIndex(ifName);

    LinkedList<Lag> lagList = (new ShowLagAll(telnet)).getLagList();

    if (lagList == null)
        return -1;

    for (int i = 0; i < lagList.size(); i++) {
        Lag lag = (Lag) lagList.get(i);
        for (int j = 0; j < lag.ethernetPortList.size(); j++) {
            if (((Integer) (lag.ethernetPortList.get(j))).intValue() == port) {
                return lag.aggregatorPort;
            }
        }
    }

    return -1;
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:21,代码来源:EXAtraxTelnetUtil.java

示例5: process

import java.util.LinkedList; //导入方法依赖的package包/类
private void process() {
    Collections.sort(recordList, new AscendingOrder());
    int p_length = recordList.size();
    double FDR = 0;
    int rank = 0;
    LinkedList<Double> frdValueList = new LinkedList();
    for (FDRInputRecord dataRecord : recordList) {
        rank = rank + 1;
        FDR = dataRecord.getPValue() * p_length / rank;
        dataRecord.setFDR(FDR);
        frdValueList.add(FDR);
    }
    int index = 0;
    while (true) {
        if (frdValueList.size() > 0) {
            double min = getMin(frdValueList);
            int minIndex = 0;
            for (int i = 0; i < frdValueList.size(); i++) {
                if (frdValueList.get(i) == min) {
                    minIndex = i;
                    for (int k = 0; k <= minIndex; k++) {
                        recordList.get(index + k).setFDR(min);
                        frdValueList.remove(0);
                    }
                    break;
                }
            }
            index = index + (minIndex + 1);
        } else {
            break;
        }
    }
}
 
开发者ID:YubinXieSYSU,项目名称:m6ASNP,代码行数:34,代码来源:FDRControl.java

示例6: 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

示例7: findShifterTargetBaselineLeft

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * This method is used to look for the target of a shifter using a given
 * window and lexicon look-up. The found shifter target must be contained in
 * the sentimentList in order to be returned by this method. Looks to the left
 * of the shifter.
 *
 * @param shifter The shifter for which a target is searched for.
 * @param sentimentList A list of found sentiments in the current sentence.
 * These are the potential shifter target candidates.
 * @param sentence The sentence the shifter is in.
 * @return The WordObj corresponding to the found shifter target, or null.
 */
private WordObj findShifterTargetBaselineLeft(WordObj shifter, ArrayList<WordObj> sentimentList, SentenceObj sentence,
        int window) {
  WordObj shifterTarget = null;
  LinkedList<WordObj> wordList = sentence.getWordList();
  int shifterPos = sentence.getWordPosition(shifter);

  for (int i = 1; i <= window; i++) {
    if (shifterPos - i >= 0) {
      shifterTarget = wordList.get(shifterPos - i);
      if (sentimentList.contains(shifterTarget)) {
        if (shifter_orientation_check) {
          if (orientationCheck(shifter, shifterTarget)) {
            return shifterTarget;
          }
        } else {
          return shifterTarget;
        }
      }
    }
  }
  return null;
}
 
开发者ID:artificial-max,项目名称:polcla,代码行数:35,代码来源:WindowBaseline.java

示例8: getAtmPVCs

import java.util.LinkedList; //导入方法依赖的package包/类
public String[] getAtmPVCs(ConsoleAccess telnet, String atmPhysicalPortIfName)
        throws IOException, ConsoleException, AbortedException {
    int slot = atmIfNameToSlot(atmPhysicalPortIfName);
    int port = atmIfNameToPort(atmPhysicalPortIfName);

    ShowAtmPvc sap = new ShowAtmPvc(telnet, slot, port);
    LinkedList<Pvc> list = sap.getPvcList();

    String str[] = new String[list.size()];

    for (int i = 0; i < list.size(); i++) {
        Pvc pvc = (Pvc) list.get(i);
        str[i] = pvc.vpi + "/" + pvc.vci;
    }

    return str;
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:18,代码来源:EXAtraxTelnetUtil.java

示例9: getStrArray

import java.util.LinkedList; //导入方法依赖的package包/类
public static String[] getStrArray(LinkedList<?> list) {
  String[] str_array = new String[list.size()];

  for (int i = 0; i < str_array.length; i++) {
    str_array[i] = (String) list.get(i);
  }

  return str_array;
}
 
开发者ID:Samsung,项目名称:MeziLang,代码行数:10,代码来源:Util.java

示例10: list2Arr

import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <E> E[] list2Arr(Class<E> clazz, LinkedList<E> list) {
  int size = list.size();
  // E[] arr = (E[]) new Object[size];
  E[] arr = (E[]) Array.newInstance(clazz, size);

  for (int i = 0; i < size; i++) {
    arr[i] = list.get(i);
  }

  return arr;
}
 
开发者ID:Samsung,项目名称:MeziLang,代码行数:13,代码来源:Util.java

示例11: getPlaceArmiesMoves

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
/**
 * This method is called for at first part of each round. This example puts two armies on random regions
 * until he has no more armies left to place.
 * @return The list of PlaceArmiesMoves for one round
 */
public ArrayList<PlaceArmiesMove> getPlaceArmiesMoves(BotState state, Long timeOut) 
{
	
	ArrayList<PlaceArmiesMove> placeArmiesMoves = new ArrayList<PlaceArmiesMove>();
	String myName = state.getMyPlayerName();
	int armies = 2;
	int armiesLeft = state.getStartingArmies();
	LinkedList<Region> visibleRegions = state.getVisibleMap().getRegions();
	
	while(armiesLeft > 0)
	{
		double rand = Math.random();
		int r = (int) (rand*visibleRegions.size());
		Region region = visibleRegions.get(r);
		
		if(region.ownedByPlayer(myName))
		{
			placeArmiesMoves.add(new PlaceArmiesMove(myName, region, armies));
			armiesLeft -= armies;
		}
	}
	
	return placeArmiesMoves;
}
 
开发者ID:stnevans,项目名称:LightRidersAI,代码行数:31,代码来源:BotStarter.java

示例12: execute

import java.util.LinkedList; //导入方法依赖的package包/类
public void execute(GuildMessageReceivedEvent e, String query) {

        final AudioHandler player = JukeBot.getPlayer(e.getGuild().getAudioManager());
        final LinkedList<AudioTrack> queue = player.getQueue();

        if (queue.isEmpty()) {
            e.getChannel().sendMessage(new EmbedBuilder()
                    .setColor(JukeBot.embedColour)
                    .setTitle("No songs queued")
                    .setDescription("Use `" + Database.getPrefix(e.getGuild().getIdLong()) + "now` to view the current track.")
                    .build()
            ).queue();
            return;
        }

        final String queueDuration = Helpers.fTime(queue.stream().map(AudioTrack::getDuration).reduce(0L, (a, b) -> a + b));
        final StringBuilder fQueue = new StringBuilder();

        final int maxPages = (int) Math.ceil((double) queue.size() / 10);
        int page = Helpers.parseNumber(query, 1);

        if (page < 1)
            page = 1;

        if (page > maxPages)
            page = maxPages;

        int begin = (page - 1) * 10;
        int end = (begin + 10) > queue.size() ? queue.size() : (begin + 10);

        for (int i = begin; i < end; i++) {
            final AudioTrack track = queue.get(i);
            fQueue.append("`")
                    .append(i + 1)
                    .append(".` **[")
                    .append(track.getInfo().title)
                    .append("](")
                    .append(track.getInfo().uri)
                    .append(")** <@")
                    .append(track.getUserData())
                    .append(">\n");
        }

        e.getChannel().sendMessage(new EmbedBuilder()
                .setColor(JukeBot.embedColour)
                .setTitle("Queue (" + queue.size() + " songs, " + queueDuration + ")")
                .setDescription(fQueue.toString().trim())
                .setFooter("Viewing page " + (page) + "/" + (maxPages), null)
                .build()
        ).queue();

    }
 
开发者ID:Devoxin,项目名称:JukeBot,代码行数:53,代码来源:Queue.java

示例13: getFileUploadProcessors

import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected List<FileUploadProcessor> getFileUploadProcessors(String group) throws Exception {
  // 初始化业务分支
  if (initdTag.compareAndSet(false, true)) {
    TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> all =
        (TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>>) fileProcessFactory.getObject();
    //
    TreeMap<Integer, LinkedList<FileUploadProcessor>> pd = all.get(AbstractChannelProcessor.KEY);
    for (Entry<Integer, LinkedList<FileUploadProcessor>> orderProcessorEntry : pd.entrySet()) {
      publicChannel.addAll(orderProcessorEntry.getValue());
    }
    all.remove(AbstractChannelProcessor.KEY);//干掉主分支
    // 遍历其他的树
    for (Entry<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> tree : all.entrySet()) {
      TreeMap<Integer, LinkedList<FileUploadProcessor>> thisTree = tree.getValue();
      LinkedList<FileUploadProcessor> thisTreeList = new LinkedList<FileUploadProcessor>();
      // 添加树枝
      for (Entry<Integer, LinkedList<FileUploadProcessor>> branch : thisTree.entrySet()) {
        thisTreeList.addAll(branch.getValue());
      }
      for (int i = 0; i < thisTreeList.size()-1; i++) {
        ((AbstractChannelProcessor)thisTreeList.get(i)).nextProcessor = thisTreeList.get(i+1);
      }
      namedChannel.put(tree.getKey(), thisTreeList);
    }
  }
  //
  if (StringUtils.isBlank(group)) {
    return publicChannel;
  } else {
    LinkedList<FileUploadProcessor> ppl = namedChannel.get(group);
    return ppl == null ? new LinkedList<FileUploadProcessor>() : ppl;
  }
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:35,代码来源:GenericFileProcessor.java

示例14: replaceExprFunc4PCon

import java.util.LinkedList; //导入方法依赖的package包/类
public static AbstractExpr replaceExprFunc4PCon(AbstractExpr aeToSolve, AbstractExpr aeOriginalExpr, LinkedList<PatternExprUnitMap> listPEUMap) throws JFCALCExpErrException, JSmartMathErrException, InterruptedException	{
	if (aeToSolve instanceof AEFunction
			&& ((AEFunction)aeToSolve).mstrFuncName.equalsIgnoreCase(FUNCTION_ORIGINAL_EXPRESSION))	{
		if (((AEFunction)aeToSolve).mlistChildren.size() != listPEUMap.size())	{
			throw new JSmartMathErrException(ERRORTYPES.ERROR_NUMBER_OF_VARIABLES_NOT_MATCH);
		}
		AbstractExpr[] aeExprUnits = new AbstractExpr[((AEFunction)aeToSolve).mlistChildren.size()];
		DataClass[] datumValues = new DataClass[((AEFunction)aeToSolve).mlistChildren.size()];
		for (int idx = 0; idx < ((AEFunction)aeToSolve).mlistChildren.size(); idx ++)	{
			// simplify it most to a constant.
               AbstractExpr aexprSimplified = ((AEFunction)aeToSolve).mlistChildren.get(idx).simplifyAExprMost(new LinkedList<UnknownVariable>(),
								new LinkedList<LinkedList<Variable>>(), new SimplifyParams(false, true, false));
			if (!(aexprSimplified instanceof AEConst))	{
				// currently only support constant parameters for f_aexpr_to_analyze
				throw new JSmartMathErrException(ERRORTYPES.ERROR_NOT_CONSTANT_ABSTRACTEXPR);
			}
			aeExprUnits[idx] = listPEUMap.get(idx).maeExprUnit;
			datumValues[idx] = ((AEConst) aexprSimplified).getDataClassRef();  // datumValues are only used in calcExprValue and they will not be changed inside the function.
		}
		aeToSolve = calcExprValue(aeOriginalExpr, aeExprUnits, datumValues);
	} else	{
		LinkedList<PatternExprUnitMap> listFromToMap = new LinkedList<PatternExprUnitMap>();
		LinkedList<AbstractExpr> listChildren = aeToSolve.getListOfChildren();
		for (int idx = 0; idx < listChildren.size(); idx ++)	{
			// does not matter if two children are the same. We just replace them together.
			PatternExprUnitMap pi = new PatternExprUnitMap(listChildren.get(idx),
					replaceExprFunc4PCon(listChildren.get(idx), aeOriginalExpr, listPEUMap));
			listFromToMap.add(pi);
		}
		aeToSolve = aeToSolve.replaceChildren(listFromToMap, true, new LinkedList<AbstractExpr>());
	}
	return aeToSolve;
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:34,代码来源:PtnSlvMultiVarsIdentifier.java

示例15: insertIntoDataCurves

import java.util.LinkedList; //导入方法依赖的package包/类
public void insertIntoDataCurves(LinkedList<LinkedDataCurve> listDataCurves, MultiLinkedPoint mlp, boolean bConnect)	{
	// assume dD1Value and dD2Value are not Nan nor Inf.
	double dD1Value = mlp.mpnt.getDim(mnMode);
	int nD2Dim = (mnMode == 2)?0:(mnMode == 1)?2:1;

	if (listDataCurves.size() == 0)	{
		// add a brand new linked data curve
		listDataCurves.add(new LinkedDataCurve(dD1Value, mlp));
	} else if (dD1Value < listDataCurves.get(0).mdBaseValue)	{
		listDataCurves.addFirst(new LinkedDataCurve(dD1Value, mlp));
	} else if (dD1Value > listDataCurves.getLast().mdBaseValue)	{
		listDataCurves.addLast(new LinkedDataCurve(dD1Value, mlp));
	} else	{
		int idxLeft = 0, idx = (listDataCurves.size() - 1)/2, idxRight = listDataCurves.size() - 1;
		while (idx != idxLeft)	{
			if (dD1Value < listDataCurves.get(idx).mdBaseValue)	{
				idxRight = idx;
				idx = (idxRight + idxLeft)/2;
			} else if (dD1Value > listDataCurves.get(idx).mdBaseValue)	{
				idxLeft = idx;
				idx = (idxRight + idxLeft)/2;
			} else	{	// find it.
				int index = insertIntoSortedList(listDataCurves.get(idx).mlistPnts, mlp, false, nD2Dim);
				if (index > 0 && bConnect)	{
					listDataCurves.get(idx).mlistPnts.get(index - 1).msetConnects.add(mlp);
					mlp.msetConnects.add(listDataCurves.get(idx).mlistPnts.get(index - 1));
				}
				if (index < listDataCurves.size() - 1 && bConnect)	{
					listDataCurves.get(idx).mlistPnts.get(index + 1).msetConnects.add(mlp);
					mlp.msetConnects.add(listDataCurves.get(idx).mlistPnts.get(index + 1));
				}
			}					
		}
		listDataCurves.add(idxLeft + 1, new LinkedDataCurve(dD1Value, mlp));
	}
}
 
开发者ID:woshiwpa,项目名称:CoreMathImgProc,代码行数:37,代码来源:DataSeriesGridSurface.java


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