From 852251ce01969883c8e87d9e24146089ae931df5 Mon Sep 17 00:00:00 2001 From: austin Date: Sat, 10 Aug 2024 19:58:10 -0400 Subject: [PATCH] low priority queue, enums as low prio --- src/main/java/electrosphere/main/Main.java | 16 +++++++++++----- .../main/core/btree/methods/ClientAttach.java | 2 +- .../main/core/btree/methods/ClientInterrupt.java | 4 ++-- .../main/core/btree/methods/ClientStart.java | 4 ++-- .../main/core/btree/methods/ServerAttach.java | 2 +- .../core/btree/methods/ServerFieldSetter.java | 2 +- .../main/core/statics/btreeenum/BTreeIdEnum.java | 2 +- .../main/core/statics/fieldenum/FieldIdEnum.java | 2 +- .../main/project/parsers/BTreeParser.java | 2 +- 9 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/electrosphere/main/Main.java b/src/main/java/electrosphere/main/Main.java index 7ff2bfb..b2836af 100644 --- a/src/main/java/electrosphere/main/Main.java +++ b/src/main/java/electrosphere/main/Main.java @@ -29,7 +29,7 @@ public class Main { public static boolean LOG = true; //controls whether files are actually written to disk or not - public static boolean WRITE_TO_DISK = true; + public static boolean WRITE_TO_DISK = false; //hard-coded white list files to always parse static final String[] ALWAYS_PARSED_CLASSES = new String[]{ @@ -82,6 +82,7 @@ public class Main { */ static List getFilesToModify(String topLevelFolderPath){ List rVal = new LinkedList(); + List lowPriority = new LinkedList(); File topLevelFolder = new File(topLevelFolderPath); List fileQueue = new LinkedList(); List fileQueueOpenSet = new LinkedList(); @@ -98,10 +99,14 @@ public class Main { String content = ""; try { content = Files.readString(currentFile.toPath()); - if( - content.contains("@SynchronizedBehaviorTree") || - isHardCodedAlwaysParse(currentFile.getName()) - ){ + if(content.contains("@SynchronizedBehaviorTree")){ + //get relative path + Path relativePath = topLevelFolder.toPath().relativize(currentFile.toPath()); + String relativePathString = "src/main/java/electrosphere/" + relativePath.toString(); + //parse + JavaClassSource source = parseJavaFile(content); + lowPriority.add(new TargetFile(currentFile.getAbsolutePath(), relativePathString, content, currentFile.getName(), source)); + } else if(isHardCodedAlwaysParse(currentFile.getName())){ //get relative path Path relativePath = topLevelFolder.toPath().relativize(currentFile.toPath()); String relativePathString = "src/main/java/electrosphere/" + relativePath.toString(); @@ -126,6 +131,7 @@ public class Main { fileQueue.remove(currentClosedFile); } } + rVal.addAll(lowPriority); return rVal; } diff --git a/src/main/java/electrosphere/main/core/btree/methods/ClientAttach.java b/src/main/java/electrosphere/main/core/btree/methods/ClientAttach.java index d8f439c..f708d3f 100644 --- a/src/main/java/electrosphere/main/core/btree/methods/ClientAttach.java +++ b/src/main/java/electrosphere/main/core/btree/methods/ClientAttach.java @@ -44,7 +44,7 @@ public class ClientAttach implements VirtualMethod { @Override public List getImports(ProjectStructure projectStructure) { List rVal = Arrays.asList(new String[]{ - "electrosphere.net.synchronization.BehaviorTreeIdEnums", + "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums", }); return rVal; } diff --git a/src/main/java/electrosphere/main/core/btree/methods/ClientInterrupt.java b/src/main/java/electrosphere/main/core/btree/methods/ClientInterrupt.java index a9403f5..ab7e9eb 100644 --- a/src/main/java/electrosphere/main/core/btree/methods/ClientInterrupt.java +++ b/src/main/java/electrosphere/main/core/btree/methods/ClientInterrupt.java @@ -44,8 +44,8 @@ public class ClientInterrupt implements VirtualMethod { public List getImports(ProjectStructure projectStructure) { List rVal = Arrays.asList(new String[]{ "electrosphere.net.parser.net.message.SynchronizationMessage", - "electrosphere.net.synchronization.BehaviorTreeIdEnums", - "electrosphere.net.synchronization.ServerSynchronizationManager", + "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums", + "electrosphere.net.synchronization.server.ServerSynchronizationManager", }); return rVal; } diff --git a/src/main/java/electrosphere/main/core/btree/methods/ClientStart.java b/src/main/java/electrosphere/main/core/btree/methods/ClientStart.java index 628c485..6ea3d31 100644 --- a/src/main/java/electrosphere/main/core/btree/methods/ClientStart.java +++ b/src/main/java/electrosphere/main/core/btree/methods/ClientStart.java @@ -44,8 +44,8 @@ public class ClientStart implements VirtualMethod { public List getImports(ProjectStructure projectStructure) { List rVal = Arrays.asList(new String[]{ "electrosphere.net.parser.net.message.SynchronizationMessage", - "electrosphere.net.synchronization.BehaviorTreeIdEnums", - "electrosphere.net.synchronization.ServerSynchronizationManager", + "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums", + "electrosphere.net.synchronization.server.ServerSynchronizationManager", }); return rVal; } diff --git a/src/main/java/electrosphere/main/core/btree/methods/ServerAttach.java b/src/main/java/electrosphere/main/core/btree/methods/ServerAttach.java index 23ba5cf..9e6b61e 100644 --- a/src/main/java/electrosphere/main/core/btree/methods/ServerAttach.java +++ b/src/main/java/electrosphere/main/core/btree/methods/ServerAttach.java @@ -45,7 +45,7 @@ public class ServerAttach implements VirtualMethod { public List getImports(ProjectStructure projectStructure) { List rVal = Arrays.asList(new String[]{ "electrosphere.server.datacell.utils.ServerBehaviorTreeUtils", - "electrosphere.net.synchronization.BehaviorTreeIdEnums", + "electrosphere.net.synchronization.enums.BehaviorTreeIdEnums", }); return rVal; } diff --git a/src/main/java/electrosphere/main/core/btree/methods/ServerFieldSetter.java b/src/main/java/electrosphere/main/core/btree/methods/ServerFieldSetter.java index 603dbc7..eae149c 100644 --- a/src/main/java/electrosphere/main/core/btree/methods/ServerFieldSetter.java +++ b/src/main/java/electrosphere/main/core/btree/methods/ServerFieldSetter.java @@ -58,7 +58,7 @@ public class ServerFieldSetter implements VirtualMethod { List rVal = Arrays.asList(new String[]{ "electrosphere.net.parser.net.message.SynchronizationMessage", "electrosphere.server.datacell.utils.DataCellSearchUtils", - "electrosphere.net.synchronization.FieldIdEnums", + "electrosphere.net.synchronization.enums.FieldIdEnums", }); return rVal; } diff --git a/src/main/java/electrosphere/main/core/statics/btreeenum/BTreeIdEnum.java b/src/main/java/electrosphere/main/core/statics/btreeenum/BTreeIdEnum.java index e9315ee..6736438 100644 --- a/src/main/java/electrosphere/main/core/statics/btreeenum/BTreeIdEnum.java +++ b/src/main/java/electrosphere/main/core/statics/btreeenum/BTreeIdEnum.java @@ -23,7 +23,7 @@ public class BTreeIdEnum extends VirtualClass { super( new TargetFile( null, - "src/main/java/electrosphere/net/synchronization/BehaviorTreeIdEnums.java", + "src/main/java/electrosphere/net/synchronization/enums/BehaviorTreeIdEnums.java", "", "BehaviorTreeIdEnums", null diff --git a/src/main/java/electrosphere/main/core/statics/fieldenum/FieldIdEnum.java b/src/main/java/electrosphere/main/core/statics/fieldenum/FieldIdEnum.java index 0077dcd..d357ec4 100644 --- a/src/main/java/electrosphere/main/core/statics/fieldenum/FieldIdEnum.java +++ b/src/main/java/electrosphere/main/core/statics/fieldenum/FieldIdEnum.java @@ -23,7 +23,7 @@ public class FieldIdEnum extends VirtualClass { super( new TargetFile( null, - "src/main/java/electrosphere/net/synchronization/FieldIdEnums.java", + "src/main/java/electrosphere/net/synchronization/enums/FieldIdEnums.java", "", "FieldIdEnums", null diff --git a/src/main/java/electrosphere/main/project/parsers/BTreeParser.java b/src/main/java/electrosphere/main/project/parsers/BTreeParser.java index a9887cb..5a4aa94 100644 --- a/src/main/java/electrosphere/main/project/parsers/BTreeParser.java +++ b/src/main/java/electrosphere/main/project/parsers/BTreeParser.java @@ -95,7 +95,7 @@ public class BTreeParser { // ADD IMPORTS HERE // // - rVal.addImport("electrosphere.net.synchronization.BehaviorTreeIdEnums"); + rVal.addImport("electrosphere.net.synchronization.enums.BehaviorTreeIdEnums"); } //