Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Middleware
Commits
685288af
Commit
685288af
authored
Feb 01, 2019
by
Alexander David Hellwig
Browse files
Refactoring: Add ClusteringAlgorithm arguments as state
parent
5ff6f51c
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/middleware/cli/algorithms/DBScanCliParameters.java
View file @
685288af
...
...
@@ -24,7 +24,9 @@ public class DBScanCliParameters extends AlgorithmCliParameters {
@Override
public
ClusteringAlgorithm
asClustringAlgorithm
()
{
return
new
DBSCANClusteringAlgorithm
();
DBSCANClusteringAlgorithm
dbscanClusteringAlgorithm
=
new
DBSCANClusteringAlgorithm
();
dbscanClusteringAlgorithm
.
setArgs
(
asAlgorithmArgs
());
return
dbscanClusteringAlgorithm
;
}
@Override
...
...
@@ -55,4 +57,12 @@ public class DBScanCliParameters extends AlgorithmCliParameters {
public
Optional
<
Double
>
getRadius
()
{
return
Optional
.
ofNullable
(
radius
);
}
public
void
setMinPts
(
Integer
min_pts
)
{
this
.
min_pts
=
min_pts
;
}
public
void
setRadius
(
Double
radius
)
{
this
.
radius
=
radius
;
}
}
src/main/java/de/monticore/lang/monticar/generator/middleware/cli/algorithms/MarkovCliParameters.java
View file @
685288af
...
...
@@ -24,7 +24,9 @@ public class MarkovCliParameters extends AlgorithmCliParameters {
@Override
public
ClusteringAlgorithm
asClustringAlgorithm
()
{
return
new
MarkovClusteringAlgorithm
();
MarkovClusteringAlgorithm
markovClusteringAlgorithm
=
new
MarkovClusteringAlgorithm
();
markovClusteringAlgorithm
.
setArgs
(
asAlgorithmArgs
());
return
markovClusteringAlgorithm
;
}
@Override
...
...
@@ -69,4 +71,20 @@ public class MarkovCliParameters extends AlgorithmCliParameters {
public
Optional
<
Double
>
getZeroMax
()
{
return
Optional
.
ofNullable
(
zero_max
);
}
public
void
setMaxResidual
(
Double
max_residual
)
{
this
.
max_residual
=
max_residual
;
}
public
void
setGammaExp
(
Double
gamma_exp
)
{
this
.
gamma_exp
=
gamma_exp
;
}
public
void
setLoopGain
(
Double
loop_gain
)
{
this
.
loop_gain
=
loop_gain
;
}
public
void
setZeroMax
(
Double
zero_max
)
{
this
.
zero_max
=
zero_max
;
}
}
src/main/java/de/monticore/lang/monticar/generator/middleware/cli/algorithms/SpectralClusteringCliParameters.java
View file @
685288af
...
...
@@ -24,7 +24,9 @@ public class SpectralClusteringCliParameters extends AlgorithmCliParameters {
@Override
public
ClusteringAlgorithm
asClustringAlgorithm
()
{
return
new
SpectralClusteringAlgorithm
();
SpectralClusteringAlgorithm
clusteringAlgorithm
=
new
SpectralClusteringAlgorithm
();
clusteringAlgorithm
.
setArgs
(
asAlgorithmArgs
());
return
clusteringAlgorithm
;
}
@Override
...
...
@@ -68,4 +70,16 @@ public class SpectralClusteringCliParameters extends AlgorithmCliParameters {
public
Optional
<
Double
>
getSigma
()
{
return
Optional
.
ofNullable
(
sigma
);
}
public
void
setNumberOfClusters
(
Integer
numberOfClusters
)
{
this
.
numberOfClusters
=
numberOfClusters
;
}
public
void
setL
(
Integer
l
)
{
this
.
l
=
l
;
}
public
void
setSigma
(
Double
sigma
)
{
this
.
sigma
=
sigma
;
}
}
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/ClusteringAlgorithm.java
View file @
685288af
...
...
@@ -7,5 +7,13 @@ import java.util.Set;
// product if for clustering factory
public
interface
ClusteringAlgorithm
{
public
List
<
Set
<
EMAComponentInstanceSymbol
>>
cluster
(
EMAComponentInstanceSymbol
component
,
Object
...
args
);
List
<
Set
<
EMAComponentInstanceSymbol
>>
cluster
(
EMAComponentInstanceSymbol
component
,
Object
...
args
);
//TODO: add arguments as typed state of the algorithms
default
List
<
Set
<
EMAComponentInstanceSymbol
>>
cluster
(
EMAComponentInstanceSymbol
component
){
return
cluster
(
component
,
getArgs
());
}
List
<
Object
>
getArgs
();
}
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/AffinityPropagationAlgorithm.java
View file @
685288af
...
...
@@ -13,6 +13,17 @@ import java.util.*;
public
class
AffinityPropagationAlgorithm
implements
ClusteringAlgorithm
{
private
List
<
Object
>
args
;
public
void
setArgs
(
List
<
Object
>
args
)
{
this
.
args
=
args
;
}
@Override
public
List
<
Object
>
getArgs
()
{
return
args
;
}
@Override
public
List
<
Set
<
EMAComponentInstanceSymbol
>>
cluster
(
EMAComponentInstanceSymbol
component
,
Object
...
args
)
{
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/DBSCANClusteringAlgorithm.java
View file @
685288af
...
...
@@ -11,6 +11,17 @@ import java.util.*;
// DBSCAN clusterer product implementation
public
class
DBSCANClusteringAlgorithm
implements
ClusteringAlgorithm
{
private
List
<
Object
>
args
;
public
void
setArgs
(
List
<
Object
>
args
)
{
this
.
args
=
args
;
}
@Override
public
List
<
Object
>
getArgs
()
{
return
args
;
}
@Override
public
List
<
Set
<
EMAComponentInstanceSymbol
>>
cluster
(
EMAComponentInstanceSymbol
component
,
Object
...
args
)
{
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/MarkovClusteringAlgorithm.java
View file @
685288af
...
...
@@ -15,6 +15,17 @@ import java.util.*;
// markov mcl clusterer product implementation
public
class
MarkovClusteringAlgorithm
implements
ClusteringAlgorithm
{
private
List
<
Object
>
args
;
public
void
setArgs
(
List
<
Object
>
args
)
{
this
.
args
=
args
;
}
@Override
public
List
<
Object
>
getArgs
()
{
return
args
;
}
private
static
Dataset
[]
getClustering
(
Dataset
data
,
SparseMatrix
matrix
)
{
int
[]
sparseMatrixSize
=
matrix
.
getSize
();
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/clustering/algorithms/SpectralClusteringAlgorithm.java
View file @
685288af
...
...
@@ -11,6 +11,17 @@ import java.util.*;
// spectral clusterer product implementation
public
class
SpectralClusteringAlgorithm
implements
ClusteringAlgorithm
{
private
List
<
Object
>
args
;
public
void
setArgs
(
List
<
Object
>
args
)
{
this
.
args
=
args
;
}
@Override
public
List
<
Object
>
getArgs
()
{
return
args
;
}
@Override
public
List
<
Set
<
EMAComponentInstanceSymbol
>>
cluster
(
EMAComponentInstanceSymbol
component
,
Object
...
args
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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