@@ -56,7 +56,11 @@ public class TrackScheme extends AbstractTrackMateModelView
5656
5757 private static final boolean DEBUG_SELECTION = false ;
5858
59- public static final String INFO_TEXT = "<html>" + "TrackScheme displays the tracking results as track lanes, <br>" + "ignoring the spot actual position. " + "<p>" + "Tracks can be edited through link creation and removal." + "</html>" ;
59+ public static final String INFO_TEXT = "<html>"
60+ + "TrackScheme displays the tracking results as track lanes, <br>"
61+ + "ignoring the spot actual position. "
62+ + "<p>" + "Tracks can be edited through link creation and removal."
63+ + "</html>" ;
6064
6165 static final int Y_COLUMN_SIZE = 96 ;
6266
@@ -85,7 +89,9 @@ public class TrackScheme extends AbstractTrackMateModelView
8589
8690 static final Color GRID_COLOR = Color .GRAY ;
8791
88- /** Are linking costs displayed by default? Can be changed in the toolbar. */
92+ /**
93+ * Are linking costs displayed by default? Can be changed in the toolbar.
94+ */
8995 static final boolean DEFAULT_DO_DISPLAY_COSTS_ON_EDGES = false ;
9096
9197 /** Do we display the background decorations by default? */
@@ -127,9 +133,9 @@ public class TrackScheme extends AbstractTrackMateModelView
127133 /**
128134 * The current row length for each frame. That is, for frame <code>i</code>,
129135 * the number of cells on the row corresponding to frame <code>i</code> is
130- * <code>rowLength.get(i)</code>.
136+ * <code>rowLength.get(i)</code>.
131137 */
132- private Map < Integer , Integer > rowLengths = new HashMap < >();
138+ private Map < Integer , Integer > rowLengths = new HashMap <>();
133139
134140 /**
135141 * Stores the column index that is the first one after all the track
@@ -505,13 +511,12 @@ public void selectionChanged( final SelectionChangeEvent event )
505511 {
506512 System .out .println ( "[TrackSchemeFrame] selectionChanged: received event " + event .hashCode () + " from " + event .getSource () + ". Fire flag is " + doFireSelectionChangeEvent );
507513 }
508- if ( !doFireSelectionChangeEvent ) {
509- return ;
510- }
514+ if ( !doFireSelectionChangeEvent )
515+ { return ; }
511516 doFireSelectionChangeEvent = false ;
512517
513518 {
514- final ArrayList < Object > newSelection = new ArrayList < >( selectionModel .getSpotSelection ().size () + selectionModel .getEdgeSelection ().size () );
519+ final ArrayList < Object > newSelection = new ArrayList <>( selectionModel .getSpotSelection ().size () + selectionModel .getEdgeSelection ().size () );
515520 final Iterator < DefaultWeightedEdge > edgeIt = selectionModel .getEdgeSelection ().iterator ();
516521 while ( edgeIt .hasNext () )
517522 {
@@ -566,22 +571,21 @@ public void centerViewOn( final Spot spot )
566571 public void modelChanged ( final ModelChangeEvent event )
567572 {
568573 // Only catch model changes
569- if ( event .getEventID () != ModelChangeEvent .MODEL_MODIFIED ) {
570- return ;
571- }
574+ if ( event .getEventID () != ModelChangeEvent .MODEL_MODIFIED )
575+ { return ; }
572576
573577 graph .getModel ().beginUpdate ();
574578 try
575579 {
576- final ArrayList < mxICell > cellsToRemove = new ArrayList < >();
580+ final ArrayList < mxICell > cellsToRemove = new ArrayList <>();
577581
578582 final int targetColumn = getUnlaidSpotColumn ();
579583
580584 // Deal with spots
581585 if ( !event .getSpots ().isEmpty () )
582586 {
583587
584- final Collection < mxCell > spotsWithStyleToUpdate = new HashSet < >();
588+ final Collection < mxCell > spotsWithStyleToUpdate = new HashSet <>();
585589
586590 for ( final Spot spot : event .getSpots () )
587591 {
@@ -638,8 +642,8 @@ else if ( event.getSpotFlag( spot ) == ModelChangeEvent.FLAG_SPOT_REMOVED )
638642 * Here we keep track of the spot and edge cells which style
639643 * we need to update.
640644 */
641- final Map < Integer , Set < mxCell >> edgesToUpdate = new HashMap <>();
642- final Collection < mxCell > spotsWithStyleToUpdate = new HashSet < >();
645+ final Map < Integer , Set < mxCell > > edgesToUpdate = new HashMap <>();
646+ final Collection < mxCell > spotsWithStyleToUpdate = new HashSet <>();
643647
644648 for ( final DefaultWeightedEdge edge : event .getEdges () )
645649 {
@@ -688,7 +692,7 @@ else if ( event.getSpotFlag( spot ) == ModelChangeEvent.FLAG_SPOT_REMOVED )
688692 Set < mxCell > edgeSet = edgesToUpdate .get ( trackID );
689693 if ( edgeSet == null )
690694 {
691- edgeSet = new HashSet < >();
695+ edgeSet = new HashSet <>();
692696 edgesToUpdate .put ( trackID , edgeSet );
693697 }
694698
@@ -718,7 +722,7 @@ else if ( event.getSpotFlag( spot ) == ModelChangeEvent.FLAG_SPOT_REMOVED )
718722 Set < mxCell > edgeSet = edgesToUpdate .get ( trackID );
719723 if ( edgeSet == null )
720724 {
721- edgeSet = new HashSet < >();
725+ edgeSet = new HashSet <>();
722726 edgesToUpdate .put ( trackID , edgeSet );
723727 }
724728 edgeSet .add ( edgeCell );
@@ -731,7 +735,7 @@ else if ( event.getEdgeFlag( edge ) == ModelChangeEvent.FLAG_EDGE_MODIFIED )
731735 Set < mxCell > edgeSet = edgesToUpdate .get ( trackID );
732736 if ( edgesToUpdate .get ( trackID ) == null )
733737 {
734- edgeSet = new HashSet < >();
738+ edgeSet = new HashSet <>();
735739 edgesToUpdate .put ( trackID , edgeSet );
736740 }
737741 edgeSet .add ( graph .getCellFor ( edge ) );
@@ -899,13 +903,12 @@ protected void initDisplaySettings()
899903 */
900904 private void userChangedSelection ( final Collection < Object > added , final Collection < Object > removed )
901905 { // Seems to be inverted
902- if ( !doFireSelectionChangeEvent ) {
903- return ;
904- }
905- final Collection < Spot > spotsToAdd = new ArrayList < >();
906- final Collection < Spot > spotsToRemove = new ArrayList < >();
907- final Collection < DefaultWeightedEdge > edgesToAdd = new ArrayList < >();
908- final Collection < DefaultWeightedEdge > edgesToRemove = new ArrayList < >();
906+ if ( !doFireSelectionChangeEvent )
907+ { return ; }
908+ final Collection < Spot > spotsToAdd = new ArrayList <>();
909+ final Collection < Spot > spotsToRemove = new ArrayList <>();
910+ final Collection < DefaultWeightedEdge > edgesToAdd = new ArrayList <>();
911+ final Collection < DefaultWeightedEdge > edgesToRemove = new ArrayList <>();
909912
910913 if ( null != added )
911914 {
@@ -1048,14 +1051,13 @@ public void invoke( final Object sender, final mxEventObject evt )
10481051 System .out .println ( "[TrackScheme] CellRemovalListener: cells removed - Source of event is " + sender .getClass () + ". Fire flag is " + doFireModelChangeEvent );
10491052 }
10501053
1051- if ( !doFireModelChangeEvent ) {
1052- return ;
1053- }
1054+ if ( !doFireModelChangeEvent )
1055+ { return ; }
10541056
10551057 // Separate spots from edges
10561058 final Object [] objects = ( Object [] ) evt .getProperty ( "cells" );
1057- final HashSet < Spot > spotsToRemove = new HashSet < >();
1058- final ArrayList < DefaultWeightedEdge > edgesToRemove = new ArrayList < >();
1059+ final HashSet < Spot > spotsToRemove = new HashSet <>();
1060+ final ArrayList < DefaultWeightedEdge > edgesToRemove = new ArrayList <>();
10591061 for ( final Object obj : objects )
10601062 {
10611063 final mxCell cell = ( mxCell ) obj ;
@@ -1126,9 +1128,8 @@ public void invoke( final Object sender, final mxEventObject evt )
11261128 {
11271129 System .out .println ( "[TrackSchemeFrame] SelectionChangeListener: selection changed by " + sender + ". Fire event flag is " + doFireSelectionChangeEvent );
11281130 }
1129- if ( !doFireSelectionChangeEvent || sender != graph .getSelectionModel () ) {
1130- return ;
1131- }
1131+ if ( !doFireSelectionChangeEvent || sender != graph .getSelectionModel () )
1132+ { return ; }
11321133 final Collection < Object > added = ( Collection < Object > ) evt .getProperty ( "added" );
11331134 final Collection < Object > removed = ( Collection < Object > ) evt .getProperty ( "removed" );
11341135 userChangedSelection ( added , removed );
@@ -1183,7 +1184,8 @@ public void resetZoom()
11831184
11841185 public void doTrackStyle ()
11851186 {
1186- if ( null == stylist ) { return ; }
1187+ if ( null == stylist )
1188+ { return ; }
11871189 gui .logger .setStatus ( "Setting style." );
11881190
11891191 graph .getModel ().beginUpdate ();
@@ -1192,11 +1194,11 @@ public void doTrackStyle()
11921194
11931195 // Collect edges
11941196 final Set < Integer > trackIDs = model .getTrackModel ().trackIDs ( true );
1195- final HashMap < Integer , Set < mxCell >> edgeMap = new HashMap <>( trackIDs .size () );
1197+ final HashMap < Integer , Set < mxCell > > edgeMap = new HashMap <>( trackIDs .size () );
11961198 for ( final Integer trackID : trackIDs )
11971199 {
11981200 final Set < DefaultWeightedEdge > edges = model .getTrackModel ().trackEdges ( trackID );
1199- final HashSet < mxCell > set = new HashSet < >( edges .size () );
1201+ final HashSet < mxCell > set = new HashSet <>( edges .size () );
12001202 for ( final DefaultWeightedEdge edge : edges )
12011203 {
12021204 set .add ( graph .getCellFor ( edge ) );
@@ -1208,7 +1210,7 @@ public void doTrackStyle()
12081210 final Set < mxICell > verticesUpdated = stylist .execute ( edgeMap );
12091211
12101212 // Take care of vertices
1211- final HashSet < mxCell > missedVertices = new HashSet < >( graph .getVertexCells () );
1213+ final HashSet < mxCell > missedVertices = new HashSet <>( graph .getVertexCells () );
12121214 missedVertices .removeAll ( verticesUpdated );
12131215 stylist .updateVertexStyle ( missedVertices );
12141216
@@ -1227,7 +1229,7 @@ private void createThumbnails()
12271229 {
12281230 // Group spots per frame
12291231 final Set < Integer > frames = model .getSpots ().keySet ();
1230- final HashMap < Integer , HashSet < Spot >> spotPerFrame = new HashMap <>( frames .size () );
1232+ final HashMap < Integer , HashSet < Spot > > spotPerFrame = new HashMap <>( frames .size () );
12311233 for ( final Integer frame : frames )
12321234 {
12331235 spotPerFrame .put ( frame , new HashSet < Spot >( model .getSpots ().getNSpots ( frame , true ) ) ); // max
@@ -1330,7 +1332,7 @@ public void linkSpots()
13301332 {
13311333
13321334 // Sort spots by time
1333- final TreeMap < Integer , Spot > spotsInTime = new TreeMap < >();
1335+ final TreeMap < Integer , Spot > spotsInTime = new TreeMap <>();
13341336 for ( final Spot spot : selectionModel .getSpotSelection () )
13351337 {
13361338 spotsInTime .put ( spot .getFeature ( Spot .FRAME ).intValue (), spot );
@@ -1444,7 +1446,7 @@ public void selectTrack( final Collection< mxCell > vertices, final Collection<
14441446 {
14451447
14461448 // Look for spot and edges matching given mxCells
1447- final HashSet < Spot > inspectionSpots = new HashSet < >( vertices .size () );
1449+ final HashSet < Spot > inspectionSpots = new HashSet <>( vertices .size () );
14481450 for ( final mxCell cell : vertices )
14491451 {
14501452 final Spot spot = graph .getSpotFor ( cell );
@@ -1458,7 +1460,7 @@ public void selectTrack( final Collection< mxCell > vertices, final Collection<
14581460 }
14591461 inspectionSpots .add ( spot );
14601462 }
1461- final HashSet < DefaultWeightedEdge > inspectionEdges = new HashSet < >( edges .size () );
1463+ final HashSet < DefaultWeightedEdge > inspectionEdges = new HashSet <>( edges .size () );
14621464 for ( final mxCell cell : edges )
14631465 {
14641466 final DefaultWeightedEdge dwe = graph .getEdgeFor ( cell );
0 commit comments