javaDungAF
Class DungAF

Object
  extended by DungAF

public class DungAF
extends Object

A class to implement Dung's abstract argumentation frameworks (AFs).

A DungAF represents an AF. Arguments and attacks are represented as Strings and two-element String-arrays ([attacker, attacked]), respectively. A DungAF may also record information concerning the interpretation of its AF, according to the semantics implemented by this class -

Hence a DungAF may record not merely an AF, but also its admissible sets, complete extensions etc. Such information is recorded whenever it is generated in response to a call, and is discarded whenever the object's AF is changed. Thus for as long as the object's AF remains unchanged, repeated calls to (for instance) getGroundedExt() do not result in repeated calculations of the grounded extension.

The implementations of the admissible semantics and the grounded semantics use existing algorithms -

For the other semantics listed above, implementation proceeds straightforwardly from the implementation of the admissible semantics. Further details on the latter are provided here.

Note: henceforth, for the sake of brevity, DungAFs will often be referred to simply as AFs - that is, as if each recorded merely an AF, and could not also record its admissible sets, complete extensions, etc.

Note: this class is not synchronized. It is not clear what might happen if, for instance, a DungAF was asked to add attacks to its AF, while it was generating the admissible sets of its AF.

Note: this class depends on Google's guava-libraries (version 10.0.01) - specifically, the implementation of the n-ary cartesian product provided by com.google.common.collect.Sets.cartesianProduct(List<? extends Set<? extends B>>).


Field Summary
private  HashSet<HashSet<String>> admissibleSets
          This AF's admissible sets.
private  HashSet<String> args
          This AF's arguments.
private  HashMap<String,HashSet<String>> argsToAttackers
          A map indicating, for each of this AF's arguments, the arguments attacking it in this AF.
private  HashMap<String,HashSet<HashSet<String>>> argsToDefenceSets
          A map indicating, for none, some or all of this AF's arguments, the defence-sets around each of those arguments in this AF.
private  HashMap<String,HashSet<String>> argsToTargets
          A map indicating, for each of this AF's arguments, the arguments attacked by it in this AF.
private  HashSet<String[]> atts
          This AF's attacks.
private  HashSet<HashSet<String>> completeExts
          This AF's complete extensions.
private  HashSet<String> eagerExt
          This AF's eager extension.
private  HashSet<String> groundedExt
          This AF's grounded extension.
private  HashSet<String> idealExt
          This AF's ideal extension.
private  HashSet<HashSet<String>> preferredExts
          This AF's preferred extensions.
private  HashSet<String> preferredScepticalExt
          The extension prescribed by the sceptical preferred semantics for this AF.
private  HashSet<HashSet<String>> semiStableExts
          This AF's semi-stable extensions.
private  HashSet<HashSet<String>> stableExts
          This AF's stable extensions.
 
Constructor Summary
DungAF()
          Constructs an empty AF.
DungAF(Collection<String[]> attsParam)
          Constructs the AF comprising the set-view of the specified collection of attacks, and all arguments involved in any of those attacks.
DungAF(Collection<String> argsParam, Collection<String[]> attsParam)
          Constructs the AF (args, atts), where args comprises the set-view of argsParam and all arguments involved in any attack in attsParam; and atts comprises the set-view of attsParam.
DungAF(DungAF anotherAF)
          Constructs a copy of anotherAF.
 
Method Summary
 boolean addArgs(Collection<String> argsToBeAdded)
          Adds the arguments in the specified collection to this AF.
 boolean addArgs(String... argsToBeAdded)
          Adds the specified arguments to this AF.
 boolean addAtts(Collection<String[]> attsToBeAdded)
          Adds the attacks comprising the specified collection to this AF.
 boolean addAtts(String[]... attsToBeAdded)
          Adds the specified attacks to this AF.
 boolean admissibleSetsContain(Collection<String>... argColls)
          Returns true if, for each of the specified collections, its set-view is admissible in this AF.
 boolean argsAccept(Collection<String> acceptingArgColl, Collection<String> argsToCheck)
          Returns true if all of argsToCheck are acceptable with respect to the set-view of acceptingArgColl in this AF.
 boolean argsAccept(Collection<String> acceptingArgColl, String... argsToCheck)
          Returns true if the specified arguments are all acceptable with respect to the set-view of acceptingArgColl in this AF.
static boolean arraysDenoteAttacks(Collection<String[]> strArrs)
          Returns true if the specified collection comprises String-arrays which denote attacks.
static boolean arraysDenoteAttacks(String[]... strArrs)
          Returns true if the specified String-arrays all denote attacks.
 void clear()
          Removes all arguments and attacks from this AF.
 boolean collnIsInConflictWithAnyOf(Collection<String> argsParam0, String... argsParam1)
          Returns true if, in this AF, any of the arguments in the specified collection is in conflict with any of the specified arguments.
 boolean completeExtsContain(Collection<String>... argColls)
          Returns true if, for each of the specified collections, its set-view is a complete extension of this AF.
 boolean containsNoConflictAmong(Collection<String> argsParam)
          Returns true if, in this AF, no argument in the specified collection attacks itself or any other argument in the collection.
 boolean containsNoConflictAmong(String... argsParam)
          Returns true if, in this AF, none of the specified arguments attacks itself or any of the other specified arguments.
<T extends Collection<String>>
boolean
containsNoConflictAmongUnionOf(Collection<T> argColls)
          Returns true if, in this AF, none of the arguments in the union of the specified collections attacks itself or any other argument in the union.
 boolean ensureDisjointWith(DungAF anotherAF)
          Ensures that this AF contains none of the arguments in anotherAF.
 boolean ensureSubsumes(DungAF anotherAF)
          Ensures that this AF is a supergraph of anotherAF.
 boolean equals(DungAF anotherAF)
          Returns true if this object and anotherAF record the same AF.
private  void findIdealExtOrEagerExt(String semantics)
          Finds and records this AF's ideal extension or eager extension.
 HashSet<String> getAdmissibleArgs()
          Returns the union of this AF's admissible sets.
 HashSet<HashSet<String>> getAdmissibleSets()
          Returns this AF's admissible sets.
 HashSet<String> getArgs()
          Returns this AF's arguments.
 HashSet<String> getArgsAcceptedBy(Collection<String> argsParam)
          Returns the arguments which are acceptable with respect to the set-view of argsParam in this AF.
 HashSet<String> getArgsAcceptedBy(String... argsParam)
          Returns the arguments which are acceptable with respect to the set comprising the specified arguments in this AF.
 HashSet<String> getAttackersOf(String arg)
          Returns the arguments attacking arg in this AF.
 HashSet<String[]> getAtts()
          Returns this AF's attacks.
 HashSet<HashSet<String>> getCompleteExts()
          Returns this AF's complete extensions.
 HashSet<HashSet<String>> getDefenceSetsAround(String arg)
          Returns the defence-sets around arg in this AF.
private  HashSet<HashSet<String>> getDefenceSetsAroundHelper(String arg, List<String> path, HashSet<HashSet<String>> canSols)
          Finds the defence-sets around arg in this AF, if called by another method (and passed arg, the empty list and the singleton set containing the empty set).
 HashSet<String> getEagerExt()
          Returns this AF's eager extension.
 HashSet<String> getExtsUnion(String semantics)
          Returns the union of the extensions prescribed by semantics for this AF, where semantics is a multiple-extension semantics implemented by this class.
 HashSet<String> getGroundedExt()
          Returns this AF's grounded extension.
 HashSet<String> getIdealExt()
          Returns this AF's ideal extension.
 HashSet<HashSet<String>> getPreferredExts()
          Returns this AF's preferred extensions.
 HashSet<String> getPreferredScepticalExt()
          Returns the extension prescribed by the sceptical preferred semantics for this AF.
static DungAF getRandomDungAF(int minArgs, int maxArgs, int minAtts, int maxAtts, Collection<String> argPool)
          Returns an AF which satisfies the constraints passed as parameters, but is otherwise constructed at random.
 HashSet<String> getSemiStableArgs()
          Returns the union of this AF's semi-stable extensions.
 HashSet<HashSet<String>> getSemiStableExts()
          Returns this AF's semi-stable extensions.
 HashSet<String> getStableArgs()
          Returns the union of this AF's stable extensions.
 HashSet<HashSet<String>> getStableExts()
          Returns this AF's stable extensions.
 HashSet<String> getTargetsOf(String arg)
          Returns the arguments attacked by arg in this AF.
 boolean hasAsConflictFreeSet(Collection<String> argsParam)
          Returns true if the set-view of the specified collection is a conflict-free set in this AF.
 boolean hasAsConflictFreeSet(String... argsParam)
          Returns true if the specified arguments form a conflict-free set in this AF.
<T extends Collection<String>>
boolean
hasUnionOfAsConflictFreeSet(Collection<T> argColls)
          Returns true if the specified collections unite to form a conflict-free set in this AF.
 boolean isDisjointWith(DungAF anotherAF)
          Returns true if this AF contains contains none of the arguments in anotherAF.
 boolean preferredExtsContain(Collection<String>... argColls)
          Returns true if, for each of the specified collections, its set-view is a preferred extension of this AF.
 boolean recordsDefenceSetsAround(String... args)
          Returns true if this object records the defence-sets around the specified arguments in its AF.
 boolean recordsExtsOfType(String semantics)
          Returns true if this object records the extension(s) prescribed by semantics for its AF, where semantics is a semantics implemented by this class.
 boolean removeArgs(Collection<String> argsToBeRemoved)
          Removes the arguments in the specified collection from this AF.
 boolean removeArgs(String... argsToBeRemoved)
          Removes the specified arguments from this AF.
 boolean removeAtts(Collection<String[]> attsToBeRemoved)
          Removes the attacks comprising the specified collection from this AF.
 boolean removeAtts(String[]... attsToBeRemoved)
          Removes the specified attacks from this AF.
private  boolean removeDuplicateAttacks()
          Ensures that this object records only a single copy of each of the attacks in its AF.
private  void removeSemanticsInfo()
          Removes from this object all information concerning the interpretation of its AF.
 boolean semiStableExtsContain(Collection<String>... argColls)
          Returns true if, for each of the specified collections, its set-view is a semi-stable extension of this AF.
 boolean stableExtsContain(Collection<String>... argColls)
          Returns true if, for each of the specified collections, its set-view is a stable extension of this AF.
 boolean subsumes(DungAF anotherAF)
          Returns true if this AF is a (strict or non-strict) supergraph of anotherAF.
 String toString()
          Returns a representation of this AF in the conventional format - ({arg1, arg2,...}, {(arg1, arg2), (arg2, arg1),...}).
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

args

private HashSet<String> args
This AF's arguments.


atts

private HashSet<String[]> atts
This AF's attacks.


argsToAttackers

private HashMap<String,HashSet<String>> argsToAttackers
A map indicating, for each of this AF's arguments, the arguments attacking it in this AF.


argsToTargets

private HashMap<String,HashSet<String>> argsToTargets
A map indicating, for each of this AF's arguments, the arguments attacked by it in this AF.


argsToDefenceSets

private HashMap<String,HashSet<HashSet<String>>> argsToDefenceSets
A map indicating, for none, some or all of this AF's arguments, the defence-sets around each of those arguments in this AF.

On defence-sets, see getDefenceSetsAround(String).


admissibleSets

private HashSet<HashSet<String>> admissibleSets
This AF's admissible sets.


completeExts

private HashSet<HashSet<String>> completeExts
This AF's complete extensions.


eagerExt

private HashSet<String> eagerExt
This AF's eager extension.


groundedExt

private HashSet<String> groundedExt
This AF's grounded extension.


idealExt

private HashSet<String> idealExt
This AF's ideal extension.


preferredExts

private HashSet<HashSet<String>> preferredExts
This AF's preferred extensions.


preferredScepticalExt

private HashSet<String> preferredScepticalExt
The extension prescribed by the sceptical preferred semantics for this AF.


semiStableExts

private HashSet<HashSet<String>> semiStableExts
This AF's semi-stable extensions.


stableExts

private HashSet<HashSet<String>> stableExts
This AF's stable extensions.

Constructor Detail

DungAF

public DungAF()
Constructs an empty AF.


DungAF

public DungAF(DungAF anotherAF)
Constructs a copy of anotherAF.

The values of all fields in anotherAF - including semantics-related fields - are copied into the constructed object.

Parameters:
anotherAF - a DungAF.

DungAF

public DungAF(Collection<String[]> attsParam)
Constructs the AF comprising the set-view of the specified collection of attacks, and all arguments involved in any of those attacks.

Parameters:
attsParam - a Collection of String-arrays (which should all denote attacks, and hence have exactly two elements).
Throws:
IllegalArgumentException - if attsParam contains a String-array which does not have exactly two elements.

DungAF

public DungAF(Collection<String> argsParam,
              Collection<String[]> attsParam)
Constructs the AF (args, atts), where args comprises the set-view of argsParam and all arguments involved in any attack in attsParam; and atts comprises the set-view of attsParam.

Parameters:
argsParam - a Collection of Strings, denoting arguments.
attsParam - a Collection of String-arrays (which should all denote attacks, and hence have exactly two elements).
Throws:
IllegalArgumentException - if attsParam contains a String-array which does not have exactly two elements.
Method Detail

getArgs

public HashSet<String> getArgs()
Returns this AF's arguments.

Returns:
a set of Strings, denoting this AF's arguments.

getAtts

public HashSet<String[]> getAtts()
Returns this AF's attacks.

Returns:
a set of String-arrays, denoting this AF's attacks.

getAttackersOf

public HashSet<String> getAttackersOf(String arg)
Returns the arguments attacking arg in this AF.

Parameters:
arg - a String, denoting an argument.
Returns:
a set of Strings, denoting the arguments attacking arg in this AF.

getTargetsOf

public HashSet<String> getTargetsOf(String arg)
Returns the arguments attacked by arg in this AF.

Parameters:
arg - a String, denoting an argument.
Returns:
a set of Strings, denoting the arguments attacked by arg in this AF.

addArgs

public boolean addArgs(Collection<String> argsToBeAdded)
Adds the arguments in the specified collection to this AF.

Parameters:
argsToBeAdded - a Collection of Strings, denoting arguments.
Returns:
true if this AF changed as a result of the call.

addArgs

public boolean addArgs(String... argsToBeAdded)
Adds the specified arguments to this AF.

Parameters:
argsToBeAdded - one or more Strings, denoting arguments.
Returns:
true if this AF changed as a result of the call.

addAtts

public boolean addAtts(Collection<String[]> attsToBeAdded)
Adds the attacks comprising the specified collection to this AF. If attsToBeAdded do not all denote attacks, this AF remains unchanged.

Parameters:
attsToBeAdded - a Collection of String-arrays (which should all denote attacks, and hence have exactly two elements).
Returns:
true if this AF changed as a result of the call.
Throws:
IllegalArgumentException - if attsToBeAdded contains a String-array which does not have exactly two elements.

addAtts

public boolean addAtts(String[]... attsToBeAdded)
Adds the specified attacks to this AF. If attsToBeAdded do not all denote attacks, this AF remains unchanged.

Parameters:
attsToBeAdded - one or more String-arrays (which should all denote attacks, and hence have exactly two elements).
Returns:
true if this AF changed as a result of the call.
Throws:
IllegalArgumentException - if attsToBeAdded contains a String-array which does not have exactly two elements.

removeArgs

public boolean removeArgs(Collection<String> argsToBeRemoved)
Removes the arguments in the specified collection from this AF.

Parameters:
argsToBeRemoved - a Collection of Strings, denoting arguments.
Returns:
true if this AF changed as a result of the call.

removeArgs

public boolean removeArgs(String... argsToBeRemoved)
Removes the specified arguments from this AF.

Parameters:
argsToBeRemoved - one or more Strings, denoting arguments.
Returns:
true if this AF changed as a result of the call.

removeAtts

public boolean removeAtts(Collection<String[]> attsToBeRemoved)
Removes the attacks comprising the specified collection from this AF. If attsToBeRemoved do not all denote attacks, this AF remains unchanged.

Parameters:
attsToBeRemoved - a Collection of String-arrays (which should all denote attacks, and hence have exactly two elements).
Returns:
true if this AF changed as a result of the call.
Throws:
IllegalArgumentException - if attsToBeRemoved contains a String-array which does not have exactly two elements.

removeAtts

public boolean removeAtts(String[]... attsToBeRemoved)
Removes the specified attacks from this AF. If attsToBeRemoved do not all denote attacks, this AF remains unchanged.

Parameters:
attsToBeRemoved - one or more String-arrays (which should all denote attacks, and hence have exactly two elements).
Returns:
true if this AF changed as a result of the call.
Throws:
IllegalArgumentException - if attsToBeRemoved contains a String-array which does not have exactly two elements.

ensureSubsumes

public boolean ensureSubsumes(DungAF anotherAF)
Ensures that this AF is a supergraph of anotherAF.

Parameters:
anotherAF - a DungAF.
Returns:
true if this AF changed as a result of the call.

ensureDisjointWith

public boolean ensureDisjointWith(DungAF anotherAF)
Ensures that this AF contains none of the arguments in anotherAF.

Parameters:
anotherAF - a DungAF.
Returns:
true if this AF changed as a result of the call.

removeSemanticsInfo

private void removeSemanticsInfo()
Removes from this object all information concerning the interpretation of its AF.

Typically called by methods which can change the AF.


clear

public void clear()
Removes all arguments and attacks from this AF.


equals

public boolean equals(DungAF anotherAF)
Returns true if this object and anotherAF record the same AF.

Thus two 'equal' objects may differ with respect to the information they record about their AF's interpretation.

Parameters:
anotherAF - a DungAF.
Returns:
true if this object and anotherAF record the same AF.

subsumes

public boolean subsumes(DungAF anotherAF)
Returns true if this AF is a (strict or non-strict) supergraph of anotherAF.

Parameters:
anotherAF - a DungAF.
Returns:
true if this AF is a (strict or non-strict) supergraph of anotherAF.

isDisjointWith

public boolean isDisjointWith(DungAF anotherAF)
Returns true if this AF contains contains none of the arguments in anotherAF.

Parameters:
anotherAF - a DungAF.
Returns:
true if this AF contains none of the arguments in anotherAF.

recordsExtsOfType

public boolean recordsExtsOfType(String semantics)
Returns true if this object records the extension(s) prescribed by semantics for its AF, where semantics is a semantics implemented by this class.

The semantics implemented by this class are recognized by the following names (case-sensitive) -

Parameters:
semantics - a String, being the name of a semantics implemented by this class.
Returns:
true if the relevant field of this object is non-null.
Throws:
IllegalArgumentException - if semantics is not the name of a semantics implemented by this class.

recordsDefenceSetsAround

public boolean recordsDefenceSetsAround(String... args)
Returns true if this object records the defence-sets around the specified arguments in its AF.

On defence-sets, see getDefenceSetsAround(String).

Parameters:
args - one or more Strings, denoting arguments.
Returns:
true if this object records the defence-sets around the specified arguments in its AF.

toString

public String toString()
Returns a representation of this AF in the conventional format - ({arg1, arg2,...}, {(arg1, arg2), (arg2, arg1),...}).

Overrides:
toString in class Object
Returns:
a String representation of this AF.

arraysDenoteAttacks

public static boolean arraysDenoteAttacks(String[]... strArrs)
Returns true if the specified String-arrays all denote attacks.

Parameters:
strArrs - one or more String-arrays.
Returns:
true if strArrs contains only two-element String-arrays.

arraysDenoteAttacks

public static boolean arraysDenoteAttacks(Collection<String[]> strArrs)
Returns true if the specified collection comprises String-arrays which denote attacks.

Parameters:
strArrs - a Collection of String-arrays.
Returns:
true if strArrs contains only two-element String-arrays.

removeDuplicateAttacks

private boolean removeDuplicateAttacks()
Ensures that this object records only a single copy of each of the attacks in its AF.

Attacks are recorded as arrays, so this method is useful when constructing DungAFs, and when expanding the AFs they record.

Returns:
true if this AF changed as a result of the call.

getRandomDungAF

public static DungAF getRandomDungAF(int minArgs,
                                     int maxArgs,
                                     int minAtts,
                                     int maxAtts,
                                     Collection<String> argPool)
Returns an AF which satisfies the constraints passed as parameters, but is otherwise constructed at random.

Parameters:
minArgs - an int, being the lower bound on the number of arguments.
maxArgs - an int, being the upper bound on the number of arguments.
minAtts - an int, being the lower bound on the number of attacks.
maxAtts - an int, being the upper bound on the number of attacks.
argPool - a Collection of Strings, denoting the arguments which may be used.
Returns:
a DungAF recording an AF which satisfies the constraints passed as parameters.
Throws:
IllegalArgumentException - if the specified constraints cannot be satisfied.

hasAsConflictFreeSet

public boolean hasAsConflictFreeSet(String... argsParam)
Returns true if the specified arguments form a conflict-free set in this AF.

Parameters:
argsParam - one or more Strings, denoting arguments.
Returns:
true if this AF contains all of argsParam; and, in this AF, none of those arguments attacks itself or any other argument in argsParam.
See Also:
containsNoConflictAmong(String... )

hasAsConflictFreeSet

public boolean hasAsConflictFreeSet(Collection<String> argsParam)
Returns true if the set-view of the specified collection is a conflict-free set in this AF.

Parameters:
argsParam - a Collection of Strings, denoting arguments.
Returns:
true if this AF contains all of argsParam; and, in this AF, none of those arguments attacks itself or any other argument in argsParam.
See Also:
containsNoConflictAmong(Collection<String>)

containsNoConflictAmong

public boolean containsNoConflictAmong(String... argsParam)
Returns true if, in this AF, none of the specified arguments attacks itself or any of the other specified arguments.

Parameters:
argsParam - one or more Strings, denoting arguments.
Returns:
true if, in this AF, none of the arguments in argsParam attacks itself or any other argument in argsParam.
See Also:
hasAsConflictFreeSet(String... )

containsNoConflictAmong

public boolean containsNoConflictAmong(Collection<String> argsParam)
Returns true if, in this AF, no argument in the specified collection attacks itself or any other argument in the collection.

Parameters:
argsParam - a Collection of Strings, denoting arguments.
Returns:
true if, in this AF, none of the arguments in argsParam attacks itself or any other argument in argsParam.
See Also:
hasAsConflictFreeSet(Collection<String>)

hasUnionOfAsConflictFreeSet

public <T extends Collection<String>> boolean hasUnionOfAsConflictFreeSet(Collection<T> argColls)
Returns true if the specified collections unite to form a conflict-free set in this AF.

Parameters:
argColls - a Collection of String-Collections, denoting argument-collections.
Returns:
true if this AF contains all of the arguments in the union of argColls; contains no attack by any of those arguments on itself; and contains no attack between any two of those arguments.
See Also:
containsNoConflictAmongUnionOf(Collection<T extends Collection<String>>)

containsNoConflictAmongUnionOf

public <T extends Collection<String>> boolean containsNoConflictAmongUnionOf(Collection<T> argColls)
Returns true if, in this AF, none of the arguments in the union of the specified collections attacks itself or any other argument in the union.

Parameters:
argColls - a Collection of String-Collections, denoting argument-collections.
Returns:
true if, in this AF, none of the arguments in the union of argColls attacks itself or any other argument in the union.
See Also:
hasUnionOfAsConflictFreeSet(Collection<T extends Collection<String>>)

collnIsInConflictWithAnyOf

public boolean collnIsInConflictWithAnyOf(Collection<String> argsParam0,
                                          String... argsParam1)
Returns true if, in this AF, any of the arguments in the specified collection is in conflict with any of the specified arguments.

Parameters:
argsParam0 - a Collection of Strings, denoting arguments.
argsParam1 - one or more Strings, denoting arguments.
Returns:
true if, in this AF, any argument in argsParam0 is attacked by/attacks any argument in argsParam1.

argsAccept

public boolean argsAccept(Collection<String> acceptingArgColl,
                          Collection<String> argsToCheck)
Returns true if all of argsToCheck are acceptable with respect to the set-view of acceptingArgColl in this AF.

Parameters:
acceptingArgColl - a Collection of Strings, denoting arguments.
argsToCheck - a Collection of Strings, denoting arguments.
Returns:
true if all of argsToCheck are acceptable with respect to the set-view of acceptingArgColl in this AF.

argsAccept

public boolean argsAccept(Collection<String> acceptingArgColl,
                          String... argsToCheck)
Returns true if the specified arguments are all acceptable with respect to the set-view of acceptingArgColl in this AF.

Parameters:
acceptingArgColl - a Collection of Strings, denoting arguments.
argsToCheck - one or more Strings, denoting arguments.
Returns:
true if all of argsToCheck are acceptable with respect to the set-view of acceptingArgColl in this AF.

getArgsAcceptedBy

public HashSet<String> getArgsAcceptedBy(String... argsParam)
Returns the arguments which are acceptable with respect to the set comprising the specified arguments in this AF.

Parameters:
argsParam - one or more Strings, denoting arguments.
Returns:
a set of Strings, denoting the arguments which are acceptable with respect to the set comprising argsParam in this AF.

getArgsAcceptedBy

public HashSet<String> getArgsAcceptedBy(Collection<String> argsParam)
Returns the arguments which are acceptable with respect to the set-view of argsParam in this AF.

Parameters:
argsParam - a Collection of Strings, denoting arguments.
Returns:
a set of Strings, denoting the arguments which are acceptable with respect to the set-view of argsParam in this AF.

getExtsUnion

public HashSet<String> getExtsUnion(String semantics)
Returns the union of the extensions prescribed by semantics for this AF, where semantics is a multiple-extension semantics implemented by this class.

The multiple-extension semantics implemented by this class are recognized by the following names (case-sensitive) -

Parameters:
semantics - a String, being the name of a multiple-extension semantics implemented by this class.
Returns:
a set of Strings, denoting the union of the extensions prescribed by semantics for this AF.
Throws:
IllegalArgumentException - if semantics is not the name of a multiple-extension semantics implemented by this class.

getGroundedExt

public HashSet<String> getGroundedExt()
Returns this AF's grounded extension.

Returns:
a set of Strings, denoting this AF's grounded extension.

admissibleSetsContain

public boolean admissibleSetsContain(Collection<String>... argColls)
Returns true if, for each of the specified collections, its set-view is admissible in this AF.

If argColls are all sets, this method returns the same as getAdmissibleSets().containsAll(argColls), but without calculating the admissible sets.

Parameters:
argColls - one or more Collections of Strings, denoting argument-collections.
Returns:
true if, for each of the specified collections, its set-view is admissible in this AF.

getAdmissibleArgs

public HashSet<String> getAdmissibleArgs()
Returns the union of this AF's admissible sets.

Returns:
a set of Strings, denoting the union of this AF's admissible sets.

getAdmissibleSets

public HashSet<HashSet<String>> getAdmissibleSets()
Returns this AF's admissible sets.

Returns:
a set of String-sets, denoting this AF's admissible sets.

getDefenceSetsAround

public HashSet<HashSet<String>> getDefenceSetsAround(String arg)
Returns the defence-sets around arg in this AF.

Vreeswijk defined defence-sets for arguments in his 2006 paper -


Given an AF af, an argument arg, and an argument-set argSet, argSet is a defence-set around arg in af, if and only if -

  1. argSet contains arg; and
  2. argSet is admissible in af; and
  3. no strict subset of argSet fulfils (1) and (2).

Parameters:
arg - a String, denoting an argument.
Returns:
a set of String-sets, denoting the defence-sets around arg in this AF.

getDefenceSetsAroundHelper

private HashSet<HashSet<String>> getDefenceSetsAroundHelper(String arg,
                                                            List<String> path,
                                                            HashSet<HashSet<String>> canSols)
Finds the defence-sets around arg in this AF, if called by another method (and passed arg, the empty list and the singleton set containing the empty set). On defence-sets, see getDefenceSetsAround(String).

This method implements a simplified and slightly modified version of Vreeswijk's algorithm for generating labelled defence-sets (the label denoting, in each case, whether the defence-set is merely an admissible set, or an admissible set which is also a subset of the grounded extension), as described in his 2006 paper -


This method's simplified and slightly modified version generates unlabelled defence-sets. Full details are provided here.

While an externally-called instance of this method returns the defence-sets around the specified argument, a recursively-called instance does not generally do so. Instead, it returns a (perhaps empty) set of argument-sets. Each returned argument-set is conflict-free, but is not necessarily a defence-set of the argument externInstArg passed to the externally-called instance. The output of a recursively-called instance represents a stage in one branch of a search for externInstArg's defence-sets. As such, it might include not just (i) defence-sets of externInstArg, but also (ii) sets which are non-admissible (on account of not being acceptable with respect to themselves), and (iii) sets which strictly subsume defence-sets of externInstArg.

Following Vreeswijk's usage, the argument-sets passed to and returned by this method are called candidate-solutions. A candidate-solution is an argument-set which is 'promising'. The algorithm builds each defence-set by addition, proceeding from the empty set. A candidate-solution cs is (loosely speaking) such that the algorithm has not yet established that cs is neither (a) a defence-set around the argument passed to the externally-called instance, nor (b) a subset of such a defence-set.

Parameters:
arg - a String, denoting an argument.
path - a list of Strings, denoting arguments.
canSols - a set of String-sets, denoting candidate-solutions.
Returns:
a set of String-sets, denoting either (a) the defence-sets around arg in this AF (if called by another method) or (b) candidate-solutions (if called recursively).

preferredExtsContain

public boolean preferredExtsContain(Collection<String>... argColls)
Returns true if, for each of the specified collections, its set-view is a preferred extension of this AF.

If argColls are all sets, this method returns the same as getPreferredExts().containsAll(argColls), but without calculating the preferred extensions.

Parameters:
argColls - one or more Collections of Strings, denoting argument-collections.
Returns:
true if, for each of the specified collections, its set-view is a preferred extension of this AF.

getPreferredExts

public HashSet<HashSet<String>> getPreferredExts()
Returns this AF's preferred extensions.

Returns:
a set of String-sets, denoting this AF's preferred extensions.

getPreferredScepticalExt

public HashSet<String> getPreferredScepticalExt()
Returns the extension prescribed by the sceptical preferred semantics for this AF.

Returns:
a set of Strings, denoting the intersection of this AF's preferred extensions.

completeExtsContain

public boolean completeExtsContain(Collection<String>... argColls)
Returns true if, for each of the specified collections, its set-view is a complete extension of this AF.

If argColls are all sets, this method returns the same as getCompleteExts().containsAll(argColls), but without calculating the complete extensions.

Parameters:
argColls - one or more Collections of Strings, denoting argument-collections.
Returns:
true if, for each of the specified collections, its set-view is a complete extension of this AF.

getCompleteExts

public HashSet<HashSet<String>> getCompleteExts()
Returns this AF's complete extensions.

Returns:
a set of String-sets, denoting this AF's complete extensions.

stableExtsContain

public boolean stableExtsContain(Collection<String>... argColls)
Returns true if, for each of the specified collections, its set-view is a stable extension of this AF.

If argColls are all sets, this method returns the same as getStableExts().containsAll(argColls), but without calculating the stable extensions.

Parameters:
argColls - one or more Collections of Strings, denoting argument-collections.
Returns:
true if, for each of the specified collections, its set-view is a stable extension of this AF.

getStableArgs

public HashSet<String> getStableArgs()
Returns the union of this AF's stable extensions.

Returns:
a set of Strings, denoting the union of this AF's stable extensions.

getStableExts

public HashSet<HashSet<String>> getStableExts()
Returns this AF's stable extensions.

Returns:
a set of String-sets, denoting this AF's stable extensions.

semiStableExtsContain

public boolean semiStableExtsContain(Collection<String>... argColls)
Returns true if, for each of the specified collections, its set-view is a semi-stable extension of this AF.

If argColls are all sets, this method returns the same as getSemiStableExts().containsAll(argColls), but without calculating the semi-stable extensions. It does, however, calculate the preferred extensions and the stable extensions, if they are not already recorded.

Parameters:
argColls - one or more Collections of Strings, denoting argument-collections.
Returns:
true if, for each of the specified collections, its set-view is a semi-stable extension of this AF.

getSemiStableArgs

public HashSet<String> getSemiStableArgs()
Returns the union of this AF's semi-stable extensions.

Returns:
a set of Strings, denoting the union of this AF's semi-stable extensions.

getSemiStableExts

public HashSet<HashSet<String>> getSemiStableExts()
Returns this AF's semi-stable extensions.

Returns:
a set of String-sets, denoting this AF's semi-stable extensions.

getIdealExt

public HashSet<String> getIdealExt()
Returns this AF's ideal extension.

Returns:
a set of Strings, denoting this AF's ideal extension.

getEagerExt

public HashSet<String> getEagerExt()
Returns this AF's eager extension.

Returns:
a set of Strings, denoting this AF's eager extension.

findIdealExtOrEagerExt

private void findIdealExtOrEagerExt(String semantics)
Finds and records this AF's ideal extension or eager extension.

Parameters:
semantics - either "ideal" or "eager", depending on whether the ideal extension or the eager extension is required.
Throws:
IllegalArgumentException - if semantics is neither "ideal" nor "eager".