Package jmav.smellFinder

Examples of jmav.smellFinder.LongMethodAgent


   
    numSmells = 0;

    LargeClassAgent largeClassAgent = null;
    LongParameterListAgent longParameterListAgent = null;
    LongMethodAgent longMethodAgent = null;
   
    /* Prendi smell selezionati */
    boolean largeClassBV = false;
    Integer largeClassSG = Integer.MAX_VALUE;
    boolean longParListBV = false;
    Integer longParListSG = Integer.MAX_VALUE;
    boolean longMethodBV = false;
    Integer longMethodSG = Integer.MAX_VALUE;
    for(Smell smell : gestoreImpostazioni.listaSmell()) {
      if(smell.getName().equals("LargeClass")) {
        largeClassBV = true;
        largeClassSG = gestoreImpostazioni.getSoglia(GestoreImpostazioni.LargeClass, 1);
      }
      if(smell.getName().equals("LongParameterList")) {
        longParListBV = true;
        longParListSG = gestoreImpostazioni.getSoglia(GestoreImpostazioni.LongParameterList, 1);
      }
      if(smell.getName().equals("LongMethod")) {
        longMethodBV = true;
        longMethodSG = gestoreImpostazioni.getSoglia(GestoreImpostazioni.LongMethod, 1);
      }
    }
   
    Set<Granularita> granularitaSet = new HashSet<Granularita>();
   
    if (largeClassBV) {
      System.out.println("Prepare Large Class Agent");
      numSmells++;
      granularitaSet.add(LargeClassAgent.getGranularita());
    }
   
    if (longParListBV) {
      System.out.println("Prepare Long Parameter List Agent");
      numSmells++;
      granularitaSet.add(LongParameterListAgent.getGranularita());
    }
   
    if (longMethodBV) {
      System.out.println("Prepare Long Method Agent");
      numSmells++;
      granularitaSet.add(LongMethodAgent.getGranularita());
    }
   
    if(numSmells == 0)
      return;
   
    /* Calcolo le posizioni coerenti in base ai livelli di granularità */
    calcolaPosizioni(granularitaSet);
   
    ExecutorService pool = Executors.newFixedThreadPool(numSmells);
   
    if(posizioni != null) {
      for(Posizione posizione : posizioni) {
        if (largeClassBV) {
          if(posizione.getGranularita() == LargeClassAgent.getGranularita()) {
            System.out.println("run Large Class Agent with "+ largeClassSG);
            largeClassAgent = new LargeClassAgent(calcolatoreMetriche);
            largeClassAgent.setSoglia(largeClassSG);
            largeClassAgent.setPosizione(posizione);
            pool.execute(largeClassAgent.getJob());
          }
        }
   
        if (longParListBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            System.out.println("run Long Parameter List with "+ longParListSG);
            longParameterListAgent = new LongParameterListAgent(calcolatoreMetriche);
            longParameterListAgent.setSoglia(longParListSG);
            longParameterListAgent.setPosizione(posizione);
            pool.execute(longParameterListAgent.getJob());
          }
        }
       
        if (longMethodBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            System.out.println("run Long Method with "+ longMethodSG);
            longMethodAgent = new LongMethodAgent(calcolatoreMetriche);
            longMethodAgent.setSoglia(longMethodSG);
            longMethodAgent.setPosizione(posizione);
            pool.execute(longMethodAgent.getJob());
          }
        }
       
        if (largeClassBV) {
          if(posizione.getGranularita() == LargeClassAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = largeClassAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LargeClassAgent aggiunge "+occorrenzaSmell);
            }
          }
        }
       
        if (longParListBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = longParameterListAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LongParameterListAgent aggiunge "+occorrenzaSmell);
            }
          }
        }
       
        if (longMethodBV) {
          if(posizione.getGranularita() == LongMethodAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = longMethodAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LongMethodAgent aggiunge "+occorrenzaSmell);
            }
          }
View Full Code Here


   
    numSmells = 0;

    LargeClassAgent largeClassAgent = null;
    LongParameterListAgent longParameterListAgent = null;
    LongMethodAgent longMethodAgent = null;
   
    Set<Granularita> GranularitaSet = new HashSet<Granularita>();

    /* Prendi smell selezionati */
    boolean largeClassBV = store.getBoolean("BV_LARGE_CLASS");
    boolean longParListBV = store.getBoolean("BV_LONG_PAR_LIST");
    boolean longMethodBV = store.getBoolean("BV_LONG_METHOD");
   
    if (largeClassBV) {
      System.out.println("Prepare Large Class Agent");
      numSmells++;
      GranularitaSet.add(LargeClassAgent.getGranularita());
    }
   
    if (longParListBV) {
      System.out.println("Prepare Long Parameter List Agent");
      numSmells++;
      GranularitaSet.add(LongParameterListAgent.getGranularita());
    }
   
    if (longMethodBV) {
      System.out.println("Prepare Long Method Agent");
      numSmells++;
      GranularitaSet.add(LongMethodAgent.getGranularita());
    }
   
    if(numSmells == 0)
      return;
   
    /* Calcolo le posizioni coerenti in base ai livelli di granularità */
    longMethodManyPar(GranularitaSet, true, true, true);
   
    ExecutorService pool = Executors.newFixedThreadPool(numSmells);
   
    if(posizioni != null) {
      for(Posizione posizione : posizioni) {
        if (largeClassBV) {
          if(posizione.getGranularita() == LargeClassAgent.getGranularita()) {
            System.out.println("run Large Class Agent with "+ store.getInteger("SG_LARGE_CLASS"));
            largeClassAgent = new LargeClassAgent(calcolatoreMetriche);
            largeClassAgent.setSoglia(store.getInteger("SG_LARGE_CLASS"));
            largeClassAgent.setPosizione(posizione);
            pool.execute(largeClassAgent.getJob());
          }
        }
   
        if (longParListBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            System.out.println("run Long Parameter List with "+ store.getInteger("SG_LONG_PAR_LIST"));
            longParameterListAgent = new LongParameterListAgent(calcolatoreMetriche);
            longParameterListAgent.setSoglia(store.getInteger("SG_LONG_PAR_LIST"));
            longParameterListAgent.setPosizione(posizione);
            pool.execute(longParameterListAgent.getJob());
          }
        }
       
        if (longMethodBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            System.out.println("run Long Parameter List with "+ store.getInteger("SG_LONG_METHOD"));
            longMethodAgent = new LongMethodAgent(calcolatoreMetriche);
            longMethodAgent.setSoglia(store.getInteger("SG_LONG_METHOD"));
            longMethodAgent.setPosizione(posizione);
            pool.execute(longMethodAgent.getJob());
          }
        }
       
        if (largeClassBV) {
          if(posizione.getGranularita() == LargeClassAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = largeClassAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LargeClassAgent aggiunge "+occorrenzaSmell);
            }
          }
        }
       
        if (longParListBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = longParameterListAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LongParameterListAgent aggiunge "+occorrenzaSmell);
            }
          }
        }
       
        if (longMethodBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = longMethodAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LongParameterListAgent aggiunge "+occorrenzaSmell);
            }
          }
View Full Code Here

   
    numSmells = 0;

    LargeClassAgent largeClassAgent = null;
    LongParameterListAgent longParameterListAgent = null;
    LongMethodAgent longMethodAgent = null;
   
    Set<Granularita> granularitaSet = new HashSet<Granularita>();

    /* Prendi smell selezionati */
    boolean largeClassBV = store.getBoolean("BV_LARGE_CLASS");
    boolean longParListBV = store.getBoolean("BV_LONG_PAR_LIST");
    boolean longMethodBV = store.getBoolean("BV_LONG_METHOD");
   
    if (largeClassBV) {
      System.out.println("Prepare Large Class Agent");
      numSmells++;
      granularitaSet.add(LargeClassAgent.getGranularita());
    }
   
    if (longParListBV) {
      System.out.println("Prepare Long Parameter List Agent");
      numSmells++;
      granularitaSet.add(LongParameterListAgent.getGranularita());
    }
   
    if (longMethodBV) {
      System.out.println("Prepare Long Method Agent");
      numSmells++;
      granularitaSet.add(LongMethodAgent.getGranularita());
    }
   
    if(numSmells == 0)
      return;
   
    /* Calcolo le posizioni coerenti in base ai livelli di granularità */
    longMethodManyPar(granularitaSet, true, true, true);
   
    ExecutorService pool = Executors.newFixedThreadPool(numSmells);
   
    if(posizioni != null) {
      for(Posizione posizione : posizioni) {
        if (largeClassBV) {
          if(posizione.getGranularita() == LargeClassAgent.getGranularita()) {
            System.out.println("run Large Class Agent with "+ store.getInteger("SG_LARGE_CLASS"));
            largeClassAgent = new LargeClassAgent(calcolatoreMetriche);
            largeClassAgent.setSoglia(store.getInteger("SG_LARGE_CLASS"));
            largeClassAgent.setPosizione(posizione);
            pool.execute(largeClassAgent.getJob());
          }
        }
   
        if (longParListBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            System.out.println("run Long Parameter List with "+ store.getInteger("SG_LONG_PAR_LIST"));
            longParameterListAgent = new LongParameterListAgent(calcolatoreMetriche);
            longParameterListAgent.setSoglia(store.getInteger("SG_LONG_PAR_LIST"));
            longParameterListAgent.setPosizione(posizione);
            pool.execute(longParameterListAgent.getJob());
          }
        }
       
        if (longMethodBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            System.out.println("run Long Parameter List with "+ store.getInteger("SG_LONG_METHOD"));
            longMethodAgent = new LongMethodAgent(calcolatoreMetriche);
            longMethodAgent.setSoglia(store.getInteger("SG_LONG_METHOD"));
            longMethodAgent.setPosizione(posizione);
            pool.execute(longMethodAgent.getJob());
          }
        }
       
        if (largeClassBV) {
          if(posizione.getGranularita() == LargeClassAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = largeClassAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LargeClassAgent aggiunge "+occorrenzaSmell);
            }
          }
        }
       
        if (longParListBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = longParameterListAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LongParameterListAgent aggiunge "+occorrenzaSmell);
            }
          }
        }
       
        if (longMethodBV) {
          if(posizione.getGranularita() == LongParameterListAgent.getGranularita()) {
            OccorrenzaSmell occorrenzaSmell = longMethodAgent.getJob().get();
            if(occorrenzaSmell.getName() != null) {
              occorrenzaSmells.add(occorrenzaSmell);
              System.out.println("LongParameterListAgent aggiunge "+occorrenzaSmell);
            }
          }
View Full Code Here

TOP

Related Classes of jmav.smellFinder.LongMethodAgent

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.