Beispiel #1
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((nome == null) ? 0 : nome.hashCode());
   result = prime * result + ((repertorioFavorito == null) ? 0 : repertorioFavorito.hashCode());
   result = prime * result + ((repertorios == null) ? 0 : repertorios.hashCode());
   return result;
 }
Beispiel #2
0
  @Override
  public String toString() {
    String repertoriosS = "";
    String repertFavS = "";

    if (repertorios.size() == 0) repertoriosS += "Nenhum";
    else {
      for (Repertorio repertorio : repertorios) {
        repertoriosS += repertorio.getNome() + "\n";
      }
    }

    if (repertorioFavorito == null) repertFavS += "Nenhum";
    else repertFavS += repertorioFavorito.getNome();

    return "Nome: "
        + this.getNome()
        + "\nRepertorios: "
        + repertoriosS
        + "\nRepertorio Favorito: "
        + repertFavS;
  }
Beispiel #3
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Banda other = (Banda) obj;
   if (nome == null) {
     if (other.nome != null) return false;
   } else if (!nome.equals(other.nome)) return false;
   if (repertorioFavorito == null) {
     if (other.repertorioFavorito != null) return false;
   } else if (!repertorioFavorito.equals(other.repertorioFavorito)) return false;
   if (repertorios == null) {
     if (other.repertorios != null) return false;
   } else if (!repertorios.equals(other.repertorios)) return false;
   return true;
 }
Beispiel #4
0
 public Repertorio pesquisaRepertorio(Repertorio repertorio) throws Exception {
   for (Repertorio repertorioDaBanda : repertorios) {
     if (repertorio.equals(repertorioDaBanda)) return repertorio;
   }
   throw new Exception("Repertorio nao encontrado!");
 }