Package com.wot.shared

Examples of com.wot.shared.DataCommunityAccountRatings


            nbBattles = nbBattles + battles;
            levelByBattles =levelByBattles + levelTank * battles;
          }
          averageLevelTank = levelByBattles/nbBattles;
         
          DataCommunityAccountRatings myDataCommunityAccountRatings = communityAccount.getData();
         
          //average level tank
          myDataCommunityAccountRatings.setAverageLevel(averageLevelTank);
         
          //log.info("averageLevelTank" + averageLevelTank);
         
          //== WR calculated
          int battles = myDataCommunityAccountRatings.getBattles();
          int battlesWin = myDataCommunityAccountRatings.getBattle_wins();
          Double wrCal = (double) ((double)battlesWin/(double)battles);
         
          //on ne conserve que 2 digits après la virgule
          wrCal = wrCal * 100; //ex : 51,844444
          int intWrCal = (int) (wrCal * 100); //ex : 5184
         
          wrCal = (double)intWrCal / 100 ; //ex : 51,84
          myDataCommunityAccountRatings.setBattle_avg_performanceCalc(wrCal);
         
          //== Ratio capture points calculated
          int ctfPoints = myDataCommunityAccountRatings.getCtf_points();
          Double ctfPointsCal = (double) ((double)ctfPoints/(double)battles);// 1,28 :1 = 1.28
         
          //on ne conserve que 2 digits après la virgule
          //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
          int intCtfPointsCal = (int) (ctfPointsCal * 100); //ex intCtfPointsCal : 128,27 ctfPointsCal = 1.28
         
          ctfPointsCal = (double)intCtfPointsCal / 100 ; //ex ctfPointsCal : 1,28 intCtfPointsCal = 128
          myDataCommunityAccountRatings.setRatioCtfPoints(ctfPointsCal);
         
          //==Damage Ration calculated
          int damagePoints = myDataCommunityAccountRatings.getDamage_dealt();
          Double ratioDamagePoints = (double) ((double)damagePoints/(double)battles);
         
          //on ne conserve que 2 digits après la virgule
          //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
          int intRatioDamagePoints = (int) (ratioDamagePoints * 100); //ex : 128,27
         
          ratioDamagePoints = (double)intRatioDamagePoints / 100 ; //ex : 1,28
          myDataCommunityAccountRatings.setRatioDamagePoints(ratioDamagePoints);
         
         
          //==Ratio Defense calculated
          int droppedCtfPoints = myDataCommunityAccountRatings.getDropped_ctf_points();
          Double ratioDroppedCtfPoints = (double) ((double)droppedCtfPoints/(double)battles);
         
          //on ne conserve que 2 digits après la virgule
          //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
          int intRatioDroppedCtfPoints = (int) (ratioDroppedCtfPoints * 100); //ex : 128,27
         
          ratioDroppedCtfPoints = (double)intRatioDroppedCtfPoints / 100 ; //ex : 1,28
          myDataCommunityAccountRatings.setRatioDroppedCtfPoints(ratioDroppedCtfPoints);
         
         
          //==Ratio Destroyed calculated
          int destroyedPoints = myDataCommunityAccountRatings.getFrags();
          Double ratiodestroyedPoints = (double) ((double)destroyedPoints/(double)battles);
         
          //on ne conserve que 2 digits après la virgule
          //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
          int intRatiodestroyedPoints = (int) (ratiodestroyedPoints * 100); //ex : 128,27
         
          ratiodestroyedPoints = (double)intRatiodestroyedPoints / 100 ; //ex : 1,28
          myDataCommunityAccountRatings.setRatioDestroyedPoints(ratiodestroyedPoints);
         
          //==Ratio Detected calculated
          int detectedPoints = myDataCommunityAccountRatings.getSpotted();
          Double ratioDetectedPoints = (double) ((double)detectedPoints/(double)battles);
         
          //on ne conserve que 2 digits après la virgule
          //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
          int intRatioDetectedPoints = (int) (ratioDetectedPoints * 100); //ex : 128,27
         
          ratioDetectedPoints = (double)intRatioDetectedPoints / 100 ; //ex : 1,28
          myDataCommunityAccountRatings.setRatioDetectedPoints(ratioDetectedPoints);
       
        }
        //add account
        listCommunityAccount.addAll(listCommunityAccount1);
 
View Full Code Here


       
          //Transform playerRatings en communityAccount (pour utiliser des types compatibles avec la sérialisation (pas de MAP !!))
          //communityAccount =  TransformDtoObject.TransformPlayerRatingsToCommunityAccount(playerRatings);
         
          //make some calculation of stats
          DataCommunityAccountRatings myDataCommunityAccountStats = communityAccount.getData();
          myDataCommunityAccountStats.setAverageLevel(5.5);
//             
          int battles = myDataCommunityAccountStats.getBattles();
          log.warning("userId :" + communityAccount.getIdUser() + " battles : " + battles);

          if (saveDataPlayer){
            //pm = PMF.get().getPersistenceManager();
                try {
View Full Code Here

//              nbBattles = nbBattles + battles;
//              levelByBattles =levelByBattles + levelTank * battles;
//            }
//            averageLevelTank = levelByBattles/nbBattles;
           
            DataCommunityAccountRatings myDataCommunityAccountRatings = communityAccount.getData();
           
            //average level tank
            myDataCommunityAccountRatings.setAverageLevel(averageLevelTank);
           
            //log.info("averageLevelTank" + averageLevelTank);
           
            //== WR calculated
            int battles = myDataCommunityAccountRatings.getBattles();
            int battlesWin = myDataCommunityAccountRatings.getBattle_wins();
            Double wrCal = (double) ((double)battlesWin/(double)battles);
           
            //on ne conserve que 2 digits après la virgule
            wrCal = wrCal * 100; //ex : 51,844444
            int intWrCal = (int) (wrCal * 100); //ex : 5184
           
            wrCal = (double)intWrCal / 100 ; //ex : 51,84
            myDataCommunityAccountRatings.setBattle_avg_performanceCalc(wrCal);
           
            //== Ratio capture points calculated
            int ctfPoints = myDataCommunityAccountRatings.getCtf_points();
            Double ctfPointsCal = (double) ((double)ctfPoints/(double)battles);// 1,28 :1 = 1.28
           
            //on ne conserve que 2 digits après la virgule
            //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
            int intCtfPointsCal = (int) (ctfPointsCal * 100); //ex intCtfPointsCal : 128,27 ctfPointsCal = 1.28
           
            ctfPointsCal = (double)intCtfPointsCal / 100 ; //ex ctfPointsCal : 1,28 intCtfPointsCal = 128
            myDataCommunityAccountRatings.setRatioCtfPoints(ctfPointsCal);
           
            //==Damage Ration calculated
            int damagePoints = myDataCommunityAccountRatings.getDamage_dealt();
            Double ratioDamagePoints = (double) ((double)damagePoints/(double)battles);
           
            //on ne conserve que 2 digits après la virgule
            //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
            int intRatioDamagePoints = (int) (ratioDamagePoints * 100); //ex : 128,27
           
            ratioDamagePoints = (double)intRatioDamagePoints / 100 ; //ex : 1,28
            myDataCommunityAccountRatings.setRatioDamagePoints(ratioDamagePoints);
           
           
            //==Ratio Defense calculated
            int droppedCtfPoints = myDataCommunityAccountRatings.getDropped_ctf_points();
            Double ratioDroppedCtfPoints = (double) ((double)droppedCtfPoints/(double)battles);
           
            //on ne conserve que 2 digits après la virgule
            //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
            int intRatioDroppedCtfPoints = (int) (ratioDroppedCtfPoints * 100); //ex : 128,27
           
            ratioDroppedCtfPoints = (double)intRatioDroppedCtfPoints / 100 ; //ex : 1,28
            myDataCommunityAccountRatings.setRatioDroppedCtfPoints(ratioDroppedCtfPoints);
           
           
            //==Ratio Destroyed calculated
            int destroyedPoints = myDataCommunityAccountRatings.getFrags();
            Double ratiodestroyedPoints = (double) ((double)destroyedPoints/(double)battles);
           
            //on ne conserve que 2 digits après la virgule
            //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
            int intRatiodestroyedPoints = (int) (ratiodestroyedPoints * 100); //ex : 128,27
           
            ratiodestroyedPoints = (double)intRatiodestroyedPoints / 100 ; //ex : 1,28
            myDataCommunityAccountRatings.setRatioDestroyedPoints(ratiodestroyedPoints);
           
            //==Ratio Detected calculated
            int detectedPoints = myDataCommunityAccountRatings.getSpotted();
            Double ratioDetectedPoints = (double) ((double)detectedPoints/(double)battles);
           
            //on ne conserve que 2 digits après la virgule
            //ctfPointsCal = ctfPointsCal * 100; //ex : 1,2827
            int intRatioDetectedPoints = (int) (ratioDetectedPoints * 100); //ex : 128,27
           
            ratioDetectedPoints = (double)intRatioDetectedPoints / 100 ; //ex : 1,28
            myDataCommunityAccountRatings.setRatioDetectedPoints(ratioDetectedPoints);
         
          }
          //add account
          listCommunityAccount.addAll(listCommunityAccount1);
   
View Full Code Here

              nbBattles = nbBattles + battles;
              levelByBattles =levelByBattles + levelTank * battles;
            }
          }//for
          averageLevelTank = levelByBattles/nbBattles;
          DataCommunityAccountRatings myDataCommunityAccountRatings = communityAccount.getData();
         
          //average level tank
          myDataCommunityAccountRatings.setAverageLevel(averageLevelTank);
          //
         
          //int battles = myDataCommunityAccountStats.getBattles();
          //log.warning("userId :" + communityAccount.getIdUser() + " battles : " + battles);

View Full Code Here

  }

 
  private static DataCommunityAccountRatings TransformDaoDataCommunityAccountToDataCommunityAccount(DaoDataCommunityAccount2 data) {
    // TODO Auto-generated method stub
    DataCommunityAccountRatings myDataCommunityAccountRatings = new DataCommunityAccountRatings();
   
   
   
    if(data.getStats().getBattle_avg_performanceCalc() != null)
      myDataCommunityAccountRatings.setBattle_avg_performanceCalc(data.getStats().getBattle_avg_performanceCalc());
   
    myDataCommunityAccountRatings.setBattle_avg_xp(new Double(data.getStats().getBattle_avg_xp()));
   
    myDataCommunityAccountRatings.setBattle_wins(new Double(data.getStats().getBattle_wins()));
   
    myDataCommunityAccountRatings.setBattles(new Double(data.getStats().getBattles()));
   
    myDataCommunityAccountRatings.setCtf_points(new Double(data.getStats().getCtf_points()));
   
    myDataCommunityAccountRatings.setDamage_dealt(new Double(data.getStats().getDamage_dealt()));
   
    myDataCommunityAccountRatings.setDropped_ctf_points(new Double(data.getStats().getDropped_ctf_points()));
   
    myDataCommunityAccountRatings.setFrags(new Double(data.getStats().getFrags()));
   
    myDataCommunityAccountRatings.setIntegrated_rating(new Double(data.getStats().getIntegrated_rating()));
   
    if (data.getStats().getRatioCtfPoints() != null)
      myDataCommunityAccountRatings.setRatioCtfPoints(new Double(data.getStats().getRatioCtfPoints()));
   
    if (data.getStats().getRatioDamagePoints() != null)
      myDataCommunityAccountRatings.setRatioDamagePoints(new Double(data.getStats().getRatioDamagePoints()));
   
    if(data.getStats().getRatioDestroyedPoints()!= null)
      myDataCommunityAccountRatings.setRatioDestroyedPoints(new Double(data.getStats().getRatioDestroyedPoints()));
   
    if(data.getStats().getRatioDetectedPoints() != null)
      myDataCommunityAccountRatings.setRatioDetectedPoints(new Double(data.getStats().getRatioDetectedPoints()));
   
    if(data.getStats().getRatioDestroyedPoints() != null)
      myDataCommunityAccountRatings.setRatioDroppedCtfPoints(new Double(data.getStats().getRatioDestroyedPoints()));
   
   
    myDataCommunityAccountRatings.setSpotted(new Double(data.getStats().getSpotted()));
   
   
    myDataCommunityAccountRatings.setXp(new Double(data.getStats().getXp()));
   
    myDataCommunityAccountRatings.setAverageLevel(new Double(data.getStats().getAverageLevel()));
   
   
   
    return myDataCommunityAccountRatings;
   
View Full Code Here

    }
    return listDataCommAccVeh;
  }

  private static DataCommunityAccountRatings TransformDaoDataCommunityAccountStatsToDataCommunityAccountStats(DaoDataCommunityAccountStats stats) {
    DataCommunityAccountRatings myDataCommunityAccountStats =  new DataCommunityAccountRatings();
   
    myDataCommunityAccountStats.setBattle_avg_performance(new Double(stats.getBattle_avg_performance()));
    myDataCommunityAccountStats.setBattle_avg_xp(new Double(stats.getBattle_avg_xp()));
    myDataCommunityAccountStats.setBattle_wins(new Double(stats.getBattle_wins()));
    myDataCommunityAccountStats.setBattles(new Double(stats.getBattles()));
    myDataCommunityAccountStats.setCtf_points(new Double(stats.getCtf_points()));
    myDataCommunityAccountStats.setDamage_dealt(new Double(stats.getDamage_dealt()));
    myDataCommunityAccountStats.setDropped_ctf_points(new Double(stats.getDropped_ctf_points()));
    myDataCommunityAccountStats.setFrags(new Double(stats.getFrags()));
    myDataCommunityAccountStats.setIntegrated_rating(new Double(stats.getIntegrated_rating()));
    myDataCommunityAccountStats.setSpotted(new Double(stats.getSpotted()));
    myDataCommunityAccountStats.setXp(new Double(stats.getXp()));
   
   
   
    return myDataCommunityAccountStats;
  }
View Full Code Here

TOP

Related Classes of com.wot.shared.DataCommunityAccountRatings

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.