/* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id_menu == null) ? 0 : id_menu.hashCode()); result = prime * result + ((id_profil == null) ? 0 : id_profil.hashCode()); return result; }
/** Affichage de l'IMG */ private void calcIMG() { // calcul de l'img float img = this.calculIMG( monProfil.getPoids(), monProfil.getTaille(), monProfil.getAge(), monProfil.getSexe()); // récupération des objets graphiques d'affichage du résultat TextView lblIMG = (TextView) findViewById(R.id.lblIMG); ImageView imgSmiley = (ImageView) findViewById(R.id.imgSmiley); // mémorisation des bornes Integer min; Integer max; if (monProfil.getSexe() == 0) { // femme min = 15; max = 30; } else { // homme min = 10; max = 25; } // analyse de l'img lblIMG.setTextColor(Color.RED); String message; if (img < min) { // maigre message = "trop faible"; imgSmiley.setImageResource(R.drawable.maigre); } else { if (img > max) { // graisse message = "trop élevé"; imgSmiley.setImageResource(R.drawable.graisse); } else { // normal lblIMG.setTextColor(Color.GREEN); message = "normal"; imgSmiley.setImageResource(R.drawable.normal); } } // construction du message complet à afficher lblIMG.setText(String.format("%.01f", img) + " : IMG " + message); }
/* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Affectation_menu other = (Affectation_menu) obj; if (id_menu == null) { if (other.id_menu != null) return false; } else if (!id_menu.equals(other.id_menu)) { return false; } if (id_profil == null) { if (other.id_profil != null) return false; } else if (!id_profil.equals(other.id_profil)) { return false; } return true; }