Skip to content

Commit de7b1f7

Browse files
committed
Reuse code in Gamma.
1 parent 690b8dd commit de7b1f7

File tree

1 file changed

+2
-18
lines changed
  • com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client

1 file changed

+2
-18
lines changed

com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/Gamma.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,11 @@ protected int getBetaParameterPosition() {
5151
}
5252

5353
protected int getAlphaParameterValueNumber(PropagationCallGraphBuilder builder) {
54-
Set<Integer> numberOfPossiblePositionalArguments =
55-
this.getNumberOfPossiblePositionalArguments(builder);
56-
int alphaParameterPosition = this.getAlphaParameterPosition();
57-
58-
if (!numberOfPossiblePositionalArguments.stream()
59-
.anyMatch(n -> n >= alphaParameterPosition + 1))
60-
throw new IllegalStateException(
61-
"Alpha parameter is mandatory and must be provided explicitly.");
62-
63-
return this.getArgumentValueNumber(alphaParameterPosition);
54+
return this.getArgumentValueNumber(builder, this.getAlphaParameterPosition());
6455
}
6556

6657
protected int getBetaParameterValueNumber(PropagationCallGraphBuilder builder) {
67-
Set<Integer> numberOfPossiblePositionalArguments =
68-
this.getNumberOfPossiblePositionalArguments(builder);
69-
int betaParameterPosition = this.getBetaParameterPosition();
70-
71-
if (!numberOfPossiblePositionalArguments.stream().anyMatch(n -> n >= betaParameterPosition + 1))
72-
return -1; // Beta parameter is optional.
73-
74-
return this.getArgumentValueNumber(betaParameterPosition);
58+
return this.getArgumentValueNumber(builder, this.getBetaParameterPosition(), true);
7559
}
7660

7761
@Override

0 commit comments

Comments
 (0)