Examples of GeomWrongFileTypeException


Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

      Vector temp = new Vector();
      try {
        st = new StringTokenizer(buf.readLine());
        try{
          Integer.parseInt(st.nextToken());
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.INVALID_MTX_HEAD_EXCEPTION, fileName, 1);
        }catch(NumberFormatException e){}
        while(st.hasMoreTokens()){
          y++;
          int nextid = Integer.parseInt(st.nextToken());
          if(!indexY.addElement(nextid)){
            throw new GeomWrongIndexException(GeomWrongIndexException.INDEX_DUPLICATE_EXCEPTION, fileName, 1, nextid);
          }
        }
        while(buf.ready()){
          st = new StringTokenizer(buf.readLine());
          x++;
          int nextid = Integer.parseInt(st.nextToken());
          if(!indexX.addElement(nextid)){
            throw new GeomWrongIndexException(GeomWrongIndexException.INDEX_DUPLICATE_EXCEPTION, fileName, x+1, nextid);
          }
          if(st.countTokens()<y){
            throw new NoSuchElementException();
          }else if(st.countTokens()>y){
            throw new GeomWrongFileTypeException(GeomWrongFileTypeException.MUCH_TOKEN_EXCEPTION, fileName, x+1);
          }
          while(st.hasMoreTokens()){
            temp.addElement(st.nextToken());
          }
        }
      } catch (IOException e) {
        e.printStackTrace();
      }
      matrix.letrehoz(x,y);
      matrix.setIndexX(indexX);
      matrix.setIndexY(indexY);
      for(int i=1; i<=matrix.meretX; i++){
        for(int j=1; j<=matrix.meretY; j++){
          matrix.setElement(i, j, Integer.parseInt((String)temp.elementAt((i-1)*matrix.meretY + j-1)));
        }
      }
      return matrix;
    } catch (FileNotFoundException e) {
      throw new GeomFileNotFoundException(fileName);
    } catch (NoSuchElementException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.FEW_TOKEN_EXCEPTION, fileName, x+1);
    } catch (NumberFormatException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NUM_CONVERT_EXCEPTION, fileName, x+1);
    }
  }
View Full Code Here

Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

        }
        base = Integer.parseInt(st.nextToken());
        begin = Integer.parseInt(st.nextToken());
        end = Integer.parseInt(st.nextToken());
        if(begin >= end){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.INVALID_INTERVAL_EXCEPTION, fileName, sor);
        }
        if(GeomResources.getInstance().getNagyT() < end){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.TIME_GREATER_THAN_NAGYT_EXCEPTION, fileName, sor);
        }
        length = Integer.parseInt(st.nextToken());
        /// ha van bejelent�si id�
        String nextToken = st.nextToken();
        if(nextToken.trim().equals("-")){
          rec = -1;
        }else{
          rec = Integer.parseInt(nextToken);
        }
        /// ha van id�egys�g alatti vesztes�g
        if(st.hasMoreTokens()){
          loseUnit =  Integer.parseInt(st.nextToken());
          if(loseUnit>maxEgysegnyiVeszteseg){
            maxEgysegnyiVeszteseg = loseUnit;
          }
        }
        if(priority<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "prioritas");
        }
        if(begin<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "idoablak kezdete");
        }
        if(end<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "idoablak vege");
        }
        if(length<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "vegrehajtasi ido");
        }
        if(rec<-1){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "bejelentesi ido");
        }
        if(loseUnit<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "egysegnyi veszteseg");
        }
        /// a munk�k id�ablak�nak sz�k�t�se
        end = begin + length + GeomResources.getInstance().getRPercent()*(end-begin-length)/100;
       
        GeomPlace place;
        try{
          place = GeomResources.getInstance().getPlaceById(base);
        } catch (GeomWrongIndexException e){
          throw new GeomWrongIndexException(GeomWrongIndexException.NO_SPECIFIED_PLACE_INDEX_EXCEPTION, fileName, sor, base);
        }
        if(map.put(new Integer(id), new GeomWork(id, type, priority, place, begin, end, length, rec, loseUnit))!=null){
          throw new GeomWrongIndexException(GeomWrongIndexException.INDEX_DUPLICATE_EXCEPTION, fileName, sor, id);
        }
        workIndexes.addElement(id);
        if(st.hasMoreTokens()){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.MUCH_TOKEN_EXCEPTION, fileName, sor);
        }
      }
      return map;
    } catch (FileNotFoundException e){
      throw new GeomFileNotFoundException(fileName);
    } catch (NoSuchElementException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.FEW_TOKEN_EXCEPTION, fileName, sor);
    } catch (NumberFormatException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NUM_CONVERT_EXCEPTION, fileName, sor);
    }
  }
View Full Code Here

Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

    placeIndexes = GeomPlace.getPlaceIndexes();
    matrixRoadCost = GeomIntMatrix.beolvas(path + "roadcost.mtx");
   
    int dif = matrixRoadCost.getIndexX().searchDiff(placeIndexes);
    if(dif==-1){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.INVALID_PLACE_INDEX_NUM_EXCEPTION, path+"roadcost.mtx", 2);
    }else if(dif!=0){
      throw new GeomWrongIndexException(GeomWrongIndexException.NO_SPECIFIED_PLACE_INDEX_EXCEPTION, path+"roadcost.mtx", dif+1, matrixRoadCost.getIndexX().getElement(dif));
    }
   
    dif = matrixRoadCost.getIndexY().searchDiff(placeIndexes);
    if(dif==-1){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.INVALID_PLACE_INDEX_NUM_EXCEPTION, path+"roadcost.mtx", 1);
    }else if(dif!=0){
      throw new GeomWrongIndexException(GeomWrongIndexException.NO_SPECIFIED_PLACE_INDEX_EXCEPTION, path+"roadcost.mtx", 1, matrixRoadCost.getIndexY().getElement(dif));
    }
   
    countMaxRoadCost(matrixRoadCost);
View Full Code Here

Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

          continue;
        }
        ertek = st.nextToken();
        if(nev.trim().equals("M") || nev.trim().toLowerCase().equals("nagym")){
          nagyM = Double.parseDouble(ertek);
          if(nagyM<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "nagyM");
        }else if(nev.trim().equals("P") || nev.trim().toLowerCase().equals("nagyp")){
          nagyP = Double.parseDouble(ertek);
          if(nagyP<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "nagyP");
        }else if(nev.trim().equals("U") || nev.trim().toLowerCase().equals("nagyu")){
          nagyU = Double.parseDouble(ertek);
          if(nagyU<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "nagyU");
        }else if(nev.trim().equals("B") || nev.trim().toLowerCase().equals("nagyb")){
          nagyB = Double.parseDouble(ertek);
          if(nagyB<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "nagyB");
        }else if(nev.trim().equals("T") || nev.trim().toLowerCase().equals("nagyt")){
          nagyT = Integer.parseInt(ertek);
          if(nagyT<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "nagyT");
        }else if(nev.trim().equals("p") || nev.trim().toLowerCase().equals("kisp")){
          kisP = Integer.parseInt(ertek);
          if(kisP<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "kisP");
        }else if(nev.trim().equals("gamma")){
          gamma = Integer.parseInt(ertek);
          if(gamma<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "gamma");
        }else if(nev.trim().equals("epszilon")){
          epszilon = Integer.parseInt(ertek);
//          if(epszilon<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "epszilon");
        }else if(nev.trim().equals("kappa")){
          kappa = Double.parseDouble(ertek);
//          if(kappa<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "kappa");
        }else if(nev.trim().equals("lambda")){
          lambda = Double.parseDouble(ertek);
//          if(lambda<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "lambda");
        }else if(nev.trim().equals("x%")){
          xPercent = Integer.parseInt(ertek);
          if(xPercent<0 || xPercent>100) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_TO_100_EXCEPTION, fileName, "xPercent");
        }else if(nev.trim().equals("r%")){
          rPercent = Integer.parseInt(ertek);
          if(rPercent<0 || rPercent>100) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_TO_100_EXCEPTION, fileName, "rPercent");
        }else if(nev.trim().equals("hp")){
          hp = Integer.parseInt(ertek);
          if(hp<0) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, "hp");
        }else if(nev.trim().equals("K")){
          K = Integer.parseInt(ertek);
          if(K!=0 && K!=1) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor, "K");
        }else if(nev.trim().equals("L")){
          L = Integer.parseInt(ertek);
          if(L!=0 && L!=1) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor, "L");
        }else if(nev.trim().toLowerCase().equals("kapij")){
          if(ertek.trim().equals("1")) logger.setKAPijEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("hozzarendelesimeret")){
          if(ertek.trim().equals("1")) logger.setHozzarendMeretEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("hozzarendelesiarany")){
          if(ertek.trim().equals("1")) logger.setHozzarendAranyEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("tau")){
          if(ertek.trim().equals("1")) logger.setTauEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("hozzarendelesek")){
          if(ertek.trim().equals("1")) logger.setHozzarendelesEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("munkakizarasok")){
          if(ertek.trim().equals("1")) logger.setWorkFinishEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("eroforraskizarasok")){
          if(ertek.trim().equals("1")) logger.setTeamFinishEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("szazalek")){
          if(ertek.trim().equals("1")) logger.setPercentEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("e'halmaz")){
          if(ertek.trim().equals("1")) logger.setEvesszoEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("m'halmaz")){
          if(ertek.trim().equals("1")) logger.setMvesszoEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("parameterek")){
          if(ertek.trim().equals("1")) logger.setParametersEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }else if(nev.trim().toLowerCase().equals("hozzarendelesifeladat")){
          if(ertek.trim().equals("1")) logger.setHozzarendelesiFeladatEnabled(true);
          else if(!ertek.trim().equals("0")) throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NOT_0_OR_1_EXCEPTION, fileName, sor);
        }
        if(st.hasMoreTokens() && !st.nextToken().startsWith("#")){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.MUCH_TOKEN_EXCEPTION, fileName, sor);
        }
      }
    } catch (FileNotFoundException e){
      throw new GeomFileNotFoundException(fileName);
    } catch (NoSuchElementException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.FEW_TOKEN_EXCEPTION, fileName, sor);
    } catch (NumberFormatException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NUM_CONVERT_EXCEPTION, fileName, sor);
    }
  }
View Full Code Here

Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

        }
        base = Integer.parseInt(st.nextToken());
        begin = Integer.parseInt(st.nextToken());
        end = Integer.parseInt(st.nextToken());
        if(begin<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "idoablak kezdete");
        }
        if(end<0){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NEGATIVE_NUMBER_EXCEPTION, fileName, sor, "idoablak vege");
        }
        if(begin >= end){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.INVALID_INTERVAL_EXCEPTION, fileName, sor);
        }
        if(GeomResources.getInstance().getNagyT() < end){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.TIME_GREATER_THAN_NAGYT_EXCEPTION, fileName, sor);
        }
        GeomPlace place;
        try{
          place = GeomResources.getInstance().getPlaceById(base);
        } catch (GeomWrongIndexException e) {
          throw new GeomWrongIndexException(GeomWrongIndexException.NO_SPECIFIED_PLACE_INDEX_EXCEPTION, fileName, sor, base);
        }
        if(map.put(new Integer(id), new GeomTeam(id, type, begin, end, place))!=null){
          throw new GeomWrongIndexException(GeomWrongIndexException.INDEX_DUPLICATE_EXCEPTION, fileName, sor, id);
        }
        teamIndexes.addElement(id);
        if(st.hasMoreTokens()){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.MUCH_TOKEN_EXCEPTION, fileName, sor);
        }
      }
      return map;
    } catch (FileNotFoundException e){
      throw new GeomFileNotFoundException(fileName);
    } catch (NoSuchElementException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.FEW_TOKEN_EXCEPTION, fileName, sor);
    } catch (NumberFormatException e) {
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NUM_CONVERT_EXCEPTION, fileName, sor);
    }
  }
View Full Code Here

Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

        if(map.put(new Integer(id), new GeomPlace(id, nev))!=null){
          throw new GeomWrongIndexException(GeomWrongIndexException.INDEX_DUPLICATE_EXCEPTION, fileName, sor, id);
        }
        placeIndexes.addElement(id);
        if(st.hasMoreTokens()){
          throw new GeomWrongFileTypeException(GeomWrongFileTypeException.MUCH_TOKEN_EXCEPTION, fileName, sor);
        }
      }
      return map;
    } catch (FileNotFoundException e){
      throw new GeomFileNotFoundException(fileName);
    } catch (NoSuchElementException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.FEW_TOKEN_EXCEPTION, fileName, sor);
    } catch (NumberFormatException e){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.NUM_CONVERT_EXCEPTION, fileName, sor);
    }
  }
View Full Code Here

Examples of hu.u_szeged.nbo.geometria.exception.GeomWrongFileTypeException

    hp = resources.getHp();
    K = resources.getK();
    L = resources.getL();
   
    if(gamma<=p){
      throw new GeomWrongFileTypeException(GeomWrongFileTypeException.KISP_NOT_LESS_THAN_GAMMA_EXCEPTION, "params.lst", 0);
    }
    if(logger.isParametersEnabled()){
      System.out.println("Parameterek:");
      System.out.println("M: " + nagyM);
      System.out.println("P: " + nagyP);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.