public List<Infracao> getInfracoesEntre(Date inicio, Date fim) {
    List<Infracao> infracoes = new LinkedList<Infracao>(getInfracoes());
    List<Infracao> lista = new LinkedList<Infracao>();

    for (Infracao inf : infracoes) {
      if ((inf.getDataInf().compareTo(inicio) >= 0) && (inf.getDataInf().compareTo(fim) <= 0))
        lista.add(inf);
    }

    return lista;
  }
  public Object[] monteDadosInf(Infracao inf) {
    Object[] s = new Object[5];
    Condutor cond = banco.getCondutorComCpf(banco.getVeiculoComPlaca(inf.getPlaca()).getCpfDono());

    s[0] = (inf.getNumInfracao());
    s[1] = FormataPlaca.coloqueMascara(inf.getPlaca());
    s[2] = ManipuladorData.format(inf.getDataInf());
    s[3] = FormataCPF.formatCpf(cond.getCPF());
    s[4] = cond.getNome();

    return s;
  }
  public List<Infracao> getInfracoesComNomeCondutor(String nome) {
    List<Infracao> infs = new LinkedList<Infracao>(getInfracoes());

    Condutor cond = null;

    List<Infracao> infracoes = new LinkedList<Infracao>();

    for (Infracao inf : infs) {
      cond = banco.getCondutorComCpf(banco.getVeiculoComPlaca(inf.getPlaca()).getCpfDono());

      if (cond.getNome().toUpperCase().contains(nome.toUpperCase())) infracoes.add(inf);
    }

    return infracoes;
  }
  public List<Infracao> getInfracoesComPlaca(String placa) {
    placa = placa.replaceAll("-", "");

    Iterator<Infracao> itInf = getInfracoes().iterator();

    Infracao temp = null;

    List<Infracao> lista = new LinkedList<Infracao>();

    while (itInf.hasNext()) {
      temp = itInf.next();

      if (temp.getPlaca().contains(placa.toUpperCase())) lista.add(temp);
    }

    return lista;
  }
  public void salvarInfracao(Infracao inf)
      throws ExcecaoPlacaInexistente, ExcecaoDataInfCondIdadeImpropria,
          ExcecaoDataInfMenorAnoFabVei {

    if (banco.getVeiculoComPlaca(inf.getPlaca()) == null) throw new ExcecaoPlacaInexistente();

    if (ManipuladorData.calculeDiferencaDeAnos(
            inf.getDataInf(),
            this.getCondutorComCpf(this.getVeiculoComPlaca(inf.getPlaca()).getCpfDono())
                .getDataNasc())
        < 18) throw new ExcecaoDataInfCondIdadeImpropria();

    int anoFabVeiculo = this.retorneAnoFabVei(inf.getPlaca());
    int anoInf = ManipuladorData.getAnoDeData(inf.getDataInf());

    if (anoFabVeiculo > anoInf) throw new ExcecaoDataInfMenorAnoFabVei();

    banco.addInfracao(inf);
  }
  public Collection<Infracao> getInfracoes(long cpf) {

    ArrayList<Infracao> infracoes = new ArrayList<Infracao>(banco.getInfracoes());
    ArrayList<Veiculo> veiculos = new ArrayList<Veiculo>(banco.getVeiculos());

    ArrayList<Infracao> infracoesCPF = new ArrayList<Infracao>();

    for (Veiculo v : veiculos) {
      if (String.valueOf(v.getCpfDono())
          .toUpperCase()
          .contains(String.valueOf(cpf).toUpperCase())) {
        for (Infracao i : infracoes) {
          if (i.getPlaca().equals(v.getPlaca())) infracoesCPF.add(i);
        }
      }
    }

    return infracoesCPF;
  }