comparison cmdline/org/tmatesoft/hg/console/Status.java @ 279:23e3ea855097

Use EnumMap when keys are from enumeration
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 31 Aug 2011 23:22:18 +0200
parents d5268ca7715b
children 45dc79e545f5
comparison
equal deleted inserted replaced
278:55fad5e0e98b 279:23e3ea855097
18 18
19 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; 19 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION;
20 20
21 import java.util.ArrayList; 21 import java.util.ArrayList;
22 import java.util.Collections; 22 import java.util.Collections;
23 import java.util.EnumMap;
23 import java.util.HashMap; 24 import java.util.HashMap;
24 import java.util.LinkedList; 25 import java.util.LinkedList;
25 import java.util.List; 26 import java.util.List;
26 import java.util.Map; 27 import java.util.Map;
27 import java.util.TreeMap;
28 28
29 import org.tmatesoft.hg.core.HgRepoFacade; 29 import org.tmatesoft.hg.core.HgRepoFacade;
30 import org.tmatesoft.hg.core.HgStatus; 30 import org.tmatesoft.hg.core.HgStatus;
31 import org.tmatesoft.hg.core.HgStatus.Kind; 31 import org.tmatesoft.hg.core.HgStatus.Kind;
32 import org.tmatesoft.hg.core.HgStatusCommand; 32 import org.tmatesoft.hg.core.HgStatusCommand;
63 // cmd.subrepo(cmdLineOpts.getBoolean("-S", "--subrepos")) 63 // cmd.subrepo(cmdLineOpts.getBoolean("-S", "--subrepos"))
64 final boolean noStatusPrefix = cmdLineOpts.getBoolean("-n", "--no-status"); 64 final boolean noStatusPrefix = cmdLineOpts.getBoolean("-n", "--no-status");
65 final boolean showCopies = cmdLineOpts.getBoolean("-C", "--copies"); 65 final boolean showCopies = cmdLineOpts.getBoolean("-C", "--copies");
66 class StatusHandler implements HgStatusCommand.Handler { 66 class StatusHandler implements HgStatusCommand.Handler {
67 67
68 final Map<HgStatus.Kind, List<Path>> data = new TreeMap<HgStatus.Kind, List<Path>>(); 68 final EnumMap<HgStatus.Kind, List<Path>> data = new EnumMap<HgStatus.Kind, List<Path>>(HgStatus.Kind.class);
69 final Map<Path, Path> copies = showCopies ? new HashMap<Path,Path>() : null; 69 final Map<Path, Path> copies = showCopies ? new HashMap<Path,Path>() : null;
70 70
71 public void handleStatus(HgStatus s) { 71 public void handleStatus(HgStatus s) {
72 List<Path> l = data.get(s.getKind()); 72 List<Path> l = data.get(s.getKind());
73 if (l == null) { 73 if (l == null) {