View Javadoc

1   // %3860311605:hoplugins.teamAnalyzer.manager%
2   package hoplugins.teamAnalyzer.manager;
3   
4   import hoplugins.teamAnalyzer.SystemManager;
5   import hoplugins.teamAnalyzer.report.TeamReport;
6   import hoplugins.teamAnalyzer.vo.Match;
7   import hoplugins.teamAnalyzer.vo.MatchDetail;
8   import hoplugins.teamAnalyzer.vo.TeamLineup;
9   
10  import java.util.ArrayList;
11  import java.util.Iterator;
12  import java.util.List;
13  
14  
15  /***
16   * TODO Missing Class Documentation
17   *
18   * @author TODO Author Name
19   */
20  public class ReportManager {
21      //~ Static fields/initializers -----------------------------------------------------------------
22  
23      /*** TODO Missing Parameter Documentation */
24      public static TeamLineup lineup;
25      private static List matchDetails;
26  
27      //~ Methods ------------------------------------------------------------------------------------
28  
29      /***
30       * TODO Missing Method Documentation
31       *
32       * @param gameNumber TODO Missing Method Parameter Documentation
33       *
34       * @return TODO Missing Return Method Documentation
35       */
36      public static TeamLineup getLineup(int gameNumber) {
37          TeamReport report = new TeamReport();
38          int i = 1;
39  
40          for (Iterator iter = matchDetails.iterator(); iter.hasNext();) {
41              MatchDetail match = (MatchDetail) iter.next();
42  
43              if (i == gameNumber) {
44                  report.addMatch(match, true);
45  
46                  break;
47              }
48  
49              i++;
50          }
51  
52          TeamLineupBuilder builder = new TeamLineupBuilder(report);
53  
54          return builder.getLineup();
55      }
56  
57      /***
58       * TODO Missing Method Documentation
59       *
60       * @return TODO Missing Return Method Documentation
61       */
62      public static TeamLineup getLineup() {
63          return lineup;
64      }
65  
66      /***
67       * TODO Missing Method Documentation
68       *
69       * @param matchDetails TODO Missing Method Parameter Documentation
70       */
71      public static void buildReport(List matchDetails) {
72          TeamReport report = new TeamReport();
73  
74          for (Iterator iter = matchDetails.iterator(); iter.hasNext();) {
75              MatchDetail match = (MatchDetail) iter.next();
76  
77              report.addMatch(match, SystemManager.getConfig().isShowUnavailable());
78          }
79  
80          TeamLineupBuilder builder = new TeamLineupBuilder(report);
81  
82          lineup = builder.getLineup();
83      }
84  
85      /***
86       *
87       */
88      public static void clean() {
89          lineup = null;
90          matchDetails = new ArrayList();
91      }
92  
93      /***
94       * TODO Missing Method Documentation
95       */
96      public static void updateReport() {
97          matchDetails = MatchManager.getMatchDetails();
98  
99          if (MatchPopulator.getAnalyzedMatch().size() > 0) {
100             buildReport(matchDetails);
101         } else {
102             lineup = null;
103         }
104 
105         updateFilteredMatches();
106     }
107 
108     /***
109      * TODO Missing Method Documentation
110      */
111     private static void updateFilteredMatches() {
112         List filterList = new ArrayList();
113 
114         for (Iterator iter = MatchManager.getSelectedMatches().iterator(); iter.hasNext();) {
115             Match match = (Match) iter.next();
116 
117             filterList.add("" + match.getMatchId());
118         }
119 
120         SystemManager.getFilter().setMatches(filterList);
121     }
122 }