View Javadoc

1   // %4044085182:hoplugins.trainingExperience.constants%
2   package hoplugins.trainingExperience.constants;
3   
4   import hoplugins.Commons;
5   
6   import plugins.IHOMiniModel;
7   import plugins.ITeam;
8   
9   
10  /***
11   * Class the manage relation between trainingtype codes and description
12   *
13   * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
14   */
15  public class Trainings {
16      //~ Methods ------------------------------------------------------------------------------------
17  
18      /***
19       * Returns the training code given the training description
20       *
21       * @param selection The training name
22       *
23       * @return training code
24       */
25      public static int getTrainingCode(String selection) {
26          int type = ITeam.TA_ALLGEMEIN;
27          IHOMiniModel p_IHMM_miniModel = Commons.getModel();
28  
29          // Compares the training name with all the training names in HO, 
30          //when a match is found it returns the right code 
31          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Allgemein"))) { //$NON-NLS-1$
32              type = ITeam.TA_ALLGEMEIN;
33          }
34  
35          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Kondition"))) { //$NON-NLS-1$
36              type = ITeam.TA_KONDITION;
37          }
38  
39          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Standards"))) { //$NON-NLS-1$
40              type = ITeam.TA_STANDARD;
41          }
42  
43          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Verteidigung"))) { //$NON-NLS-1$
44              type = ITeam.TA_VERTEIDIGUNG;
45          }
46  
47          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Chancenverwertung"))) { //$NON-NLS-1$
48              type = ITeam.TA_CHANCEN;
49          }
50  
51          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Fluegelspiel"))) { //$NON-NLS-1$
52              type = ITeam.TA_FLANKEN;
53          }
54  
55          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Torschuss_Training"))) { //$NON-NLS-1$
56              type = ITeam.TA_SCHUSSTRAINING;
57          }
58  
59          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Passpiel"))) { //$NON-NLS-1$
60              type = ITeam.TA_PASSSPIEL;
61          }
62  
63          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Spielaufbau"))) { //$NON-NLS-1$
64              type = ITeam.TA_SPIELAUFBAU;
65          }
66  
67          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Torwart"))) { //$NON-NLS-1$
68              type = ITeam.TA_TORWART;
69          }
70  
71          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Steilpaesse"))) { //$NON-NLS-1$
72              type = ITeam.TA_STEILPAESSE;
73          }
74  
75          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("Defensivpositionen"))) { //$NON-NLS-1$
76              type = ITeam.TA_ABWEHRVERHALTEN;
77          }
78  
79          // TODO Real name
80          if (selection.equals(p_IHMM_miniModel.getResource().getProperty("ExternalAttack"))) { //$NON-NLS-1$
81              type = ITeam.TA_EXTERNALATTACK;
82          }
83  
84          return type;
85      }
86  
87      /***
88       * Returns training descriptions
89       *
90       * @param type training type
91       *
92       * @return String description
93       */
94      public static String getTrainingDescription(int type) {
95          IHOMiniModel p_IHMM_miniModel = Commons.getModel();
96          String selectedTrain = ""; //$NON-NLS-1$
97  
98          // based on the type returns the right HO property
99          if (type == ITeam.TA_ALLGEMEIN) {
100             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Allgemein")); //$NON-NLS-1$
101         }
102 
103         if (type == ITeam.TA_KONDITION) {
104             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Kondition")); //$NON-NLS-1$
105         }
106 
107         if (type == ITeam.TA_STANDARD) {
108             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Standards")); //$NON-NLS-1$
109         }
110 
111         if (type == ITeam.TA_VERTEIDIGUNG) {
112             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Verteidigung")); //$NON-NLS-1$
113         }
114 
115         if (type == ITeam.TA_CHANCEN) {
116             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Chancenverwertung")); //$NON-NLS-1$
117         }
118 
119         if (type == ITeam.TA_FLANKEN) {
120             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Fluegelspiel")); //$NON-NLS-1$
121         }
122 
123         if (type == ITeam.TA_SCHUSSTRAINING) {
124             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Torschuss_Training")); //$NON-NLS-1$
125         }
126 
127         if (type == ITeam.TA_PASSSPIEL) {
128             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Passpiel")); //$NON-NLS-1$
129         }
130 
131         if (type == ITeam.TA_SPIELAUFBAU) {
132             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Spielaufbau")); //$NON-NLS-1$
133         }
134 
135         if (type == ITeam.TA_TORWART) {
136             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Torwart")); //$NON-NLS-1$
137         }
138 
139         if (type == ITeam.TA_STEILPAESSE) {
140             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Steilpaesse")); //$NON-NLS-1$
141         }
142 
143         if (type == ITeam.TA_ABWEHRVERHALTEN) {
144             selectedTrain = new String(p_IHMM_miniModel.getResource().getProperty("Defensivpositionen")); //$NON-NLS-1$
145         }
146 
147         if (type == ITeam.TA_EXTERNALATTACK) {
148             selectedTrain = new String(""
149                                        + p_IHMM_miniModel.getResource().getProperty("ExternalAttack")); //$NON-NLS-1$
150         }
151 
152         return selectedTrain;
153     }
154 }