183
|
1 package jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.test;
|
|
2
|
|
3
|
|
4 import fj.data.List;
|
|
5 import fj.data.Option;
|
|
6
|
|
7 import java.util.Iterator;
|
|
8
|
|
9 /**
|
|
10 * Created by e115731 on 15/03/21.
|
|
11 */
|
|
12 public class FJListAccessThread extends AbstractTreeMapThread {
|
|
13 Option<List<String>> list;
|
|
14 private long findCount;
|
|
15 boolean loop = true;
|
|
16
|
|
17 public FJListAccessThread(Option<List<String>> list) {
|
|
18 this.list = list;
|
|
19 }
|
|
20
|
|
21 @Override
|
|
22 public long getFindCount() {
|
|
23 System.out.println("thread count = " + findCount);
|
|
24 return findCount;
|
|
25 }
|
|
26
|
|
27 @Override
|
|
28 public void set(boolean loop) {
|
|
29 this.loop = loop;
|
|
30 }
|
|
31
|
|
32 @Override
|
|
33 public void run() {
|
|
34 while (loop) {
|
|
35 Iterator<String> it = list.some().iterator();
|
|
36 for (; it.hasNext(); ) {
|
|
37 String str = it.next();
|
|
38 }
|
|
39 findCount++;
|
|
40 }
|
|
41 }
|
|
42 } |