1 | package com.medias.database.objects; |
---|
2 | |
---|
3 | // Generated 5 févr. 2007 11:07:11 by Hibernate Tools 3.2.0.b9 |
---|
4 | |
---|
5 | import java.util.Comparator; |
---|
6 | import java.util.HashSet; |
---|
7 | import java.util.Set; |
---|
8 | |
---|
9 | /** |
---|
10 | * Parametre generated by hbm2java |
---|
11 | */ |
---|
12 | public class Parametre |
---|
13 | implements java.io.Serializable |
---|
14 | { |
---|
15 | |
---|
16 | /** |
---|
17 | * |
---|
18 | */ |
---|
19 | private static final long serialVersionUID = 1L; |
---|
20 | |
---|
21 | private int parametreId; |
---|
22 | |
---|
23 | private Unite unite; |
---|
24 | |
---|
25 | private CategorieParam categorieParam; |
---|
26 | |
---|
27 | private Commentaire commentaire; |
---|
28 | |
---|
29 | private String parametreNom; |
---|
30 | |
---|
31 | private String parametreCode; |
---|
32 | |
---|
33 | private Set<Jeu> jeus = new HashSet<Jeu>( 0 ); |
---|
34 | |
---|
35 | private Set<Plateforme> plateformes = new HashSet<Plateforme>( 0 ); |
---|
36 | |
---|
37 | private Set<Bilan> bilans = new HashSet<Bilan>( 0 ); |
---|
38 | |
---|
39 | private Set<Capteur> capteurs = new HashSet<Capteur>( 0 ); |
---|
40 | |
---|
41 | private Set<Valeur> valeurs = new HashSet<Valeur>( 0 ); |
---|
42 | |
---|
43 | public Parametre() |
---|
44 | { |
---|
45 | } |
---|
46 | |
---|
47 | public Parametre( int parametreId, Unite unite, |
---|
48 | CategorieParam categorieParam, String parametreNom, |
---|
49 | String parametreCode ) |
---|
50 | { |
---|
51 | this.parametreId = parametreId; |
---|
52 | this.unite = unite; |
---|
53 | this.categorieParam = categorieParam; |
---|
54 | this.parametreNom = parametreNom; |
---|
55 | this.parametreCode = parametreCode; |
---|
56 | } |
---|
57 | |
---|
58 | public Parametre( int parametreId, Unite unite, |
---|
59 | CategorieParam categorieParam, Commentaire commentaire, |
---|
60 | String parametreNom, String parametreCode, Set<Jeu> jeus, |
---|
61 | Set<Plateforme> plateformes, Set<Bilan> bilans, |
---|
62 | Set<Capteur> capteurs, Set<Valeur> valeurs ) |
---|
63 | { |
---|
64 | this.parametreId = parametreId; |
---|
65 | this.unite = unite; |
---|
66 | this.categorieParam = categorieParam; |
---|
67 | this.commentaire = commentaire; |
---|
68 | this.parametreNom = parametreNom; |
---|
69 | this.parametreCode = parametreCode; |
---|
70 | this.jeus = jeus; |
---|
71 | this.plateformes = plateformes; |
---|
72 | this.bilans = bilans; |
---|
73 | this.capteurs = capteurs; |
---|
74 | this.valeurs = valeurs; |
---|
75 | } |
---|
76 | |
---|
77 | public int getParametreId() |
---|
78 | { |
---|
79 | return this.parametreId; |
---|
80 | } |
---|
81 | |
---|
82 | public void setParametreId( int parametreId ) |
---|
83 | { |
---|
84 | this.parametreId = parametreId; |
---|
85 | } |
---|
86 | |
---|
87 | public Unite getUnite() |
---|
88 | { |
---|
89 | return this.unite; |
---|
90 | } |
---|
91 | |
---|
92 | public void setUnite( Unite unite ) |
---|
93 | { |
---|
94 | this.unite = unite; |
---|
95 | } |
---|
96 | |
---|
97 | public CategorieParam getCategorieParam() |
---|
98 | { |
---|
99 | return this.categorieParam; |
---|
100 | } |
---|
101 | |
---|
102 | public void setCategorieParam( CategorieParam categorieParam ) |
---|
103 | { |
---|
104 | this.categorieParam = categorieParam; |
---|
105 | } |
---|
106 | |
---|
107 | public Commentaire getCommentaire() |
---|
108 | { |
---|
109 | return this.commentaire; |
---|
110 | } |
---|
111 | |
---|
112 | public void setCommentaire( Commentaire commentaire ) |
---|
113 | { |
---|
114 | this.commentaire = commentaire; |
---|
115 | } |
---|
116 | |
---|
117 | public String getParametreNom() |
---|
118 | { |
---|
119 | return this.parametreNom; |
---|
120 | } |
---|
121 | |
---|
122 | public void setParametreNom( String parametreNom ) |
---|
123 | { |
---|
124 | this.parametreNom = parametreNom; |
---|
125 | } |
---|
126 | |
---|
127 | public String getParametreCode() |
---|
128 | { |
---|
129 | return this.parametreCode; |
---|
130 | } |
---|
131 | |
---|
132 | public void setParametreCode( String parametreCode ) |
---|
133 | { |
---|
134 | this.parametreCode = parametreCode; |
---|
135 | } |
---|
136 | |
---|
137 | public Set<Jeu> getJeus() |
---|
138 | { |
---|
139 | return this.jeus; |
---|
140 | } |
---|
141 | |
---|
142 | public void setJeus( Set<Jeu> jeus ) |
---|
143 | { |
---|
144 | this.jeus = jeus; |
---|
145 | } |
---|
146 | |
---|
147 | public Set<Plateforme> getPlateformes() |
---|
148 | { |
---|
149 | return this.plateformes; |
---|
150 | } |
---|
151 | |
---|
152 | public void setPlateformes( Set<Plateforme> plateformes ) |
---|
153 | { |
---|
154 | this.plateformes = plateformes; |
---|
155 | } |
---|
156 | |
---|
157 | public Set<Bilan> getBilans() |
---|
158 | { |
---|
159 | return this.bilans; |
---|
160 | } |
---|
161 | |
---|
162 | public void setBilans( Set<Bilan> bilans ) |
---|
163 | { |
---|
164 | this.bilans = bilans; |
---|
165 | } |
---|
166 | |
---|
167 | public Set<Capteur> getCapteurs() |
---|
168 | { |
---|
169 | return this.capteurs; |
---|
170 | } |
---|
171 | |
---|
172 | public void setCapteurs( Set<Capteur> capteurs ) |
---|
173 | { |
---|
174 | this.capteurs = capteurs; |
---|
175 | } |
---|
176 | |
---|
177 | public Set<Valeur> getValeurs() |
---|
178 | { |
---|
179 | return this.valeurs; |
---|
180 | } |
---|
181 | |
---|
182 | public void setValeurs( Set<Valeur> valeurs ) |
---|
183 | { |
---|
184 | this.valeurs = valeurs; |
---|
185 | } |
---|
186 | |
---|
187 | public String getParametreDescription() |
---|
188 | { |
---|
189 | if( commentaire == null ) |
---|
190 | { |
---|
191 | return ""; |
---|
192 | } |
---|
193 | else |
---|
194 | { |
---|
195 | return commentaire.getCommentaireTxt(); |
---|
196 | } |
---|
197 | } |
---|
198 | |
---|
199 | /** |
---|
200 | * We need this equals to display only one Parameter and the others with the same name in submenus |
---|
201 | * example : "Particle Concentration" |
---|
202 | * |
---|
203 | * @param o |
---|
204 | * @return |
---|
205 | */ |
---|
206 | @Override |
---|
207 | public boolean equals( final Object o ) |
---|
208 | { |
---|
209 | if( this == o ) return true; |
---|
210 | if( o == null || getClass() != o.getClass() ) return false; |
---|
211 | |
---|
212 | final Parametre parametre = (Parametre) o; |
---|
213 | |
---|
214 | if( parametreNom != null ? !parametreNom.equals( parametre.parametreNom ) : parametre.parametreNom != null ) return false; |
---|
215 | |
---|
216 | return true; |
---|
217 | } |
---|
218 | |
---|
219 | public class ComparatorNom |
---|
220 | implements Comparator<Parametre> |
---|
221 | { |
---|
222 | public int compare( Parametre p1, Parametre p2 ) |
---|
223 | { |
---|
224 | return p1.getParametreNom().compareTo( p2.getParametreNom() ); |
---|
225 | } |
---|
226 | } |
---|
227 | |
---|
228 | public class ComparatorNomId |
---|
229 | implements Comparator<Parametre> |
---|
230 | { |
---|
231 | public int compare( Parametre p1, Parametre p2 ) |
---|
232 | { |
---|
233 | int compareNom = p1.getParametreNom().compareTo( p2.getParametreNom() ); |
---|
234 | if( compareNom == 0 ) |
---|
235 | return new Integer( p1.getParametreId() ).compareTo( new Integer( p2.getParametreId() ) ); |
---|
236 | else |
---|
237 | return compareNom; |
---|
238 | } |
---|
239 | } |
---|
240 | } |
---|