Package owl.automaton.edge
Class Edge<S>
- java.lang.Object
-
- owl.automaton.edge.Edge<S>
-
- Type Parameters:
S
- The type of the (successor) state.
public abstract class Edge<S> extends Object
This class (with specialised subclasses) represents edges of automata including their acceptance membership.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract PrimitiveIterator.OfInt
acceptanceSetIterator()
An iterator containing all acceptance sets this edge is a member of in ascending order.abstract BitSet
acceptanceSets()
abstract void
forEachAcceptanceSet(IntConsumer action)
abstract boolean
hasAcceptanceSets()
Returns whether this edge has any acceptance set.abstract boolean
inSet(int i)
Test membership of this edge for a specific acceptance set.abstract int
largestAcceptanceSet()
Returns the largest acceptance set this edge is a member of, or-1
if none.static <S> Edge<S>
of(S successor)
Creates an edge which belongs to no acceptance set.static <S> Edge<S>
of(S successor, int acceptance)
Creates an edge which belongs to a single acceptance set.static <S> Edge<S>
of(S successor, BitSet acceptance)
Creates an edge which belongs to the specified acceptance sets.abstract int
smallestAcceptanceSet()
Returns the largest acceptance set this edge is a member of, orInteger.MAX_VALUE
if none.S
successor()
Get the target state of the edge.String
toString()
Edge<S>
withAcceptance(int i)
Edge<S>
withAcceptance(BitSet acceptance)
Edge<S>
withAcceptance(IntUnaryOperator transformer)
Edge<S>
withoutAcceptance()
abstract <T> Edge<T>
withSuccessor(T successor)
Returns an edge which has the same acceptance but the given state as successor.
-
-
-
Method Detail
-
of
public static <S> Edge<S> of(S successor)
Creates an edge which belongs to no acceptance set.- Type Parameters:
S
- Type of the successor.- Parameters:
successor
- Successor of this edge.- Returns:
- An edge leading to
successor
with no acceptance.
-
of
public static <S> Edge<S> of(S successor, @Nonnegative int acceptance)
Creates an edge which belongs to a single acceptance set.- Type Parameters:
S
- Type of the successor.- Parameters:
successor
- Successor of this edge.acceptance
- The delegate set this edge should belong to.- Returns:
- An edge leading to
successor
with given acceptance.
-
of
public static <S> Edge<S> of(S successor, BitSet acceptance)
Creates an edge which belongs to the specified acceptance sets.- Type Parameters:
S
- Type of the successor.- Parameters:
successor
- Successor of this edge.acceptance
- The delegate sets this edge should belong to.- Returns:
- An edge leading to
successor
with given acceptance.
-
acceptanceSetIterator
public abstract PrimitiveIterator.OfInt acceptanceSetIterator()
An iterator containing all acceptance sets this edge is a member of in ascending order.- Returns:
- An iterator with all acceptance sets of this edge.
-
forEachAcceptanceSet
public abstract void forEachAcceptanceSet(IntConsumer action)
-
acceptanceSets
public abstract BitSet acceptanceSets()
-
successor
public final S successor()
Get the target state of the edge.- Returns:
- The state the edge points to.
-
hasAcceptanceSets
public abstract boolean hasAcceptanceSets()
Returns whether this edge has any acceptance set.
-
inSet
public abstract boolean inSet(@Nonnegative int i)
Test membership of this edge for a specific acceptance set.- Parameters:
i
- The number of the acceptance set.- Returns:
- True if this edge is a member, false otherwise.
-
largestAcceptanceSet
public abstract int largestAcceptanceSet()
Returns the largest acceptance set this edge is a member of, or-1
if none.
-
smallestAcceptanceSet
public abstract int smallestAcceptanceSet()
Returns the largest acceptance set this edge is a member of, orInteger.MAX_VALUE
if none.
-
withAcceptance
public Edge<S> withAcceptance(IntUnaryOperator transformer)
-
withSuccessor
public abstract <T> Edge<T> withSuccessor(T successor)
Returns an edge which has the same acceptance but the given state as successor.
-
-