diff --git a/src/test/java/org/mastodon/mamut/feature/branch/exampleGraph/AbstractExampleGraph.java b/src/test/java/org/mastodon/mamut/feature/branch/exampleGraph/AbstractExampleGraph.java index 0d25b5813..89576f55c 100644 --- a/src/test/java/org/mastodon/mamut/feature/branch/exampleGraph/AbstractExampleGraph.java +++ b/src/test/java/org/mastodon/mamut/feature/branch/exampleGraph/AbstractExampleGraph.java @@ -30,9 +30,11 @@ import javax.annotation.Nonnull; +import org.mastodon.mamut.model.Link; import org.mastodon.mamut.model.Model; import org.mastodon.mamut.model.ModelGraph; import org.mastodon.mamut.model.Spot; +import org.mastodon.mamut.model.branch.BranchLink; import org.mastodon.mamut.model.branch.BranchSpot; import org.mastodon.mamut.model.branch.ModelBranchGraph; @@ -70,6 +72,12 @@ public BranchSpot getBranchSpot(@Nonnull Spot spot) return modelBranchGraph.getBranchVertex( spot, modelBranchGraph.vertexRef() ); } + public BranchLink getBranchLink( @Nonnull Link link ) + { + rebuiltGraphIfRequired(); + return modelBranchGraph.getBranchEdge( link, modelBranchGraph.edgeRef() ); + } + private void rebuiltGraphIfRequired() { if ( ! branchGraphRequiresRebuild ) @@ -87,9 +95,10 @@ protected Spot addNode( @Nonnull String label, int timepoint, double[] xyz ) return spot; } - protected void addEdge( @Nonnull Spot source, @Nonnull Spot target ) + protected Link addEdge( @Nonnull Spot source, @Nonnull Spot target ) { - modelGraph.addEdge( source, target ); + Link link = modelGraph.addEdge( source, target ); branchGraphRequiresRebuild = true; + return link; } }