Package hu.u_szeged.nbo.geometria.exception

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


        }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);
View Full Code Here


        sor++;
        st = new StringTokenizer(buf.readLine());
        id = Integer.parseInt(st.nextToken());
        type = Integer.parseInt(st.nextToken());
        if(!GeomResources.getInstance().getWorkTypeIndexes().isEleme(type)){
          throw new GeomWrongIndexException(GeomWrongIndexException.NO_SPECIFIED_TYPE_INDEX_EXCEPTION, fileName, sor, type);
        }
        priority = Integer.parseInt(st.nextToken());
        if(priority>maxPriority){
          maxPriority = priority;
        }
        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);
        }
View Full Code Here

   
    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);
   
    matrixTypePair = GeomIntMatrix.beolvas(path + "typepair.mtx");
View Full Code Here

  public GeomPlace getPlaceById(int id) throws GeomWrongIndexException{
    GeomPlace place = (GeomPlace)places.get(new Integer(id));
    if(place!=null){
      return place;
    } else {
      throw new GeomWrongIndexException();
    }
  }
View Full Code Here

        String s = buf.readLine();
        st = new StringTokenizer(s);
        id = Integer.parseInt(st.nextToken());
        type = Integer.parseInt(st.nextToken());
        if(!GeomResources.getInstance().getTeamTypeIndexes().isEleme(type)){
          throw new GeomWrongIndexException(GeomWrongIndexException.NO_SPECIFIED_TYPE_INDEX_EXCEPTION, fileName, sor, type);
        }
        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);
        }
View Full Code Here

        String s = buf.readLine();
        st = new StringTokenizer(s);
        id = Integer.parseInt(st.nextToken());
        nev = st.nextToken();
        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);
        }
View Full Code Here

TOP

Related Classes of hu.u_szeged.nbo.geometria.exception.GeomWrongIndexException

Copyright © 2018 www.massapicom. 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.