Example #1
0
  public int[] getCadeiras(int id) throws NumeroInvalidoException, PeriodoNaoExisteException {

    int[] cadeiras2 = null;
    String check = id + "";
    if (!check.matches("^[0-9]{1,45}$")) {
      throw new NumeroInvalidoException();
    } else if (this.rep.isItReal(id)) {
      Periodo p = this.rep.searchPeriodo(id);
      cadeiras2 = p.getCadeiras();
    }

    return cadeiras2;
  }
Example #2
0
  public String[] getProfessores(int id) throws NumeroInvalidoException, PeriodoNaoExisteException {

    String[] professores2 = null;
    String check = id + "";
    if (!check.matches("^[0-9]{1,45}$")) {
      throw new NumeroInvalidoException();
    } else if (this.rep.isItReal(id)) {
      Periodo p = this.rep.searchPeriodo(id);
      professores2 = p.getProfessores();
    }

    return professores2;
  }
Example #3
0
  public void addPeriodo(int[] cadeiras, String[] professores, int id)
      throws PeriodoJaCadastradoException, NumeroInvalidoException {

    String check = id + "";
    if (!check.matches("^[0-9]{1,45}$")) {
      throw new NumeroInvalidoException();
    } else if (this.rep.isItReal(id)) {
      throw new PeriodoJaCadastradoException();
    } else {
      Periodo novoPeriodo = new Periodo(id);
      novoPeriodo.setCadeiras(cadeiras);
      novoPeriodo.setProfessores(professores);
      rep.addPeriodo(novoPeriodo);
    }
  }