Making code compatible with java 8 #14

this was easy!
This commit is contained in:
rusefi 2020-03-14 17:51:03 -04:00
parent 2841943fe1
commit f891b61a1d
4 changed files with 11 additions and 14 deletions

View File

@ -20,17 +20,13 @@ package eu.mihosoft.freerouting.autoroute;
import java.util.*;
import eu.mihosoft.freerouting.board.*;
import eu.mihosoft.freerouting.datastructures.TimeLimit;
import eu.mihosoft.freerouting.datastructures.UndoableObjects;
import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
import eu.mihosoft.freerouting.geometry.planar.FloatLine;
import eu.mihosoft.freerouting.board.Connectable;
import eu.mihosoft.freerouting.board.Item;
import eu.mihosoft.freerouting.board.DrillItem;
import eu.mihosoft.freerouting.board.RoutingBoard;
import eu.mihosoft.freerouting.interactive.BoardHandling;
import eu.mihosoft.freerouting.interactive.InteractiveActionThread;
import eu.mihosoft.freerouting.logger.FRLogger;
@ -124,7 +120,7 @@ public class BatchAutorouter
this.is_interrupted = true;
}
var current_board_hash = this.routing_board.get_hash();
String current_board_hash = this.routing_board.get_hash();
if (already_checked_board_hashes.contains(current_board_hash))
{
FRLogger.warn("This board was already evaluated, so we stop autorouter to avoid the endless loop.");
@ -142,14 +138,14 @@ public class BatchAutorouter
String start_message = resources.getString("batch_autorouter") + " " + resources.getString("stop_message") + " " + resources.getString("pass") + " " + curr_pass_no.toString() + ": ";
hdlg.screen_messages.set_status_message(start_message);
var boardBefore = this.routing_board.clone();
BasicBoard boardBefore = this.routing_board.clone();
FRLogger.traceEntry("BatchAutorouter.autoroute_pass #"+curr_pass_no+" on board '"+current_board_hash+"' making {} changes");
already_checked_board_hashes.add(this.routing_board.get_hash());
still_unrouted_items = autoroute_pass(curr_pass_no, true);
// let's check if there was enough change in the last pass, because if it were little, so should probably stop
var newTraceDifferences = this.routing_board.diff_traces(boardBefore);
int newTraceDifferences = this.routing_board.diff_traces(boardBefore);
diffBetweenBoards.add(newTraceDifferences);
if (diffBetweenBoards.size() > 20) {

View File

@ -89,8 +89,8 @@ public class BasicBoard implements java.io.Serializable
{
try
{
var output_stream = new ByteArrayOutputStream();
var object_stream = new ObjectOutputStream(output_stream);
ByteArrayOutputStream output_stream = new ByteArrayOutputStream();
ObjectOutputStream object_stream = new ObjectOutputStream(output_stream);
if (basicProfile) {
object_stream.writeObject(this.get_traces());
@ -115,8 +115,8 @@ public class BasicBoard implements java.io.Serializable
{
try
{
var input_stream = new ByteArrayInputStream(object_byte_array);
var object_stream = new ObjectInputStream(input_stream);
ByteArrayInputStream input_stream = new ByteArrayInputStream(object_byte_array);
ObjectInputStream object_stream = new ObjectInputStream(input_stream);
return (BasicBoard)object_stream.readObject();
}

View File

@ -24,6 +24,7 @@
package eu.mihosoft.freerouting.gui;
import eu.mihosoft.freerouting.board.TestLevel;
import eu.mihosoft.freerouting.interactive.InteractiveActionThread;
import eu.mihosoft.freerouting.interactive.ThreadActionListener;
import eu.mihosoft.freerouting.logger.FRLogger;
@ -106,7 +107,7 @@ public class MainApplication extends javax.swing.JFrame
new_frame.board_panel.board_handling.settings.autoroute_settings.set_stop_pass_no(new_frame.board_panel.board_handling.settings.autoroute_settings.get_start_pass_no() + startupOptions.max_passes - 1);
if (startupOptions.max_passes < 99999)
{
var thread = new_frame.board_panel.board_handling.start_batch_autorouter();
InteractiveActionThread thread = new_frame.board_panel.board_handling.start_batch_autorouter();
thread.addListener(new ThreadActionListener() {
@Override

View File

@ -35,7 +35,7 @@ public class FRLogger {
public static void traceExit(String perfId, Object result)
{
var timeElapsed = Duration.between(perfData.get(perfId.hashCode()), java.time.Instant.now()).toMillis();
long timeElapsed = Duration.between(perfData.get(perfId.hashCode()), java.time.Instant.now()).toMillis();
perfData.remove(perfId.hashCode());
if (timeElapsed < 0) {