@Override public synchronized boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Solicitacao other = (Solicitacao) obj; if (destinoCaronaSolicitacao == null) { if (other.destinoCaronaSolicitacao != null) return false; } else if (!destinoCaronaSolicitacao.equals(other.destinoCaronaSolicitacao)) return false; if (donoDaCaronaSolicitacao == null) { if (other.donoDaCaronaSolicitacao != null) return false; } else if (!donoDaCaronaSolicitacao.equals(other.donoDaCaronaSolicitacao)) return false; if (donoDaSolicitacao == null) { if (other.donoDaSolicitacao != null) return false; } else if (!donoDaSolicitacao.equals(other.donoDaSolicitacao)) return false; if (estado == null) { if (other.estado != null) return false; } else if (!estado.equals(other.estado)) return false; if (idCarona == null) { if (other.idCarona != null) return false; } else if (!idCarona.equals(other.idCarona)) return false; if (idSolicitacao == null) { if (other.idSolicitacao != null) return false; } else if (!idSolicitacao.equals(other.idSolicitacao)) return false; if (origemCaronaSolicitacao == null) { if (other.origemCaronaSolicitacao != null) return false; } else if (!origemCaronaSolicitacao.equals(other.origemCaronaSolicitacao)) return false; if (sugestaoDePontoEncontro == null) { if (other.sugestaoDePontoEncontro != null) return false; } else if (!sugestaoDePontoEncontro.equals(other.sugestaoDePontoEncontro)) return false; if (tipoSolicitacao != other.tipoSolicitacao) return false; return true; }
@Override public synchronized int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((destinoCaronaSolicitacao == null) ? 0 : destinoCaronaSolicitacao.hashCode()); result = prime * result + ((donoDaCaronaSolicitacao == null) ? 0 : donoDaCaronaSolicitacao.hashCode()); result = prime * result + ((donoDaSolicitacao == null) ? 0 : donoDaSolicitacao.hashCode()); result = prime * result + ((estado == null) ? 0 : estado.hashCode()); result = prime * result + ((idCarona == null) ? 0 : idCarona.hashCode()); result = prime * result + ((idSolicitacao == null) ? 0 : idSolicitacao.hashCode()); result = prime * result + ((origemCaronaSolicitacao == null) ? 0 : origemCaronaSolicitacao.hashCode()); result = prime * result + ((sugestaoDePontoEncontro == null) ? 0 : sugestaoDePontoEncontro.hashCode()); result = prime * result + ((tipoSolicitacao == null) ? 0 : tipoSolicitacao.hashCode()); return result; }
/** * Cancela solicitacao. * * @param carona * @throws EstadoSolicitacaoException * @throws CaronaInexistenteException */ public synchronized void cancelar(Carona carona) throws EstadoSolicitacaoException, CaronaInexistenteException { estado.cancelar(this, carona); }
/** * Muda estado da solicitacao para rejeitada. * * @param c: carona a qual a solicitacao pertence * @throws CaronaInexistenteException * @throws EstadoSolicitacaoException */ public synchronized void rejeitar(Carona c) throws CaronaInexistenteException, EstadoSolicitacaoException { estado.rejeitar(this, c); }
/** * Muda estado da solicitacao para aceita. * * @param c: carona a qual a solicitacao pertence * @throws CaronaInexistenteException * @throws EstadoSolicitacaoException * @throws IllegalArgumentException */ public synchronized void aceitar(Carona c) throws CaronaInexistenteException, IllegalArgumentException, EstadoSolicitacaoException { estado.aceitar(this, c); }