Skip to content

Commit

Permalink
Reformatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
thetabotmaintainer[bot] committed Nov 9, 2023
1 parent 274b07d commit 0a6b932
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@
public final class ArgStructuralEquality {
private static final Map<Object, Integer> hashCodeCache = new LinkedHashMap<>();

private ArgStructuralEquality(){
private ArgStructuralEquality() {
}

public static boolean equals(final ArgNode<? extends State, ? extends Action> n1,
final ArgNode<? extends State, ? extends Action> n2) {

// if one node has a parent but the other one does not, nodes are not equal
if(n1.inEdge.isPresent() != n2.inEdge.isPresent()) {
if (n1.inEdge.isPresent() != n2.inEdge.isPresent()) {
return false;
}

// if in edge is not same, nodes are not equal
if(n1.inEdge.isPresent() && !equals(n1.inEdge.get(), n2.inEdge.get())) {
if (n1.inEdge.isPresent() && !equals(n1.inEdge.get(), n2.inEdge.get())) {
return false;
}

// if wrapped state is not same, nodes are not equal
if(!n1.getState().equals(n2.getState())) {
if (!n1.getState().equals(n2.getState())) {
return false;
}

Expand All @@ -68,12 +68,12 @@ public static boolean equals(final ArgEdge<? extends State, ? extends Action> e1
final ArgEdge<? extends State, ? extends Action> e2) {

// if source node is not same, edges are not equal
if(!equals(e1.getSource(), e2.getSource())) {
if (!equals(e1.getSource(), e2.getSource())) {
return false;
}

// if wrapped action is not same, edges are not equal
if(!e1.getAction().equals(e2.getAction())) {
if (!e1.getAction().equals(e2.getAction())) {
return false;
}

Expand All @@ -87,14 +87,14 @@ public static boolean equals(final ARG<? extends State, ? extends Action> a1,
Set<ArgNode<? extends State, ? extends Action>> leaves2 = a2.getNodes().filter(ArgNode::isLeaf).collect(Collectors.toUnmodifiableSet());

// if the two ARGs contain a different number of leaf nodes, they are not equal
if(leaves1.size() != leaves2.size()) {
if (leaves1.size() != leaves2.size()) {
return false;
}

leaves1loop:
for (ArgNode<? extends State, ? extends Action> n1 : leaves1) {
for (ArgNode<? extends State, ? extends Action> n2 : leaves2) {
if(equals(n1, n2)) {
if (equals(n1, n2)) {
continue leaves1loop;
}
}
Expand All @@ -112,10 +112,10 @@ public static boolean equals(final ArgTrace<? extends State, ? extends Action> t


public static int hashCode(final ArgNode<? extends State, ? extends Action> n) {
if(!hashCodeCache.containsKey(n)) {
if (!hashCodeCache.containsKey(n)) {
int hashcode = 0;

if(n.inEdge.isPresent()) {
if (n.inEdge.isPresent()) {
hashcode += hashCode(n.inEdge.get());
}

Expand All @@ -126,7 +126,7 @@ public static int hashCode(final ArgNode<? extends State, ? extends Action> n) {
}

public static int hashCode(final ArgEdge<? extends State, ? extends Action> e) {
if(!hashCodeCache.containsKey(e)) {
if (!hashCodeCache.containsKey(e)) {
int hashcode = 0;

hashcode += hashCode(e.getSource());
Expand All @@ -151,7 +151,7 @@ public static int hashCode(final ARG<? extends State, ? extends Action> a) {
}

public static int hashCode(final ArgTrace<? extends State, ? extends Action> t) {
if(!hashCodeCache.containsKey(t)) {
if (!hashCodeCache.containsKey(t)) {
int hashcode = hashCode(t.node(t.length()));
hashCodeCache.put(t, hashcode);
}
Expand Down

0 comments on commit 0a6b932

Please sign in to comment.