Skip to content

Commit ee1e989

Browse files
author
Mariana Azevedo
committed
Merge branch 'dev/java8update'
2 parents 9aacc46 + de767fd commit ee1e989

File tree

101 files changed

+1329
-1437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+1329
-1437
lines changed

.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
<classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.14.jar"/>
1010
<classpathentry exported="true" kind="lib" path="lib/commons-csv-1.0.jar"/>
1111
<classpathentry kind="lib" path="lib/jsefa-1.0.0.RELEASE.jar"/>
12+
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
1213
<classpathentry kind="output" path="bin"/>
1314
</classpath>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
eclipse.preferences.version=1
2-
encoding//src/o3smeasures/astvisitors/LooseClassCohesionVisitor.java=UTF-8
3-
encoding//src/o3smeasures/measures/NumberOfClasses.java=UTF-8
2+
encoding//src/com/o3smeasures/astvisitors/LooseClassCohesionVisitor.java=UTF-8
3+
encoding//src/com/o3smeasures/measures/NumberOfClasses.java=UTF-8
44
encoding/<project>=UTF-8
55
encoding/src=UTF-8

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
language: java
22
jdk:
33
- oraclejdk8
4-
sudo: false
5-
addons:
6-
apt:
7-
packages:
8-
- oracle-java8-installer
4+
sudo: false

META-INF/MANIFEST.MF

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: O3SMeasures
44
Bundle-SymbolicName: O3SMeasures;singleton:=true
5-
Bundle-Version: 1.1.0
5+
Bundle-Version: 1.2.0
66
Bundle-Vendor: Mariana Azevedo
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.resources,
@@ -11,29 +11,30 @@ Require-Bundle: org.eclipse.ui,
1111
org.junit;bundle-version="4.11.0",
1212
org.w3c.dom.events;bundle-version="3.0.0"
1313
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
14-
Bundle-Activator: o3smeasures.plugin.Activator
14+
Bundle-Activator: com.o3smeasures.plugin.Activator
1515
Bundle-ActivationPolicy: lazy
16-
Export-Package: o3smeasures.astvisitors,
17-
o3smeasures.builder,
18-
o3smeasures.builder.generic,
19-
o3smeasures.javamodel,
20-
o3smeasures.javamodel.generic,
21-
o3smeasures.main,
22-
o3smeasures.measures,
23-
o3smeasures.plugin,
24-
o3smeasures.plugin.chart,
25-
o3smeasures.plugin.views,
26-
o3smeasures.popup.actions,
27-
o3smeasures.preferences,
28-
o3smeasures.statistic,
29-
o3smeasures.statistic.generic,
30-
o3smeasures.structures,
31-
o3smeasures.util,
16+
Export-Package: com.o3smeasures.astvisitors,
17+
com.o3smeasures.builder,
18+
com.o3smeasures.builder.generic,
19+
com.o3smeasures.javamodel,
20+
com.o3smeasures.javamodel.generic,
21+
com.o3smeasures.main,
22+
com.o3smeasures.measures,
23+
com.o3smeasures.plugin,
24+
com.o3smeasures.plugin.chart,
25+
com.o3smeasures.plugin.views,
26+
com.o3smeasures.popup.actions,
27+
com.o3smeasures.preferences,
28+
com.o3smeasures.statistic,
29+
com.o3smeasures.statistic.generic,
30+
com.o3smeasures.structures,
31+
com.o3smeasures.util,
3232
org.jfree.chart.axis
3333
Bundle-ClassPath: lib/jcommon-1.0.16.jar,
3434
lib/jcommon-1.0.17.jar,
3535
lib/jfreechart-1.0.14-swt.jar,
3636
lib/jfreechart-1.0.14.jar,
3737
.,
3838
lib/commons-csv-1.0.jar,
39-
lib/jsefa-1.0.0.RELEASE.jar
39+
lib/jsefa-1.0.0.RELEASE.jar,
40+
lib/log4j-1.2.17.jar

build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ bin.includes = plugin.xml,\
77
lib/jfreechart-1.0.14-swt.jar,\
88
lib/jfreechart-1.0.14.jar,\
99
lib/jcommon-1.0.16.jar,\
10-
lib/jcommon-1.0.17.jar
10+
lib/jcommon-1.0.17.jar,\
11+
lib/log4j-1.2.17.jar
1112
src.includes = lib/
1213
jars.compile.order = .

doc/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
function show(type)
22
{
3-
count = 0;
3+
var count = 0;
44
for (var key in methods) {
55
var row = document.getElementById(key);
6-
if ((methods[key] & type) != 0) {
6+
if ((methods[key] && type) != 0) {
77
row.style.display = '';
88
row.className = (count++ % 2) ? rowColor : altColor;
99
}

lib/log4j-1.2.17.jar

478 KB
Binary file not shown.

plugin.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<menuContribution locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
77
<menu label="O3SMeasures"
88
mnemonic="O3SMeasures" id="O3SMeasures.menu1">
9-
<command commandId="o3smeasures.popup.actions.Measurement"
9+
<command commandId="com.o3smeasures.popup.actions.Measurement"
1010
id="O3SMeasures.newAction"
1111
label="Measure"
1212
style="push"
@@ -32,31 +32,31 @@
3232
<extension point="org.eclipse.ui.commands">
3333
<category id="o3smeasures" name="o3smeasures"></category>
3434
<command categoryId="o3smeasures"
35-
id="o3smeasures.popup.actions.Measurement"
35+
id="com.o3smeasures.popup.actions.Measurement"
3636
description="O3SMeasures"
3737
name="O3SMeasures"
38-
defaultHandler="o3smeasures.popup.actions.Measurement">
38+
defaultHandler="com.o3smeasures.popup.actions.Measurement">
3939
</command>
4040
</extension>
4141

4242
<extension point="org.eclipse.ui.perspectiveExtensions">
4343
<perspectiveExtension targetID="org.eclipse.jdt.ui.JavaPerspective">
44-
<view id="o3smeasures.plugin.views.SampleView"
44+
<view id="com.o3smeasures.plugin.views.SampleView"
4545
ratio="0.5"
4646
relationship="right"
4747
relative="org.eclipse.ui.views.ProblemView">
4848
</view>
49-
<view id="o3smeasures.plugin.views.PieChartView"
49+
<view id="com.o3smeasures.plugin.views.PieChartView"
5050
ratio="0.5"
5151
relationship="right"
5252
relative="org.eclipse.ui.views.ProblemView">
5353
</view>
54-
<view id="o3smeasures.plugin.views.FactorsView"
54+
<view id="com.o3smeasures.plugin.views.FactorsView"
5555
ratio="0.5"
5656
relationship="right"
5757
relative="org.eclipse.ui.views.ProblemView">
5858
</view>
59-
<view id="o3smeasures.plugin.views.IndicatorsView"
59+
<view id="com.o3smeasures.plugin.views.IndicatorsView"
6060
ratio="0.5"
6161
relationship="right"
6262
relative="org.eclipse.ui.views.ProblemView">
@@ -67,35 +67,35 @@
6767
<extension point="org.eclipse.ui.views">
6868
<category id="o3smeasures" name="o3smeasures"></category>
6969
<view category="o3smeasures"
70-
class="o3smeasures.plugin.views.SampleView"
70+
class="com.o3smeasures.plugin.views.SampleView"
7171
icon="icons/eclipse16.gif"
72-
id="o3smeasures.plugin.views.SampleView"
72+
id="com.o3smeasures.plugin.views.SampleView"
7373
name="O3SMeasures Diagnostic View">
7474
</view>
7575
<view category="o3smeasures"
76-
class="o3smeasures.plugin.views.PieChartView"
76+
class="com.o3smeasures.plugin.views.PieChartView"
7777
icon="icons/eclipse16.gif"
78-
id="o3smeasures.plugin.views.PieChartView"
78+
id="com.o3smeasures.plugin.views.PieChartView"
7979
name="O3SMeasures PieChart View">
8080
</view>
8181
<view category="o3smeasures"
82-
class="o3smeasures.plugin.views.FactorsView"
82+
class="com.o3smeasures.plugin.views.FactorsView"
8383
icon="icons/eclipse16.gif"
84-
id="o3smeasures.plugin.views.FactorsView"
84+
id="com.o3smeasures.plugin.views.FactorsView"
8585
name="O3SMeasures Factors View">
8686
</view>
8787
<view category="o3smeasures"
88-
class="o3smeasures.plugin.views.IndicatorsView"
88+
class="com.o3smeasures.plugin.views.IndicatorsView"
8989
icon="icons/eclipse16.gif"
90-
id="o3smeasures.plugin.views.IndicatorsView"
90+
id="com.o3smeasures.plugin.views.IndicatorsView"
9191
name="O3SMeasures Indicators View">
9292
</view>
9393
</extension>
9494
<extension
9595
point="org.eclipse.ui.preferencePages">
9696
<page
97-
class="o3smeasures.preferences.O3SMeasuresPreferencePage"
98-
id="o3smeasures.preferencePage"
97+
class="com.o3smeasures.preferences.O3SMeasuresPreferencePage"
98+
id="com.o3smeasures.preferencePage"
9999
name="O3SMeasures Preferences">
100100
</page>
101101
</extension>

src/o3smeasures/astvisitors/ClassVisitor.java renamed to src/com/o3smeasures/astvisitors/ClassVisitor.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package o3smeasures.astvisitors;
1+
package com.o3smeasures.astvisitors;
22

33
import java.util.Iterator;
44
import java.util.List;
@@ -57,20 +57,16 @@ private void calculateNumberOfClasses(CompilationUnit unit) {
5757
numOfClassClasses++;
5858

5959
for (Object type :unit.types()){
60-
if (type instanceof TypeDeclaration){
60+
if ((type instanceof TypeDeclaration) && !((TypeDeclaration) type).isInterface()){
6161

62-
if (!((TypeDeclaration) type).isInterface()){
63-
64-
List<TypeDeclaration> bodyDeclarationsList = ((TypeDeclaration) type).bodyDeclarations();
65-
Iterator<TypeDeclaration> itBodyDeclaration = bodyDeclarationsList.iterator();
66-
67-
while (itBodyDeclaration.hasNext()){
68-
Object itItem = itBodyDeclaration.next();
69-
if (itItem instanceof TypeDeclaration){
70-
if (!((TypeDeclaration) itItem).isInterface()){
71-
numOfClassClasses++;
72-
}
73-
}
62+
List<TypeDeclaration> bodyDeclarationsList = ((TypeDeclaration) type).bodyDeclarations();
63+
Iterator<TypeDeclaration> itBodyDeclaration = bodyDeclarationsList.iterator();
64+
65+
while (itBodyDeclaration.hasNext()){
66+
Object itItem = itBodyDeclaration.next();
67+
if ((itItem instanceof TypeDeclaration)
68+
&& !((TypeDeclaration) itItem).isInterface()){
69+
numOfClassClasses++;
7470
}
7571
}
7672
}

src/o3smeasures/astvisitors/CouplingBetweenObjectsVisitor.java renamed to src/com/o3smeasures/astvisitors/CouplingBetweenObjectsVisitor.java

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
package o3smeasures.astvisitors;
1+
package com.o3smeasures.astvisitors;
22

33
import java.util.List;
4+
import java.util.Optional;
5+
import java.util.stream.Collectors;
46

57
import org.eclipse.jdt.core.IType;
68
import org.eclipse.jdt.core.dom.ASTVisitor;
@@ -24,13 +26,13 @@
2426
public class CouplingBetweenObjectsVisitor extends ASTVisitor{
2527

2628
private IType[] iTypeList;
27-
private static int ITYPE_SIZE = 20;
29+
private static int size = 20;
2830
private int numCalls;
2931
private static CouplingBetweenObjectsVisitor instance;
3032

3133
public CouplingBetweenObjectsVisitor(){
3234
super();
33-
iTypeList = new IType[ITYPE_SIZE];
35+
iTypeList = new IType[size];
3436
}
3537

3638
public static CouplingBetweenObjectsVisitor getInstance(){
@@ -57,22 +59,14 @@ public boolean visit(CompilationUnit node) {
5759
* @since 13/07/2014
5860
* @param unit
5961
*/
62+
@SuppressWarnings("unchecked")
6063
private void calculateClazzUsed(CompilationUnit unit){
61-
for (Object type :unit.types()){
62-
if (type instanceof TypeDeclaration){
63-
64-
MethodDeclaration [] methods = ((TypeDeclaration) type).getMethods();
65-
66-
for (MethodDeclaration method: methods){
67-
68-
Block firstMethodBody = method.getBody();
69-
70-
if (firstMethodBody != null){
71-
72-
checkMethodStatements(method, firstMethodBody);
73-
}
74-
}
75-
}
64+
65+
Object typeDeclaration = unit.types().stream().filter(type -> type instanceof TypeDeclaration).collect(Collectors.toList());
66+
MethodDeclaration [] methods = ((List<TypeDeclaration>) typeDeclaration).get(0).getMethods();
67+
for (MethodDeclaration method: methods){
68+
Block firstMethodBody = method.getBody();
69+
Optional.ofNullable(firstMethodBody).ifPresent(m -> checkMethodStatements(method, firstMethodBody));
7670
}
7771
}
7872

@@ -86,11 +80,7 @@ private void calculateClazzUsed(CompilationUnit unit){
8680
@SuppressWarnings("unchecked")
8781
private void checkMethodStatements(MethodDeclaration method, Block firstMethodBody) {
8882
List<Statement> firstMethodStatements = firstMethodBody.statements();
89-
90-
if (!firstMethodStatements.isEmpty()){
91-
92-
getMethodDeclarations(method, firstMethodStatements);
93-
}
83+
if (!firstMethodStatements.isEmpty()) getMethodDeclarations(method, firstMethodStatements);
9484
}
9585

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

107-
if (firstMethodStatements.toString().contains(ty.getElementName())){
108-
numCalls++;
109-
}
97+
if (firstMethodStatements.toString().contains(ty.getElementName())) numCalls++;
11098

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

@@ -143,6 +131,6 @@ public void cleanArrayAndVariable(){
143131
* @return
144132
*/
145133
public Double getCouplingBetweenObjectsIndex(){
146-
return Double.valueOf(iTypeList.length + numCalls);
134+
return Double.valueOf(iTypeList.length) + Double.valueOf(numCalls);
147135
}
148136
}

0 commit comments

Comments
 (0)