當前位置: 首頁>>代碼示例>>Java>>正文


Java LinkedList.indexOf方法代碼示例

本文整理匯總了Java中java.util.LinkedList.indexOf方法的典型用法代碼示例。如果您正苦於以下問題:Java LinkedList.indexOf方法的具體用法?Java LinkedList.indexOf怎麽用?Java LinkedList.indexOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.LinkedList的用法示例。


在下文中一共展示了LinkedList.indexOf方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processHttpMessage

import java.util.LinkedList; //導入方法依賴的package包/類
@Override
public void processHttpMessage(int flag, boolean isRequest, IHttpRequestResponse message) {
    if (!isRequest && (IBurpExtenderCallbacks.TOOL_PROXY == flag 
            || IBurpExtenderCallbacks.TOOL_SPIDER == flag)
            && ibec.isInScope(message.getUrl())) {
        if (uInterface.alreadyExists(message)) {
            return;
        }
        LinkedList<IParameter> reflectedParams = new LinkedList<>();
        IRequestInfo info = helpers.analyzeRequest(message.getRequest());
        byte[] response = message.getResponse();
        //byte[] request = message.getRequest();
        List<IParameter> parameters = info.getParameters();
        for (IParameter param : parameters) {
            if (param.getValue().length() > 4) {
                int indexOf = helpers.indexOf(response, helpers.stringToBytes(param.getValue())
                        ,true, 0, response.length - 1);
                if (indexOf != -1) {
                    reflectedParams.add(param);
                }
                //test urldecoded too
                indexOf = helpers.indexOf(response, helpers.stringToBytes(
                        helpers.urlDecode(param.getValue())),true, 0, response.length - 1);
                if (indexOf != -1 && reflectedParams.indexOf(param)==-1) {
                    reflectedParams.add(param);
                }
            }
        }
        if (reflectedParams.size() > 0) {
            uInterface.sendToRequestsTable(message, reflectedParams);
        }
    }
}
 
開發者ID:rammarj,項目名稱:burp-reflected-param,代碼行數:34,代碼來源:BurpExtender.java

示例2: getPrefixWords

import java.util.LinkedList; //導入方法依賴的package包/類
/**
 * 
 * @param sen sen.length() greater than 0
 * @param start at first start = 0
 * @param dic
 */
private static LinkedList<Integer> getPrefixWords(String sen,int start,Dictionary dic){
	LinkedList<Integer> wl = new LinkedList<>();
	if(start == sen.length())
		return wl;
	for(int i=start+1;i<=sen.length();i++){
		String w = sen.substring(start,i);
		SortedMap<String,Double> map = dic.prefixMap(w);
		if(map.isEmpty()){
			//we find a new word! Its length maybe larger than 1.
			if(i==start+1){
				wl.add(i); //this new word's length is 1.
			}else{ //this new word's length is larger than 1.
				if(wl.indexOf(i-1) == -1)
					wl.add(i-1);
			}
			return wl;
		}
		if(map.containsKey(w)){
			wl.add(i);
		}else{
			if(i==sen.length())
				wl.add(i); //we find a new word! Its length maybe larger than 1. 
		}
	}
	return wl;
}
 
開發者ID:profullstack,項目名稱:cjk-mmseg,代碼行數:33,代碼來源:Mmseg.java

示例3: slideOverTimeSeries

import java.util.LinkedList; //導入方法依賴的package包/類
private void slideOverTimeSeries(TimeSeries<Accel> ts, int recordIndex) {
  this.nncCallCount[recordIndex] = 0;
  LinkedList<TimeSeries<Accel>> trainingData = new LinkedList<TimeSeries<Accel>>();
  LinkedList<TimeSeries<Accel>> testData = new LinkedList<TimeSeries<Accel>>();
  for (int i = 1; i < 9; i++) {
    trainingData.add(ts.intervalByTag(Integer.toString(i)));
    testData.add(ts.intervalByTag(Integer.toString(i + 8)));
  }
  int fromIndex = ts.lastIndexOf(ts.intervalByTag(Integer.toString(8)).getLast()) + 1;
  int toIndex = ts.size();
  TimeSeries<Accel> taggedRecord = ts.subTimeSeries(fromIndex, toIndex);
  TimeSeries<Accel> record = new TimeSeries<Accel>();
  for (Point<Accel> point : taggedRecord) {
    record.add(new Point<Accel>(point.getData()));
  }
  int windowSize = this.windowSize.windowSize(trainingData);
  int stepSize = (int) (windowSize / 10.0);
  int time = 0;
  NearestNeighbourClassificator<TimeSeries<Accel>> nnc =
      this.nncFactory.create(this.distance, trainingData);
  Filter<TimeSeries<Accel>> filter = this.filterFactory.create(trainingData);
  double[] thresholds = this.threshold.threshold(trainingData, testData, this.distance);
  while (time + windowSize <= record.size()) {
    TimeSeries<Accel> window = record.subTimeSeries(time, time + windowSize);
    if (filter.filter(window)) {
      TimeSeries<Accel> nn = nnc.nearestNeighbour(window);
      this.nncCallCount[recordIndex]++;
      double dist = this.distance.distance(window, nn);
      if (dist <= thresholds[trainingData.indexOf(nn)]) {
        for (int i = time; i < time + windowSize; i++) {
          record.set(
              i,
              new Point<Accel>(
                  record.get(i).getData(),
                  Integer.toString(trainingData.indexOf(nn) + 9)
              )
          );
        }
        time += windowSize;
      } else {
        time += stepSize;
      }
    } else {
      time += stepSize;
    }
  }
  int[][] matches = this.setSuccessAndFailCount(taggedRecord, record);
  this.truePositive[recordIndex] = matches[0];
  this.trueNegative[recordIndex] = matches[1];
  this.falsePositive[recordIndex] = matches[2];
  this.falseNegative[recordIndex] = matches[3];
}
 
開發者ID:GordonLesti,項目名稱:SlidingWindowFilter-evaluator,代碼行數:53,代碼來源:SlidingWindow.java


注:本文中的java.util.LinkedList.indexOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。