comparison test/org/tmatesoft/hg/test/TestStatus.java @ 427:31a89587eb04

FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 29 Mar 2012 17:14:35 +0200
parents 528b6780a8bd
children cd658b24a620
comparison
equal deleted inserted replaced
426:063b0663495a 427:31a89587eb04
180 private static class StatusCollector implements HgStatusHandler { 180 private static class StatusCollector implements HgStatusHandler {
181 private final Map<Kind, List<Path>> kind2names = new TreeMap<Kind, List<Path>>(); 181 private final Map<Kind, List<Path>> kind2names = new TreeMap<Kind, List<Path>>();
182 private final Map<Path, List<Kind>> name2kinds = new TreeMap<Path, List<Kind>>(); 182 private final Map<Path, List<Kind>> name2kinds = new TreeMap<Path, List<Kind>>();
183 private final Map<Path, Status> name2error = new LinkedHashMap<Path, Status>(); 183 private final Map<Path, Status> name2error = new LinkedHashMap<Path, Status>();
184 184
185 public void handleStatus(HgStatus s) { 185 public void status(HgStatus s) {
186 List<Path> l = kind2names.get(s.getKind()); 186 List<Path> l = kind2names.get(s.getKind());
187 if (l == null) { 187 if (l == null) {
188 kind2names.put(s.getKind(), l = new LinkedList<Path>()); 188 kind2names.put(s.getKind(), l = new LinkedList<Path>());
189 } 189 }
190 l.add(s.getPath()); 190 l.add(s.getPath());
194 name2kinds.put(s.getPath(), k = new LinkedList<Kind>()); 194 name2kinds.put(s.getPath(), k = new LinkedList<Kind>());
195 } 195 }
196 k.add(s.getKind()); 196 k.add(s.getKind());
197 } 197 }
198 198
199 public void handleError(Path file, Status s) { 199 public void error(Path file, Status s) {
200 name2error.put(file, s); 200 name2error.put(file, s);
201 } 201 }
202 202
203 public List<Path> get(Kind k) { 203 public List<Path> get(Kind k) {
204 List<Path> rv = kind2names.get(k); 204 List<Path> rv = kind2names.get(k);