ThreadPoolTask.java
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.bsth.vehicle.gpsdata.arrival;
import java.util.List;
import java.util.Set;
import com.bsth.entity.realcontrol.ScheduleRealInfo;
import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
import com.bsth.vehicle.gpsdata.arrival.match.ScheduleRealMatcher;
import com.bsth.vehicle.gpsdata.buffer.ArrivalDataBuffer;
import com.google.common.collect.ArrayListMultimap;
public class ThreadPoolTask implements Runnable {
String lineCode;
public ThreadPoolTask(String lineCode) {
this.lineCode = lineCode;
}
@Override
public void run() {
List<ScheduleRealInfo> allList = ScheduleBuffer.realSchedulListMap.get(lineCode);
//按车辆分组班次
ArrayListMultimap<String, ScheduleRealInfo> alMap = ArrayListMultimap.create();
for(ScheduleRealInfo sch : allList){
//停车场即起点站的进出场班次不参与匹配
if(!sch.isParkIsFirstStation())
alMap.put(sch.getClZbh(), sch);
}
//开始匹配
ScheduleRealMatcher srMatcher;
Set<String> ks = alMap.keySet();
for(String nbbm : ks){
srMatcher = new ScheduleRealMatcher(alMap.get(nbbm), ArrivalDataBuffer.pops(nbbm));
//在这里应用各种匹配规则
srMatcher
.timeClosest()
.matchEnd();
}
}
}