Skip to content

Commit 178d633

Browse files
committed
minor update to equivalence for AFs
1 parent f8d0bd1 commit 178d633

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

org-tweetyproject-arg-dung/src/main/java/org/tweetyproject/arg/dung/equivalence/IdentityEquivalence.java renamed to org-tweetyproject-arg-dung/src/main/java/org/tweetyproject/arg/dung/equivalence/SyntacticEquivalence.java

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,41 @@
1414
* You should have received a copy of the GNU Lesser General Public License
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*
17-
* Copyright 2023 The TweetyProject Team <http://tweetyproject.org/contact/>
17+
* Copyright 2025 The TweetyProject Team <http://tweetyproject.org/contact/>
1818
*/
1919
package org.tweetyproject.arg.dung.equivalence;
2020

21-
import java.util.Collection;
22-
2321
import org.tweetyproject.arg.dung.syntax.DungTheory;
2422

23+
import java.util.Collection;
24+
2525
/**
2626
* This class defines 'syntactic' equivalence of {@link DungTheory Argumentation Frameworks},
2727
* i.e., it checks whether two AFs have exactly the same arguments and attacks.
2828
*
29-
* @author Julian Sander
29+
* @author Julian Sander, Lars Bengel
3030
*/
31-
public class IdentityEquivalence implements Equivalence<DungTheory> {
32-
33-
@Override
34-
public boolean isEquivalent(DungTheory obj1, DungTheory obj2) {
35-
return obj1.equals(obj2);
36-
}
31+
public class SyntacticEquivalence implements Equivalence<DungTheory> {
32+
@Override
33+
public boolean isEquivalent(DungTheory theory1, DungTheory theory2) {
34+
if (!theory1.getNodes().equals(theory2.getNodes())) return false;
35+
return theory1.getAttacks().equals(theory2.getAttacks());
36+
}
3737

38-
@Override
39-
public boolean isEquivalent(Collection<DungTheory> objects) {
40-
DungTheory first = objects.iterator().next();
41-
for (DungTheory framework : objects) {
42-
if(framework == first) {
43-
continue;
44-
}
45-
if(!this.isEquivalent(framework, first)) {
46-
return false;
47-
}
48-
}
49-
return true;
50-
}
38+
@Override
39+
public boolean isEquivalent(Collection<DungTheory> theories) {
40+
DungTheory first = theories.iterator().next();
5141

52-
@Override
53-
public String getName() {
54-
return "Syntactic Equivalence";
55-
}
42+
for(DungTheory theory : theories) {
43+
if (!isEquivalent(theory, first)) {
44+
return false;
45+
}
46+
}
47+
return true;
48+
}
5649

50+
@Override
51+
public String getName() {
52+
return "Syntactic Equivalence";
53+
}
5754
}

org-tweetyproject-arg-dung/src/main/java/org/tweetyproject/arg/dung/reasoner/AbstractExtensionReasoner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public static AbstractExtensionReasoner getSimpleReasonerForSemantics(Semantics
103103
case UD -> new UndisputedReasoner();
104104
case SUD -> new StronglyUndisputedReasoner();
105105
case IS -> new SimpleInitialReasoner();
106+
case UC -> new SerialisedExtensionReasoner(Semantics.UC);
106107
default -> throw new IllegalArgumentException("Unknown semantics.");
107108
};
108109
}

0 commit comments

Comments
 (0)