Skip to content

Commit ae6d880

Browse files
refactor: change base package
1 parent 391f40d commit ae6d880

26 files changed

Lines changed: 151 additions & 117 deletions

src/main/java/de/hub/mse/variantsync/ecco/ECCO_LIGHT.java renamed to src/main/java/de/hub/mse/variantsync/boosting/ECCO_LIGHT.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
package de.hub.mse.variantsync.ecco;
2-
3-
import de.hub.mse.variantsync.ecco.data.*;
4-
import de.hub.mse.variantsync.ecco.data.Module;
5-
import de.hub.mse.variantsync.ecco.data.ProductPassport;
6-
import de.hub.mse.variantsync.ecco.data.specialization.CAST;
7-
import de.hub.mse.variantsync.ecco.data.specialization.ESupportedLanguages;
8-
import de.hub.mse.variantsync.ecco.data.specialization.JavaAST;
9-
import de.hub.mse.variantsync.ecco.data.specialization.LineAST;
10-
import de.hub.mse.variantsync.ecco.threading.ProductInitializationTask;
11-
import de.hub.mse.variantsync.ecco.threading.ProductLoadTask;
12-
import de.hub.mse.variantsync.ecco.threading.ProductSaveTask;
1+
package de.hub.mse.variantsync.boosting;
2+
3+
import de.hub.mse.variantsync.boosting.data.*;
4+
import de.hub.mse.variantsync.boosting.data.Module;
5+
import de.hub.mse.variantsync.boosting.data.ProductPassport;
6+
import de.hub.mse.variantsync.boosting.data.specialization.CAST;
7+
import de.hub.mse.variantsync.boosting.data.specialization.ESupportedLanguages;
8+
import de.hub.mse.variantsync.boosting.data.specialization.JavaAST;
9+
import de.hub.mse.variantsync.boosting.data.specialization.LineAST;
10+
import de.hub.mse.variantsync.boosting.threading.ProductInitializationTask;
11+
import de.hub.mse.variantsync.boosting.threading.ProductLoadTask;
12+
import de.hub.mse.variantsync.boosting.threading.ProductSaveTask;
1313
import org.tinylog.Logger;
14-
import de.hub.mse.variantsync.ecco.util.ProductLoader;
14+
import de.hub.mse.variantsync.boosting.util.ProductLoader;
1515
import org.logicng.formulas.FType;
1616
import org.logicng.formulas.Formula;
1717
import org.logicng.formulas.FormulaFactory;

src/main/java/de/hub/mse/variantsync/ecco/data/AbstractAST.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/AbstractAST.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

3-
import de.hub.mse.variantsync.ecco.data.position.FilePosition;
4-
import de.hub.mse.variantsync.ecco.data.position.RootPosition;
3+
import de.hub.mse.variantsync.boosting.data.position.FilePosition;
4+
import de.hub.mse.variantsync.boosting.data.position.RootPosition;
55

66
import java.io.File;
77
import java.io.Serializable;
@@ -39,7 +39,8 @@ public AbstractAST(final EccoNode root, final EccoSet<EccoNode> astNodes,
3939
this.astNodes = astNodes;
4040
}
4141

42-
// collects all nodes (except the root node) of the AST in one set to simplify their access
42+
// collects all nodes (except the root node) of the AST in one set to simplify
43+
// their access
4344
public EccoSet<EccoNode> collectAstNodes() {
4445
final EccoSet<EccoNode> result = new EccoSet<>();
4546
final ArrayList<EccoNode> nodesToVisit = new ArrayList<>();

src/main/java/de/hub/mse/variantsync/ecco/data/Association.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/Association.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

33
import org.logicng.formulas.Formula;
44

@@ -11,10 +11,11 @@ public class Association {
1111
private EccoSet<Module> max;
1212
private EccoSet<Module> not;
1313
private Formula mapping;
14-
//isBasic tells whether the code of the association appears in all products
14+
// isBasic tells whether the code of the association appears in all products
1515
private boolean isBasic;
1616

17-
public Association(final EccoSet<Module> min, final EccoSet<Module> all, final EccoSet<Module> max, final EccoSet<Module> not, final EccoSet<EccoNode> astNodes) {
17+
public Association(final EccoSet<Module> min, final EccoSet<Module> all, final EccoSet<Module> max,
18+
final EccoSet<Module> not, final EccoSet<EccoNode> astNodes) {
1819
this.min = new EccoSet<>(min);
1920
this.all = new EccoSet<>(all);
2021
this.max = new EccoSet<>(max);
@@ -26,8 +27,10 @@ public Association(final EccoSet<Module> min, final EccoSet<Module> all, final E
2627

2728
@Override
2829
public boolean equals(final Object o) {
29-
if (this == o) return true;
30-
if (o == null || getClass() != o.getClass()) return false;
30+
if (this == o)
31+
return true;
32+
if (o == null || getClass() != o.getClass())
33+
return false;
3134
final Association that = (Association) o;
3235
return Objects.equals(min, that.min) &&
3336
Objects.equals(all, that.all) &&
@@ -90,7 +93,7 @@ private List<Module> getSmallestModules(final EccoSet<Module> modules) {
9093
result.clear();
9194
result.add(module);
9295
size = module.size();
93-
} else if(module.size() == size) {
96+
} else if (module.size() == size) {
9497
result.add(module);
9598
size = module.size();
9699
}

src/main/java/de/hub/mse/variantsync/ecco/data/EccoNode.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/EccoNode.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

3-
import de.hub.mse.variantsync.ecco.ECCO_LIGHT;
4-
import de.hub.mse.variantsync.ecco.data.position.Position;
3+
import de.hub.mse.variantsync.boosting.ECCO_LIGHT;
4+
import de.hub.mse.variantsync.boosting.data.position.Position;
55
import org.logicng.formulas.FType;
66
import org.logicng.formulas.Formula;
77
import org.logicng.io.parsers.ParserException;
@@ -29,7 +29,8 @@ public enum NODE_TYPE {
2929
private EccoNode productEquivalent;
3030
private int sequenceNumber = 0;
3131

32-
public EccoNode(final EccoNode parent, final String code, final Position position, final NODE_TYPE type, final Formula mapping) {
32+
public EccoNode(final EccoNode parent, final String code, final Position position, final NODE_TYPE type,
33+
final Formula mapping) {
3334
this.parent = parent;
3435
this.code = code;
3536
this.startPosition = Objects.requireNonNull(position);
@@ -39,9 +40,14 @@ public EccoNode(final EccoNode parent, final String code, final Position positio
3940
productEquivalent = null;
4041
}
4142

42-
//if two nodes are at the same position of the AST and contain the same code, we distinguish them by sequence numbers
43-
/*Warning: Later on we will match nodes from different products by their sequence numbers, but that is not necessarily correct (they can e.g. be shifted by inserts or deletes).
44-
Correct matching of the sequence numbers would require further investigation of the nodes' children and was omitted here.
43+
// if two nodes are at the same position of the AST and contain the same code,
44+
// we distinguish them by sequence numbers
45+
/*
46+
* Warning: Later on we will match nodes from different products by their
47+
* sequence numbers, but that is not necessarily correct (they can e.g. be
48+
* shifted by inserts or deletes).
49+
* Correct matching of the sequence numbers would require further investigation
50+
* of the nodes' children and was omitted here.
4551
*/
4652
public void addChild(final EccoNode child) {
4753
while (!children.add(child)) {
@@ -58,8 +64,10 @@ public EccoNode getProductEquivalent() {
5864
}
5965

6066
public boolean isSimilar(final EccoNode eccoNode) {
61-
if (this == eccoNode) return true;
62-
if (eccoNode == null || getClass() != eccoNode.getClass()) return false;
67+
if (this == eccoNode)
68+
return true;
69+
if (eccoNode == null || getClass() != eccoNode.getClass())
70+
return false;
6371
return Objects.equals(code, eccoNode.code) &&
6472
this.similarParent(eccoNode) &&
6573
type == eccoNode.type &&
@@ -83,8 +91,10 @@ private String getAncestorCode() {
8391
}
8492

8593
private boolean similarParent(final EccoNode other) {
86-
if (this.parent == other.parent) return true;
87-
if (this.parent == null || this.parent.getClass() != other.parent.getClass()) return false;
94+
if (this.parent == other.parent)
95+
return true;
96+
if (this.parent == null || this.parent.getClass() != other.parent.getClass())
97+
return false;
8898
return Objects.equals(this.parent.code, other.parent.code) &&
8999
this.parent.type == other.parent.type &&
90100
this.parent.sequenceNumber == other.parent.sequenceNumber;
@@ -110,7 +120,8 @@ public Position getStartPosition() {
110120
}
111121
}
112122

113-
//return set of all possible mappings (if the mapping is a DNF formula, each clause is a possible mapping on its own)
123+
// return set of all possible mappings (if the mapping is a DNF formula, each
124+
// clause is a possible mapping on its own)
114125
public EccoSet<Formula> getMappings() {
115126
final EccoSet<Formula> mappings = new EccoSet<>();
116127
if (mapping.type() == FType.OR) {
@@ -123,7 +134,7 @@ public EccoSet<Formula> getMappings() {
123134
return mappings;
124135
}
125136

126-
//return whole mapping as a formula
137+
// return whole mapping as a formula
127138
public Formula getMapping() {
128139
return mapping;
129140
}
@@ -151,7 +162,7 @@ private void writeObject(final ObjectOutputStream oos)
151162
} else {
152163
o2 = null;
153164
}
154-
oos.writeObject(new Object[]{o1, o2});
165+
oos.writeObject(new Object[] { o1, o2 });
155166
}
156167

157168
private void readObject(final ObjectInputStream ois) throws ClassNotFoundException, IOException, ParserException {

src/main/java/de/hub/mse/variantsync/ecco/data/EccoSet.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/EccoSet.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

33
import java.util.Collection;
44
import java.util.HashSet;
@@ -25,7 +25,8 @@ public void overwrite(final E element) {
2525
* Return a new set that is the union of this set and the given set
2626
*
2727
* @param toUnite The set to form the union with
28-
* @return A new set that contains the union of elements from this set and the given set
28+
* @return A new set that contains the union of elements from this set and the
29+
* given set
2930
*/
3031
public EccoSet<E> unite(final EccoSet<E> toUnite) {
3132
final EccoSet<E> result = new EccoSet<>(this);
@@ -37,7 +38,8 @@ public EccoSet<E> unite(final EccoSet<E> toUnite) {
3738
* Return a new set that is the union of this set and the given set
3839
*
3940
* @param toUnite The set to form the union with
40-
* @return A new set that contains the union of elements from this set and the given set
41+
* @return A new set that contains the union of elements from this set and the
42+
* given set
4143
*/
4244
public EccoSet<E> uniteElement(final E toUnite) {
4345
final EccoSet<E> result = new EccoSet<>(this);
@@ -46,10 +48,12 @@ public EccoSet<E> uniteElement(final E toUnite) {
4648
}
4749

4850
/**
49-
* Return a new set that contains all elements in this set after removing the elements in the given set
51+
* Return a new set that contains all elements in this set after removing the
52+
* elements in the given set
5053
*
5154
* @param without The elements that should not be in the new set
52-
* @return New set with elements that are only in this set but not in the given set
55+
* @return New set with elements that are only in this set but not in the given
56+
* set
5357
*/
5458
public EccoSet<E> without(final EccoSet<E> without) {
5559
final EccoSet<E> result = new EccoSet<>(this);
@@ -58,10 +62,12 @@ public EccoSet<E> without(final EccoSet<E> without) {
5862
}
5963

6064
/**
61-
* Return a new set that contains all elements in this set after removing the elements in the given set
65+
* Return a new set that contains all elements in this set after removing the
66+
* elements in the given set
6267
*
6368
* @param without The elements that should not be in the new set
64-
* @return New set with elements that are only in this set but not in the given set
69+
* @return New set with elements that are only in this set but not in the given
70+
* set
6571
*/
6672
public EccoSet<E> withoutElement(final E without) {
6773
final EccoSet<E> result = new EccoSet<>(this);
@@ -73,7 +79,8 @@ public EccoSet<E> withoutElement(final E without) {
7379
* Return a new set that is an intersection between this set and the given set
7480
*
7581
* @param toIntersect set to intersect with
76-
* @return a new set with the elements that represent the intersection of both sets
82+
* @return a new set with the elements that represent the intersection of both
83+
* sets
7784
*/
7885
public EccoSet<E> intersect(final EccoSet<E> toIntersect) {
7986
final EccoSet<E> result = new EccoSet<>(this);
@@ -85,7 +92,8 @@ public EccoSet<E> intersect(final EccoSet<E> toIntersect) {
8592
* Return a new set that is an intersection between this set and the given set
8693
*
8794
* @param toIntersect set to intersect with
88-
* @return a new set with the elements that represent the intersection of both sets
95+
* @return a new set with the elements that represent the intersection of both
96+
* sets
8997
*/
9098
public EccoSet<E> intersectElement(final E toIntersect) {
9199
final EccoSet<E> result = new EccoSet<>(this);

src/main/java/de/hub/mse/variantsync/ecco/data/Feature.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/Feature.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

33
import java.io.Serializable;
44
import java.util.Objects;
@@ -17,8 +17,10 @@ public String getName() {
1717

1818
@Override
1919
public boolean equals(final Object o) {
20-
if (this == o) return true;
21-
if (o == null || getClass() != o.getClass()) return false;
20+
if (this == o)
21+
return true;
22+
if (o == null || getClass() != o.getClass())
23+
return false;
2224
final Feature feature = (Feature) o;
2325
return name.equals(feature.name);
2426
}

src/main/java/de/hub/mse/variantsync/ecco/data/MainTree.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/MainTree.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

3-
import de.hub.mse.variantsync.ecco.ECCO_LIGHT;
4-
import de.hub.mse.variantsync.ecco.data.position.ProductPosition;
5-
import de.hub.mse.variantsync.ecco.data.position.UnspecifiedPosition;
3+
import de.hub.mse.variantsync.boosting.ECCO_LIGHT;
4+
import de.hub.mse.variantsync.boosting.data.position.ProductPosition;
5+
import de.hub.mse.variantsync.boosting.data.position.UnspecifiedPosition;
66
import org.logicng.formulas.Formula;
77

88
import java.io.Serializable;

src/main/java/de/hub/mse/variantsync/ecco/data/Module.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/Module.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

33
import org.logicng.formulas.Literal;
44

@@ -13,8 +13,10 @@ public Module(final EccoSet<Literal> literals) {
1313

1414
@Override
1515
public boolean equals(final Object o) {
16-
if (this == o) return true;
17-
if (!(o instanceof Module)) return false;
16+
if (this == o)
17+
return true;
18+
if (!(o instanceof Module))
19+
return false;
1820
final Module module = (Module) o;
1921
return Objects.equals(literals, module.literals);
2022
}

src/main/java/de/hub/mse/variantsync/ecco/data/Product.java renamed to src/main/java/de/hub/mse/variantsync/boosting/data/Product.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package de.hub.mse.variantsync.ecco.data;
1+
package de.hub.mse.variantsync.boosting.data;
22

3-
import de.hub.mse.variantsync.ecco.ECCO_LIGHT;
4-
import de.hub.mse.variantsync.ecco.data.position.Position;
5-
import de.hub.mse.variantsync.ecco.data.specialization.JavaAST;
6-
import de.hub.mse.variantsync.ecco.data.specialization.LineAST;
3+
import de.hub.mse.variantsync.boosting.ECCO_LIGHT;
4+
import de.hub.mse.variantsync.boosting.data.position.Position;
5+
import de.hub.mse.variantsync.boosting.data.specialization.JavaAST;
6+
import de.hub.mse.variantsync.boosting.data.specialization.LineAST;
77
import org.logicng.formulas.Formula;
88
import org.logicng.io.parsers.ParserException;
99

@@ -17,12 +17,14 @@
1717
public class Product implements Serializable {
1818
private final EccoSet<Feature> features;
1919
private final String name;
20-
//the original product AST
20+
// the original product AST
2121
private AbstractAST productAST;
22-
//the AST nodes of the main tree that correspond to the AST nodes of the product AST
22+
// the AST nodes of the main tree that correspond to the AST nodes of the
23+
// product AST
2324
private EccoSet<EccoNode> astNodesMainTree;
2425

25-
public Product(final String name, final EccoSet<EccoNode> astNodesMainTree, final AbstractAST productAST, final EccoSet<Feature> features) {
26+
public Product(final String name, final EccoSet<EccoNode> astNodesMainTree, final AbstractAST productAST,
27+
final EccoSet<Feature> features) {
2628
this.name = name;
2729
this.astNodesMainTree = astNodesMainTree;
2830
this.productAST = productAST;
@@ -72,12 +74,14 @@ public EccoSet<EccoNode> getAstNodesMainTree() {
7274
return astNodesMainTree;
7375
}
7476

75-
//returns the mapping of the node at given position in the product or (if it was already merged into the main tree) the mapping of the corresponding node in the main tree
77+
// returns the mapping of the node at given position in the product or (if it
78+
// was already merged into the main tree) the mapping of the corresponding node
79+
// in the main tree
7680
public Formula getMappingFromPosition(final Position position) {
77-
//look for the right node in the product AST's nodes
81+
// look for the right node in the product AST's nodes
7882
for (final EccoNode oldNode : productAST.getAstNodes()) {
7983
if (position.equals(oldNode.getStartPosition())) {
80-
//find and return the mapping of the corresponding node in the main tree
84+
// find and return the mapping of the corresponding node in the main tree
8185
for (final EccoNode newNode : astNodesMainTree) {
8286
if (newNode.isSimilar(oldNode)) {
8387
return newNode.getMapping();
@@ -93,12 +97,13 @@ public String getName() {
9397
return name;
9498
}
9599

96-
//returns the node at given position in the product or (if it was already merged into the main tree) the corresponding node in the main tree
100+
// returns the node at given position in the product or (if it was already
101+
// merged into the main tree) the corresponding node in the main tree
97102
public EccoNode getNodeFromPosition(final Position position) {
98-
//look for the right node in the product AST's nodes
103+
// look for the right node in the product AST's nodes
99104
for (final EccoNode oldNode : productAST.getAstNodes()) {
100105
if (position.equals(oldNode.getStartPosition())) {
101-
//find and return the corresponding node in the main tree
106+
// find and return the corresponding node in the main tree
102107
for (final EccoNode newNode : astNodesMainTree) {
103108
if (newNode.isSimilar(oldNode)) {
104109
return newNode;
@@ -198,8 +203,10 @@ private static EccoNode copyNode(final EccoNode node) {
198203

199204
@Override
200205
public boolean equals(final Object o) {
201-
if (this == o) return true;
202-
if (!(o instanceof Product)) return false;
206+
if (this == o)
207+
return true;
208+
if (!(o instanceof Product))
209+
return false;
203210
final Product product = (Product) o;
204211
return features.equals(product.features);
205212
}

0 commit comments

Comments
 (0)