Skip to content

Commit

Permalink
Merge branch 'dev/java8update'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariana Azevedo committed Sep 30, 2017
2 parents 9aacc46 + de767fd commit ee1e989
Show file tree
Hide file tree
Showing 101 changed files with 1,329 additions and 1,437 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.14.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-csv-1.0.jar"/>
<classpathentry kind="lib" path="lib/jsefa-1.0.0.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 2 additions & 2 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
encoding//src/o3smeasures/astvisitors/LooseClassCohesionVisitor.java=UTF-8
encoding//src/o3smeasures/measures/NumberOfClasses.java=UTF-8
encoding//src/com/o3smeasures/astvisitors/LooseClassCohesionVisitor.java=UTF-8
encoding//src/com/o3smeasures/measures/NumberOfClasses.java=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
language: java
jdk:
- oraclejdk8
sudo: false
addons:
apt:
packages:
- oracle-java8-installer
sudo: false
39 changes: 20 additions & 19 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: O3SMeasures
Bundle-SymbolicName: O3SMeasures;singleton:=true
Bundle-Version: 1.1.0
Bundle-Version: 1.2.0
Bundle-Vendor: Mariana Azevedo
Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources,
Expand All @@ -11,29 +11,30 @@ Require-Bundle: org.eclipse.ui,
org.junit;bundle-version="4.11.0",
org.w3c.dom.events;bundle-version="3.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: o3smeasures.plugin.Activator
Bundle-Activator: com.o3smeasures.plugin.Activator
Bundle-ActivationPolicy: lazy
Export-Package: o3smeasures.astvisitors,
o3smeasures.builder,
o3smeasures.builder.generic,
o3smeasures.javamodel,
o3smeasures.javamodel.generic,
o3smeasures.main,
o3smeasures.measures,
o3smeasures.plugin,
o3smeasures.plugin.chart,
o3smeasures.plugin.views,
o3smeasures.popup.actions,
o3smeasures.preferences,
o3smeasures.statistic,
o3smeasures.statistic.generic,
o3smeasures.structures,
o3smeasures.util,
Export-Package: com.o3smeasures.astvisitors,
com.o3smeasures.builder,
com.o3smeasures.builder.generic,
com.o3smeasures.javamodel,
com.o3smeasures.javamodel.generic,
com.o3smeasures.main,
com.o3smeasures.measures,
com.o3smeasures.plugin,
com.o3smeasures.plugin.chart,
com.o3smeasures.plugin.views,
com.o3smeasures.popup.actions,
com.o3smeasures.preferences,
com.o3smeasures.statistic,
com.o3smeasures.statistic.generic,
com.o3smeasures.structures,
com.o3smeasures.util,
org.jfree.chart.axis
Bundle-ClassPath: lib/jcommon-1.0.16.jar,
lib/jcommon-1.0.17.jar,
lib/jfreechart-1.0.14-swt.jar,
lib/jfreechart-1.0.14.jar,
.,
lib/commons-csv-1.0.jar,
lib/jsefa-1.0.0.RELEASE.jar
lib/jsefa-1.0.0.RELEASE.jar,
lib/log4j-1.2.17.jar
3 changes: 2 additions & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bin.includes = plugin.xml,\
lib/jfreechart-1.0.14-swt.jar,\
lib/jfreechart-1.0.14.jar,\
lib/jcommon-1.0.16.jar,\
lib/jcommon-1.0.17.jar
lib/jcommon-1.0.17.jar,\
lib/log4j-1.2.17.jar
src.includes = lib/
jars.compile.order = .
4 changes: 2 additions & 2 deletions doc/script.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function show(type)
{
count = 0;
var count = 0;
for (var key in methods) {
var row = document.getElementById(key);
if ((methods[key] & type) != 0) {
if ((methods[key] && type) != 0) {
row.style.display = '';
row.className = (count++ % 2) ? rowColor : altColor;
}
Expand Down
Binary file added lib/log4j-1.2.17.jar
Binary file not shown.
34 changes: 17 additions & 17 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<menuContribution locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
<menu label="O3SMeasures"
mnemonic="O3SMeasures" id="O3SMeasures.menu1">
<command commandId="o3smeasures.popup.actions.Measurement"
<command commandId="com.o3smeasures.popup.actions.Measurement"
id="O3SMeasures.newAction"
label="Measure"
style="push"
Expand All @@ -32,31 +32,31 @@
<extension point="org.eclipse.ui.commands">
<category id="o3smeasures" name="o3smeasures"></category>
<command categoryId="o3smeasures"
id="o3smeasures.popup.actions.Measurement"
id="com.o3smeasures.popup.actions.Measurement"
description="O3SMeasures"
name="O3SMeasures"
defaultHandler="o3smeasures.popup.actions.Measurement">
defaultHandler="com.o3smeasures.popup.actions.Measurement">
</command>
</extension>

<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.jdt.ui.JavaPerspective">
<view id="o3smeasures.plugin.views.SampleView"
<view id="com.o3smeasures.plugin.views.SampleView"
ratio="0.5"
relationship="right"
relative="org.eclipse.ui.views.ProblemView">
</view>
<view id="o3smeasures.plugin.views.PieChartView"
<view id="com.o3smeasures.plugin.views.PieChartView"
ratio="0.5"
relationship="right"
relative="org.eclipse.ui.views.ProblemView">
</view>
<view id="o3smeasures.plugin.views.FactorsView"
<view id="com.o3smeasures.plugin.views.FactorsView"
ratio="0.5"
relationship="right"
relative="org.eclipse.ui.views.ProblemView">
</view>
<view id="o3smeasures.plugin.views.IndicatorsView"
<view id="com.o3smeasures.plugin.views.IndicatorsView"
ratio="0.5"
relationship="right"
relative="org.eclipse.ui.views.ProblemView">
Expand All @@ -67,35 +67,35 @@
<extension point="org.eclipse.ui.views">
<category id="o3smeasures" name="o3smeasures"></category>
<view category="o3smeasures"
class="o3smeasures.plugin.views.SampleView"
class="com.o3smeasures.plugin.views.SampleView"
icon="icons/eclipse16.gif"
id="o3smeasures.plugin.views.SampleView"
id="com.o3smeasures.plugin.views.SampleView"
name="O3SMeasures Diagnostic View">
</view>
<view category="o3smeasures"
class="o3smeasures.plugin.views.PieChartView"
class="com.o3smeasures.plugin.views.PieChartView"
icon="icons/eclipse16.gif"
id="o3smeasures.plugin.views.PieChartView"
id="com.o3smeasures.plugin.views.PieChartView"
name="O3SMeasures PieChart View">
</view>
<view category="o3smeasures"
class="o3smeasures.plugin.views.FactorsView"
class="com.o3smeasures.plugin.views.FactorsView"
icon="icons/eclipse16.gif"
id="o3smeasures.plugin.views.FactorsView"
id="com.o3smeasures.plugin.views.FactorsView"
name="O3SMeasures Factors View">
</view>
<view category="o3smeasures"
class="o3smeasures.plugin.views.IndicatorsView"
class="com.o3smeasures.plugin.views.IndicatorsView"
icon="icons/eclipse16.gif"
id="o3smeasures.plugin.views.IndicatorsView"
id="com.o3smeasures.plugin.views.IndicatorsView"
name="O3SMeasures Indicators View">
</view>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
class="o3smeasures.preferences.O3SMeasuresPreferencePage"
id="o3smeasures.preferencePage"
class="com.o3smeasures.preferences.O3SMeasuresPreferencePage"
id="com.o3smeasures.preferencePage"
name="O3SMeasures Preferences">
</page>
</extension>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package o3smeasures.astvisitors;
package com.o3smeasures.astvisitors;

import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -57,20 +57,16 @@ private void calculateNumberOfClasses(CompilationUnit unit) {
numOfClassClasses++;

for (Object type :unit.types()){
if (type instanceof TypeDeclaration){
if ((type instanceof TypeDeclaration) && !((TypeDeclaration) type).isInterface()){

if (!((TypeDeclaration) type).isInterface()){

List<TypeDeclaration> bodyDeclarationsList = ((TypeDeclaration) type).bodyDeclarations();
Iterator<TypeDeclaration> itBodyDeclaration = bodyDeclarationsList.iterator();

while (itBodyDeclaration.hasNext()){
Object itItem = itBodyDeclaration.next();
if (itItem instanceof TypeDeclaration){
if (!((TypeDeclaration) itItem).isInterface()){
numOfClassClasses++;
}
}
List<TypeDeclaration> bodyDeclarationsList = ((TypeDeclaration) type).bodyDeclarations();
Iterator<TypeDeclaration> itBodyDeclaration = bodyDeclarationsList.iterator();

while (itBodyDeclaration.hasNext()){
Object itItem = itBodyDeclaration.next();
if ((itItem instanceof TypeDeclaration)
&& !((TypeDeclaration) itItem).isInterface()){
numOfClassClasses++;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package o3smeasures.astvisitors;
package com.o3smeasures.astvisitors;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.ASTVisitor;
Expand All @@ -24,13 +26,13 @@
public class CouplingBetweenObjectsVisitor extends ASTVisitor{

private IType[] iTypeList;
private static int ITYPE_SIZE = 20;
private static int size = 20;
private int numCalls;
private static CouplingBetweenObjectsVisitor instance;

public CouplingBetweenObjectsVisitor(){
super();
iTypeList = new IType[ITYPE_SIZE];
iTypeList = new IType[size];
}

public static CouplingBetweenObjectsVisitor getInstance(){
Expand All @@ -57,22 +59,14 @@ public boolean visit(CompilationUnit node) {
* @since 13/07/2014
* @param unit
*/
@SuppressWarnings("unchecked")
private void calculateClazzUsed(CompilationUnit unit){
for (Object type :unit.types()){
if (type instanceof TypeDeclaration){

MethodDeclaration [] methods = ((TypeDeclaration) type).getMethods();

for (MethodDeclaration method: methods){

Block firstMethodBody = method.getBody();

if (firstMethodBody != null){

checkMethodStatements(method, firstMethodBody);
}
}
}

Object typeDeclaration = unit.types().stream().filter(type -> type instanceof TypeDeclaration).collect(Collectors.toList());
MethodDeclaration [] methods = ((List<TypeDeclaration>) typeDeclaration).get(0).getMethods();
for (MethodDeclaration method: methods){
Block firstMethodBody = method.getBody();
Optional.ofNullable(firstMethodBody).ifPresent(m -> checkMethodStatements(method, firstMethodBody));
}
}

Expand All @@ -86,11 +80,7 @@ private void calculateClazzUsed(CompilationUnit unit){
@SuppressWarnings("unchecked")
private void checkMethodStatements(MethodDeclaration method, Block firstMethodBody) {
List<Statement> firstMethodStatements = firstMethodBody.statements();

if (!firstMethodStatements.isEmpty()){

getMethodDeclarations(method, firstMethodStatements);
}
if (!firstMethodStatements.isEmpty()) getMethodDeclarations(method, firstMethodStatements);
}

/**
Expand All @@ -104,9 +94,7 @@ private void checkMethodStatements(MethodDeclaration method, Block firstMethodBo
private void getMethodDeclarations(MethodDeclaration method, List<Statement> firstMethodStatements) {
for (IType ty : iTypeList){

if (firstMethodStatements.toString().contains(ty.getElementName())){
numCalls++;
}
if (firstMethodStatements.toString().contains(ty.getElementName())) numCalls++;

for (Object param : method.parameters()){
if (((SingleVariableDeclaration)param).getType().toString().matches(ty.getElementName())){
Expand All @@ -132,7 +120,7 @@ public void addListOfTypes(IType[] types){
* @since 13/07/2014
*/
public void cleanArrayAndVariable(){
this.iTypeList = new IType[ITYPE_SIZE];
this.iTypeList = new IType[size];
this.numCalls = 0;
}

Expand All @@ -143,6 +131,6 @@ public void cleanArrayAndVariable(){
* @return
*/
public Double getCouplingBetweenObjectsIndex(){
return Double.valueOf(iTypeList.length + numCalls);
return Double.valueOf(iTypeList.length) + Double.valueOf(numCalls);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package o3smeasures.astvisitors;
package com.o3smeasures.astvisitors;

import java.math.BigDecimal;
import java.math.MathContext;
Expand Down Expand Up @@ -29,7 +29,7 @@
public class CyclomaticComplexityVisitor extends ASTVisitor{

private Double cyclomaticComplexityIndex;
private static Double sumCyclomaticComplexity;
private Double sumCyclomaticComplexity;
private static CyclomaticComplexityVisitor instance;

public CyclomaticComplexityVisitor(){
Expand Down Expand Up @@ -180,7 +180,7 @@ public Double getCyclomaticComplexityIndex(){
*/
public void cleanVariables(){
this.cyclomaticComplexityIndex = 0d;
CyclomaticComplexityVisitor.sumCyclomaticComplexity = 0d;
this.sumCyclomaticComplexity = 0d;
}

/**
Expand All @@ -189,7 +189,7 @@ public void cleanVariables(){
* @since 13/07/2014
* @return
*/
public static Double getAllCyclomaticComplexity() {
public Double getAllCyclomaticComplexity() {
return sumCyclomaticComplexity;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package o3smeasures.astvisitors;
package com.o3smeasures.astvisitors;

import java.math.BigDecimal;
import java.math.MathContext;
Expand Down Expand Up @@ -26,7 +26,7 @@ public class FanOutVisitor extends ASTVisitor{

public FanOutVisitor(){
super();
typesList = new ArrayList<TypeDeclaration>();
typesList = new ArrayList<>();
}

public static FanOutVisitor getInstance(){
Expand Down Expand Up @@ -68,7 +68,7 @@ private void calculateFanOut(CompilationUnit unit){
* @since 13/07/2014
*/
public void cleanArray(){
this.typesList = new ArrayList<TypeDeclaration>();
this.typesList = new ArrayList<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package o3smeasures.astvisitors;
package com.o3smeasures.astvisitors;

import java.math.BigDecimal;
import java.math.MathContext;
Expand Down
Loading

0 comments on commit ee1e989

Please sign in to comment.