public String toString() {

    String assegurançaListString = "";
    for (Assegurança a : this.assegurances) {
      if (a != null) {
        if (assegurançaListString != "") assegurançaListString = assegurançaListString + "\n";
        assegurançaListString =
            assegurançaListString + "\n" + a.getClass().getSimpleName() + a.toString();
      }
    }
    String agentListString = "";
    for (Agent a : this.agents) {
      if (a != null) {
        if (agentListString != "") agentListString = agentListString + "\n";
        agentListString = agentListString + "\nAgent" + a.toString();
      }
    }
    String clientListString = "";
    Node item = this.clients;
    while (item != null) {
      if (clientListString != "") clientListString = clientListString + "\n";
      clientListString = clientListString + "\nClient" + item.toString();
      item = item.getSeguent();
    }

    return "Companyia: "
        + getNom()
        + "\n Adreça: "
        + this.getAdreça()
        + "\n\n----- quantsClients: "
        + this.quantsClients("")
        + "\n----- quantsClients (poblacio= Canet de mar): "
        + this.quantsClients("Canet de mar")
        + "\n\n----- Cartera de clients: "
        + clientListString
        + "\n\n----- Agents d’assegurances: "
        + agentListString
        + "\n\n----- Assegurances:"
        + this.quantesAssegurances
        + " polisses (Max:"
        + this.maxAssegurances
        + ")"
        + "\n quantesAsssegurancesVehicleTotRisc: "
        + this.quantesAsssegurancesVehicleTotRisc()
        + "\n quantesAsssegurancesVehicleTotRisc (franquicia>=200): "
        + this.quantesAsssegurancesVehicleTotRisc(200)
        + "\n "
        + assegurançaListString;
  }
 public void remAgent(Agent a) throws Exception {
   if (!this.agents.contains(a)) throw new Exception("L'agent no existeix " + a.toString());
   agents.remove(a);
 }
 public void addAgent(Agent a) throws Exception {
   if (this.agents.contains(a)) throw new Exception("L'agent ja existeix " + a.toString());
   agents.add(a);
 }