From 9239aee487ed6de221f6f8d6850cd2675e831c9b Mon Sep 17 00:00:00 2001 From: austin Date: Wed, 31 Jul 2024 10:49:54 -0400 Subject: [PATCH] refactoring code --- src/main/java/electrosphere/main/Main.java | 2 +- .../ClientSynchronizationManager.java | 21 +- .../electrosphere/main/codegen/ClientGen.java | 292 ---------------- .../electrosphere/main/codegen/CodeGen.java | 31 -- .../electrosphere/main/codegen/ServerGen.java | 316 ------------------ .../btree}/BehaviorTree.java | 68 +++- .../enums}/BTreeIdEnum.java | 10 +- .../enums}/FieldIdEnum.java | 10 +- .../syncfield}/SynchronizedField.java | 40 ++- .../syncfield}/SynchronizedType.java | 10 +- .../ProjectStructure.java | 44 ++- .../EntityValueTrackingService.java | 2 +- .../main/structure/TranslatorService.java | 8 - .../main/util/ClassSourceUtils.java | 2 +- 14 files changed, 172 insertions(+), 684 deletions(-) rename src/main/java/electrosphere/main/{structure => client}/ClientSynchronizationManager.java (88%) delete mode 100644 src/main/java/electrosphere/main/codegen/ClientGen.java delete mode 100644 src/main/java/electrosphere/main/codegen/CodeGen.java delete mode 100644 src/main/java/electrosphere/main/codegen/ServerGen.java rename src/main/java/electrosphere/main/{structure => core/btree}/BehaviorTree.java (66%) rename src/main/java/electrosphere/main/{structure => core/enums}/BTreeIdEnum.java (88%) rename src/main/java/electrosphere/main/{structure => core/enums}/FieldIdEnum.java (85%) rename src/main/java/electrosphere/main/{structure => core/syncfield}/SynchronizedField.java (85%) rename src/main/java/electrosphere/main/{structure => core/syncfield}/SynchronizedType.java (95%) rename src/main/java/electrosphere/main/{structure => project}/ProjectStructure.java (92%) rename src/main/java/electrosphere/main/{structure => server}/EntityValueTrackingService.java (90%) delete mode 100644 src/main/java/electrosphere/main/structure/TranslatorService.java diff --git a/src/main/java/electrosphere/main/Main.java b/src/main/java/electrosphere/main/Main.java index 7855d80..cec856d 100644 --- a/src/main/java/electrosphere/main/Main.java +++ b/src/main/java/electrosphere/main/Main.java @@ -11,7 +11,7 @@ import java.util.Map; import org.jboss.forge.roaster.Roaster; import org.jboss.forge.roaster.model.source.JavaClassSource; -import electrosphere.main.structure.ProjectStructure; +import electrosphere.main.project.ProjectStructure; import electrosphere.main.targets.TargetFile; /** diff --git a/src/main/java/electrosphere/main/structure/ClientSynchronizationManager.java b/src/main/java/electrosphere/main/client/ClientSynchronizationManager.java similarity index 88% rename from src/main/java/electrosphere/main/structure/ClientSynchronizationManager.java rename to src/main/java/electrosphere/main/client/ClientSynchronizationManager.java index cefd858..2a7c86c 100644 --- a/src/main/java/electrosphere/main/structure/ClientSynchronizationManager.java +++ b/src/main/java/electrosphere/main/client/ClientSynchronizationManager.java @@ -1,5 +1,10 @@ -package electrosphere.main.structure; +package electrosphere.main.client; +import electrosphere.main.core.btree.BehaviorTree; +import electrosphere.main.core.enums.BTreeIdEnum; +import electrosphere.main.core.syncfield.SynchronizedField; +import electrosphere.main.core.syncfield.SynchronizedType; +import electrosphere.main.project.ProjectStructure; import electrosphere.main.targets.TargetFile; import electrosphere.main.util.ClassSourceUtils; import electrosphere.main.util.TemplateInjectionUtils; @@ -21,16 +26,16 @@ public class ClientSynchronizationManager { */ public static void update(ProjectStructure structure, TargetFile clientSynchronizationManager){ String updateCases = ""; - for(BehaviorTree serverTree : structure.behaviorTrees){ + for(BehaviorTree serverTree : structure.getBehaviorTrees()){ //counterintuitively, want to only update client for server behavior tree ids if(serverTree.isServer()){ - BehaviorTree clientEquivalent = structure.getTree(serverTree.correspondingTreeName); + BehaviorTree clientEquivalent = structure.getTree(serverTree.getCorrespondingTreeName()); updateCases = updateCases + " case BehaviorTreeIdEnums." + BTreeIdEnum.getTreeIdEnum(serverTree) + ": {\n"; updateCases = updateCases + " switch(message.getfieldId()){\n"; - for(SynchronizedField field : serverTree.synchronizedFields){ + for(SynchronizedField field : serverTree.getSynchronizedFields()){ String treeName = clientEquivalent.getClassName(); - String fieldIdVariable = "TREE_" + serverTree.name.toUpperCase() + "_SYNCEDFIELD_" + field.fieldName.toUpperCase() + "_ID"; - switch(field.typeName){ + String fieldIdVariable = "TREE_" + serverTree.getName().toUpperCase() + "_SYNCEDFIELD_" + field.getFieldName().toUpperCase() + "_ID"; + switch(field.getTypeName()){ case "int": { updateCases = updateCases + " case FieldIdEnums." + fieldIdVariable + ":{\n"; updateCases = updateCases + " " + treeName + " tree = " + treeName + ".get" + treeName + "(entity);\n"; @@ -62,7 +67,7 @@ public class ClientSynchronizationManager { updateCases = updateCases + " } break;\n"; } break; default: { - SynchronizedType type = structure.getType(field.typeName); + SynchronizedType type = structure.getType(field.getTypeName()); String typeClass = type.getTargetFile().getSource().getName(); updateCases = updateCases + " case FieldIdEnums." + fieldIdVariable + ":{\n"; updateCases = updateCases + " " + treeName + " tree = " + treeName + ".get" + treeName + "(entity);\n"; @@ -76,7 +81,7 @@ public class ClientSynchronizationManager { //guarantee import // ClassSourceUtils.importClass(structure, clientSynchronizationManager, serverTree.getTargetFile().getQualifiedPath()); - ClassSourceUtils.importClass(structure, clientSynchronizationManager, structure.getTree(serverTree.correspondingTreeName).getTargetFile().getQualifiedPath()); + ClassSourceUtils.importClass(structure, clientSynchronizationManager, structure.getTree(serverTree.getCorrespondingTreeName()).getTargetFile().getQualifiedPath()); } } ClassSourceUtils.importClass(structure, clientSynchronizationManager, "electrosphere.net.synchronization.FieldIdEnums"); diff --git a/src/main/java/electrosphere/main/codegen/ClientGen.java b/src/main/java/electrosphere/main/codegen/ClientGen.java deleted file mode 100644 index f2cadcb..0000000 --- a/src/main/java/electrosphere/main/codegen/ClientGen.java +++ /dev/null @@ -1,292 +0,0 @@ -package electrosphere.main.codegen; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import org.jboss.forge.roaster.model.source.AnnotationSource; -import org.jboss.forge.roaster.model.source.EnumConstantSource; -import org.jboss.forge.roaster.model.source.FieldSource; -import org.jboss.forge.roaster.model.source.JavaClassSource; -import org.jboss.forge.roaster.model.source.JavaEnumSource; -import org.jboss.forge.roaster.model.source.JavaSource; -import org.jboss.forge.roaster.model.source.MethodSource; - -import electrosphere.main.Main; -import electrosphere.main.targets.NetcodeGenTarget; -import electrosphere.main.targets.TargetFile; -import electrosphere.main.util.Utilities; - -/** - * Generates client-side synchronization code - */ -public class ClientGen { - - - - public static void generateCode(JavaClassSource source, String bTreeName, File file, String content) throws Exception { - TargetFile targetFile = new TargetFile(file.getAbsolutePath(), content, bTreeName, source); - StringBuilder outputContent = new StringBuilder(content); - List targets = parseGenerationTargets(targetFile); - // - //Find if there was already a parse network message function - MethodSource parseNetworkMessageFunction = null; - for(MethodSource method : targetFile.getSource().getMethods()){ - if(method.getName().equals("parseBTreeMessages")){ - parseNetworkMessageFunction = method; - } - } - // - //Code gen for each synchronized variable - // - for(NetcodeGenTarget target : targets){ - // - //Look for existing methods - MethodSource setter = null; - MethodSource enumToIntMapper = null; - MethodSource intToEnumMapper = null; - for(MethodSource method : targetFile.getSource().getMethods()){ - if(method.getName().equals(getSetterName(target.getName()))){ - setter = method; - } - if(method.getName().equals(getEnumToIntMapperName(target.getName()))){ - enumToIntMapper = method; - } - if(method.getName().equals(getIntToEnumMapperName(target.getName()))){ - intToEnumMapper = method; - } - } - - - - // - //check if need to make enum to int mapper function - if(target.getAnnotation().getStringValue("isEnum") != null){ - if(target.getAnnotation().getStringValue("enumId") == null){ - throw new Exception("Failed to parse enum because enumId is not set on the synchronized field annotation"); - } - // int enumId = Integer.parseInt(target.getAnnotation().getStringValue("enumId")); - - // - //find enum in current file - JavaSource enumSource = null; - for(JavaSource nestedSource : targetFile.getSource().getNestedTypes()){ - if(nestedSource.getName().equals(target.getTypeName())){ - enumSource = (JavaSource)nestedSource; - break; - } - } - List enumConstNames = new LinkedList(); - if(enumSource != null){ - for(EnumConstantSource enumConstant : enumSource.getOrigin().getEnumConstants()){ - enumConstNames.add(enumConstant.getName()); - } - } - - // - //mapper enum->int - if(enumToIntMapper != null){ - //regenerate - int startChar = enumToIntMapper.getStartPosition(); - int endChar = enumToIntMapper.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateEnumToIntMapperCode(target,enumConstNames), lineNumber, 1); - } else { - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateEnumToIntMapperCode(target,enumConstNames), lineNumber, 1); - } - - // - //mapper int->enum - if(intToEnumMapper != null){ - //regenerate - int startChar = intToEnumMapper.getStartPosition(); - int endChar = intToEnumMapper.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateIntToEnumMapperCode(target,enumConstNames), lineNumber, 1); - } else { - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateIntToEnumMapperCode(target,enumConstNames), lineNumber, 1); - } - } - - - - - // - //generate setter - if(setter != null){ - //regenerate - int startChar = setter.getStartPosition(); - int endChar = setter.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateSetterCode(targetFile,target.getName(),target), lineNumber, 1); - } else { - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateSetterCode(targetFile,target.getName(),target), lineNumber, 1); - } - } - //message parser generation - if(parseNetworkMessageFunction == null){ - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateParseBTreeMessages(targetFile, targets), lineNumber, 1); - } else { - //regenerate - int startChar = parseNetworkMessageFunction.getStartPosition(); - int endChar = parseNetworkMessageFunction.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateParseBTreeMessages(targetFile, targets), lineNumber, 1); - } - - // System.out.println(outputContent); - } - - static List parseGenerationTargets(TargetFile targetFile){ - int targetIdIterator = 0; - List targets = new LinkedList(); - for(FieldSource field : targetFile.getSource().getFields()){ - List> annotations = field.getAnnotations(); - for(AnnotationSource annotation : annotations){ - if(annotation.getName().equals("SyncedField")){ - targets.add(new NetcodeGenTarget(targetIdIterator, field.getName(), field.getType().getName(), field, annotation)); - targetIdIterator++; - } - } - } - return targets; - } - - static String getSetterName(String fieldName){ - return "set" + Utilities.camelCase(fieldName); - } - - static String getEnumToIntMapperName(String fieldName){ - return "getEnumIntValue" + Utilities.camelCase(fieldName); - } - - static String getIntToEnumMapperName(String fieldName){ - return "getIntEnumValue" + Utilities.camelCase(fieldName); - } - - static String generateSetterCode(TargetFile targetFile, String variableName, NetcodeGenTarget target){ - String messageConstructor = ""; - // - //regular types - switch(target.getTypeName()){ - case "int": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/SetterInt.java")); - } break; - case "double": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/SetterDouble.java")); - } break; - case "float": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/SetterFloat.java")); - } break; - case "String": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/SetterString.java")); - } break; - } - messageConstructor = messageConstructor - .replace("REPLACEBTREEID",Main.bTreeIdMap.get(targetFile.getName()) + "") - .replace("REPLACEPROPERTYID",target.getId() + "") - .replace("REPLACENAMENOTCAMEL",variableName); - // - //enum type handling - if(target.getAnnotation().getStringValue("isEnum") != null){ - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/SetterEnum.java")) - .replace("REPLACEBTREEID",Main.bTreeIdMap.get(targetFile.getName()) + "") - .replace("REPLACEPROPERTYID",target.getId() + "") - .replace("REPLACENAMECAMEL",Utilities.camelCase(variableName)) - .replace("REPLACENAMENOTCAMEL",variableName); - } - // - //returns setter string - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/Setter.java")) - .replace("REPLACENAMECAMEL",Utilities.camelCase(variableName)) - .replace("REPLACETYPE",target.getTypeName()) - .replace("REPLACENAMENOTCAMEL",variableName) - .replace("REPLACEMESSAGECONSTRUCTOR",messageConstructor); - return rVal; - } - - static String generateEnumToIntMapperCode(NetcodeGenTarget target, List enumConstNames){ - String switchCases = ""; - int i = 0; - for(String enumConstName : enumConstNames){ - switchCases = switchCases + "case " + enumConstName + ":\n" + - "return " + i + ";\n"; - i++; - } - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/EnumToIntMapper.java")) - .replace("REPLACEENUMTYPE",target.getTypeName()) - .replace("REPLACENAMECAMEL",Utilities.camelCase(target.getName())) - .replace("REPLACETYPENAME",target.getTypeName()); - rVal = Utilities.replacePhraseWithPhraseAtIndent(rVal, switchCases, "REPLACECASE"); - return rVal; - } - - - static String generateIntToEnumMapperCode(NetcodeGenTarget target, List enumConstNames){ - String switchCases = ""; - int i = 0; - for(String enumConstName : enumConstNames){ - switchCases = switchCases + "case " + i + ":\n" + - "return " + target.getTypeName() + "." + enumConstName + ";\n"; - i++; - } - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/IntToEnumMapper.java")) - .replace("REPLACEENUMTYPE",target.getTypeName()) - .replace("REPLACENAMECAMEL",Utilities.camelCase(target.getName())); - rVal = Utilities.replacePhraseWithPhraseAtIndent(rVal, switchCases, "REPLACECASE"); - return rVal; - } - - static String generateParseBTreeMessages(TargetFile targetFile, List targets){ - String setCases = ""; - for(NetcodeGenTarget target : targets){ - String base = "case REPLACE_PROPERTY_ID: {\n" + - "setREPLACE_VARIABLE_NAME_CAMEL(REPLACE_GET_PROPERTY_VALUE);\n" + - "} break;\n"; - String propertyValueFetcher = ""; - switch(target.getTypeName()){ - case "int": { - propertyValueFetcher = "message.getpropertyValueInt()"; - } break; - case "float": { - propertyValueFetcher = "message.getpropertyValueFloat()"; - } break; - case "double": { - propertyValueFetcher = "message.getpropertyValueDouble()"; - } break; - case "String": { - propertyValueFetcher = "message.getpropertyValueString()"; - } break; - //enum - default: { - propertyValueFetcher = "getIntEnumValueREPLACENAMECAMEL(message.getpropertyValueInt())".replace("REPLACENAMECAMEL",Utilities.camelCase(target.getName())); - } break; - } - String replaced = base - .replace("REPLACE_PROPERTY_ID",target.getId() + "") - .replace("REPLACE_GET_PROPERTY_VALUE",propertyValueFetcher) - .replace("REPLACE_VARIABLE_NAME_CAMEL",Utilities.camelCase(target.getName())); - setCases = setCases + replaced; - } - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/client/ParseBTreeMessages.java")); - rVal = Utilities.replacePhraseWithPhraseAtIndent(rVal, setCases, "REPLACE_WITH_CASES"); - return rVal; - } - -} diff --git a/src/main/java/electrosphere/main/codegen/CodeGen.java b/src/main/java/electrosphere/main/codegen/CodeGen.java deleted file mode 100644 index f3dee47..0000000 --- a/src/main/java/electrosphere/main/codegen/CodeGen.java +++ /dev/null @@ -1,31 +0,0 @@ -package electrosphere.main.codegen; - -import java.io.File; - -import org.jboss.forge.roaster.model.source.AnnotationSource; -import org.jboss.forge.roaster.model.source.JavaClassSource; - -import electrosphere.main.Main; - -/** - * Generates synchronization code. Principally figures out if it's a server or a client btree and handles accordingly. - */ -public class CodeGen { - - public static void generateCode(JavaClassSource source, File file, String content) throws Exception { - AnnotationSource mainAnnotation = source.getAnnotation("SynchronizedBehaviorTree"); - - String bTreeName = mainAnnotation.getStringValue("name"); - boolean isServer = Boolean.parseBoolean(mainAnnotation.getStringValue("isServer")); - - Main.bTreeIdMap.put(bTreeName,Main.bTreeIterator); - Main.bTreeIterator++; - - if(isServer){ - ServerGen.generateCode(source, bTreeName, file, content); - } else { - ClientGen.generateCode(source, bTreeName, file, content); - } - } - -} diff --git a/src/main/java/electrosphere/main/codegen/ServerGen.java b/src/main/java/electrosphere/main/codegen/ServerGen.java deleted file mode 100644 index ded1f7a..0000000 --- a/src/main/java/electrosphere/main/codegen/ServerGen.java +++ /dev/null @@ -1,316 +0,0 @@ -package electrosphere.main.codegen; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import org.jboss.forge.roaster.model.source.AnnotationSource; -import org.jboss.forge.roaster.model.source.EnumConstantSource; -import org.jboss.forge.roaster.model.source.FieldSource; -import org.jboss.forge.roaster.model.source.JavaClassSource; -import org.jboss.forge.roaster.model.source.JavaEnumSource; -import org.jboss.forge.roaster.model.source.JavaSource; -import org.jboss.forge.roaster.model.source.MethodSource; - -import com.google.common.io.Files; - -import electrosphere.main.Main; -import electrosphere.main.targets.NetcodeGenTarget; -import electrosphere.main.targets.TargetFile; -import electrosphere.main.util.Utilities; - -/** - * Generates server-side synchronization code - */ -public class ServerGen { - - - /** - * Main method for replacing source file content with synchronization code - * @param source The roaster source file object - * @param bTreeName The name of this btree - * @param file The file handle for this source file - * @param content The content of the source file - * @throws Exception Can throw an exception if an enum isn't properly annotated - */ - public static void generateCode(JavaClassSource source, String bTreeName, File file, String content) throws Exception { - TargetFile targetFile = new TargetFile(file.getAbsolutePath(), content, bTreeName, source); - StringBuilder outputContent = new StringBuilder(content); - List targets = parseGenerationTargets(targetFile); - // - //Find if there was already a parse network message function - MethodSource parseNetworkMessageFunction = null; - for(MethodSource method : targetFile.getSource().getMethods()){ - if(method.getName().equals("parseBTreeMessages")){ - parseNetworkMessageFunction = method; - } - } - // - //Code gen for each synchronized variable - // - for(NetcodeGenTarget target : targets){ - // - //Look for existing methods - MethodSource setter = null; - MethodSource enumToIntMapper = null; - MethodSource intToEnumMapper = null; - for(MethodSource method : targetFile.getSource().getMethods()){ - if(method.getName().equals(getSetterName(target.getName()))){ - setter = method; - } - if(method.getName().equals(getEnumToIntMapperName(target.getName()))){ - enumToIntMapper = method; - } - if(method.getName().equals(getIntToEnumMapperName(target.getName()))){ - intToEnumMapper = method; - } - } - - - - // - //check if need to make enum to int mapper function - if(target.getAnnotation().getStringValue("isEnum") != null){ - if(target.getAnnotation().getStringValue("enumId") == null){ - throw new Exception("Failed to parse enum because enumId is not set on the synchronized field annotation"); - } - // int enumId = Integer.parseInt(target.getAnnotation().getStringValue("enumId")); - - // - //find enum in current file - JavaSource enumSource = null; - for(JavaSource nestedSource : targetFile.getSource().getNestedTypes()){ - if(nestedSource.getName().equals(target.getTypeName())){ - enumSource = (JavaSource)nestedSource; - break; - } - } - List enumConstNames = new LinkedList(); - if(enumSource != null){ - for(EnumConstantSource enumConstant : enumSource.getOrigin().getEnumConstants()){ - enumConstNames.add(enumConstant.getName()); - } - } - - // - //mapper enum->int - if(enumToIntMapper != null){ - //regenerate - int startChar = enumToIntMapper.getStartPosition(); - int endChar = enumToIntMapper.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateEnumToIntMapperCode(target,enumConstNames), lineNumber, 1); - } else { - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateEnumToIntMapperCode(target,enumConstNames), lineNumber, 1); - } - - // - //mapper int->enum - if(intToEnumMapper != null){ - //regenerate - int startChar = intToEnumMapper.getStartPosition(); - int endChar = intToEnumMapper.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateIntToEnumMapperCode(target,enumConstNames), lineNumber, 1); - } else { - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateIntToEnumMapperCode(target,enumConstNames), lineNumber, 1); - } - } - - - - - // - //generate setter - if(setter != null){ - //regenerate - int startChar = setter.getStartPosition(); - int endChar = setter.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateSetterCode(targetFile,target.getName(),target), lineNumber, 1); - } else { - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateSetterCode(targetFile,target.getName(),target), lineNumber, 1); - } - } - //create network message parser for incoming requests to change synchronized variables - //... - - //message parser generation - if(parseNetworkMessageFunction == null){ - //generate - int positionJustBeforeClassEnd = targetFile.getSource().getEndPosition() - 1; - int lineNumber = Utilities.getLineNumber(outputContent.toString(), positionJustBeforeClassEnd); - outputContent = Utilities.insertIntoSource(outputContent, generateParseBTreeMessages(targetFile, targets), lineNumber, 1); - } else { - //regenerate - int startChar = parseNetworkMessageFunction.getStartPosition(); - int endChar = parseNetworkMessageFunction.getEndPosition(); - outputContent = outputContent.delete(startChar, endChar); - int lineNumber = Utilities.getLineNumber(outputContent.toString(), startChar); - Utilities.insertIntoSource(outputContent, generateParseBTreeMessages(targetFile, targets), lineNumber, 1); - } - - // - //Replace file on disk - Files.write(outputContent.toString().getBytes(), file); - } - - static List parseGenerationTargets(TargetFile targetFile){ - int targetIdIterator = 0; - List targets = new LinkedList(); - for(FieldSource field : targetFile.getSource().getFields()){ - List> annotations = field.getAnnotations(); - for(AnnotationSource annotation : annotations){ - if(annotation.getName().equals("SyncedField")){ - targets.add(new NetcodeGenTarget(targetIdIterator, field.getName(), field.getType().getName(), field, annotation)); - targetIdIterator++; - } - } - } - return targets; - } - - static String getSetterName(String fieldName){ - return "set" + Utilities.camelCase(fieldName); - } - - static String getEnumToIntMapperName(String fieldName){ - return "getEnumIntValue" + Utilities.camelCase(fieldName); - } - - static String getIntToEnumMapperName(String fieldName){ - return "getIntEnumValue" + Utilities.camelCase(fieldName); - } - - /** - * Generates code for a setter method for a synchronized field - * @param targetFile The target file - * @param variableName The name of the variable being set - * @param target The target - * @return The source code string - */ - static String generateSetterCode(TargetFile targetFile, String variableName, NetcodeGenTarget target){ - String messageConstructor = ""; - // - //regular types - switch(target.getTypeName()){ - case "int": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/SetterInt.java")); - } break; - case "double": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/SetterDouble.java")); - } break; - case "float": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/SetterFloat.java")); - } break; - case "String": { - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/SetterString.java")); - } break; - } - messageConstructor = messageConstructor - .replace("REPLACEBTREEID",Main.bTreeIdMap.get(targetFile.getName()) + "") - .replace("REPLACEPROPERTYID",target.getId() + "") - .replace("REPLACENAMENOTCAMEL",variableName); - - // - //enum type handling - if(target.getAnnotation().getStringValue("isEnum") != null){ - messageConstructor = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/SetterEnum.java")) - .replace("REPLACEBTREEID",Main.bTreeIdMap.get(targetFile.getName()) + "") - .replace("REPLACEPROPERTYID",target.getId() + "") - .replace("REPLACENAMECAMEL",Utilities.camelCase(variableName)) - .replace("REPLACENAMENOTCAMEL",variableName); - } - - // - //returns setter string - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/Setter.java")) - .replace("REPLACENAMECAMEL",Utilities.camelCase(variableName)) - .replace("REPLACETYPE",target.getTypeName()) - .replace("REPLACENAMENOTCAMEL",variableName) - .replace("REPLACEMESSAGECONSTRUCTOR",messageConstructor); - return rVal; - } - - static String generateEnumToIntMapperCode(NetcodeGenTarget target, List enumConstNames){ - String switchCases = ""; - int i = 0; - for(String enumConstName : enumConstNames){ - switchCases = switchCases + "case " + enumConstName + ":\n" + - "return " + i + ";\n"; - i++; - } - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/EnumToIntMapper.java")) - .replace("REPLACEENUMTYPE",target.getTypeName()) - .replace("REPLACENAMECAMEL",Utilities.camelCase(target.getName())) - .replace("REPLACETYPENAME",target.getTypeName()); - rVal = Utilities.replacePhraseWithPhraseAtIndent(rVal, switchCases, "REPLACECASE"); - return rVal; - } - - - static String generateIntToEnumMapperCode(NetcodeGenTarget target, List enumConstNames){ - String switchCases = ""; - int i = 0; - for(String enumConstName : enumConstNames){ - switchCases = switchCases + "case " + i + ":\n" + - "return " + target.getTypeName() + "." + enumConstName + ";\n"; - i++; - } - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/IntToEnumMapper.java")) - .replace("REPLACEENUMTYPE",target.getTypeName()) - .replace("REPLACENAMECAMEL",Utilities.camelCase(target.getName())); - rVal = Utilities.replacePhraseWithPhraseAtIndent(rVal, switchCases, "REPLACECASE"); - return rVal; - } - - static String generateParseBTreeMessages(TargetFile targetFile, List targets){ - String setCases = ""; - for(NetcodeGenTarget target : targets){ - String base = "case REPLACE_PROPERTY_ID: {\n" + - " setREPLACE_VARIABLE_NAME_CAMEL(REPLACE_GET_PROPERTY_VALUE);\n" + - "} break;\n"; - String propertyValueFetcher = ""; - switch(target.getTypeName()){ - case "int": { - propertyValueFetcher = "message.getpropertyValueInt()"; - } break; - case "float": { - propertyValueFetcher = "message.getpropertyValueFloat()"; - } break; - case "double": { - propertyValueFetcher = "message.getpropertyValueDouble()"; - } break; - case "String": { - propertyValueFetcher = "message.getpropertyValueString()"; - } break; - //enum - default: { - propertyValueFetcher = "getIntEnumValueREPLACENAMECAMEL(message.getpropertyValueInt())".replace("REPLACENAMECAMEL",Utilities.camelCase(target.getName())); - } break; - } - String replaced = base - .replace("REPLACE_PROPERTY_ID",target.getId() + "") - .replace("REPLACE_GET_PROPERTY_VALUE",propertyValueFetcher) - .replace("REPLACE_VARIABLE_NAME_CAMEL",Utilities.camelCase(target.getName())); - // System.out.println(replaced); - setCases = setCases + replaced; - } - String rVal = Utilities.readBakedResourceToString(Main.class.getResourceAsStream("/server/ParseBTreeMessages.java")); - rVal = Utilities.replacePhraseWithPhraseAtIndent(rVal, setCases, "REPLACE_WITH_CASES"); - return rVal; - } - -} diff --git a/src/main/java/electrosphere/main/structure/BehaviorTree.java b/src/main/java/electrosphere/main/core/btree/BehaviorTree.java similarity index 66% rename from src/main/java/electrosphere/main/structure/BehaviorTree.java rename to src/main/java/electrosphere/main/core/btree/BehaviorTree.java index 0f94fa4..c06fff1 100644 --- a/src/main/java/electrosphere/main/structure/BehaviorTree.java +++ b/src/main/java/electrosphere/main/core/btree/BehaviorTree.java @@ -1,7 +1,8 @@ -package electrosphere.main.structure; +package electrosphere.main.core.btree; import java.util.List; +import electrosphere.main.core.syncfield.SynchronizedField; import electrosphere.main.targets.TargetFile; import electrosphere.main.util.TemplateInjectionUtils; @@ -58,26 +59,58 @@ public class BehaviorTree { this.targetFile = targetFile; } + /** + * Gets the name of this behavior tree + * @return The name of this behavior tree + */ public String getName(){ return name; } + /** + * Gets the id of this behavior tree + * @return The id + */ + public int getId(){ + return this.id; + } + + /** + * Gets the class name of this behavior tree + * @return The class name + */ public String getClassName(){ return className; } + /** + * Gets the corresponding tree name for this behavior tree + * @return The corresponding tree's name + */ public String getCorrespondingTreeName(){ return correspondingTreeName; } + /** + * Gets whether this is a server behavior tree or not + * @return true if this is a server behavior tree, false otherwise + */ public boolean isServer(){ return isServer; } + /** + * Gets the list of synchronized fields within this behavior tree + * @return The list of synchronized fields within this behavior tree + */ public List getSynchronizedFields(){ return synchronizedFields; } + /** + * Gets the target file associated with this behavior tree + * @return The target file + */ public TargetFile getTargetFile(){ return targetFile; } @@ -91,7 +124,12 @@ public class BehaviorTree { return rVal; } - public String getAttachMethodContent(boolean isServer){ + /** + * Gets the content for the attach method of this behavior tree + * @param isServer true if this is a server behavior tree, false otherwise + * @return The attach method content + */ + public String getAttachMethodContent(){ String templateSource = "/server/AttachBTree.java"; if(!isServer){ templateSource = "/client/AttachBTree.java"; @@ -100,13 +138,21 @@ public class BehaviorTree { return rVal; } + /** + * Gets the detatch method's name + * @return The detatch method's name + */ public String getDetachMethodName(){ String rVal = ""; rVal = "detachTree"; return rVal; } - public String getDetachMethodContent(boolean isServer){ + /** + * Gets the content for the detatch method + * @return The content + */ + public String getDetachMethodContent(){ String templateSource = "/server/DetachBTree.java"; if(!isServer){ templateSource = "/client/DetachBTree.java"; @@ -115,21 +161,37 @@ public class BehaviorTree { return rVal; } + /** + * Gets the fetch method's name + * @return The name + */ public String getEntityFetchMethodName(){ String rVal = "get" + className; return rVal; } + /** + * Gets the content for the fetch method + * @return The content + */ public String getEntityFetchMethodContent(){ String rVal = TemplateInjectionUtils.getFragmentWithReplacement("/btree/EntityFetchMethod.java", this.className, "TREE_" + this.name.toUpperCase()); return rVal; } + /** + * Gets the constructor method's name + * @return The constructor method's name + */ public String getConstructorMethodName(){ String rVal = className; return rVal; } + /** + * Gets the constructor method's content + * @return The content + */ public String getConstructorMethodContent(){ String rVal = TemplateInjectionUtils.getFragmentWithReplacement("/btree/Constructor.java", this.className); return rVal; diff --git a/src/main/java/electrosphere/main/structure/BTreeIdEnum.java b/src/main/java/electrosphere/main/core/enums/BTreeIdEnum.java similarity index 88% rename from src/main/java/electrosphere/main/structure/BTreeIdEnum.java rename to src/main/java/electrosphere/main/core/enums/BTreeIdEnum.java index 48e94ce..418b2dd 100644 --- a/src/main/java/electrosphere/main/structure/BTreeIdEnum.java +++ b/src/main/java/electrosphere/main/core/enums/BTreeIdEnum.java @@ -1,10 +1,12 @@ -package electrosphere.main.structure; +package electrosphere.main.core.enums; import java.io.File; import java.io.IOException; import com.google.common.io.Files; +import electrosphere.main.core.btree.BehaviorTree; +import electrosphere.main.project.ProjectStructure; import electrosphere.main.util.ClassSourceUtils; /** @@ -49,8 +51,8 @@ public class BTreeIdEnum { source = source + "\n"; source = source + ClassSourceUtils.generateClassHeader("BehaviorTreeIdEnums", "List of enums for each automatically synchronized behavior tree.", true); source = source + "\n"; - for(BehaviorTree tree : structure.behaviorTrees){ - source = source + " public static final int " + getTreeIdEnum(tree) + " = " + tree.id + ";\n"; + for(BehaviorTree tree : structure.getBehaviorTrees()){ + source = source + " public static final int " + getTreeIdEnum(tree) + " = " + tree.getId() + ";\n"; } source = source + "\n"; source = source + ClassSourceUtils.generateClassEnd(); @@ -68,7 +70,7 @@ public class BTreeIdEnum { * @return the name */ public static String getTreeIdEnum(BehaviorTree tree){ - return "BTREE_" + tree.name.toUpperCase() + "_ID"; + return "BTREE_" + tree.getName().toUpperCase() + "_ID"; } } diff --git a/src/main/java/electrosphere/main/structure/FieldIdEnum.java b/src/main/java/electrosphere/main/core/enums/FieldIdEnum.java similarity index 85% rename from src/main/java/electrosphere/main/structure/FieldIdEnum.java rename to src/main/java/electrosphere/main/core/enums/FieldIdEnum.java index f705b4b..b614ab9 100644 --- a/src/main/java/electrosphere/main/structure/FieldIdEnum.java +++ b/src/main/java/electrosphere/main/core/enums/FieldIdEnum.java @@ -1,10 +1,12 @@ -package electrosphere.main.structure; +package electrosphere.main.core.enums; import java.io.File; import java.io.IOException; import com.google.common.io.Files; +import electrosphere.main.core.syncfield.SynchronizedField; +import electrosphere.main.project.ProjectStructure; import electrosphere.main.util.ClassSourceUtils; /** @@ -50,8 +52,8 @@ public class FieldIdEnum { source = source + "\n"; source = source + ClassSourceUtils.generateClassHeader("FieldIdEnums", "List of enums of all fields and their associated ids.", true); source = source + "\n"; - for(SynchronizedField field : structure.synchronizedFields){ - source = source + " public static final int " + getFieldIdEnum(field) + " = " + field.id + ";\n"; + for(SynchronizedField field : structure.getSynchronizedFields()){ + source = source + " public static final int " + getFieldIdEnum(field) + " = " + field.getId() + ";\n"; } source = source + "\n"; source = source + ClassSourceUtils.generateClassEnd(); @@ -69,7 +71,7 @@ public class FieldIdEnum { * @return the name */ public static String getFieldIdEnum(SynchronizedField field){ - return "TREE_" + field.parent.name.toUpperCase() + "_SYNCEDFIELD_" + field.fieldName.toUpperCase() + "_ID"; + return "TREE_" + field.getParent().getName().toUpperCase() + "_SYNCEDFIELD_" + field.getFieldName().toUpperCase() + "_ID"; } } diff --git a/src/main/java/electrosphere/main/structure/SynchronizedField.java b/src/main/java/electrosphere/main/core/syncfield/SynchronizedField.java similarity index 85% rename from src/main/java/electrosphere/main/structure/SynchronizedField.java rename to src/main/java/electrosphere/main/core/syncfield/SynchronizedField.java index 6a956ea..9236235 100644 --- a/src/main/java/electrosphere/main/structure/SynchronizedField.java +++ b/src/main/java/electrosphere/main/core/syncfield/SynchronizedField.java @@ -1,5 +1,7 @@ -package electrosphere.main.structure; +package electrosphere.main.core.syncfield; +import electrosphere.main.core.btree.BehaviorTree; +import electrosphere.main.project.ProjectStructure; import electrosphere.main.targets.TargetFile; import electrosphere.main.util.TemplateInjectionUtils; import electrosphere.main.util.Utilities; @@ -71,8 +73,8 @@ public class SynchronizedField { public String getServerSetterContent(ProjectStructure structure){ String rVal = null; - String bTreeIdVariable = "BehaviorTreeIdEnums.BTREE_" + this.parent.name.toUpperCase() + "_ID"; - String fieldIdVariable = "FieldIdEnums.TREE_" + this.parent.name.toUpperCase() + "_SYNCEDFIELD_" + this.fieldName.toUpperCase() + "_ID"; + String bTreeIdVariable = "BehaviorTreeIdEnums.BTREE_" + this.parent.getName().toUpperCase() + "_ID"; + String fieldIdVariable = "FieldIdEnums.TREE_" + this.parent.getName().toUpperCase() + "_SYNCEDFIELD_" + this.fieldName.toUpperCase() + "_ID"; switch(typeName){ case "long": { String packetContentFiller = " DataCellSearchUtils.getEntityDataCell(parent).broadcastNetworkMessage(SynchronizationMessage.constructUpdateClientLongStateMessage(parent.getId(), " + bTreeIdVariable + ", " + fieldIdVariable + ", " + fieldName + "));"; @@ -110,4 +112,36 @@ public class SynchronizedField { return rVal; } + /** + * Gets the id of this field + * @return The id + */ + public int getId(){ + return this.id; + } + + /** + * Gets the name of this field + * @return The name of the field + */ + public String getFieldName(){ + return this.fieldName; + } + + /** + * Gets the parent behavior tree of this field + * @return The parent behavior tree + */ + public BehaviorTree getParent(){ + return this.parent; + } + + /** + * Gets the name of the type for this synchronized field + * @return The name of the type + */ + public String getTypeName(){ + return this.typeName; + } + } diff --git a/src/main/java/electrosphere/main/structure/SynchronizedType.java b/src/main/java/electrosphere/main/core/syncfield/SynchronizedType.java similarity index 95% rename from src/main/java/electrosphere/main/structure/SynchronizedType.java rename to src/main/java/electrosphere/main/core/syncfield/SynchronizedType.java index a76b4ca..535674a 100644 --- a/src/main/java/electrosphere/main/structure/SynchronizedType.java +++ b/src/main/java/electrosphere/main/core/syncfield/SynchronizedType.java @@ -1,4 +1,4 @@ -package electrosphere.main.structure; +package electrosphere.main.core.syncfield; import java.util.List; @@ -115,4 +115,12 @@ public class SynchronizedType { return getTargetFile().getName().substring(0, getTargetFile().getName().length() - 5); } + /** + * The name of the type + * @return The name + */ + public String getName(){ + return this.name; + } + } diff --git a/src/main/java/electrosphere/main/structure/ProjectStructure.java b/src/main/java/electrosphere/main/project/ProjectStructure.java similarity index 92% rename from src/main/java/electrosphere/main/structure/ProjectStructure.java rename to src/main/java/electrosphere/main/project/ProjectStructure.java index 6faabaf..89b958b 100644 --- a/src/main/java/electrosphere/main/structure/ProjectStructure.java +++ b/src/main/java/electrosphere/main/project/ProjectStructure.java @@ -1,4 +1,4 @@ -package electrosphere.main.structure; +package electrosphere.main.project; import java.io.File; import java.util.Collection; @@ -15,6 +15,12 @@ import org.jboss.forge.roaster.model.source.JavaEnumSource; import org.jboss.forge.roaster.model.source.JavaSource; import electrosphere.main.Main; +import electrosphere.main.client.ClientSynchronizationManager; +import electrosphere.main.core.btree.BehaviorTree; +import electrosphere.main.core.enums.BTreeIdEnum; +import electrosphere.main.core.enums.FieldIdEnum; +import electrosphere.main.core.syncfield.SynchronizedField; +import electrosphere.main.core.syncfield.SynchronizedType; import electrosphere.main.targets.TargetFile; import electrosphere.main.util.ClassSourceUtils; @@ -158,20 +164,20 @@ public class ProjectStructure { //generate in-class functions for btrees for(BehaviorTree tree : behaviorTrees){ if(Main.LOG){ - System.out.println("Generating for " + tree.className); + System.out.println("Generating for " + tree.getClassName()); } //server side getter + setter - if(tree.isServer){ + if(tree.isServer()){ - for(SynchronizedField field : tree.synchronizedFields){ + for(SynchronizedField field : tree.getSynchronizedFields()){ ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), field.getGetterName(), field.getServerGetterContent()); ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), field.getSetterName(), field.getServerSetterContent(this)); } //attach + detatch methods - ClassSourceUtils.addMethodIfAbsent(this, tree.getTargetFile(), tree.getAttachMethodName(), tree.getAttachMethodContent(true)); - ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), tree.getDetachMethodName(), tree.getDetachMethodContent(true)); + ClassSourceUtils.addMethodIfAbsent(this, tree.getTargetFile(), tree.getAttachMethodName(), tree.getAttachMethodContent()); + ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), tree.getDetachMethodName(), tree.getDetachMethodContent()); //imports ClassSourceUtils.importClass(this, tree.getTargetFile(), "electrosphere.engine.Globals"); ClassSourceUtils.importClass(this, tree.getTargetFile(), "electrosphere.server.datacell.utils.DataCellSearchUtils"); @@ -186,13 +192,13 @@ public class ProjectStructure { - for(SynchronizedField field : tree.synchronizedFields){ + for(SynchronizedField field : tree.getSynchronizedFields()){ ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), field.getGetterName(), field.getClientGetterContent()); ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), field.getSetterName(), field.getClientSetterContent(this)); } //attach + detatch methods - ClassSourceUtils.addMethodIfAbsent(this, tree.getTargetFile(), tree.getAttachMethodName(), tree.getAttachMethodContent(false)); - ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), tree.getDetachMethodName(), tree.getDetachMethodContent(false)); + ClassSourceUtils.addMethodIfAbsent(this, tree.getTargetFile(), tree.getAttachMethodName(), tree.getAttachMethodContent()); + ClassSourceUtils.addOrReplaceMethod(this, tree.getTargetFile(), tree.getDetachMethodName(), tree.getDetachMethodContent()); //imports ClassSourceUtils.importClass(this, tree.getTargetFile(), "electrosphere.engine.Globals"); // for client scene wrapper ClassSourceUtils.importClass(this, tree.getTargetFile(), "electrosphere.entity.Entity"); @@ -249,7 +255,7 @@ public class ProjectStructure { */ public SynchronizedType getType(String typeName){ for(SynchronizedType type : this.synchronizedTypes){ - if(type.name.equals(typeName)){ + if(type.getName().equals(typeName)){ return type; } } @@ -263,7 +269,7 @@ public class ProjectStructure { */ public BehaviorTree getTree(String typeName){ for(BehaviorTree tree : this.behaviorTrees){ - if(tree.name.equals(typeName)){ + if(tree.getName().equals(typeName)){ return tree; } } @@ -344,4 +350,20 @@ public class ProjectStructure { } } + /** + * Gets the list of synchronized fields + * @return The list of synchronized fields + */ + public List getSynchronizedFields(){ + return this.synchronizedFields; + } + + /** + * Gets the list of all behavior trees + * @return The list of all behavior trees + */ + public List getBehaviorTrees(){ + return this.behaviorTrees; + } + } diff --git a/src/main/java/electrosphere/main/structure/EntityValueTrackingService.java b/src/main/java/electrosphere/main/server/EntityValueTrackingService.java similarity index 90% rename from src/main/java/electrosphere/main/structure/EntityValueTrackingService.java rename to src/main/java/electrosphere/main/server/EntityValueTrackingService.java index 16336fc..ed03d1c 100644 --- a/src/main/java/electrosphere/main/structure/EntityValueTrackingService.java +++ b/src/main/java/electrosphere/main/server/EntityValueTrackingService.java @@ -1,4 +1,4 @@ -package electrosphere.main.structure; +package electrosphere.main.server; /** * This should represent a service placed in project source folder that tracks which trees are attached to which entities and which values they have diff --git a/src/main/java/electrosphere/main/structure/TranslatorService.java b/src/main/java/electrosphere/main/structure/TranslatorService.java deleted file mode 100644 index cc4273e..0000000 --- a/src/main/java/electrosphere/main/structure/TranslatorService.java +++ /dev/null @@ -1,8 +0,0 @@ -package electrosphere.main.structure; - -/** - * This should represent a file placed in project source that translates enums to ints and vice-versa - */ -public class TranslatorService { - -} diff --git a/src/main/java/electrosphere/main/util/ClassSourceUtils.java b/src/main/java/electrosphere/main/util/ClassSourceUtils.java index 14a343d..bd0e345 100644 --- a/src/main/java/electrosphere/main/util/ClassSourceUtils.java +++ b/src/main/java/electrosphere/main/util/ClassSourceUtils.java @@ -7,7 +7,7 @@ import org.jboss.forge.roaster.model.source.Import; import org.jboss.forge.roaster.model.source.JavaClassSource; import org.jboss.forge.roaster.model.source.MethodSource; -import electrosphere.main.structure.ProjectStructure; +import electrosphere.main.project.ProjectStructure; import electrosphere.main.targets.TargetFile; /**