Class SetAf
java.lang.Object
org.tweetyproject.commons.BeliefSet<Argument,SetAfSignature>
org.tweetyproject.arg.setaf.syntax.SetAf
- All Implemented Interfaces:
Comparable<SetAf>
,Iterable<Argument>
,Collection<Argument>
,ArgumentationFramework<Argument>
,BeliefBase
,DirHyperGraph<Argument>
,GeneralGraph<Argument>
public class SetAf
extends BeliefSet<Argument,SetAfSignature>
implements DirHyperGraph<Argument>, Comparable<SetAf>, ArgumentationFramework<Argument>
This class implements a SetAF in the sense of Nielson/Parson:
- Author:
- Sebastian Franke, Lars Bengel
- See Also:
-
Field Summary
Fields inherited from class org.tweetyproject.commons.BeliefSet
EQUALS_USES_SIGNATURE
Fields inherited from interface org.tweetyproject.graphs.DirHyperGraph
IGNORE_SELFLOOPS, INVERT_SELFLOOPS, REMOVE_SELFLOOPS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Add argument to SetAfboolean
Adds all arguments and attacks of the given theory to this theoryboolean
Return whether the attack was added or notboolean
add
(GeneralEdge edge) Adds the given edge to this DirHyperGraph.boolean
addAllAttacks
(Set<SetAttack> edges2) Adds the set of attacks to this SetAf theory.boolean
Adds an attack from the first argument to the second to this SetAf theory.boolean
Adds an attack from the first argument to the second to this SetAf theory.boolean
areAdjacent
(Argument a, Argument b) Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.clone()
clones the SetAfint
boolean
Returns "true" when this DirHyperGraph contains the given node or edge.boolean
containsAll
(Collection<?> c) Checks if the argumentation framework contains all the elements in the given collection.boolean
containsAttack
(SetAttack att) Checks whether this theory contains the given attack.boolean
boolean
existsDirectedPath
(Argument node1, Argument node2) Checks whether there is a (directed) path from node1 to node2.static <S extends Node>
booleanexistsDirectedPath
(SetAf hyperGraph, Argument node1, Argument node2) Return whether the path existsThe characteristic function of an abstract argumentation framework: F_AF(S) = {A|A is acceptable wrt.Returns the adjacency matrix of this DirHyperGraph (the order of the nodes is the same as returned by "iterator()").getAttacked
(Collection<Argument> arguments) Computes the set of arguments collectively attacked byarguments
.getAttackers
(Argument node) Computes the set {A | (A,argument) in attacks}.Return all attacksgetChildren
(Set<Argument> node) Return the children of the nodegetChildren
(Node node) Returns the set of children (node connected via an undirected edge or a directed edge where the given node is the parent) of the given node.getComplementGraph
(int selfloops) Returns the complement DirHyperGraph of this DirHyperGraph, i.e.getDirEdge
(Set<Argument> node1, Node b) Return the edge between the twoReturns the corresponding edge (a,b) if a and b are adjacent.getEdges()
Returns the edges of this DirHyperGraph.Returns the signature of the language of this knowledge base.getNeighbors
(Argument node) Returns the set of neighbors of the given node.getNodes()
Returns the nodes of this DirHyperGraph.int
Returns the number of nodes in this DirHyperGraph.getParents
(Argument node) Return the arguments' parentsgetParents
(Node node) Returns the set of parents (node connected via an undirected edge or a directed edge where the given node is the child) of the given node.getRestriction
(Collection<Argument> nodes) Returns copy of this DirHyperGraph consisting only of the given nodes and all corresponding edges.Returns the strongly connected components of this DirHyperGraph.Returns the set of sub graphs of the given graph.Returns the set of sub DirHyperGraphs of this DirHyperGraph.static Collection
<DirHyperGraph<Argument>> Return the subgraphs of the SetAfint
hashCode()
boolean
Returns "true" iff the DirHyperGraph has a self loop (an edge from a node to itself).boolean
isAcceptable
(Argument argument, Extension<SetAf> ext) returns true if every attacker onargument
is attacked by some accepted argument wrt.boolean
isAdmissible
(Extension<SetAf> ext) returns true if every accepted argument of this is defended by some accepted argument wrt.boolean
isAttacked
(Argument argument, Extension<? extends ArgumentationFramework<?>> ext) returns true if some argument ofext
attacks argument.boolean
isAttackedBy
(Argument arg2, Collection<Argument> ext) returns true if some argument ofext
is attacked by argument.boolean
isAttackedBy
(Argument arg1, Argument arg2) Checks whether arg1 is attacked by arg2.boolean
returns true ifarguments
attack all other arguments in the theoryboolean
isConflictFree
(Extension<SetAf> arguments) returns true if one arguments inarguments
attacks another within this attack relation.boolean
Checks whether the given extension is stable wrt.boolean
Checks whether this DirHyperGraph only contains weighted edges.iterator()
Return the powerset ofPretty prints the SetAfboolean
Removes the argument and all its attacksboolean
Removes the given attack from this SetAf theory.boolean
removeAll
(Collection<?> c) int
size()
toString()
Methods inherited from class org.tweetyproject.commons.BeliefSet
add, addAll, clear, getSignature, isEmpty, remove, retainAll, setSignature, toArray, toArray, toString
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
SetAf
public SetAf()Initializes a new enpty SetAf -
SetAf
Creates a new theory from the given DirHyperGraph.- Parameters:
graph
- some DirHyperGraph
-
-
Method Details
-
size
public int size()- Specified by:
size
in interfaceCollection<Argument>
- Overrides:
size
in classBeliefSet<Argument,
SetAfSignature>
-
iterator
- Specified by:
iterator
in interfaceCollection<Argument>
- Specified by:
iterator
in interfaceDirHyperGraph<Argument>
- Specified by:
iterator
in interfaceIterable<Argument>
- Overrides:
iterator
in classBeliefSet<Argument,
SetAfSignature>
-
clone
-
getMinimalSignature
Description copied from interface:BeliefBase
Returns the signature of the language of this knowledge base.- Specified by:
getMinimalSignature
in interfaceBeliefBase
- Returns:
- the signature of the language of this knowledge base.
-
isAttackingAllOtherArguments
-
isConflictFree
-
isAcceptable
returns true if every attacker onargument
is attacked by some accepted argument wrt. the given theory.- Parameters:
argument
- an argumentext
- an extension (the knowledge base)- Returns:
- true if every attacker on
argument
is attacked by some accepted argument wrt. the given theory.
-
isAdmissible
returns true if every accepted argument of this is defended by some accepted argument wrt. the given SetAf theory.- Parameters:
ext
- an extension.- Returns:
- true if every accepted argument of this is defended by some accepted argument wrt. the given SetAf theory.
-
getAttackers
Computes the set {A | (A,argument) in attacks}.- Parameters:
node
- an argument- Returns:
- the set of all sets of arguments that attack
argument
.
-
getAttacked
Computes the set of arguments collectively attacked byarguments
.- Parameters:
arguments
- a set of arguments- Returns:
- set of arguments collectively attacked by
arguments
-
isAttacked
returns true if some argument ofext
attacks argument.- Specified by:
isAttacked
in interfaceArgumentationFramework<Argument>
- Parameters:
argument
- an argumentext
- an extension, i.e. a set of arguments- Returns:
- true if some argument of
ext
attacks argument.
-
isAttackedBy
returns true if some argument ofext
is attacked by argument.- Parameters:
arg2
- an argumentext
- an extension, i.e. a set of arguments- Returns:
- true if some argument of
ext
is attacked by argument.
-
isAttackedBy
-
isStable
-
faf
-
add
Add argument to SetAf- Specified by:
add
in interfaceCollection<Argument>
- Specified by:
add
in interfaceDirHyperGraph<Argument>
- Overrides:
add
in classBeliefSet<Argument,
SetAfSignature> - Parameters:
arg
- some argument- Returns:
- true if argument has been added
-
addAttack
-
addAttack
-
remove
Removes the given attack from this SetAf theory.- Parameters:
attack
- an attack- Returns:
- "true" if the set of attacks has been modified.
-
remove
Removes the argument and all its attacks- Parameters:
a
- some argument- Returns:
- true if this structure has been changed
-
removeAll
- Specified by:
removeAll
in interfaceCollection<Argument>
- Overrides:
removeAll
in classBeliefSet<Argument,
SetAfSignature>
-
containsAll
Description copied from interface:ArgumentationFramework
Checks if the argumentation framework contains all the elements in the given collection.- Specified by:
containsAll
in interfaceArgumentationFramework<Argument>
- Specified by:
containsAll
in interfaceCollection<Argument>
- Overrides:
containsAll
in classBeliefSet<Argument,
SetAfSignature> - Parameters:
c
- the collection of elements to be checked for containment.- Returns:
- true if this framework contains all elements in the specified collection, false otherwise.
-
containsAttack
Checks whether this theory contains the given attack.- Parameters:
att
- some attack- Returns:
- "true" iff this theory contains the given attack.
-
addAllAttacks
-
add
Adds all arguments and attacks of the given theory to this theory- Parameters:
theory
- some SetAf theory- Returns:
- "true" if this SetAf Theory has been modified
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Argument>
- Overrides:
hashCode
in classBeliefSet<Argument,
SetAfSignature>
-
equals
- Specified by:
equals
in interfaceCollection<Argument>
- Overrides:
equals
in classBeliefSet<Argument,
SetAfSignature>
-
compareTo
- Specified by:
compareTo
in interfaceComparable<SetAf>
-
add
Return whether the attack was added or not- Parameters:
edge
- attack- Returns:
- whether the attack was added or not
-
getNodes
Description copied from interface:DirHyperGraph
Returns the nodes of this DirHyperGraph.- Specified by:
getNodes
in interfaceArgumentationFramework<Argument>
- Specified by:
getNodes
in interfaceDirHyperGraph<Argument>
- Specified by:
getNodes
in interfaceGeneralGraph<Argument>
- Returns:
- the nodes of this DirHyperGraph.
-
getNumberOfNodes
public int getNumberOfNodes()Description copied from interface:DirHyperGraph
Returns the number of nodes in this DirHyperGraph.- Specified by:
getNumberOfNodes
in interfaceDirHyperGraph<Argument>
- Returns:
- the number of nodes in this DirHyperGraph.
-
areAdjacent
Description copied from interface:DirHyperGraph
Returns "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.- Specified by:
areAdjacent
in interfaceDirHyperGraph<Argument>
- Parameters:
a
- some nodeb
- some node- Returns:
- "true" iff the two nodes are connected by a directed edge from a to b or an undirected edge.
-
getEdge
Description copied from interface:DirHyperGraph
Returns the corresponding edge (a,b) if a and b are adjacent. Otherwise it returns null.- Specified by:
getEdge
in interfaceDirHyperGraph<Argument>
- Parameters:
a
- some nodeb
- some node- Returns:
- the edge (a,b) or null.
-
getAttacks
-
getDirEdge
-
getEdges
Description copied from interface:DirHyperGraph
Returns the edges of this DirHyperGraph.- Specified by:
getEdges
in interfaceDirHyperGraph<Argument>
- Specified by:
getEdges
in interfaceGeneralGraph<Argument>
- Returns:
- the edges of this DirHyperGraph.
-
contains
Description copied from interface:DirHyperGraph
Returns "true" when this DirHyperGraph contains the given node or edge.- Specified by:
contains
in interfaceCollection<Argument>
- Specified by:
contains
in interfaceDirHyperGraph<Argument>
- Overrides:
contains
in classBeliefSet<Argument,
SetAfSignature> - Parameters:
obj
- an object- Returns:
- "true" if this DirHyperGraph contains the given node or edge.
-
getChildren
Return the children of the node- Parameters:
node
- the node- Returns:
- the children of the node
-
getParents
Description copied from interface:DirHyperGraph
Returns the set of parents (node connected via an undirected edge or a directed edge where the given node is the child) of the given node.- Specified by:
getParents
in interfaceDirHyperGraph<Argument>
- Parameters:
node
- some node (must be in the DirHyperGraph).- Returns:
- the set of parents of the given node.
-
getParents
Return the arguments' parents- Parameters:
node
- an argument- Returns:
- the arguments' parents
-
existsDirectedPath
-
existsDirectedPath
Description copied from interface:DirHyperGraph
Checks whether there is a (directed) path from node1 to node2.- Specified by:
existsDirectedPath
in interfaceDirHyperGraph<Argument>
- Parameters:
node1
- some node.node2
- some node.- Returns:
- "true" if there is a directed path from node1 to node2.
-
getNeighbors
Description copied from interface:DirHyperGraph
Returns the set of neighbors of the given node.- Specified by:
getNeighbors
in interfaceDirHyperGraph<Argument>
- Parameters:
node
- some node (must be in the DirHyperGraph).- Returns:
- the set of neighbors of the given node.
-
getAdjacencyMatrix
Description copied from interface:DirHyperGraph
Returns the adjacency matrix of this DirHyperGraph (the order of the nodes is the same as returned by "iterator()").- Specified by:
getAdjacencyMatrix
in interfaceDirHyperGraph<Argument>
- Returns:
- the adjacency matrix of this DirHyperGraph
-
powerSet
-
getComplementGraph
Description copied from interface:DirHyperGraph
Returns the complement DirHyperGraph of this DirHyperGraph, i.e. the DirHyperGraph on the same set of vertices as this DirHyperGraph that connects two vertices v and w with an edge if and only if v and w are not connected in this DirHyperGraph.- Specified by:
getComplementGraph
in interfaceDirHyperGraph<Argument>
- Parameters:
selfloops
- Indicates how to deal with selfloops:
IGNORE_SELFLOOPS - ignore self loops (don't add and don't remove)
INVERT_SELFLOOPS - deal with self loops like ordinary edges (add if not present and remove if present)
REMOVE_SELFLOOPS - simple remove self loops, but don't add new ones.- Returns:
- the complement DirHyperGraph of this DirHyperGraph.
-
getStronglyConnectedComponents
Description copied from interface:DirHyperGraph
Returns the strongly connected components of this DirHyperGraph. A set of nodes is strongly connected, if there is a path from each node to each other. A set of nodes is called strongly connected component if it is strongly connected and maximal with respect to set inclusion.- Specified by:
getStronglyConnectedComponents
in interfaceDirHyperGraph<Argument>
- Returns:
- the strongly connected components of this DirHyperGraph.
-
getSubgraphs
Returns the set of sub graphs of the given graph.- Parameters:
g
- a graph- Returns:
- the set of sub graphs of the given graph.
-
getRestriction
Description copied from interface:DirHyperGraph
Returns copy of this DirHyperGraph consisting only of the given nodes and all corresponding edges.- Specified by:
getRestriction
in interfaceDirHyperGraph<Argument>
- Specified by:
getRestriction
in interfaceGeneralGraph<Argument>
- Parameters:
nodes
- a set of nodes- Returns:
- a DirHyperGraph.
-
hasSelfLoops
public boolean hasSelfLoops()Description copied from interface:DirHyperGraph
Returns "true" iff the DirHyperGraph has a self loop (an edge from a node to itself).- Specified by:
hasSelfLoops
in interfaceDirHyperGraph<Argument>
- Returns:
- "true" iff the DirHyperGraph has a self loop (an edge from a node to itself).
-
isWeightedGraph
public boolean isWeightedGraph()Description copied from interface:DirHyperGraph
Checks whether this DirHyperGraph only contains weighted edges.- Specified by:
isWeightedGraph
in interfaceDirHyperGraph<Argument>
- Returns:
- "true" if all edges are weighted in this DirHyperGraph.
-
add
Description copied from interface:DirHyperGraph
Adds the given edge to this DirHyperGraph. If at least one of the nodes the given edge connects is not in the DirHyperGraph, an illegal argument exception is thrown.- Specified by:
add
in interfaceDirHyperGraph<Argument>
- Parameters:
edge
- some edge.- Returns:
- "true" iff the edge has been added successfully.
-
toString
- Specified by:
toString
in interfaceBeliefBase
- Specified by:
toString
in interfaceDirHyperGraph<Argument>
- Overrides:
toString
in classBeliefSet<Argument,
SetAfSignature>
-
getChildren
Description copied from interface:DirHyperGraph
Returns the set of children (node connected via an undirected edge or a directed edge where the given node is the parent) of the given node.- Specified by:
getChildren
in interfaceDirHyperGraph<Argument>
- Parameters:
node
- some node (must be in the DirHyperGraph).- Returns:
- the set of children of the given node.
-
getSubGraphs
Description copied from interface:DirHyperGraph
Returns the set of sub DirHyperGraphs of this DirHyperGraph.- Specified by:
getSubGraphs
in interfaceDirHyperGraph<Argument>
- Returns:
- the set of sub DirHyperGraphs of this DirHyperGraph.
-
getSubgraphsHelper
Return the subgraphs of the SetAf- Parameters:
g
- the SetAf- Returns:
- the subgraphs of the SetAf
-
prettyPrint
-