Interface AbstractDialecticalFramework
-
public interface AbstractDialecticalFramework
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
Nested Classes Modifier and Type Interface Description static interface
AbstractDialecticalFramework.Builder
-
Method Summary
Modifier and Type Method Description default boolean
bipolar()
Checks if the ADF is bipolar.static AbstractDialecticalFramework.Builder
builder()
java.util.Set<Argument>
children(Argument parent)
boolean
contains(Argument arg)
static AbstractDialecticalFramework.Builder
copy(AbstractDialecticalFramework adf)
Creates a copy of the given AbstractDialecticalFramework, which can be modified before build() is called.static AbstractDialecticalFramework
empty()
static AbstractDialecticalFramework.Builder
fromMap(java.util.Map<Argument,AcceptanceCondition> map)
AcceptanceCondition
getAcceptanceCondition(Argument argument)
Guaranteed to be non-null if the ADF contains the argument.java.util.Set<Argument>
getArguments()
int
incomingDegree(Argument arg)
int
kBipolar()
Returns the count k of non-bipolar links, which makes this ADF k-bipolar.Link
link(Argument parent, Argument child)
Computes the link (parent, child) iff necessary and returns it afterwards.java.util.Set<Link>
links()
If the caller just consumes some of the links, the methodlinksStream()
should be preferred to this one.java.util.Set<Link>
linksFrom(Argument parent)
default java.util.stream.Stream<Link>
linksStream()
If the caller just consumes some links, this method should be used.java.util.Set<Link>
linksTo(Argument child)
int
outgoingDegree(Argument arg)
java.util.Set<Argument>
parents(Argument child)
default int
size()
static AbstractDialecticalFramework.Builder
transform(AbstractDialecticalFramework adf, Transformer<AcceptanceCondition> transformer)
Creates a newAbstractDialecticalFramework
with transformed acceptance conditions.
-
-
-
Method Detail
-
empty
static AbstractDialecticalFramework empty()
-
builder
static AbstractDialecticalFramework.Builder builder()
-
fromMap
static AbstractDialecticalFramework.Builder fromMap(java.util.Map<Argument,AcceptanceCondition> map)
-
copy
static AbstractDialecticalFramework.Builder copy(AbstractDialecticalFramework adf)
Creates a copy of the given AbstractDialecticalFramework, which can be modified before build() is called.- Parameters:
adf
- the ADF to copy- Returns:
- the builder initialized with the values of the original ADF
-
transform
static AbstractDialecticalFramework.Builder transform(AbstractDialecticalFramework adf, Transformer<AcceptanceCondition> transformer)
Creates a newAbstractDialecticalFramework
with transformed acceptance conditions.- Parameters:
adf
- the ADFtransformer
- the transformed to use- Returns:
- the builder which is initialized with the transformed acceptance conditions
-
size
default int size()
-
getArguments
java.util.Set<Argument> getArguments()
- Returns:
- an unmodifiable set of all the arguments
-
linksStream
default java.util.stream.Stream<Link> linksStream()
If the caller just consumes some links, this method should be used. Depending on the implementation, the links may be computed lazily and therefore we may avoid unnecessary computation.- Returns:
- a stream of the links of this adf
-
links
java.util.Set<Link> links()
If the caller just consumes some of the links, the methodlinksStream()
should be preferred to this one. Depending on the implementation, the links may be computed lazily and therefore we may avoid unnecessary computation.- Returns:
- an unmodifiable set of all the links
-
link
Link link(Argument parent, Argument child)
Computes the link (parent, child) iff necessary and returns it afterwards.- Parameters:
parent
- the parentchild
- the child- Returns:
- the link (parent, child)
- Throws:
java.lang.IllegalArgumentException
- if the adf does not contain a link (parent, child)
-
linksTo
java.util.Set<Link> linksTo(Argument child)
- Parameters:
child
- the child- Returns:
- a set of links (parent, child)
-
linksFrom
java.util.Set<Link> linksFrom(Argument parent)
- Parameters:
parent
- the parent- Returns:
- a set of links (parent, child)
-
outgoingDegree
int outgoingDegree(Argument arg)
-
incomingDegree
int incomingDegree(Argument arg)
-
contains
boolean contains(Argument arg)
-
getAcceptanceCondition
AcceptanceCondition getAcceptanceCondition(Argument argument)
Guaranteed to be non-null if the ADF contains the argument.- Parameters:
argument
- some argument of this ADF- Returns:
- the found acceptance condition, never
null
- Throws:
java.lang.IllegalArgumentException
- if the argument is not contained in the ADF
-
bipolar
default boolean bipolar()
Checks if the ADF is bipolar. May compute all links to do so.- Returns:
- true iff all of the links are bipolar
-
kBipolar
int kBipolar()
Returns the count k of non-bipolar links, which makes this ADF k-bipolar.- Returns:
- k
-
-