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 47 48 49 50 51 52 53 54 55 56
| public class TraitementTrameNMEA implements Runnable{
public static String id;
public SelectionKey cleTracker;
String hex;
public static HashMap<String, SelectionKey> monhashMap = new HashMap<String,SelectionKey>();
static String idTracker;
public static void main(String[] args) throws Exception {
getTailleHashMap(monhashMap);
}
public TraitementTrameNMEA(String id, SelectionKey cleTracker, String hex) {
super();
this.id = id;
this.cleTracker = cleTracker;
this.hex = hex;
}
public TraitementTrameNMEA() {
}
public synchronized void run() {
try{
// //receiver
String receiver= hex.substring(0,4);
if(receiver.equals("2424")){//Test sur l'entete de la trame
// //ID
id= hex.substring(8,22);
//remplissage du hashMap
System.out.println("I put id and cleTracker in the HashMap");
System.out.println("id"+id);
System.out.println("cle du tracker"+cleTracker);
Thread.sleep(2);
}
catch(InterruptedException e){}
ClasseB.recapMap.put(id,cleTracker );
System.out.println("la taille du recapHashMap est"+ClasseB.recapMap.size());
//ClasseB.recapMap=monhashMap;
} |
Partager