public synchronized Term getTracks() {
   Set<BigInteger> trackIdentifiers = tracks.keySet();
   Iterator<BigInteger> trackIdentifiersIterator = trackIdentifiers.iterator();
   Term list1 = PrologEmptyList.instance;
   while (trackIdentifiersIterator.hasNext()) {
     BigInteger blobIdentifier = trackIdentifiersIterator.next();
     StableTrack track = tracks.get(blobIdentifier);
     Term prologIdentifier = new PrologInteger(blobIdentifier);
     ArrayList<TrackSegment> segmentList = track.getTrackSegments();
     ListIterator<TrackSegment> segmentListIterator = segmentList.listIterator(segmentList.size());
     Term list2 = PrologEmptyList.instance;
     while (segmentListIterator.hasPrevious()) {
       TrackSegment segment = segmentListIterator.previous();
       int[][] rectangles = segment.rectangles;
       if (rectangles.length <= 0) {
         continue;
       }
       ;
       long beginningTime = segment.beginningTime;
       int[] firstRectangle = rectangles[0];
       long frameNumber1 = beginningTime + firstRectangle[0];
       long x1 = StrictMath.round((firstRectangle[1] + firstRectangle[2]) / 2.0);
       long y1 = StrictMath.round((firstRectangle[3] + firstRectangle[4]) / 2.0);
       int[] lastRectangle = rectangles[rectangles.length - 1];
       long frameNumber2 = beginningTime + lastRectangle[0];
       long x2 = StrictMath.round((lastRectangle[1] + lastRectangle[2]) / 2.0);
       long y2 = StrictMath.round((lastRectangle[3] + lastRectangle[4]) / 2.0);
       Term prologSegment =
           assembleTrackSegment(frameNumber1, x1, y1, frameNumber2, x2, y2, segment);
       list2 = new PrologList(prologSegment, list2);
     }
     ;
     Term prologTrack =
         new PrologSet(
             -SymbolCodes.symbolCode_E_identifier,
             prologIdentifier,
             new PrologSet(-SymbolCodes.symbolCode_E_segments, list2, PrologEmptySet.instance));
     list1 = new PrologList(prologTrack, list1);
   }
   ;
   return list1;
 }
 protected ConnectedGraph[] formConnectedGraphs() {
   ArrayList<ConnectedGraph> graphs = new ArrayList<>();
   int numberOfActiveBlobs = blobIdentifiers.length;
   Loop1:
   for (int n = 0; n < numberOfActiveBlobs; n++) {
     BigInteger identifier = blobIdentifiers[n];
     for (int k = 0; k < graphs.size(); k++) {
       if (graphs.get(k).containsTrack(identifier)) {
         continue Loop1;
       }
     }
     ;
     StableTrack track = tracks.get(identifier);
     if (track != null) {
       track.assembleConnectedGraph(graphs, tracks);
     }
   }
   ;
   ConnectedGraph[] array = new ConnectedGraph[graphs.size()];
   graphs.toArray(array);
   return array;
 }