equal
deleted
inserted
replaced
71 // rewind to the first entry |
71 // rewind to the first entry |
72 buffer.rewind(); |
72 buffer.rewind(); |
73 buffer.position(prologue.getEntryOffset()); |
73 buffer.position(prologue.getEntryOffset()); |
74 nextEntry = buffer.position(); |
74 nextEntry = buffer.position(); |
75 // rebuild all the counters |
75 // rebuild all the counters |
76 map = new TreeMap<String, Counter>(); |
76 map = new TreeMap<>(); |
77 } |
77 } |
78 |
78 |
79 boolean hasNext() { |
79 boolean hasNext() { |
80 return (nextEntry < prologue.getUsed()); |
80 return (nextEntry < prologue.getUsed()); |
81 } |
81 } |
152 Counter c = getNextCounter(); |
152 Counter c = getNextCounter(); |
153 if (c != null) { |
153 if (c != null) { |
154 map.put(c.getName(), c); |
154 map.put(c.getName(), c); |
155 } |
155 } |
156 } |
156 } |
157 return new ArrayList<Counter>(map.values()); |
157 return new ArrayList<>(map.values()); |
158 } |
158 } |
159 |
159 |
160 public synchronized List<Counter> findByPattern(String patternString) { |
160 public synchronized List<Counter> findByPattern(String patternString) { |
161 while (hasNext()) { |
161 while (hasNext()) { |
162 Counter c = getNextCounter(); |
162 Counter c = getNextCounter(); |
165 } |
165 } |
166 } |
166 } |
167 |
167 |
168 Pattern pattern = Pattern.compile(patternString); |
168 Pattern pattern = Pattern.compile(patternString); |
169 Matcher matcher = pattern.matcher(""); |
169 Matcher matcher = pattern.matcher(""); |
170 List<Counter> matches = new ArrayList<Counter>(); |
170 List<Counter> matches = new ArrayList<>(); |
|
171 |
171 |
172 |
172 for (Map.Entry<String,Counter> me: map.entrySet()) { |
173 for (Map.Entry<String,Counter> me: map.entrySet()) { |
173 String name = me.getKey(); |
174 String name = me.getKey(); |
174 |
175 |
175 // apply pattern to counter name |
176 // apply pattern to counter name |