Login | Register
My pages Projects Community openCollabNet

Discussions > Commits > svn commit: r129 - trunk/externalTools/MetricsGather/src/metrics

argouml-spl
Discussion topic

Back to topic list

svn commit: r129 - trunk/externalTools/MetricsGather/src/metrics

Author marcusvnac
Full name Marcus Vinícius de Ávila Couto
Date 2010-09-26 13:36:00 PDT
Message Author: marcusvnac
Date: 2010-09-26 13:35:59-0700
New Revision: 129

Modified:
   trunk/externalTools/​MetricsGather/src/me​trics/GatherMetrics.​java
   trunk/externalTools/​MetricsGather/src/me​trics/MetricType.jav​a
   trunk/externalTools/​MetricsGather/src/me​trics/MetricsProcess​or.java

Log:
Add SD metric

Modified: trunk/externalTools/​MetricsGather/src/me​trics/GatherMetrics.​java
Url: http://argouml-spl.t​igris.org/source/bro​wse/argouml-spl/trun​k/externalTools/Metr​icsGather/src/metric​s/GatherMetrics.java​?view=diff&pathr​ev=129&r1=128​&r2=129
====================​====================​====================​==================
--- trunk/externalTools/​MetricsGather/src/me​trics/GatherMetrics.​java (original)
+++ trunk/externalTools/​MetricsGather/src/me​trics/GatherMetrics.​java 2010-09-26 13:35:59-0700
@@ -55,7 +55,6 @@
     FilenameFilter javaFileFilter = new FilenameFilter() {
         public boolean accept(File dir, String name) {
             return name.endsWith(".java");
-// && name.equals("Agency.java");
             }
         };
         
@@ -108,10 +107,13 @@
     private void processFile(File file) {
         try {
             BufferedReader br = new BufferedReader(new FileReader(file));
- HasValidJavaFile = br.ready();
+ Boolean hasData = false;
             while (br.ready()) {
- metricsProcessor.ins​ertMetric(br.readLin​e().trim());
-
+ String line = br.readLine().trim();
+ if (!line.isEmpty()) {
+ metricsProcessor.ins​ertMetric(line);
+ HasValidJavaFile = true;
+ }
             }
             br.close();
         } catch (FileNotFoundException e) {

Modified: trunk/externalTools/​MetricsGather/src/me​trics/MetricType.jav​a
Url: http://argouml-spl.t​igris.org/source/bro​wse/argouml-spl/trun​k/externalTools/Metr​icsGather/src/metric​s/MetricType.java?vi​ew=diff&pathrev=​129&r1=128&r​2=129
====================​====================​====================​==================
--- trunk/externalTools/​MetricsGather/src/me​trics/MetricType.jav​a (original)
+++ trunk/externalTools/​MetricsGather/src/me​trics/MetricType.jav​a 2010-09-26 13:35:59-0700
@@ -6,7 +6,7 @@
  *
  */
 public enum MetricType {
- GRANULARITY("GranularityType"), LOCALIZATION("Localization"), OR("OR"), AND("AND"),
+ GRANULARITY("GranularityType"), LOCALIZATION("Localization"), OR("OR"), AND("AND"), SD("SD"),
     CLASS_NUMBER("#Classes"), PACKAGE_NUMBER("#Pacotes"), LOC("LOC");
     
      /** Origem da venda.*/

Modified: trunk/externalTools/​MetricsGather/src/me​trics/MetricsProcess​or.java
Url: http://argouml-spl.t​igris.org/source/bro​wse/argouml-spl/trun​k/externalTools/Metr​icsGather/src/metric​s/MetricsProcessor.j​ava?view=diff&pa​threv=129&r1=128​&r2=129
====================​====================​====================​==================
--- trunk/externalTools/​MetricsGather/src/me​trics/MetricsProcess​or.java (original)
+++ trunk/externalTools/​MetricsGather/src/me​trics/MetricsProcess​or.java 2010-09-26 13:35:59-0700
@@ -147,7 +147,6 @@
      * @param value linha lida da classe Java.
      */
     public void insertMetric(String value) {
- value = value.trim();
         // Common Metrics
         if (value.contains(Metr​icsProcessor.IDENTIF​IER)) {
             if (value.contains(Metr​icType.GRANULARITY.g​etIdentifier())) {
@@ -158,19 +157,26 @@
                 Log.info("Identificador inválido. Dados: " + value);
             }
         }
- // AND e OR Metrics
- else if (value.matches("//#if defined\\(.*\\) (and|or) defined\\(.*\\)")) {
+ // AND, OR e SD Metrics
+ else if (value.matches("//#if defined\\(.*\\).*")) {
             String feature1 = value.substring(valu​e.indexOf("(")+1, value.indexOf(")"));
- String feature2 = value.substring(valu​e.lastIndexOf("(")+1​, value.lastIndexOf(")"));
-
- MetricType type;
- if (value.toLowerCase()​.contains(MetricType​.OR.getIdentifier().​toLowerCase())) {
- type = MetricType.OR;
- } else {
- type = MetricType.AND;
+ // AND e OR
+ if (value.matches("//#if defined\\(.*\\) (and|or) defined\\(.*\\)")) {
+ String feature2 = value.substring(valu​e.lastIndexOf("(")+1​, value.lastIndexOf(")"));
+ MetricType type;
+ if (value.toLowerCase()​.contains(MetricType​.OR.getIdentifier().​toLowerCase())) {
+ type = MetricType.OR;
+ } else {
+ type = MetricType.AND;
+ }
+ // Inserir métricas AND e OR
+ insertMetric(String.​format(FAKEMETRICIDE​NTIFIER, feature1, type.getIdentifier()), type);
+ insertMetric(String.​format(FAKEMETRICIDE​NTIFIER, feature2, type.getIdentifier()), type);
+ // Inserir métrica SD
+ insertMetric(String.​format(FAKEMETRICIDE​NTIFIER, feature2, MetricType.SD.getIdentifier()), MetricType.SD);
             }
- insertMetric(String.​format(FAKEMETRICIDE​NTIFIER, feature1, type.getIdentifier()), type);
- insertMetric(String.​format(FAKEMETRICIDE​NTIFIER, feature2, type.getIdentifier()), type);
+ // Inserir métrica SD
+ insertMetric(String.​format(FAKEMETRICIDE​NTIFIER, feature1, MetricType.SD.getIdentifier()), MetricType.SD);
         }
         // LOC Metric
         else if (!isCommentOrBlankLine(value)) {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r129 - trunk/externalTools/MetricsGather/src/metrics marcusvnac Marcus Vinícius de Ávila Couto 2010-09-26 13:36:00 PDT
Messages per page: