Interface AbstractDialecticalFramework
- All Superinterfaces:
ArgumentationFramework<Argument>
,BeliefBase
,Collection<Argument>
,GeneralGraph<Argument>
,Graph<Argument>
,Iterable<Argument>
public interface AbstractDialecticalFramework
extends Graph<Argument>, Collection<Argument>, ArgumentationFramework<Argument>
The implementing subtypes must ensure the following properties:
- Immutability
- All methods return a non-null value if its parameters, e.g. arguments, are from this ADF
- If a method returns a collection or stream, all its elements are non-null
AbstractDialecticalFramework
implementations
more convenient to the user, since it avoids unnecessary nullchecks and
therefore leads to more readable code. Immutability should lead to more
robust code, since an ADF always remains in a valid state after creation. It
makes it also easier to use in a parallel context.- Author:
- Mathias Hofer
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Builder interface for constructing instances ofAbstractDialecticalFramework
. -
Field Summary
Fields inherited from interface org.tweetyproject.graphs.Graph
IGNORE_SELFLOOPS, INVERT_SELFLOOPS, REMOVE_SELFLOOPS
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
bipolar()
Checks if the ADF is bipolar, meaning all links are either supporting or attacking.builder()
Returns a builder for constructing a newAbstractDialecticalFramework
.Returns a set of child arguments for the given parent argument.boolean
Checks if the given argument is contained in thisAbstractDialecticalFramework
.static AbstractDialecticalFramework
empty()
Returns an emptyAbstractDialecticalFramework
.static AbstractDialecticalFramework
Reads anAbstractDialecticalFramework
from a file.Creates a builder from a map of arguments and their corresponding acceptance conditions.getAcceptanceCondition
(Argument argument) Retrieves the acceptance condition for the specified argument.Returns an unmodifiable set of all the arguments in thisAbstractDialecticalFramework
.int
incomingDegree
(Argument arg) Returns the number of incoming links to the given argument.int
kBipolar()
Returns the number of non-bipolar links, indicating the degree of bipolarity in this ADF.Computes and returns the link between the given parent and child arguments.links()
Returns an unmodifiable set of all the links in thisAbstractDialecticalFramework
.Returns a set of links originating from the specified parent argument.Returns a stream of the links in thisAbstractDialecticalFramework
.Returns a set of links directed towards the specified child argument.int
outgoingDegree
(Argument arg) Returns the number of outgoing links from the given argument.Returns a set of parent arguments for the given child argument.default SemanticsStep
query()
Initiates a query on thisAbstractDialecticalFramework
using the default configuration.default int
size()
Returns the number of arguments in thisAbstractDialecticalFramework
.transform
(BiFunction<Argument, AcceptanceCondition, AcceptanceCondition> transformer) Creates a newAbstractDialecticalFramework
with acceptance conditions transformed based on both the argument and its acceptance condition.transform
(Function<AcceptanceCondition, AcceptanceCondition> transformer) Creates a newAbstractDialecticalFramework
with acceptance conditions transformed using the provided function.transform
(Transformer<AcceptanceCondition> transformer) Creates a newAbstractDialecticalFramework
with acceptance conditions transformed using aTransformer
.Methods inherited from interface org.tweetyproject.arg.dung.syntax.ArgumentationFramework
containsAll, getNodes, isAttacked
Methods inherited from interface org.tweetyproject.commons.BeliefBase
getMinimalSignature, toString
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface org.tweetyproject.graphs.GeneralGraph
getRestriction
Methods inherited from interface org.tweetyproject.graphs.Graph
add, add, areAdjacent, contains, existsDirectedPath, getAdjacencyMatrix, getChildren, getComplementGraph, getEdge, getEdges, getNeighbors, getNodes, getNumberOfEdges, getNumberOfNodes, getParents, getStronglyConnectedComponents, getSubgraphs, hasSelfLoops, isWeightedGraph, iterator, toString
-
Method Details
-
empty
Returns an emptyAbstractDialecticalFramework
. This can be used to create an ADF with no arguments or links.- Returns:
- an empty AbstractDialecticalFramework instance
-
builder
Returns a builder for constructing a newAbstractDialecticalFramework
. The builder allows for adding arguments, acceptance conditions, and links incrementally.- Returns:
- a builder for constructing an AbstractDialecticalFramework
-
fromFile
Reads anAbstractDialecticalFramework
from a file. The file is parsed into an ADF using a format parser.- Parameters:
file
- the file containing the ADF definition- Returns:
- an AbstractDialecticalFramework parsed from the file
- Throws:
FileNotFoundException
- if the file is not foundIOException
- if an I/O error occurs while reading the file
-
fromMap
Creates a builder from a map of arguments and their corresponding acceptance conditions.- Parameters:
map
- a map of arguments to acceptance conditions- Returns:
- a builder for constructing an AbstractDialecticalFramework from the given map
-
transform
AbstractDialecticalFramework transform(Function<AcceptanceCondition, AcceptanceCondition> transformer) Creates a newAbstractDialecticalFramework
with acceptance conditions transformed using the provided function.- Parameters:
transformer
- the transformer to apply to each acceptance condition- Returns:
- a new ADF with transformed acceptance conditions
-
transform
AbstractDialecticalFramework transform(BiFunction<Argument, AcceptanceCondition, AcceptanceCondition> transformer) Creates a newAbstractDialecticalFramework
with acceptance conditions transformed based on both the argument and its acceptance condition.- Parameters:
transformer
- the transformer to apply to each acceptance condition and argument- Returns:
- a new ADF with transformed acceptance conditions
-
transform
Creates a newAbstractDialecticalFramework
with acceptance conditions transformed using aTransformer
.- Parameters:
transformer
- the transformer to apply to each acceptance condition- Returns:
- a new ADF with transformed acceptance conditions
-
query
Initiates a query on thisAbstractDialecticalFramework
using the default configuration. The returnedSemanticsStep
allows further refinement of the query.- Returns:
- a SemanticsStep to refine the query
-
size
default int size()Returns the number of arguments in thisAbstractDialecticalFramework
.- Specified by:
size
in interfaceCollection<Argument>
- Returns:
- the number of arguments in this ADF
-
getArguments
Returns an unmodifiable set of all the arguments in thisAbstractDialecticalFramework
.- Returns:
- an unmodifiable set of arguments
-
linksStream
Returns a stream of the links in thisAbstractDialecticalFramework
. This method is preferable if the caller only needs to consume some of the links.- Returns:
- a stream of links in this ADF
-
links
Returns an unmodifiable set of all the links in thisAbstractDialecticalFramework
. This method returns all the links and should be used when access to all links is needed.- Returns:
- an unmodifiable set of links in this ADF
-
link
Computes and returns the link between the given parent and child arguments.- Parameters:
parent
- the parent argumentchild
- the child argument- Returns:
- the link between the parent and child
- Throws:
IllegalArgumentException
- if the ADF does not contain a link between the parent and child
-
linksTo
-
linksFrom
-
parents
-
children
-
outgoingDegree
Returns the number of outgoing links from the given argument.- Parameters:
arg
- the argument- Returns:
- the number of outgoing links
-
incomingDegree
Returns the number of incoming links to the given argument.- Parameters:
arg
- the argument- Returns:
- the number of incoming links
-
contains
Checks if the given argument is contained in thisAbstractDialecticalFramework
.- Parameters:
arg
- the argument to check- Returns:
- true if the argument is contained, false otherwise
-
getAcceptanceCondition
Retrieves the acceptance condition for the specified argument. The acceptance condition is guaranteed to be non-null if the argument is present in the ADF.- Parameters:
argument
- the argument for which to retrieve the acceptance condition- Returns:
- the acceptance condition for the given argument
- Throws:
IllegalArgumentException
- if the argument is not contained in the ADF
-
bipolar
default boolean bipolar()Checks if the ADF is bipolar, meaning all links are either supporting or attacking.- Returns:
- true if the ADF is bipolar, false otherwise
-
kBipolar
int kBipolar()Returns the number of non-bipolar links, indicating the degree of bipolarity in this ADF.- Returns:
- the count of non-bipolar links
-