Skip to content

Commit c9a3be5

Browse files
authored
Merge branch 'main' into 139-missing-tffunction-parameters
2 parents 617cfb5 + e374b3c commit c9a3be5

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

edu.cuny.hunter.hybridize.core/src/edu/cuny/hunter/hybridize/core/analysis/Function.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class Function extends RefactorableProgramEntity {
3434

3535
/**
3636
* Parameters that may be passed to a tf.fuction decorator. Parameter descriptions found at:
37-
* https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/function Note: We are also parsing the deprecated parameters specified in
37+
* https://tensorflow.org/versions/r2.9/api_docs/python/tf/function Note: We are also parsing the deprecated parameters specified in
3838
* the documentation. Users can still use these deprecated parameters. Therefore we need to be able to account for them. Please refer to
3939
* https://github.com/ponder-lab/Hybridize-Functions-Refactoring/wiki/tf.function-parameter's-version-information to see more
4040
* information about the tf.function parameters according to the versions.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package edu.cuny.hunter.hybridize.tests;
2+
3+
import java.util.ArrayList;
4+
import java.util.Arrays;
5+
import java.util.Collections;
6+
import java.util.List;
7+
import java.util.Objects;
8+
9+
/**
10+
* A specification of a Python function being tested.
11+
*
12+
* @author <a href="mailto:rk1424@hunter.cuny.edu">Raffi Khatchadourian</a>
13+
*/
14+
public class FunctionUnderTest {
15+
16+
/**
17+
* The simple name of this function under test.
18+
*/
19+
private String name;
20+
21+
/**
22+
* The names of the parameteres of this function under test.
23+
*/
24+
private List<String> parameters = new ArrayList<>();
25+
26+
/**
27+
* Whether this function under test should be a hybrid function.
28+
*/
29+
private boolean hybrid;
30+
31+
public FunctionUnderTest(String name) {
32+
this.name = name;
33+
}
34+
35+
public FunctionUnderTest(String name, boolean hybrid) {
36+
this(name);
37+
this.hybrid = hybrid;
38+
}
39+
40+
public boolean addParameters(String... parameter) {
41+
return this.parameters.addAll(Arrays.asList(parameter));
42+
}
43+
44+
public String getName() {
45+
return name;
46+
}
47+
48+
public List<String> getParameters() {
49+
return Collections.unmodifiableList(parameters);
50+
}
51+
52+
public boolean isHybrid() {
53+
return hybrid;
54+
}
55+
56+
@Override
57+
public int hashCode() {
58+
return Objects.hash(name, parameters, hybrid);
59+
}
60+
61+
@Override
62+
public boolean equals(Object obj) {
63+
if (this == obj)
64+
return true;
65+
if (obj == null)
66+
return false;
67+
if (getClass() != obj.getClass())
68+
return false;
69+
FunctionUnderTest other = (FunctionUnderTest) obj;
70+
return Objects.equals(name, other.name) && Objects.equals(parameters, other.parameters) && Objects.equals(hybrid, other.hybrid);
71+
}
72+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3434
<jacoco-version>0.8.8</jacoco-version>
3535
<maven-checkstyle-plugin-version>3.2.1</maven-checkstyle-plugin-version>
36-
<checkstyle-version>10.9.2</checkstyle-version>
36+
<checkstyle-version>10.9.3</checkstyle-version>
3737
<junit-version>4.13.2</junit-version>
3838
<eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
3939
<platform-version-name>2022-09</platform-version-name>

0 commit comments

Comments
 (0)