Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
EMAM2Middleware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Middleware
Commits
908db221
Commit
908db221
authored
Jan 21, 2019
by
Alexander David Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes for new EMA Version
parent
f90a4558
Pipeline
#98741
failed with stages
in 5 minutes and 27 seconds
Changes
11
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
211 additions
and
219 deletions
+211
-219
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/AutomaticClusteringHelper.java
...ator/middleware/clustering/AutomaticClusteringHelper.java
+13
-14
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/ClusteringAlgorithm.java
.../generator/middleware/clustering/ClusteringAlgorithm.java
+2
-2
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/FlattenArchitecture.java
.../generator/middleware/clustering/FlattenArchitecture.java
+96
-105
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/AffinityPropagationAlgorithm.java
...e/clustering/algorithms/AffinityPropagationAlgorithm.java
+4
-4
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/DBSCANClusteringAlgorithm.java
...ware/clustering/algorithms/DBSCANClusteringAlgorithm.java
+4
-4
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/MarkovClusteringAlgorithm.java
...ware/clustering/algorithms/MarkovClusteringAlgorithm.java
+4
-4
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/SpectralClusteringAlgorithm.java
...re/clustering/algorithms/SpectralClusteringAlgorithm.java
+4
-4
src/main/java/de/monticore/lang/monticar/generator/middleware/helpers/ComponentHelper.java
...onticar/generator/middleware/helpers/ComponentHelper.java
+10
-9
src/main/java/de/monticore/lang/monticar/generator/middleware/impls/MiddlewareTagGenImpl.java
...icar/generator/middleware/impls/MiddlewareTagGenImpl.java
+11
-11
src/test/java/de/monticore/lang/monticar/generator/middleware/AutomaticClusteringTest.java
...onticar/generator/middleware/AutomaticClusteringTest.java
+58
-58
src/test/java/de/monticore/lang/monticar/generator/middleware/GenerationTest.java
...re/lang/monticar/generator/middleware/GenerationTest.java
+5
-4
No files found.
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/AutomaticClusteringHelper.java
View file @
908db221
...
...
@@ -2,6 +2,9 @@ package de.monticore.lang.monticar.generator.middleware.clustering;
import
de.monticore.expressionsbasis._ast.ASTExpression
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.*
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAConnectorInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol
;
import
de.monticore.lang.math._ast.ASTNumberExpression
;
import
de.monticore.lang.monticar.common2._ast.ASTCommonMatrixType
;
...
...
@@ -21,25 +24,21 @@ public class AutomaticClusteringHelper {
static
double
MAXCOST
=
999999
;
public
static
double
[][]
createAdjacencyMatrix
(
List
<
E
xpandedComponentInstanceSymbol
>
subcomps
,
Collection
<
Connector
Symbol
>
connectors
,
Map
<
String
,
Integer
>
subcompLabels
)
{
public
static
double
[][]
createAdjacencyMatrix
(
List
<
E
MAComponentInstanceSymbol
>
subcomps
,
Collection
<
EMAConnectorInstance
Symbol
>
connectors
,
Map
<
String
,
Integer
>
subcompLabels
)
{
// Nodes = subcomponents
// Verts = connectors between subcomponents
double
[][]
res
=
new
double
[
subcomps
.
size
()][
subcomps
.
size
()];
connectors
.
forEach
(
con
->
{
Optional
<
ExpandedComponentInstanceSymbol
>
sourceCompOpt
=
con
.
getSourcePort
().
getComponentInstance
();
Optional
<
ExpandedComponentInstanceSymbol
>
targetCompOpt
=
con
.
getTargetPort
().
getComponentInstance
();
EMAComponentInstanceSymbol
sourceCompOpt
=
con
.
getSourcePort
().
getComponentInstance
();
EMAComponentInstanceSymbol
targetCompOpt
=
con
.
getTargetPort
().
getComponentInstance
();
if
(
sourceCompOpt
.
isPresent
()
&&
targetCompOpt
.
isPresent
())
{
int
index1
=
subcompLabels
.
get
(
sourceCompOpt
.
get
().
getFullName
());
int
index2
=
subcompLabels
.
get
(
targetCompOpt
.
get
().
getFullName
());
int
index1
=
subcompLabels
.
get
(
sourceCompOpt
.
getFullName
());
int
index2
=
subcompLabels
.
get
(
targetCompOpt
.
getFullName
());
res
[
index1
][
index2
]
=
getTypeCostHeuristic
(
con
.
getSourcePort
());
res
[
index2
][
index1
]
=
getTypeCostHeuristic
(
con
.
getSourcePort
());
}
else
{
Log
.
error
(
"0xADE65: Component of source or target not found!"
);
}
});
...
...
@@ -105,16 +104,16 @@ public class AutomaticClusteringHelper {
return
normalizeMatrix
(
inverseProbabilitiesMatrix
(
adjacencyMatrix
));
}
public
static
void
annotateComponentWithRosTagsForClusters
(
E
xpandedComponentInstanceSymbol
componentInstanceSymbol
,
List
<
Set
<
Expanded
ComponentInstanceSymbol
>>
clusters
)
{
Collection
<
ConnectorSymbol
>
connectors
=
componentInstanceSymbol
.
getConnector
s
();
public
static
void
annotateComponentWithRosTagsForClusters
(
E
MAComponentInstanceSymbol
componentInstanceSymbol
,
List
<
Set
<
EMA
ComponentInstanceSymbol
>>
clusters
)
{
Collection
<
EMAConnectorInstanceSymbol
>
connectors
=
componentInstanceSymbol
.
getConnectorInstance
s
();
connectors
.
forEach
(
con
->
{
// -1 = super comp
int
sourceClusterLabel
=
-
1
;
int
targetClusterLabel
=
-
1
;
E
xpandedComponentInstanceSymbol
sourceComp
=
con
.
getSourcePort
().
getComponentInstance
().
get
();
E
xpandedComponentInstanceSymbol
targetComp
=
con
.
getTargetPort
().
getComponentInstance
().
get
();
E
MAComponentInstanceSymbol
sourceComp
=
con
.
getSourcePort
().
getComponentInstance
();
E
MAComponentInstanceSymbol
targetComp
=
con
.
getTargetPort
().
getComponentInstance
();
for
(
int
i
=
0
;
i
<
clusters
.
size
();
i
++){
if
(
clusters
.
get
(
i
).
contains
(
sourceComp
)){
...
...
@@ -135,7 +134,7 @@ public class AutomaticClusteringHelper {
}
public
static
double
getTypeCostHeuristic
(
PortSymbol
port
){
public
static
double
getTypeCostHeuristic
(
EMA
PortSymbol
port
){
return
getTypeCostHeuristic
(
port
.
getTypeReference
());
}
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/ClusteringAlgorithm.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware.clustering
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Expanded
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMA
ComponentInstanceSymbol
;
import
java.util.List
;
import
java.util.Set
;
// product if for clustering factory
public
interface
ClusteringAlgorithm
{
public
List
<
Set
<
E
xpandedComponentInstanceSymbol
>>
cluster
(
Expanded
ComponentInstanceSymbol
component
,
Object
...
args
);
public
List
<
Set
<
E
MAComponentInstanceSymbol
>>
cluster
(
EMA
ComponentInstanceSymbol
component
,
Object
...
args
);
}
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/FlattenArchitecture.java
View file @
908db221
This diff is collapsed.
Click to expand it.
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/AffinityPropagationAlgorithm.java
View file @
908db221
...
...
@@ -2,7 +2,7 @@ package de.monticore.lang.monticar.generator.middleware.clustering.algorithms;
import
com.clust4j.algo.AffinityPropagation
;
import
com.clust4j.algo.AffinityPropagationParameters
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Expanded
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMA
ComponentInstanceSymbol
;
import
de.monticore.lang.monticar.generator.middleware.clustering.AutomaticClusteringHelper
;
import
de.monticore.lang.monticar.generator.middleware.clustering.ClusteringAlgorithm
;
import
de.monticore.lang.monticar.generator.middleware.helpers.ComponentHelper
;
...
...
@@ -14,9 +14,9 @@ import java.util.*;
public
class
AffinityPropagationAlgorithm
implements
ClusteringAlgorithm
{
@Override
public
List
<
Set
<
E
xpandedComponentInstanceSymbol
>>
cluster
(
Expanded
ComponentInstanceSymbol
component
,
Object
...
args
)
{
public
List
<
Set
<
E
MAComponentInstanceSymbol
>>
cluster
(
EMA
ComponentInstanceSymbol
component
,
Object
...
args
)
{
List
<
E
xpanded
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
List
<
E
MA
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
Map
<
String
,
Integer
>
labelsForSubcomps
=
ComponentHelper
.
getLabelsForSubcomps
(
subcompsOrderedByName
);
double
[][]
adjMatrix
=
AutomaticClusteringHelper
.
createAdjacencyMatrix
(
subcompsOrderedByName
,
ComponentHelper
.
getInnerConnectors
(
component
),
...
...
@@ -28,7 +28,7 @@ public class AffinityPropagationAlgorithm implements ClusteringAlgorithm {
final
int
[]
labels
=
clustering
.
getLabels
();
List
<
Set
<
E
xpanded
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
List
<
Set
<
E
MA
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
labels
.
length
;
i
++){
res
.
add
(
new
HashSet
<>());
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/DBSCANClusteringAlgorithm.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware.clustering.algorithms
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Expanded
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMA
ComponentInstanceSymbol
;
import
de.monticore.lang.monticar.generator.middleware.clustering.AutomaticClusteringHelper
;
import
de.monticore.lang.monticar.generator.middleware.clustering.ClusteringAlgorithm
;
import
de.monticore.lang.monticar.generator.middleware.helpers.ComponentHelper
;
...
...
@@ -12,9 +12,9 @@ import java.util.*;
// DBSCAN clusterer product implementation
public
class
DBSCANClusteringAlgorithm
implements
ClusteringAlgorithm
{
@Override
public
List
<
Set
<
E
xpandedComponentInstanceSymbol
>>
cluster
(
Expanded
ComponentInstanceSymbol
component
,
Object
...
args
)
{
public
List
<
Set
<
E
MAComponentInstanceSymbol
>>
cluster
(
EMA
ComponentInstanceSymbol
component
,
Object
...
args
)
{
List
<
Set
<
E
xpanded
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
List
<
Set
<
E
MA
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
// params
Integer
minPts
=
null
;
...
...
@@ -69,7 +69,7 @@ public class DBSCANClusteringAlgorithm implements ClusteringAlgorithm {
if
(
error
)
{
Log
.
error
(
"DBSCANClusteringAlgorithm: Mandatory parameter(s) missing!"
);
}
else
{
List
<
E
xpanded
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
List
<
E
MA
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
Map
<
String
,
Integer
>
labelsForSubcomps
=
ComponentHelper
.
getLabelsForSubcomps
(
subcompsOrderedByName
);
double
[][]
adjMatrix
=
AutomaticClusteringHelper
.
createAdjacencyMatrix
(
subcompsOrderedByName
,
ComponentHelper
.
getInnerConnectors
(
component
),
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/MarkovClusteringAlgorithm.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware.clustering.algorithms
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Expanded
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMA
ComponentInstanceSymbol
;
import
de.monticore.lang.monticar.generator.middleware.clustering.AutomaticClusteringHelper
;
import
de.monticore.lang.monticar.generator.middleware.clustering.ClusteringAlgorithm
;
import
de.monticore.lang.monticar.generator.middleware.helpers.ComponentHelper
;
...
...
@@ -67,9 +67,9 @@ public class MarkovClusteringAlgorithm implements ClusteringAlgorithm {
}
@Override
public
List
<
Set
<
E
xpandedComponentInstanceSymbol
>>
cluster
(
Expanded
ComponentInstanceSymbol
component
,
Object
...
args
)
{
public
List
<
Set
<
E
MAComponentInstanceSymbol
>>
cluster
(
EMA
ComponentInstanceSymbol
component
,
Object
...
args
)
{
List
<
Set
<
E
xpanded
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
List
<
Set
<
E
MA
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
// params
Double
maxResidual
=
null
;
...
...
@@ -136,7 +136,7 @@ public class MarkovClusteringAlgorithm implements ClusteringAlgorithm {
if
(
error
)
{
Log
.
error
(
"MarkovClusteringAlgorithm: Mandatory parameter(s) missing!"
);
}
else
{
List
<
E
xpanded
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
List
<
E
MA
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
Map
<
String
,
Integer
>
labelsForSubcomps
=
ComponentHelper
.
getLabelsForSubcomps
(
subcompsOrderedByName
);
double
[][]
adjMatrix
=
AutomaticClusteringHelper
.
createAdjacencyMatrix
(
subcompsOrderedByName
,
ComponentHelper
.
getInnerConnectors
(
component
),
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/SpectralClusteringAlgorithm.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware.clustering.algorithms
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Expanded
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMA
ComponentInstanceSymbol
;
import
de.monticore.lang.monticar.generator.middleware.clustering.AutomaticClusteringHelper
;
import
de.monticore.lang.monticar.generator.middleware.clustering.ClusteringAlgorithm
;
import
de.monticore.lang.monticar.generator.middleware.helpers.ComponentHelper
;
...
...
@@ -12,9 +12,9 @@ import java.util.*;
// spectral clusterer product implementation
public
class
SpectralClusteringAlgorithm
implements
ClusteringAlgorithm
{
@Override
public
List
<
Set
<
E
xpandedComponentInstanceSymbol
>>
cluster
(
Expanded
ComponentInstanceSymbol
component
,
Object
...
args
)
{
public
List
<
Set
<
E
MAComponentInstanceSymbol
>>
cluster
(
EMA
ComponentInstanceSymbol
component
,
Object
...
args
)
{
List
<
Set
<
E
xpanded
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
List
<
Set
<
E
MA
ComponentInstanceSymbol
>>
res
=
new
ArrayList
<>();
// params
Integer
numClusters
=
null
;
...
...
@@ -75,7 +75,7 @@ public class SpectralClusteringAlgorithm implements ClusteringAlgorithm {
if
(
error
)
{
Log
.
error
(
"SpectralClusteringAlgorithm: Mandatory parameter(s) missing!"
);
}
else
{
List
<
E
xpanded
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
List
<
E
MA
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
component
);
Map
<
String
,
Integer
>
labelsForSubcomps
=
ComponentHelper
.
getLabelsForSubcomps
(
subcompsOrderedByName
);
double
[][]
adjMatrix
=
AutomaticClusteringHelper
.
createAdjacencyMatrix
(
subcompsOrderedByName
,
ComponentHelper
.
getInnerConnectors
(
component
),
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/helpers/ComponentHelper.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware.helpers
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ConnectorSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAConnectorInstanceSymbol
;
import
java.util.*
;
import
java.util.stream.Collectors
;
public
class
ComponentHelper
{
public
static
List
<
E
xpandedComponentInstanceSymbol
>
getSubcompsOrderedByName
(
Expanded
ComponentInstanceSymbol
componentInstanceSymbol
){
public
static
List
<
E
MAComponentInstanceSymbol
>
getSubcompsOrderedByName
(
EMA
ComponentInstanceSymbol
componentInstanceSymbol
){
return
componentInstanceSymbol
.
getSubComponents
().
stream
()
.
sorted
(
Comparator
.
comparing
(
E
xpanded
ComponentInstanceSymbol:
:
getFullName
))
.
sorted
(
Comparator
.
comparing
(
E
MA
ComponentInstanceSymbol:
:
getFullName
))
.
collect
(
Collectors
.
toList
());
}
public
static
Collection
<
ConnectorSymbol
>
getInnerConnectors
(
Expanded
ComponentInstanceSymbol
componentInstanceSymbol
){
public
static
Collection
<
EMAConnectorInstanceSymbol
>
getInnerConnectors
(
EMA
ComponentInstanceSymbol
componentInstanceSymbol
){
String
superCompName
=
componentInstanceSymbol
.
getFullName
();
return
componentInstanceSymbol
.
getConnectors
().
stream
()
return
componentInstanceSymbol
.
getConnector
Instance
s
().
stream
()
//filter out all connectors to super component
.
filter
(
con
->
!
con
.
getSourcePort
().
getComponentInstance
().
get
().
get
FullName
().
equals
(
superCompName
)
&&
!
con
.
getTargetPort
().
getComponentInstance
().
get
().
get
FullName
().
equals
(
superCompName
))
.
filter
(
con
->
!
con
.
getSourcePort
().
getComponentInstance
().
getFullName
().
equals
(
superCompName
)
&&
!
con
.
getTargetPort
().
getComponentInstance
().
getFullName
().
equals
(
superCompName
))
.
collect
(
Collectors
.
toList
());
}
public
static
Map
<
String
,
Integer
>
getLabelsForSubcomps
(
List
<
E
xpanded
ComponentInstanceSymbol
>
subcomps
)
{
public
static
Map
<
String
,
Integer
>
getLabelsForSubcomps
(
List
<
E
MA
ComponentInstanceSymbol
>
subcomps
)
{
Map
<
String
,
Integer
>
componentIndecies
=
new
HashMap
<>();
int
[]
i
=
{
0
};
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/impls/MiddlewareTagGenImpl.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware.impls
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Expanded
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Port
Symbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMA
ComponentInstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMAPortInstance
Symbol
;
import
de.monticore.lang.embeddedmontiarc.tagging.middleware.MiddlewareSymbol
;
import
de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol
;
import
de.monticore.lang.monticar.generator.FileContent
;
...
...
@@ -21,21 +21,21 @@ public class MiddlewareTagGenImpl implements GeneratorImpl {
private
String
generationTargetPath
;
@Override
public
List
<
File
>
generate
(
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
,
TaggingResolver
taggingResolver
)
throws
IOException
{
public
List
<
File
>
generate
(
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
,
TaggingResolver
taggingResolver
)
throws
IOException
{
List
<
File
>
res
=
new
ArrayList
<>();
//Collect Ports with Middleware Symbols from Super Component and first level subcomponents
List
<
PortSymbol
>
middlewarePortsSuper
=
componentInstanceSymbol
.
getPorts
List
().
stream
()
List
<
EMAPortInstanceSymbol
>
middlewarePortsSuper
=
componentInstanceSymbol
.
getPortInstance
List
().
stream
()
.
filter
(
portSymbol
->
portSymbol
.
getMiddlewareSymbol
().
isPresent
())
.
collect
(
Collectors
.
toList
());
List
<
Port
Symbol
>
middlewarePortsSub
=
componentInstanceSymbol
.
getSubComponents
()
List
<
EMAPortInstance
Symbol
>
middlewarePortsSub
=
componentInstanceSymbol
.
getSubComponents
()
.
stream
()
.
flatMap
(
ecis
->
ecis
.
getPort
s
List
().
stream
())
.
flatMap
(
ecis
->
ecis
.
getPort
Instance
List
().
stream
())
.
filter
(
portSymbol
->
portSymbol
.
getMiddlewareSymbol
().
isPresent
())
.
collect
(
Collectors
.
toList
());
List
<
Port
Symbol
>
middlewarePorts
=
new
ArrayList
<>();
List
<
EMAPortInstance
Symbol
>
middlewarePorts
=
new
ArrayList
<>();
middlewarePorts
.
addAll
(
middlewarePortsSub
);
middlewarePorts
.
addAll
(
middlewarePortsSuper
);
...
...
@@ -44,9 +44,9 @@ public class MiddlewareTagGenImpl implements GeneratorImpl {
return
res
;
}
private
File
generateRosTags
(
String
packageName
,
List
<
Port
Symbol
>
middlewarePorts
)
throws
IOException
{
List
<
Port
Symbol
>
rosPorts
=
middlewarePorts
.
stream
()
.
filter
(
Port
Symbol:
:
isRosPort
)
private
File
generateRosTags
(
String
packageName
,
List
<
EMAPortInstance
Symbol
>
middlewarePorts
)
throws
IOException
{
List
<
EMAPortInstance
Symbol
>
rosPorts
=
middlewarePorts
.
stream
()
.
filter
(
EMAPortInstance
Symbol:
:
isRosPort
)
.
collect
(
Collectors
.
toList
());
FileContent
result
=
new
FileContent
();
...
...
@@ -88,7 +88,7 @@ public class MiddlewareTagGenImpl implements GeneratorImpl {
}
@Override
public
boolean
willAccept
(
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
)
{
public
boolean
willAccept
(
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
)
{
//TODO: fill?
return
true
;
}
...
...
src/test/java/de/monticore/lang/monticar/generator/middleware/AutomaticClusteringTest.java
View file @
908db221
package
de.monticore.lang.monticar.generator.middleware
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Connector
Symbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
ExpandedComponent
InstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
Port
Symbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMAComponentInstance
Symbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMAConnector
InstanceSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.
instanceStructure.EMAPortInstance
Symbol
;
import
de.monticore.lang.monticar.generator.middleware.clustering.*
;
import
de.monticore.lang.monticar.generator.middleware.clustering.algorithms.*
;
import
com.clust4j.algo.AffinityPropagation
;
...
...
@@ -41,10 +41,10 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
public
void
testAdjacencyMatrixCreation
(){
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpandedComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
ExpandedComponentInstanceSymbol
>
resolve
(
"lab.system"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MAComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
EMAComponentInstanceSymbol
>
resolve
(
"lab.system"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
List
<
E
xpanded
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
componentInstanceSymbol
);
List
<
E
MA
ComponentInstanceSymbol
>
subcompsOrderedByName
=
ComponentHelper
.
getSubcompsOrderedByName
(
componentInstanceSymbol
);
double
[][]
matrix
=
AutomaticClusteringHelper
.
createAdjacencyMatrix
(
subcompsOrderedByName
,
ComponentHelper
.
getInnerConnectors
(
componentInstanceSymbol
),
ComponentHelper
.
getLabelsForSubcomps
(
subcompsOrderedByName
));
...
...
@@ -102,15 +102,15 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
public
void
testFlattenAlgorithm1
(){
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
xpandedComponentInstanceSymbol
>
resolve
(
"lab.overallSystem"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
MAComponentInstanceSymbol
>
resolve
(
"lab.overallSystem"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
E
xpanded
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
E
MA
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
.
flattenArchitecture
(
componentInstanceSymbol
);
assertNotNull
(
newComponentInstanceSymbol
);
Collection
<
E
xpanded
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
ConnectorSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnector
s
();
Collection
<
E
MA
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
EMAConnectorInstanceSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnectorInstance
s
();
assertEquals
(
10
,
subComponents
.
size
());
assertEquals
(
20
,
connectors
.
size
());
}
...
...
@@ -119,15 +119,15 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
public
void
testFlattenAlgorithm1ShortNames
(){
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
xpandedComponentInstanceSymbol
>
resolve
(
"lab.overallSystem"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
MAComponentInstanceSymbol
>
resolve
(
"lab.overallSystem"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
E
xpanded
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
E
MA
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
.
flattenArchitecture
(
componentInstanceSymbol
,
new
HashMap
<>());
assertNotNull
(
newComponentInstanceSymbol
);
Collection
<
E
xpanded
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
ConnectorSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnector
s
();
Collection
<
E
MA
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
EMAConnectorInstanceSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnectorInstance
s
();
assertEquals
(
10
,
subComponents
.
size
());
assertEquals
(
20
,
connectors
.
size
());
}
...
...
@@ -136,15 +136,15 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
public
void
testFlattenAlgorithm2
(){
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
xpandedComponentInstanceSymbol
>
resolve
(
"lab.spanningSystem"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
MAComponentInstanceSymbol
>
resolve
(
"lab.spanningSystem"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
E
xpanded
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
E
MA
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
.
flattenArchitecture
(
componentInstanceSymbol
);
assertNotNull
(
newComponentInstanceSymbol
);
Collection
<
E
xpanded
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
ConnectorSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnector
s
();
Collection
<
E
MA
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
EMAConnectorInstanceSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnectorInstance
s
();
assertEquals
(
20
,
subComponents
.
size
());
assertEquals
(
40
,
connectors
.
size
());
}
...
...
@@ -153,15 +153,15 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
public
void
testFlattenAlgorithm2ShortNames
()
{
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
xpandedComponentInstanceSymbol
>
resolve
(
"lab.spanningSystem"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
MAComponentInstanceSymbol
>
resolve
(
"lab.spanningSystem"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
E
xpanded
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
E
MA
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
.
flattenArchitecture
(
componentInstanceSymbol
,
new
HashMap
<>());
assertNotNull
(
newComponentInstanceSymbol
);
Collection
<
E
xpanded
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
ConnectorSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnector
s
();
Collection
<
E
MA
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
EMAConnectorInstanceSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnectorInstance
s
();
assertEquals
(
20
,
subComponents
.
size
());
assertEquals
(
40
,
connectors
.
size
());
}
...
...
@@ -170,15 +170,15 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
public
void
testFlattenAlgorithmWithLevels
()
{
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpanded
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
xpandedComponentInstanceSymbol
>
resolve
(
"lab.spanningSystem"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MA
ComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
E
MAComponentInstanceSymbol
>
resolve
(
"lab.spanningSystem"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
E
xpanded
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
E
MA
ComponentInstanceSymbol
newComponentInstanceSymbol
=
FlattenArchitecture
.
flattenArchitecture
(
componentInstanceSymbol
,
new
HashMap
<>(),
2
);
assertNotNull
(
newComponentInstanceSymbol
);
Collection
<
E
xpanded
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
ConnectorSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnector
s
();
Collection
<
E
MA
ComponentInstanceSymbol
>
subComponents
=
newComponentInstanceSymbol
.
getSubComponents
();
Collection
<
EMAConnectorInstanceSymbol
>
connectors
=
newComponentInstanceSymbol
.
getConnectorInstance
s
();
assertEquals
(
4
,
subComponents
.
size
());
assertEquals
(
24
,
connectors
.
size
());
}
...
...
@@ -509,12 +509,12 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
//UnambiguousCluster
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
E
xpandedComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
ExpandedComponentInstanceSymbol
>
resolve
(
"clustering.unambiguousCluster"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MAComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
EMAComponentInstanceSymbol
>
resolve
(
"clustering.unambiguousCluster"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
System
.
out
.
println
(
algorithm
);
List
<
Set
<
E
xpanded
ComponentInstanceSymbol
>>
clusters
=
null
;
List
<
Set
<
E
MA
ComponentInstanceSymbol
>>
clusters
=
null
;
if
(
params
!=
null
)
clusters
=
algorithm
.
cluster
(
componentInstanceSymbol
,
params
);
else
clusters
=
algorithm
.
cluster
(
componentInstanceSymbol
);
...
...
@@ -523,8 +523,8 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
assertTrue
(
clusters
.
size
()
==
2
);
Set
<
E
xpanded
ComponentInstanceSymbol
>
cluster1
=
clusters
.
get
(
0
);
Set
<
E
xpanded
ComponentInstanceSymbol
>
cluster2
=
clusters
.
get
(
1
);
Set
<
E
MA
ComponentInstanceSymbol
>
cluster1
=
clusters
.
get
(
0
);
Set
<
E
MA
ComponentInstanceSymbol
>
cluster2
=
clusters
.
get
(
1
);
assertTrue
(
cluster1
.
size
()
==
2
);
assertTrue
(
cluster2
.
size
()
==
2
);
...
...
@@ -555,10 +555,10 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
assertTrue
(
clusters
.
size
()
==
4
);
Set
<
E
xpanded
ComponentInstanceSymbol
>
cluster1
=
clusters
.
get
(
0
);
Set
<
E
xpanded
ComponentInstanceSymbol
>
cluster2
=
clusters
.
get
(
1
);
Set
<
E
xpanded
ComponentInstanceSymbol
>
cluster3
=
clusters
.
get
(
2
);
Set
<
E
xpanded
ComponentInstanceSymbol
>
cluster4
=
clusters
.
get
(
3
);
Set
<
E
MA
ComponentInstanceSymbol
>
cluster1
=
clusters
.
get
(
0
);
Set
<
E
MA
ComponentInstanceSymbol
>
cluster2
=
clusters
.
get
(
1
);
Set
<
E
MA
ComponentInstanceSymbol
>
cluster3
=
clusters
.
get
(
2
);
Set
<
E
MA
ComponentInstanceSymbol
>
cluster4
=
clusters
.
get
(
3
);
assertTrue
(
cluster1
.
size
()
==
1
);
assertTrue
(
cluster2
.
size
()
==
1
);
assertTrue
(
cluster3
.
size
()
==
1
);
...
...
@@ -584,18 +584,18 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
//ClustersWithSingleConnection
E
xpandedComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
ExpandedComponentInstanceSymbol
>
resolve
(
"clustering.clustersWithSingleConnection"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MAComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
EMAComponentInstanceSymbol
>
resolve
(
"clustering.clustersWithSingleConnection"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
//Force cluster; spectral would not cluster this way!
List
<
Set
<
E
xpanded
ComponentInstanceSymbol
>>
clusters
=
new
ArrayList
<>();
List
<
Set
<
E
MA
ComponentInstanceSymbol
>>
clusters
=
new
ArrayList
<>();
HashSet
<
E
xpanded
ComponentInstanceSymbol
>
cluster1
=
new
HashSet
<>();
HashSet
<
E
MA
ComponentInstanceSymbol
>
cluster1
=
new
HashSet
<>();
cluster1
.
add
(
componentInstanceSymbol
.
getSubComponent
(
"outComp1"
).
get
());
cluster1
.
add
(
componentInstanceSymbol
.
getSubComponent
(
"inOutComp"
).
get
());
clusters
.
add
(
cluster1
);
HashSet
<
E
xpanded
ComponentInstanceSymbol
>
cluster2
=
new
HashSet
<>();
HashSet
<
E
MA
ComponentInstanceSymbol
>
cluster2
=
new
HashSet
<>();
cluster2
.
add
(
componentInstanceSymbol
.
getSubComponent
(
"outComp2"
).
get
());
cluster2
.
add
(
componentInstanceSymbol
.
getSubComponent
(
"doubleInComp"
).
get
());
clusters
.
add
(
cluster2
);
...
...
@@ -603,15 +603,15 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
AutomaticClusteringHelper
.
annotateComponentWithRosTagsForClusters
(
componentInstanceSymbol
,
clusters
);
List
<
String
>
rosPortsSuper
=
componentInstanceSymbol
.
getPort
s
List
().
stream
()
.
filter
(
Port
Symbol:
:
isRosPort
)
.
map
(
Port
Symbol:
:
getFullName
)
List
<
String
>
rosPortsSuper
=
componentInstanceSymbol
.
getPort
Instance
List
().
stream
()
.
filter
(
EMAPortInstance
Symbol:
:
isRosPort
)
.
map
(
EMAPortInstance
Symbol:
:
getFullName
)
.
collect
(
Collectors
.
toList
());
List
<
String
>
rosPortsSubComps
=
componentInstanceSymbol
.
getSubComponents
().
stream
()
.
flatMap
(
subc
->
subc
.
getPort
s
List
().
stream
())
.
filter
(
Port
Symbol:
:
isRosPort
)
.
map
(
Port
Symbol:
:
getFullName
)
.
flatMap
(
subc
->
subc
.
getPort
Instance
List
().
stream
())
.
filter
(
EMAPortInstance
Symbol:
:
isRosPort
)
.
map
(
EMAPortInstance
Symbol:
:
getFullName
)
.
collect
(
Collectors
.
toList
());
//No Ports in super comp
...
...
@@ -636,28 +636,28 @@ public class AutomaticClusteringTest extends AbstractSymtabTest{
TaggingResolver
taggingResolver
=
AbstractSymtabTest
.
createSymTabAndTaggingResolver
(
TEST_PATH
);
//CostHeuristic
E
xpandedComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
ExpandedComponentInstanceSymbol
>
resolve
(
"test.costHeuristic"
,
Expanded
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
E
MAComponentInstanceSymbol
componentInstanceSymbol
=
taggingResolver
.<
EMAComponentInstanceSymbol
>
resolve
(
"test.costHeuristic"
,
EMA
ComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentInstanceSymbol
);
double
inC
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inC"
).
get
());
double
inQ
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inQ"
).
get
());
double
inZ
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inZ"
).
get
());
double
inB
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inB"
).
get
());
double
inC
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inC"
).
get
());
double
inQ
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inQ"
).
get
());
double
inZ
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inZ"
).
get
());
double
inB
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inB"
).
get
());
assertTrue
(
inC
>
inQ
);
assertTrue
(
inQ
>
inZ
);
assertTrue
(
inZ
>
inB
);
double
inQVec
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inQVec"
).
get
());
double
inQVec2
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inQVec2"
).
get
());
double
inQVec
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inQVec"
).
get
());
double
inQVec2
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inQVec2"
).
get
());
double
inQMat
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inQMat"
).
get
());
double
inQMat2
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inQMat2"
).
get
());
double
inQMat
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inQMat"
).
get
());
double
inQMat2
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inQMat2"
).
get
());
assertTrue
(
inQVec2
>
inQVec
);
assertTrue
(
inQMat2
>
inQMat
);
double
inPos
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
(
"inPos"
).
get
());
double
inPos
=
AutomaticClusteringHelper
.
getTypeCostHeuristic
(
componentInstanceSymbol
.
getPort
Instance
(
"inPos"
).
get
());
}