Skip to content

Commit 460d6af

Browse files
committed
Corrected bounds.
1 parent ebefd81 commit 460d6af

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

  • core/src/main/java/org/jetbrains/research/groups/ml_methods/algorithm

core/src/main/java/org/jetbrains/research/groups/ml_methods/algorithm/HAC.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
public class HAC extends AbstractAlgorithm {
2929
private static final Logger LOGGER = Logging.getLogger(HAC.class);
30-
private static final int MAX_NUMBER_OF_CLASSES = 3000;
31-
private static final int MAX_NUMBER_OF_METHODS = 20000;
32-
private static final int MAX_NUMBER_OF_FIELDS = 9000;
30+
private static final int MAX_NUMBER_OF_CLASSES = 1000;
31+
private static final int MAX_NUMBER_OF_METHODS = 3000;
32+
private static final int MAX_NUMBER_OF_FIELDS = 1500;
3333
private static final double ACCURACY = 1;
3434

3535
private static final @NotNull DistanceCalculator distanceCalculator = RelevanceBasedDistanceCalculator.getInstance();
@@ -51,16 +51,20 @@ public HAC() {
5151
@NotNull
5252
@Override
5353
public AlgorithmResult execute(@NotNull AttributesStorage attributes, @Nullable ExecutorService service, boolean enableFieldRefactorings) {
54-
if (attributes.getClassesAttributes().size() > MAX_NUMBER_OF_CLASSES ||
55-
attributes.getMethodsAttributes().size() > MAX_NUMBER_OF_METHODS ||
56-
attributes.getFieldsAttributes().size() > MAX_NUMBER_OF_FIELDS) {
54+
if (willHaveLongTimeExecution(attributes)) {
5755
LOGGER.warn("HAC haven't been executed because project is too large and HAC will work too long");
5856
return new AlgorithmResult(AlgorithmType.HAC,
5957
new TooLargeProjectException("HAC execution will be too long on this project"));
6058
}
6159
return super.execute(attributes, service, enableFieldRefactorings);
6260
}
6361

62+
private boolean willHaveLongTimeExecution(@NotNull AttributesStorage attributes) {
63+
return attributes.getClassesAttributes().size() > MAX_NUMBER_OF_CLASSES ||
64+
attributes.getMethodsAttributes().size() > MAX_NUMBER_OF_METHODS ||
65+
attributes.getFieldsAttributes().size() > MAX_NUMBER_OF_FIELDS;
66+
}
67+
6468
private static class HACExecutor implements Executor {
6569
private final SortedSet<Triple> heap = new TreeSet<>();
6670
private final Map<Long, Triple> triples = new HashMap<>();

0 commit comments

Comments
 (0)