Skip to content

Commit

Permalink
Update #16 javadoc, code style, and exceptions.
Browse files Browse the repository at this point in the history
Note : Tests were commented for UI.
  • Loading branch information
Omar WALDMANN committed May 30, 2017
1 parent bf73b6d commit edafe37
Show file tree
Hide file tree
Showing 10 changed files with 1,676 additions and 1,938 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,54 @@

import fr.cnes.analysis.tools.analyzer.datas.AbstractMetric;
import fr.cnes.analysis.tools.analyzer.datas.FileValue;
import fr.cnes.analysis.tools.analyzer.exception.JFlexException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Logger;

/**
* This class is responsible of computing a metric on a file and to return it's
* results as a Thread by implementing {@link Callable} interface.
*
* @since 3.0
*/
public class CallableMetricAnalyzer implements Callable<List<FileValue>> {

private AbstractMetric metric;
private File file;
/** Logger */
private static final Logger LOGGER = Logger.getLogger(CallableMetricAnalyzer.class.getName());

public CallableMetricAnalyzer(AbstractMetric pMetric, File pFile) {
this.metric = pMetric;
this.file = pFile;
}
/** The metric to compute */
private AbstractMetric metric;
/** The file to analyze */
private File file;

@Override
public List<FileValue> call() throws Exception {
List<FileValue> results = new ArrayList<>();
metric.setInputFile(file);
results.add(metric.run());
return results;
}
/**
* Constructor for {@link CallableMetricAnalyzer}.
*
* @param pMetric
* to compute
* @param pInputFile
* to analyze
*/
public CallableMetricAnalyzer(AbstractMetric pMetric, File pInputFile) {
this.metric = pMetric;
this.file = pInputFile;
}

/*
* (non-Javadoc)
*
* @see java.util.concurrent.Callable#call()
*/
@Override
public List<FileValue> call() throws IOException, JFlexException {
LOGGER.entering(this.getClass().getName(), "call");
final List<FileValue> results = new ArrayList<>();
metric.setInputFile(file);
results.add(metric.run());
return results;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,50 @@

import fr.cnes.analysis.tools.analyzer.datas.AbstractRule;
import fr.cnes.analysis.tools.analyzer.datas.Violation;
import fr.cnes.analysis.tools.analyzer.exception.JFlexException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

/**
* This class is responsible of applying a rule on a file and to return it's
* results as a Thread by implementing {@link Callable} interface.
*
* @since 3.0
*/
public class CallableRuleAnalyzer implements Callable<List<Violation>> {

private AbstractRule rule;
private File file;
/** The rule to apply */
private AbstractRule rule;
/** The metric to analyze */
private File file;

public CallableRuleAnalyzer(AbstractRule rule, File file) {
this.rule = rule;
this.file = file;
}
/**
* Constructor for {@link CallableRuleAnalyzer}.
*
* @param pRule
* to apply
* @param pInputFile
* to analyze
*/
public CallableRuleAnalyzer(AbstractRule pRule, File pInputFile) {
this.rule = pRule;
this.file = pInputFile;
}

@Override
public List<Violation> call() throws Exception {
List<Violation> results = new ArrayList<>();
rule.setInputFile(file);
results.addAll(rule.run());
return results;
}
/*
* (non-Javadoc)
*
* @see java.util.concurrent.Callable#call()
*/
@Override
public List<Violation> call() throws IOException, JFlexException {
final List<Violation> results = new ArrayList<>();
rule.setInputFile(file);
results.addAll(rule.run());
return results;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/************************************************************************************************/
/* i-Code CNES is a static code analyzer. */
/* This software is a free software, under the terms of the Eclipse Public License version 1.0. */
/* http://www.eclipse.org/legal/epl-v10.html */
/************************************************************************************************/
/**
* Package containing i-Code CNES UI analyzer service.
*
* @version 3.0
*/
package fr.cnes.analysis.tools.analyzer;
Loading

0 comments on commit edafe37

Please sign in to comment.