Class ConflictGraph
- java.lang.Object
-
- pl.poznan.put.structure.pseudoknots.ConflictGraph
-
- Direct Known Subclasses:
ImmutableConflictGraph
@Immutable public abstract class ConflictGraph extends Object
A graph of conflicts between regions. A conflict is when one region starts/end in the middle of another region.d
-
-
Constructor Summary
Constructors Constructor Description ConflictGraph()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<ConflictClique>conflictCliques()Searches for connected components (named conflict cliques, although they are not real cliques).protected Map<Region,Set<Region>>conflicts()Set<Region>conflictsWith(Region region)Returns all regions that conflict with a given one.booleanhasConflicts()booleanhasConflicts(Region region)Checks if a given region has any conflicts.static booleanisConflicting(Region first, Region second)Checks if given regions are conflicting.protected abstract List<Region>regions()Set<Region>regionsWithConflicts()Returns all regions that are in conflict with at least one other region.voidremoveRegion(Region region)Removes region and all associated conflicts with it from the graph.ConflictGraphsimplified()Creates a simplified copy of this instance.
-
-
-
Method Detail
-
isConflicting
public static boolean isConflicting(Region first, Region second)
Checks if given regions are conflicting. A conflict is when one region starts/ends in the middle of another region.- Parameters:
first- The first region.second- The second region.- Returns:
- True if regions are conflicting.
-
removeRegion
public final void removeRegion(Region region)
Removes region and all associated conflicts with it from the graph.- Parameters:
region- The region to remove.
-
conflictsWith
public final Set<Region> conflictsWith(Region region)
Returns all regions that conflict with a given one.- Parameters:
region- The region to search conflict for.- Returns:
- A collection of regions in conflict with the given one.
-
regionsWithConflicts
public final Set<Region> regionsWithConflicts()
Returns all regions that are in conflict with at least one other region.- Returns:
- A set of regions which are in at least one conflict.
-
hasConflicts
public final boolean hasConflicts()
- Returns:
- True if at least one region has at least one conflict.
-
hasConflicts
public final boolean hasConflicts(Region region)
Checks if a given region has any conflicts.- Parameters:
region- The region to check.- Returns:
- True if the given region has at least one conflict.
-
conflictCliques
public final List<ConflictClique> conflictCliques()
Searches for connected components (named conflict cliques, although they are not real cliques).- Returns:
- The list of conflict cliques.
-
simplified
public final ConflictGraph simplified()
Creates a simplified copy of this instance. The simplification merges smaller region which are fully embedded into the bigger ones, if both the small and big region have exactly the same conflicts.- Returns:
- A simplified instance of this conflict graph.
-
-