Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Middleware
Commits
b6cebda6
Commit
b6cebda6
authored
Feb 12, 2019
by
Alexander David Hellwig
Browse files
Added durration messuring to clustering
parent
2d5e0d61
Pipeline
#104362
failed with stages
in 20 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/ClusteringResult.java
View file @
b6cebda6
...
...
@@ -13,19 +13,22 @@ import java.util.Set;
public
class
ClusteringResult
{
Double
score
=
null
;
private
EMAComponentInstanceSymbol
component
;
private
AlgorithmCliParameters
parameters
;
private
List
<
Set
<
EMAComponentInstanceSymbol
>>
clustering
;
private
long
durration
;
private
ClusteringResult
(
EMAComponentInstanceSymbol
component
,
AlgorithmCliParameters
parameters
,
List
<
Set
<
EMAComponentInstanceSymbol
>>
clustering
)
{
private
ClusteringResult
(
EMAComponentInstanceSymbol
component
,
AlgorithmCliParameters
parameters
,
List
<
Set
<
EMAComponentInstanceSymbol
>>
clustering
,
long
durration
)
{
this
.
component
=
component
;
this
.
parameters
=
parameters
;
this
.
clustering
=
clustering
;
this
.
durration
=
durration
;
}
public
static
ClusteringResult
fromParameters
(
EMAComponentInstanceSymbol
component
,
AlgorithmCliParameters
parameters
){
long
startTime
=
System
.
currentTimeMillis
();
List
<
Set
<
EMAComponentInstanceSymbol
>>
res
=
parameters
.
asClusteringAlgorithm
().
clusterWithState
(
component
);
return
new
ClusteringResult
(
component
,
parameters
,
res
);
long
endTime
=
System
.
currentTimeMillis
();
return
new
ClusteringResult
(
component
,
parameters
,
res
,
endTime
-
startTime
);
}
public
double
getScore
(){
...
...
@@ -51,6 +54,10 @@ public class ClusteringResult {
return
clustering
.
size
();
}
private
long
getDurration
()
{
return
this
.
durration
;
}
public
boolean
hasNumberOfClusters
(
int
n
){
return
getNumberOfClusters
()
==
n
;
}
...
...
@@ -60,7 +67,8 @@ public class ClusteringResult {
res
.
setFileName
(
fileName
);
String
prefix
=
"//Algorithm: "
+
this
.
getParameters
().
toString
()
+
"\n"
+
"//Number of clusters: "
+
this
.
getNumberOfClusters
()
+
"\n"
+
"//Score: "
+
this
.
getScore
()
+
"\n"
;
"//Score: "
+
this
.
getScore
()
+
"\n"
+
"//Durration in ms: "
+
this
.
getDurration
()
+
"\n"
;
String
content
=
MiddlewareTagGenImpl
.
getFileContent
(
component
,
this
.
clustering
);
res
.
setFileContent
(
prefix
+
content
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment