diff --git a/src/commands/CommandBlurry.java b/src/commands/CommandBlurry.java index ff56a5b..c2a834b 100644 --- a/src/commands/CommandBlurry.java +++ b/src/commands/CommandBlurry.java @@ -63,8 +63,8 @@ public class CommandBlurry extends Command postProcessed = new File(name); res.sendFile(postProcessed, "png"); - ImageUtils.BlockingFileDelete(preProcessed); - ImageUtils.BlockingFileDelete(postProcessed); + ImageUtils.blockingFileDelete(preProcessed); + ImageUtils.blockingFileDelete(postProcessed); } private static void ApplySnap(BufferedImage image, String name) throws IOException diff --git a/src/commands/CommandBoop.java b/src/commands/CommandBoop.java index fc0da25..d694277 100644 --- a/src/commands/CommandBoop.java +++ b/src/commands/CommandBoop.java @@ -42,7 +42,7 @@ public class CommandBoop extends Command } catch (NumberFormatException e) { - GlobalLog.Warn(LogFilter.Command, "No valid value was found for boops! Starting over at 0!"); + GlobalLog.warn(LogFilter.Command, "No valid value was found for boops! Starting over at 0!"); boops = 0; markDirty(); } diff --git a/src/commands/CommandCatch.java b/src/commands/CommandCatch.java index dd24612..ceaa01d 100644 --- a/src/commands/CommandCatch.java +++ b/src/commands/CommandCatch.java @@ -54,7 +54,7 @@ public class CommandCatch extends Command catcheeFile = new File(catchFilename); ImageOverlayBuilder builder = new ImageOverlayBuilder("assets/catch/frames/", "catch ", 92, 18); - builder.Overlay(ImageIO.read(catcheeFile), name); + builder.overlay(ImageIO.read(catcheeFile), name); } catch (IOException e) { @@ -65,7 +65,7 @@ public class CommandCatch extends Command res.sendFile(catchFile, "gif"); // Thread cleanup... - ImageUtils.BlockingFileDelete(catchFile); - ImageUtils.BlockingFileDelete(catcheeFile); + ImageUtils.blockingFileDelete(catchFile); + ImageUtils.blockingFileDelete(catcheeFile); } } diff --git a/src/commands/CommandColiru.java b/src/commands/CommandColiru.java index 3973801..9dc39c1 100644 --- a/src/commands/CommandColiru.java +++ b/src/commands/CommandColiru.java @@ -23,7 +23,7 @@ public class CommandColiru extends Command return; } - res.send(compiler.compileCPlus(input.args)); + res.send(compiler.compileCPlusPlus(input.args)); } } diff --git a/src/commands/CommandColor.java b/src/commands/CommandColor.java index a130c86..a4c2059 100644 --- a/src/commands/CommandColor.java +++ b/src/commands/CommandColor.java @@ -32,7 +32,7 @@ public class CommandColor extends Command public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) { // First, try and parse out the color to make sure we can even get it. - ColorData colorData = theColorAPI.LookupHex(input.args.trim()); + ColorData colorData = theColorAPI.lookupHex(input.args.trim()); // Verify the color was even found if(colorData == null) @@ -77,7 +77,7 @@ public class CommandColor extends Command // Send then delete the temp local files res.send(response); - ImageUtils.BlockingFileDelete(file); + ImageUtils.blockingFileDelete(file); }; } diff --git a/src/commands/CommandHelpBuilder.java b/src/commands/CommandHelpBuilder.java index e736c5e..109dc03 100644 --- a/src/commands/CommandHelpBuilder.java +++ b/src/commands/CommandHelpBuilder.java @@ -63,13 +63,13 @@ public class CommandHelpBuilder extends Command { } catch (FileNotFoundException e) { - GlobalLog.Error(e.toString()); + GlobalLog.error(e.toString()); return; } File file = new File(filename); res.sendFile(file, "txt"); - ImageUtils.BlockingFileDelete(file); + ImageUtils.blockingFileDelete(file); } // Generates the section for a specific role, optionally adding spacing after for another section diff --git a/src/commands/CommandLeaderboard.java b/src/commands/CommandLeaderboard.java index 29914c5..79a1ff6 100644 --- a/src/commands/CommandLeaderboard.java +++ b/src/commands/CommandLeaderboard.java @@ -32,7 +32,7 @@ public class CommandLeaderboard extends Command public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) { // Start by force-flushing. We need to be up-to-date. - GlobalLog.Log("Flushed database for " + DatabaseManager.instance.upkeep() + " items."); + GlobalLog.log("Flushed database for " + DatabaseManager.instance.upkeep() + " items."); // Get all users associated with a guild and get their bean count String guildID = guild.uniqueID; @@ -74,7 +74,7 @@ public class CommandLeaderboard extends Command return (int)difference; }); - GlobalLog.Log(LogFilter.Command, "Sorted through " + users.size() + " KittyUsers for leaderboard purposes."); + GlobalLog.log(LogFilter.Command, "Sorted through " + users.size() + " KittyUsers for leaderboard purposes."); // Configure output final int listSize = 10; diff --git a/src/commands/CommandMap.java b/src/commands/CommandMap.java index e337f3f..f607229 100644 --- a/src/commands/CommandMap.java +++ b/src/commands/CommandMap.java @@ -43,18 +43,18 @@ public class CommandMap extends Command { OptionParser parser = new OptionParser(input.args); - String seedStr = parser.GetOption("-s", true); + String seedStr = parser.getOption("-s", true); if(seedStr != null) { seed = Long.parseLong(seedStr); hasSeed = true; } - String widthStr = parser.GetOption("-w", true); + String widthStr = parser.getOption("-w", true); if(widthStr != null) width = ValidateSize(Integer.parseInt(widthStr), MaxWidth); - String heightStr = parser.GetOption("-h", true); + String heightStr = parser.getOption("-h", true); if(heightStr != null) height = ValidateSize(Integer.parseInt(heightStr), MaxHeight); } diff --git a/src/commands/CommandPerish.java b/src/commands/CommandPerish.java index 9089a72..8da8ba6 100644 --- a/src/commands/CommandPerish.java +++ b/src/commands/CommandPerish.java @@ -69,8 +69,8 @@ public class CommandPerish extends Command postProcessed = new File(name); res.sendFile(postProcessed, "png"); - ImageUtils.BlockingFileDelete(preProcessed); - ImageUtils.BlockingFileDelete(postProcessed); + ImageUtils.blockingFileDelete(preProcessed); + ImageUtils.blockingFileDelete(postProcessed); } private static void ApplyTintEffect(BufferedImage image, String name) throws IOException diff --git a/src/commands/CommandShutdown.java b/src/commands/CommandShutdown.java index afcb43f..aec54ea 100644 --- a/src/commands/CommandShutdown.java +++ b/src/commands/CommandShutdown.java @@ -48,14 +48,14 @@ public class CommandShutdown extends Command // Force upkeep, this works so long as upkeep is on the main thread. res.sendImmediate(LocStrings.stub("ShutdownSafe")); DatabaseManager.instance.upkeep(); - GlobalLog.Warn(LogFilter.Command, LocStrings.lookup("ShutdownSafe")); + GlobalLog.warn(LogFilter.Command, LocStrings.lookup("ShutdownSafe")); System.exit(0); } else { res.sendImmediate(LocStrings.stub("ShutdownUnsafe"));// "``"); - GlobalLog.Warn(LogFilter.Command, LocStrings.lookup("ShutdownSafe")); + GlobalLog.warn(LogFilter.Command, LocStrings.lookup("ShutdownSafe")); System.exit(0); } } diff --git a/src/commands/CommandStark.java b/src/commands/CommandStark.java index 24865e0..f33b076 100644 --- a/src/commands/CommandStark.java +++ b/src/commands/CommandStark.java @@ -63,8 +63,8 @@ public class CommandStark extends Command postProcessed = new File(name); res.sendFile(postProcessed, "png"); - ImageUtils.BlockingFileDelete(preProcessed); - ImageUtils.BlockingFileDelete(postProcessed); + ImageUtils.blockingFileDelete(preProcessed); + ImageUtils.blockingFileDelete(postProcessed); } private static void ApplySnap(BufferedImage image, String name) throws IOException diff --git a/src/commands/CommandTeey.java b/src/commands/CommandTeey.java index 8ba9f4d..c98d0b2 100644 --- a/src/commands/CommandTeey.java +++ b/src/commands/CommandTeey.java @@ -54,7 +54,7 @@ public class CommandTeey extends Command teeyeeFile = new File(yeeteeFilename); ImageOverlayBuilder builder = new ImageOverlayBuilder("assets/teey/frames/", "teey ", 24, 18); - builder.Overlay(ImageIO.read(teeyeeFile), name); + builder.overlay(ImageIO.read(teeyeeFile), name); } catch (IOException e) { @@ -65,7 +65,7 @@ public class CommandTeey extends Command res.sendFile(teeyFile, "gif"); // Thread cleanup... - ImageUtils.BlockingFileDelete(teeyFile); - ImageUtils.BlockingFileDelete(teeyeeFile); + ImageUtils.blockingFileDelete(teeyFile); + ImageUtils.blockingFileDelete(teeyeeFile); } } diff --git a/src/commands/CommandWolfram.java b/src/commands/CommandWolfram.java index 54b26b4..ee341cc 100644 --- a/src/commands/CommandWolfram.java +++ b/src/commands/CommandWolfram.java @@ -27,7 +27,7 @@ public class CommandWolfram extends Command { File pic = new File(searcher.getWolfram(input.args)); res.sendFile(pic, "png"); - ImageUtils.BlockingFileDelete(pic); + ImageUtils.blockingFileDelete(pic); } catch (IOException e) { diff --git a/src/commands/CommandYeet.java b/src/commands/CommandYeet.java index 6fd467b..71c5a63 100644 --- a/src/commands/CommandYeet.java +++ b/src/commands/CommandYeet.java @@ -54,7 +54,7 @@ public class CommandYeet extends Command yeeteeFile = new File(yeeteeFilename); ImageOverlayBuilder builder = new ImageOverlayBuilder("assets/yeet/frames/", "yeet ", 24, 18); - builder.Overlay(ImageIO.read(yeeteeFile), name); + builder.overlay(ImageIO.read(yeeteeFile), name); } catch (IOException e) { @@ -65,7 +65,7 @@ public class CommandYeet extends Command res.sendFile(yeetFile, "gif"); // Thread cleanup... - ImageUtils.BlockingFileDelete(yeetFile); - ImageUtils.BlockingFileDelete(yeeteeFile); + ImageUtils.blockingFileDelete(yeetFile); + ImageUtils.blockingFileDelete(yeeteeFile); } } diff --git a/src/core/BaseKeyValueFile.java b/src/core/BaseKeyValueFile.java index 9519fb6..b2b19bd 100644 --- a/src/core/BaseKeyValueFile.java +++ b/src/core/BaseKeyValueFile.java @@ -38,7 +38,7 @@ public class BaseKeyValueFile File f = new File(filename); if(f.isFile() && f.canRead()) { - String content = FileUtils.ReadContent(f).trim(); + String content = FileUtils.readContent(f).trim(); String[] lines = content.split("" + pairSeparator); for(int i = 0; i < lines.length; ++i) @@ -84,7 +84,7 @@ public class BaseKeyValueFile } catch (IOException e) { - GlobalLog.Error(LogFilter.Core, "Issue writing file " + filename + ": " + e.getMessage()); + GlobalLog.error(LogFilter.Core, "Issue writing file " + filename + ": " + e.getMessage()); } } } diff --git a/src/core/BaseLocFile.java b/src/core/BaseLocFile.java index 672fd30..a139857 100644 --- a/src/core/BaseLocFile.java +++ b/src/core/BaseLocFile.java @@ -30,9 +30,9 @@ public abstract class BaseLocFile protected TaggedPairStore stringStore; // Logging - private void log(String str) { GlobalLog.Log(LogFilter.Strings, str); } - private void warn(String str) { GlobalLog.Warn(LogFilter.Strings, str); } - private void error(String str) { GlobalLog.Error(LogFilter.Strings, str); } + private void log(String str) { GlobalLog.log(LogFilter.Strings, str); } + private void warn(String str) { GlobalLog.warn(LogFilter.Strings, str); } + private void error(String str) { GlobalLog.error(LogFilter.Strings, str); } // File monitoring protected FileMonitor fileMonitor; @@ -49,7 +49,7 @@ public abstract class BaseLocFile { synchronized(stringStore) { - fileMonitor.Update(this::onFileChange); + fileMonitor.update(this::onFileChange); } } @@ -80,7 +80,7 @@ public abstract class BaseLocFile String filename = path.getFileName().toString(); if(filename.contains(".java")) { - String contents = FileUtils.ReadContent(path); + String contents = FileUtils.readContent(path); String[] split = contents.split(functionName); // Identify all localizer function calls @@ -203,7 +203,7 @@ public abstract class BaseLocFile public void scrapeAll() { ArrayList localizeList = new ArrayList(); - FileUtils.AcquireAllFiles(KittySourceDirectory).forEach((path) -> tryStripSpecified(path, localizeList)); + FileUtils.acquireAllFiles(KittySourceDirectory).forEach((path) -> tryStripSpecified(path, localizeList)); for(LocInfo toStub : localizeList) stringStore.addKeyValue(toStub.file, toStub.phrase, toStub.phrase); diff --git a/src/core/CharacterManager.java b/src/core/CharacterManager.java index 81aa10d..0a55d81 100644 --- a/src/core/CharacterManager.java +++ b/src/core/CharacterManager.java @@ -24,7 +24,7 @@ public class CharacterManager } else { - GlobalLog.Error(LogFilter.Core, "Attempted to create a second CharacterManager singleton!"); + GlobalLog.error(LogFilter.Core, "Attempted to create a second CharacterManager singleton!"); return; } } diff --git a/src/core/Command.java b/src/core/Command.java index 954edb5..f38e0e8 100644 --- a/src/core/Command.java +++ b/src/core/Command.java @@ -28,7 +28,7 @@ public abstract class Command private void reject(KittyUser user, String reason) { - GlobalLog.Warn(LogFilter.Command, this.getClass().getSimpleName() + " from " + user.name + " rejected due to command's " + reason); + GlobalLog.warn(LogFilter.Command, this.getClass().getSimpleName() + " from " + user.name + " rejected due to command's " + reason); } // Determine if we're exclusive enough for this command and diff --git a/src/core/CommandEnabler.java b/src/core/CommandEnabler.java index 160c921..b249655 100644 --- a/src/core/CommandEnabler.java +++ b/src/core/CommandEnabler.java @@ -30,7 +30,7 @@ public class CommandEnabler extends BaseKeyValueFile super(name); // Create/Init variables - GlobalLog.Log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName()); + GlobalLog.log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName()); enabledMap = new HashMap<>(); keyList = new ArrayList<>(); @@ -68,7 +68,7 @@ public class CommandEnabler extends BaseKeyValueFile if(enabledMap.putIfAbsent(command, defaultEnabledState) == null) { - GlobalLog.Log(LogFilter.Strings, "Identified new toggleable raw command: " + command); + GlobalLog.log(LogFilter.Strings, "Identified new toggleable raw command: " + command); keyList.add(command); } } diff --git a/src/core/CommandManager.java b/src/core/CommandManager.java index e4ada68..73befc7 100644 --- a/src/core/CommandManager.java +++ b/src/core/CommandManager.java @@ -59,11 +59,11 @@ public class CommandManager if(old != null) { - GlobalLog.Warn(LogFilter.Core, "Writing over a command with the key " + key); + GlobalLog.warn(LogFilter.Core, "Writing over a command with the key " + key); return; } - GlobalLog.Log(LogFilter.Core, "Command registered under key " + key); + GlobalLog.log(LogFilter.Core, "Command registered under key " + key); } // Registers a command under multiple names! @@ -91,7 +91,7 @@ public class CommandManager } else { - GlobalLog.Warn(LogFilter.Command, "User " + user.name + " tried to invoke command that doesn't exist: " + input.key); + GlobalLog.warn(LogFilter.Command, "User " + user.name + " tried to invoke command that doesn't exist: " + input.key); return false; } } diff --git a/src/core/DatabaseDriverKeyValue.java b/src/core/DatabaseDriverKeyValue.java index c7f7469..14a8699 100644 --- a/src/core/DatabaseDriverKeyValue.java +++ b/src/core/DatabaseDriverKeyValue.java @@ -38,14 +38,14 @@ public class DatabaseDriverKeyValue public void ensureTableExists(String tableName, String keyName, String valueName) { // Require a global table if it doesn't exist already - driver.ExecuteStatement(JDBCStatementType.Create, "CREATE TABLE IF NOT EXISTS " + tableName + " (" + keyName + " text PRIMARY KEY, " + valueName + " text)", null); + driver.executeStatement(JDBCStatementType.Create, "CREATE TABLE IF NOT EXISTS " + tableName + " (" + keyName + " text PRIMARY KEY, " + valueName + " text)", null); } // Set up and create a table in the database public boolean connect() { driver = new JDBCDriverSQLite(); - if(driver.Connect() == false) + if(driver.connect() == false) { return false; } @@ -59,7 +59,7 @@ public class DatabaseDriverKeyValue // The key will be created if it doesn't exist and the value specified will be stored. public void createSetKey(String key, String value) { - GlobalLog.Log(LogFilter.Database, "CreateSetKey: Key-" + key + " value-" + value); + GlobalLog.log(LogFilter.Database, "CreateSetKey: Key-" + key + " value-" + value); if(hasKey(key)) { @@ -74,7 +74,7 @@ public class DatabaseDriverKeyValue // Creates a key. The key will be created if it doesn't exist, and the default value returned. public String createGetKey(String key) { - GlobalLog.Log(LogFilter.Database, "CreateGetKey: " + key); + GlobalLog.log(LogFilter.Database, "CreateGetKey: " + key); if(hasKey(key)) { @@ -92,15 +92,15 @@ public class DatabaseDriverKeyValue private void updateKey(String key, String value) { String command = "UPDATE " + tableName + " SET " + valueColumnName + " = ? WHERE " + keyColumnName + " = ?"; - boolean status = driver.ExecuteStatement(JDBCStatementType.Update, command, new String[] { value, key }); - GlobalLog.Log(LogFilter.Database, "UpdateKey status: " + status); + boolean status = driver.executeStatement(JDBCStatementType.Update, command, new String[] { value, key }); + GlobalLog.log(LogFilter.Database, "UpdateKey status: " + status); } // Protoype updating for seeing if a key exists private boolean hasKey(String key) { String command = "SELECT COUNT(1) as count FROM " + tableName + " WHERE " + keyColumnName + " = ?"; - ResultSet set = driver.ExecuteReturningStatement(JDBCStatementType.Select, command, new String[] { key }); + ResultSet set = driver.executeReturningStatement(JDBCStatementType.Select, command, new String[] { key }); String out = resultAsString(set, "count"); return out.charAt(0) == '1'; } @@ -109,7 +109,7 @@ public class DatabaseDriverKeyValue private String getKey(String key) { String command = "SELECT " + valueColumnName + " as searchedKey FROM " + tableName +" WHERE " + keyColumnName + " = ?"; - ResultSet set = driver.ExecuteReturningStatement(JDBCStatementType.Select, command, new String[] { key }); + ResultSet set = driver.executeReturningStatement(JDBCStatementType.Select, command, new String[] { key }); return resultAsString(set, "searchedKey"); } @@ -117,15 +117,15 @@ public class DatabaseDriverKeyValue private void createKey(String key, String value) { String command = "INSERT INTO " + tableName + " (GlobalKey, GlobalValue) VALUES (?, ?)"; - boolean status = driver.ExecuteStatement(JDBCStatementType.Insert, command, new String[] { key, value }); - GlobalLog.Log(LogFilter.Database, "CreateKey status: " + status); + boolean status = driver.executeStatement(JDBCStatementType.Insert, command, new String[] { key, value }); + GlobalLog.log(LogFilter.Database, "CreateKey status: " + status); } // Get all keys containing a substring public List getKeysWith(String keySubstring) { String command = "SELECT * FROM " + tableName + " WHERE " + keyColumnName + " like ?"; - ResultSet result = driver.ExecuteReturningStatement(JDBCStatementType.Select, command, new String[] { "%" + keySubstring + "%" }); + ResultSet result = driver.executeReturningStatement(JDBCStatementType.Select, command, new String[] { "%" + keySubstring + "%" }); List keys = new ArrayList(); @@ -165,7 +165,7 @@ public class DatabaseDriverKeyValue } catch (SQLException e) { - GlobalLog.Error(LogFilter.Database, e.toString()); + GlobalLog.error(LogFilter.Database, e.toString()); return null; } } diff --git a/src/core/DatabaseManager.java b/src/core/DatabaseManager.java index f5a3a11..204165b 100644 --- a/src/core/DatabaseManager.java +++ b/src/core/DatabaseManager.java @@ -35,7 +35,7 @@ public class DatabaseManager // Constructor to enforce singleton. public DatabaseManager() { - GlobalLog.Log(LogFilter.Database, "Creating database manager"); + GlobalLog.log(LogFilter.Database, "Creating database manager"); if(instance == null) { @@ -43,7 +43,7 @@ public class DatabaseManager } else { - GlobalLog.Error(LogFilter.Database, "Attempted to register a second DataBase manager!"); + GlobalLog.error(LogFilter.Database, "Attempted to register a second DataBase manager!"); return; } @@ -59,13 +59,13 @@ public class DatabaseManager // Connect data sets if(globalDataDriver.connect() == false) { - GlobalLog.Error("Global database failed to connect. Without this DB, this bot can not run."); + GlobalLog.error("Global database failed to connect. Without this DB, this bot can not run."); System.exit(1); } if(characterDataDriver.connect() == false) { - GlobalLog.Error("Character database failed to connect. Without this DB, this bot can not run."); + GlobalLog.error("Character database failed to connect. Without this DB, this bot can not run."); System.exit(1); } } diff --git a/src/core/LocCommands.java b/src/core/LocCommands.java index 6c2b40e..86bfc1d 100644 --- a/src/core/LocCommands.java +++ b/src/core/LocCommands.java @@ -19,7 +19,7 @@ public class LocCommands extends BaseLocFile { super(fileName, function); - GlobalLog.Log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName()); + GlobalLog.log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName()); if(instance == null) { @@ -33,7 +33,7 @@ public class LocCommands extends BaseLocFile } else { - GlobalLog.Error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName()); + GlobalLog.error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName()); } } diff --git a/src/core/LocStrings.java b/src/core/LocStrings.java index 95f1594..c95d363 100644 --- a/src/core/LocStrings.java +++ b/src/core/LocStrings.java @@ -18,7 +18,7 @@ public class LocStrings extends BaseLocFile { super(fileName, function); - GlobalLog.Log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName()); + GlobalLog.log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName()); if(instance == null) { @@ -32,7 +32,7 @@ public class LocStrings extends BaseLocFile } else { - GlobalLog.Error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName()); + GlobalLog.error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName()); } } diff --git a/src/core/ObjectBuilderFactory.java b/src/core/ObjectBuilderFactory.java index 87cc63a..640157b 100644 --- a/src/core/ObjectBuilderFactory.java +++ b/src/core/ObjectBuilderFactory.java @@ -99,7 +99,7 @@ public class ObjectBuilderFactory } catch(InterruptedException ie) { - GlobalLog.Error(LogFilter.Core, "Issue during object builder lazy initialization." + GlobalLog.error(LogFilter.Core, "Issue during object builder lazy initialization." + " The factory was not initialized, and kitty will not be able to continue functionally."); } } diff --git a/src/core/RPManager.java b/src/core/RPManager.java index 91c7a05..9047d9e 100644 --- a/src/core/RPManager.java +++ b/src/core/RPManager.java @@ -23,7 +23,7 @@ public class RPManager } else { - GlobalLog.Error(LogFilter.Core, "Attempted to create a second RP Manager!"); + GlobalLog.error(LogFilter.Core, "Attempted to create a second RP Manager!"); return; } } diff --git a/src/core/Stats.java b/src/core/Stats.java index 4c7353c..f3fc254 100644 --- a/src/core/Stats.java +++ b/src/core/Stats.java @@ -31,7 +31,7 @@ public class Stats } else { - GlobalLog.Error(LogFilter.Core, "Attempted to create a second Stats singleton!"); + GlobalLog.error(LogFilter.Core, "Attempted to create a second Stats singleton!"); return; } diff --git a/src/core/benchmark/BenchmarkInput.java b/src/core/benchmark/BenchmarkInput.java index 3e131ff..3773c36 100644 --- a/src/core/benchmark/BenchmarkInput.java +++ b/src/core/benchmark/BenchmarkInput.java @@ -19,7 +19,7 @@ public class BenchmarkInput return; raw = raw.trim(); - int whitespacePos = StringUtils.FindFirstWhitespace(raw); + int whitespacePos = StringUtils.findFirstWhitespace(raw); if(whitespacePos == -1) { diff --git a/src/core/benchmark/BenchmarkLog.java b/src/core/benchmark/BenchmarkLog.java index 999b5a0..0417f02 100644 --- a/src/core/benchmark/BenchmarkLog.java +++ b/src/core/benchmark/BenchmarkLog.java @@ -5,7 +5,7 @@ import utils.GlobalLog; //Logging shim public class BenchmarkLog { - public static void log(String str) { GlobalLog.Log("[Benchmark] " + str); } - public static void warn(String str) { GlobalLog.Warn("[Benchmark] " + str); } - public static void error(String str) { GlobalLog.Error(" [Benchmark] " + str); } + public static void log(String str) { GlobalLog.log("[Benchmark] " + str); } + public static void warn(String str) { GlobalLog.warn("[Benchmark] " + str); } + public static void error(String str) { GlobalLog.error(" [Benchmark] " + str); } } diff --git a/src/core/benchmark/BenchmarkManager.java b/src/core/benchmark/BenchmarkManager.java index 466454f..04e9909 100644 --- a/src/core/benchmark/BenchmarkManager.java +++ b/src/core/benchmark/BenchmarkManager.java @@ -35,7 +35,7 @@ public class BenchmarkManager rebuildLookup(); - BenchmarkLog.log("Took " + (Instant.now().toEpochMilli() - start) + " ms to load " + raw.size() + " entries from " + directoryMonitor.GetCurrentFiles().size() + " file" + (raw.size() > 1 ? "s" : "")); + BenchmarkLog.log("Took " + (Instant.now().toEpochMilli() - start) + " ms to load " + raw.size() + " entries from " + directoryMonitor.getCurrentFiles().size() + " file" + (raw.size() > 1 ? "s" : "")); } // Rebuilds the files being monitored @@ -50,14 +50,14 @@ public class BenchmarkManager synchronized(directoryMonitor) { - files = directoryMonitor.GetCurrentFiles(); + files = directoryMonitor.getCurrentFiles(); } if(files != null) { for(MonitoredFile mf : files) { - String contents = FileUtils.ReadContent(mf.path); + String contents = FileUtils.readContent(mf.path); String[] lines = contents.split(lineDelimiter); for(int i = 1; i < lines.length; ++i) @@ -169,7 +169,7 @@ public class BenchmarkManager public void update() { needsUpdate = false; - directoryMonitor.Update(this::onRescan, this::onRescan, this::onRescan); + directoryMonitor.update(this::onRescan, this::onRescan, this::onRescan); if(needsUpdate) rebuildLookup(); diff --git a/src/core/lua/PluginLog.java b/src/core/lua/PluginLog.java index b5e16fb..471cf2b 100644 --- a/src/core/lua/PluginLog.java +++ b/src/core/lua/PluginLog.java @@ -5,7 +5,7 @@ import utils.LogFilter; public class PluginLog { - public static void log(String s) { GlobalLog.Log(LogFilter.Plugin, s); } - public static void warn(String s) { GlobalLog.Warn(LogFilter.Plugin, s); } - public static void error(String s) { GlobalLog.Error(LogFilter.Plugin, s); } + public static void log(String s) { GlobalLog.log(LogFilter.Plugin, s); } + public static void warn(String s) { GlobalLog.warn(LogFilter.Plugin, s); } + public static void error(String s) { GlobalLog.error(LogFilter.Plugin, s); } } diff --git a/src/core/rpg/RPGInput.java b/src/core/rpg/RPGInput.java index 64ec472..d93a318 100644 --- a/src/core/rpg/RPGInput.java +++ b/src/core/rpg/RPGInput.java @@ -18,7 +18,7 @@ public class RPGInput return; raw = raw.trim(); - int whitespacePos = StringUtils.FindFirstWhitespace(raw); + int whitespacePos = StringUtils.findFirstWhitespace(raw); if(whitespacePos == -1) { diff --git a/src/core/rpg/RPGLog.java b/src/core/rpg/RPGLog.java index 08b1bc9..cbf6774 100644 --- a/src/core/rpg/RPGLog.java +++ b/src/core/rpg/RPGLog.java @@ -7,6 +7,6 @@ public class RPGLog { public static void log(String toWrite) { - GlobalLog.Log(LogFilter.Command, "[RPG] " + toWrite); + GlobalLog.log(LogFilter.Command, "[RPG] " + toWrite); } } diff --git a/src/dataStructures/KittyTrackedLong.java b/src/dataStructures/KittyTrackedLong.java index c7f60bb..3b4ab5b 100644 --- a/src/dataStructures/KittyTrackedLong.java +++ b/src/dataStructures/KittyTrackedLong.java @@ -71,7 +71,7 @@ public class KittyTrackedLong extends DatabaseTrackedObject catch(Exception e) { tracked = 0; - GlobalLog.Error(LogFilter.Core, "Falling back to default of 0 due to failure to deserialize long with database ID " + identifier); + GlobalLog.error(LogFilter.Core, "Falling back to default of 0 due to failure to deserialize long with database ID " + identifier); } } else diff --git a/src/dataStructures/KittyTrackedString.java b/src/dataStructures/KittyTrackedString.java index 5bb959c..d777f2f 100644 --- a/src/dataStructures/KittyTrackedString.java +++ b/src/dataStructures/KittyTrackedString.java @@ -49,7 +49,7 @@ public class KittyTrackedString extends DatabaseTrackedObject } else { - GlobalLog.Log(LogFilter.Database, "String had null or empty value with identifier: " + identifier); + GlobalLog.log(LogFilter.Database, "String had null or empty value with identifier: " + identifier); string = ""; markDirty(); } diff --git a/src/dataStructures/KittyUser.java b/src/dataStructures/KittyUser.java index db91d4a..730e09e 100644 --- a/src/dataStructures/KittyUser.java +++ b/src/dataStructures/KittyUser.java @@ -87,7 +87,7 @@ public class KittyUser extends DatabaseTrackedObject String[] strings = prepareFromString(string); if(strings.length < 2) { - GlobalLog.Log(LogFilter.Database, "Upgrading user " + name + " to include 'role' in DB"); + GlobalLog.log(LogFilter.Database, "Upgrading user " + name + " to include 'role' in DB"); // Mark ourselves dirty to re-write the role information stored in the user. // Just uses defaults from earlier again. @@ -101,7 +101,7 @@ public class KittyUser extends DatabaseTrackedObject } catch (NumberFormatException e) { - GlobalLog.Warn(LogFilter.Database, "Invalid user data for user " + name + "! " + GlobalLog.warn(LogFilter.Database, "Invalid user data for user " + name + "! " + "Starting over at 0 beans with a general role!"); // We don't need to specify the role at this point because it is set at this point. diff --git a/src/dataStructures/Response.java b/src/dataStructures/Response.java index 18549e0..8e8ba10 100644 --- a/src/dataStructures/Response.java +++ b/src/dataStructures/Response.java @@ -90,7 +90,7 @@ public class Response // Queues a standard text-based message response to the channel that issued the command. public void send(String toRespondWith) { - GlobalLog.Log(LogFilter.Response, "Sending response: " + toRespondWith); + GlobalLog.log(LogFilter.Response, "Sending response: " + toRespondWith); if(toRespondWith.length() > discordMessageMax) { event.getChannel().sendMessage(toRespondWith.substring(0, kittyMessageMax) + "\n\nI think that's enough!").queue(); @@ -119,7 +119,7 @@ public class Response // Immediately dispatches the message to the channel that issued the command. public void sendImmediate(String toRespondWith) { - GlobalLog.Log(LogFilter.Response, "Sending immediate response: " + toRespondWith); + GlobalLog.log(LogFilter.Response, "Sending immediate response: " + toRespondWith); if(toRespondWith.length() > discordMessageMax) { event.getChannel().sendMessage(toRespondWith.substring(0, kittyMessageMax) + "\n\nI think that's enough!"); @@ -133,14 +133,14 @@ public class Response // Queues a file response to the channel that issued the command. public void sendFile(File toRespondWith, String extension) { - GlobalLog.Log(LogFilter.Response, "Sending file response"); + GlobalLog.log(LogFilter.Response, "Sending file response"); event.getChannel().sendFile(toRespondWith, "return." + extension).queue(); } // Queues an input stream response to the channel that issued the command. public void sendFile(InputStream in, String extension) { - GlobalLog.Log(LogFilter.Response, "Sending input stream response"); + GlobalLog.log(LogFilter.Response, "Sending input stream response"); event.getChannel().sendFile(in, "return." + extension).queue(); } } diff --git a/src/dataStructures/TaggedPairStore.java b/src/dataStructures/TaggedPairStore.java index 9318553..8513b11 100644 --- a/src/dataStructures/TaggedPairStore.java +++ b/src/dataStructures/TaggedPairStore.java @@ -93,8 +93,8 @@ public class TaggedPairStore Map.Entry internalPair = (Map.Entry)internal.next(); String key = (String)internalPair.getKey(); String value = (String)internalPair.getValue(); - key = StringUtils.ReEscape(key); - value = StringUtils.ReEscape(value); + key = StringUtils.reEscape(key); + value = StringUtils.reEscape(value); if(key.endsWith("\\r")) { @@ -160,8 +160,8 @@ public class TaggedPairStore String key = line.substring(0, splitPos); String value = line.substring(splitPos + PairSplit.length()); - key = StringUtils.UnEscape(key); - value = StringUtils.UnEscape(value); + key = StringUtils.unEscape(key); + value = StringUtils.unEscape(value); taggedPairs.get(sectionName).putIfAbsent(key, value); allPairs.putIfAbsent(key, value); diff --git a/src/network/JDBCDriver.java b/src/network/JDBCDriver.java index bd99ee1..1c59163 100644 --- a/src/network/JDBCDriver.java +++ b/src/network/JDBCDriver.java @@ -7,14 +7,14 @@ import java.sql.ResultSet; public abstract class JDBCDriver { // Connects to the database, returns a bool if it succeeded. - public abstract boolean Connect(); + public abstract boolean connect(); // Disconnects the driver. Returns if the driver is disconnected now, regardless of connection status. - public abstract boolean Disconnect(); + public abstract boolean disconnect(); // Executes a SQL command with the database. Returns if it was executed successfully, or in the // case of the returning statement, returns the ResultSet. Args are placed into the prepared statement // in place of each '?' places into it. - public abstract boolean ExecuteStatement(JDBCStatementType type, String command, String[] args); - public abstract ResultSet ExecuteReturningStatement(JDBCStatementType type, String command, String[] args); + public abstract boolean executeStatement(JDBCStatementType type, String command, String[] args); + public abstract ResultSet executeReturningStatement(JDBCStatementType type, String command, String[] args); } diff --git a/src/network/JDBCDriverMySQL.java b/src/network/JDBCDriverMySQL.java index 5fbb404..3649989 100644 --- a/src/network/JDBCDriverMySQL.java +++ b/src/network/JDBCDriverMySQL.java @@ -5,25 +5,25 @@ import java.sql.ResultSet; public class JDBCDriverMySQL extends JDBCDriver { @Override - public boolean Connect() { + public boolean connect() { // TODO Auto-generated method stub return false; } @Override - public boolean Disconnect() { + public boolean disconnect() { // TODO Auto-generated method stub return false; } @Override - public boolean ExecuteStatement(JDBCStatementType type, String statement, String[] args) { + public boolean executeStatement(JDBCStatementType type, String statement, String[] args) { // TODO Auto-generated method stub return false; } @Override - public ResultSet ExecuteReturningStatement(JDBCStatementType type, String statement, String[] args) { + public ResultSet executeReturningStatement(JDBCStatementType type, String statement, String[] args) { // TODO Auto-generated method stub return null; } diff --git a/src/network/JDBCDriverPostgreSQL.java b/src/network/JDBCDriverPostgreSQL.java index b6765eb..fbe1593 100644 --- a/src/network/JDBCDriverPostgreSQL.java +++ b/src/network/JDBCDriverPostgreSQL.java @@ -5,25 +5,25 @@ import java.sql.ResultSet; public class JDBCDriverPostgreSQL extends JDBCDriver { @Override - public boolean Connect() { + public boolean connect() { // TODO Auto-generated method stub return false; } @Override - public boolean Disconnect() { + public boolean disconnect() { // TODO Auto-generated method stub return false; } @Override - public boolean ExecuteStatement(JDBCStatementType type, String statement, String[] args) { + public boolean executeStatement(JDBCStatementType type, String statement, String[] args) { // TODO Auto-generated method stub return false; } @Override - public ResultSet ExecuteReturningStatement(JDBCStatementType type, String statement, String[] args) { + public ResultSet executeReturningStatement(JDBCStatementType type, String statement, String[] args) { // TODO Auto-generated method stub return null; } diff --git a/src/network/JDBCDriverSQLite.java b/src/network/JDBCDriverSQLite.java index 594906f..62edfe1 100644 --- a/src/network/JDBCDriverSQLite.java +++ b/src/network/JDBCDriverSQLite.java @@ -18,7 +18,7 @@ public class JDBCDriverSQLite extends JDBCDriver public static final String databaseName = "catfood"; @Override - public boolean Connect() + public boolean connect() { if(connection == null) { @@ -38,23 +38,23 @@ public class JDBCDriverSQLite extends JDBCDriver // create a connection to the database connection = DriverManager.getConnection(url); - GlobalLog.Log(LogFilter.Database, "Connection to SQLite has been established."); + GlobalLog.log(LogFilter.Database, "Connection to SQLite has been established."); } catch (SQLException e) { - GlobalLog.Error(e.getMessage()); + GlobalLog.error(e.getMessage()); } } else { - GlobalLog.Log(LogFilter.Database, "SQLite database asked to connect a second time. This is perfectly fine as this app has all its data tied together."); + GlobalLog.log(LogFilter.Database, "SQLite database asked to connect a second time. This is perfectly fine as this app has all its data tied together."); } return connection != null; } @Override - public boolean Disconnect() + public boolean disconnect() { try { @@ -67,13 +67,13 @@ public class JDBCDriverSQLite extends JDBCDriver } catch (SQLException ex) { - GlobalLog.Error(ex.getMessage()); + GlobalLog.error(ex.getMessage()); return false; } } @Override - public ResultSet ExecuteReturningStatement(JDBCStatementType type, String command, String[] args) + public ResultSet executeReturningStatement(JDBCStatementType type, String command, String[] args) { if(connection == null) return null; @@ -114,7 +114,7 @@ public class JDBCDriverSQLite extends JDBCDriver { try { - GlobalLog.Fatal(e.getMessage()); + GlobalLog.fatal(e.getMessage()); } catch (Exception e1) { @@ -125,7 +125,7 @@ public class JDBCDriverSQLite extends JDBCDriver } } - public boolean ExecuteStatement(JDBCStatementType type, String command, String[] args) + public boolean executeStatement(JDBCStatementType type, String command, String[] args) { if(connection == null) return false; @@ -178,7 +178,7 @@ public class JDBCDriverSQLite extends JDBCDriver { try { - GlobalLog.Fatal(e.getMessage()); + GlobalLog.fatal(e.getMessage()); } catch (Exception e1) { diff --git a/src/network/NetworkColiru.java b/src/network/NetworkColiru.java index 63d80fb..6cf23fd 100644 --- a/src/network/NetworkColiru.java +++ b/src/network/NetworkColiru.java @@ -4,7 +4,7 @@ import utils.HTTPUtils; public class NetworkColiru { - public String compileCPlus(String query) + public String compileCPlusPlus(String query) { // Escape characters that need escaping. // Primarily types of whitespace. @@ -15,7 +15,7 @@ public class NetworkColiru query = query.replace("\t", "\\t"); // Send the compilation request! - String result = HTTPUtils.SendPOSTRequest("http://coliru.stacked-crooked.com/compile" + String result = HTTPUtils.sendPOSTRequest("http://coliru.stacked-crooked.com/compile" , "{ \"cmd\": \"g++ main.cpp && ./a.out\", \"src\": \"" + query + "\" }"); // If we got a valid response... @@ -23,6 +23,7 @@ public class NetworkColiru { result = "Here's what happened when I went to compiled that! \n```" + result + "```"; } + return result; } diff --git a/src/network/NetworkDerpi.java b/src/network/NetworkDerpi.java index 04f82f5..4463b40 100644 --- a/src/network/NetworkDerpi.java +++ b/src/network/NetworkDerpi.java @@ -26,7 +26,7 @@ public class NetworkDerpi GenericImage image = new GenericImage(" ", " ", " "); query = query.trim(); query = query.replace(" ", ","); - String res = HTTPUtils.SendGETRequest(mainURL + query + "&random_image=1&key=" + Ref.derpiKey); + String res = HTTPUtils.sendGETRequest(mainURL + query + "&random_image=1&key=" + Ref.derpiKey); if(res != null) { // Use class evaluation on an array of the response object to be able to hold multiple. @@ -34,7 +34,7 @@ public class NetworkDerpi if(res != null) { - String res2 = HTTPUtils.SendGETRequest("https://derpibooru.org/" + obj.id + ".json"); + String res2 = HTTPUtils.sendGETRequest("https://derpibooru.org/" + obj.id + ".json"); image.editPostURL(""); DerpiResponseObject imageObj = jsonParser_.fromJson(res2, DerpiResponseObject.class); diff --git a/src/network/NetworkE621.java b/src/network/NetworkE621.java index 6cadeca..ef913a0 100644 --- a/src/network/NetworkE621.java +++ b/src/network/NetworkE621.java @@ -56,7 +56,7 @@ public class NetworkE621 // Configure and send request. Note: Random ordering added as first // tag by default. User-provided tags, therefore, will override it. // If order:score is provided, that will be honored over order:random. - String res = HTTPUtils.SendPOSTRequest(API_ROOT + String res = HTTPUtils.sendPOSTRequest(API_ROOT , "tags=order:random%20" + input + "&limit=" + maxSearchResults_); diff --git a/src/network/NetworkJDoodle.java b/src/network/NetworkJDoodle.java index 824f93b..5ba01f8 100644 --- a/src/network/NetworkJDoodle.java +++ b/src/network/NetworkJDoodle.java @@ -35,7 +35,8 @@ public class NetworkJDoodle String input = "{\"clientId\": \"" + Ref.jdoodleID + "\",\"clientSecret\":\"" + Ref.jdoodleSecret + "\",\"script\":\"" + query + "\",\"language\":\"" + lang + "\",\"versionIndex\":\"" + version + "\"} "; - try { + try + { URL url = new URL("https://api.jdoodle.com/v1/execute"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); @@ -69,10 +70,12 @@ public class NetworkJDoodle result += "The CPU time was " + doodle.cpuTime + "\n"; connection.disconnect(); return result; - } catch (MalformedURLException e) + } + catch (MalformedURLException e) { return "You probably shouldn't be seeing this"; - } catch (IOException e) + } + catch (IOException e) { return "You probably shouldn't be seeing this"; } diff --git a/src/network/NetworkTheColorAPI.java b/src/network/NetworkTheColorAPI.java index 2bb9f0d..5f2e2b2 100644 --- a/src/network/NetworkTheColorAPI.java +++ b/src/network/NetworkTheColorAPI.java @@ -71,12 +71,12 @@ public class NetworkTheColorAPI public tca_XYZ XYZ; } - public ColorData LookupHex(String hex) + public ColorData lookupHex(String hex) { try { hex = hex.replace("#", ""); - String response = HTTPUtils.SendGETRequest("https://www.thecolorapi.com/id?hex=" + hex); + String response = HTTPUtils.sendGETRequest("https://www.thecolorapi.com/id?hex=" + hex); ColorData data = jsonParser.fromJson(response, ColorData.class); return data; diff --git a/src/network/NetworkTwitter.java b/src/network/NetworkTwitter.java index f298e4e..0c9a9bd 100644 --- a/src/network/NetworkTwitter.java +++ b/src/network/NetworkTwitter.java @@ -18,8 +18,6 @@ public class NetworkTwitter .setOAuthConsumerSecret(Ref.twitterAPISecret) .setOAuthAccessToken(Ref.twitterAccessToken) .setOAuthAccessTokenSecret(Ref.twitterAccessTokenSecret); - - } public String tweet(String tweetText) throws Exception @@ -28,6 +26,5 @@ public class NetworkTwitter Twitter twitter = tf.getInstance(); Status status = twitter.updateStatus(tweetText); return "Status set to: `" + status.getText() + "`!"; - } } diff --git a/src/utils/GlobalLog.java b/src/utils/GlobalLog.java index 0131587..e0652ba 100644 --- a/src/utils/GlobalLog.java +++ b/src/utils/GlobalLog.java @@ -23,12 +23,12 @@ public class GlobalLog DateFormat dF = new SimpleDateFormat("yyyy_MM_dd_HH-mm"); Date today = new Date(); - FileUtils.CreateDirectoryIfDoesntExist(directory); + FileUtils.createDirectoryIfDoesntExist(directory); outputLog = new PrintWriter(directory + (dF.format(today) + ".log"), "UTF-8"); - GlobalLog.Log(LogFilter.Util, "Finished initializing logging system"); + GlobalLog.log(LogFilter.Util, "Finished initializing logging system"); } - private static void Write(String status, LogFilter filter, String body) + private static void write(String status, LogFilter filter, String body) { String logLine = "[" + status + "] " + "[" + filter.name() + "] " + body; outputLog.write(logLine + "\n"); @@ -36,13 +36,13 @@ public class GlobalLog System.out.println(logLine); } - public static void Log(String msg) { Write(log, LogFilter.Debug, msg); } - public static void Warn(String msg) { Write(warn, LogFilter.Debug, msg); } - public static void Error(String msg) { Write(error, LogFilter.Debug, msg); } - public static void Fatal(String msg) throws Exception { Write(fatal, LogFilter.Debug, msg); throw new Exception(msg); } + public static void log(String msg) { write(log, LogFilter.Debug, msg); } + public static void warn(String msg) { write(warn, LogFilter.Debug, msg); } + public static void error(String msg) { write(error, LogFilter.Debug, msg); } + public static void fatal(String msg) throws Exception { write(fatal, LogFilter.Debug, msg); throw new Exception(msg); } - public static void Log(LogFilter filter, String msg) { Write(log, filter, msg); } - public static void Warn(LogFilter filter, String msg) { Write(warn, filter, msg); } - public static void Error(LogFilter filter, String msg) { Write(error, filter, msg); } - public static void Fatal(LogFilter filter, String msg) throws Exception { Write(fatal, filter, msg); throw new Exception(msg); } + public static void log(LogFilter filter, String msg) { write(log, filter, msg); } + public static void warn(LogFilter filter, String msg) { write(warn, filter, msg); } + public static void error(LogFilter filter, String msg) { write(error, filter, msg); } + public static void fatal(LogFilter filter, String msg) throws Exception { write(fatal, filter, msg); throw new Exception(msg); } } diff --git a/src/utils/HTTPUtils.java b/src/utils/HTTPUtils.java index b9355a1..ef1ef98 100644 --- a/src/utils/HTTPUtils.java +++ b/src/utils/HTTPUtils.java @@ -21,7 +21,7 @@ public class HTTPUtils // Sends a GET request for the specified URL. - public static String SendGETRequest(String url) + public static String sendGETRequest(String url) { try { @@ -45,8 +45,8 @@ public class HTTPUtils // Sends a POST request to the desired URL. // There are two forms of this function, one of which takes - public static String SendPOSTRequest(String url) { return SendPOSTRequest(url, ""); } - public static String SendPOSTRequest(String url, String params) + public static String sendPOSTRequest(String url) { return sendPOSTRequest(url, ""); } + public static String sendPOSTRequest(String url, String params) { try { @@ -103,8 +103,10 @@ public class HTTPUtils // Close and return our data in.close(); return new String(String.toString()); - } else { - GlobalLog.Error(LogFilter.Network, con.getRequestMethod() + " responded with " + responseCode + " instead of 200."); + } + else + { + GlobalLog.error(LogFilter.Network, con.getRequestMethod() + " responded with " + responseCode + " instead of 200."); return Integer.toString(responseCode); } } diff --git a/src/utils/ImageOverlayBuilder.java b/src/utils/ImageOverlayBuilder.java index 21da10e..00837f2 100644 --- a/src/utils/ImageOverlayBuilder.java +++ b/src/utils/ImageOverlayBuilder.java @@ -34,10 +34,10 @@ public class ImageOverlayBuilder public static final String LOG_HEADER = "[Overlay] "; // Logging intermediate functions - private static void Verbose(String str) { if(VERBOSE) Log("[Verbose] " + str); } - private static void Log(String str) { GlobalLog.Log(LogFilter.Util, LOG_HEADER + str); } - private static void Warn(String str) { GlobalLog.Warn(LogFilter.Util, LOG_HEADER + str); } - private static void Error(String str) { GlobalLog.Error(LogFilter.Util, LOG_HEADER + str); } + private static void verbose(String str) { if(VERBOSE) log("[Verbose] " + str); } + private static void log(String str) { GlobalLog.log(LogFilter.Util, LOG_HEADER + str); } + private static void warn(String str) { GlobalLog.warn(LogFilter.Util, LOG_HEADER + str); } + private static void error(String str) { GlobalLog.error(LogFilter.Util, LOG_HEADER + str); } // Local variables private final String basePath; // The folder location of the files @@ -61,46 +61,46 @@ public class ImageOverlayBuilder } // Performs a per-frame overlay, catches IO errors as a note.) - public void Overlay(BufferedImage overlay, String outpath) + public void overlay(BufferedImage overlay, String outpath) { try { long start = Calendar.getInstance().getTimeInMillis(); - ProcessOverlay(overlay, outpath); + processOverlay(overlay, outpath); long end = Calendar.getInstance().getTimeInMillis(); - Log("Took " + (end - start) + "ms"); + log("Took " + (end - start) + "ms"); } catch (IOException e) { - Error(e.getMessage()); + error(e.getMessage()); } } // Processing the image frames to construct a gif. Relies on (0,255,0) pixel for image center specification. - private void ProcessOverlay(BufferedImage overlay, String outfileName) throws IOException + private void processOverlay(BufferedImage overlay, String outfileName) throws IOException { ArrayList frames = new ArrayList(frameCount); //BufferedImage[] frames = new BufferedImage[frameCount]; for(int i = 0; i < frameCount; ++i) { - BufferedImage out = CombineImages(basePath + baseName + i + FRAME_FILE_EXTENSION , overlay); + BufferedImage out = combineImages(basePath + baseName + i + FRAME_FILE_EXTENSION , overlay); if(out != null) frames.add(out);// = out; else - Warn("Skipping frame " + i + " of base " + basePath + baseName); + warn("Skipping frame " + i + " of base " + basePath + baseName); } if(frames.isEmpty()) { - Error("No frames were found at all, so the gif could not be made!"); + error("No frames were found at all, so the gif could not be made!"); return; } - Verbose("Processed " + frameCount + " frames, found " + frames.size() + " valid, writing..."); + verbose("Processed " + frameCount + " frames, found " + frames.size() + " valid, writing..."); ImageOutputStream output = new FileImageOutputStream(new File(outfileName)); GifSequenceWriter writer = new GifSequenceWriter(output, frames.get(0).getType(), fps, true); @@ -115,7 +115,7 @@ public class ImageOverlayBuilder // Performs an overlay at a pixel location. We're making some assumptions here, mostly that there is going // to be an RGBA-32-bit encoded PNG image read in for our parsing purposes. We then look for a 0, 255, 0 // green pixel on the base frame to apply the overlay buffer to, centered. - private BufferedImage CombineImages(String pathBase, BufferedImage overlay) throws IOException + private BufferedImage combineImages(String pathBase, BufferedImage overlay) throws IOException { // Acquire images BufferedImage imageBase = null; @@ -137,7 +137,7 @@ public class ImageOverlayBuilder // Warn about odd sizing when applicable if(overlayHeight > baseHeight || overlayWidth > baseWidth) - Warn("Size mismatch, overlay is larger. May function, but not supported."); + warn("Size mismatch, overlay is larger. May function, but not supported."); // Skim base picture for solid green pixel to use as target center int targetX = NONE; @@ -165,7 +165,7 @@ public class ImageOverlayBuilder // Skip overlay if we have no target location if(targetX == NONE || targetY == NONE) { - Verbose("No overlay required for this frame."); + verbose("No overlay required for this frame."); return imageBase; } diff --git a/src/utils/ImageUtils.java b/src/utils/ImageUtils.java index 7d8822a..640191c 100644 --- a/src/utils/ImageUtils.java +++ b/src/utils/ImageUtils.java @@ -39,7 +39,7 @@ public class ImageUtils boolean didWrite = ImageIO.write(data, extension, outputfile); if(!didWrite) { - GlobalLog.Error(LogFilter.Util, "Could not identify the writer for extension type '" + extension + "' - Did you accidentally include a period or other punctuation?"); + GlobalLog.error(LogFilter.Util, "Could not identify the writer for extension type '" + extension + "' - Did you accidentally include a period or other punctuation?"); return null; } @@ -47,7 +47,7 @@ public class ImageUtils } catch (IOException e) { - GlobalLog.Error(LogFilter.Util, "Exception in writeTempImageData: " + e.toString()); + GlobalLog.error(LogFilter.Util, "Exception in writeTempImageData: " + e.toString()); return null; } @@ -90,14 +90,14 @@ public class ImageUtils } catch(Exception e) { - GlobalLog.Error(LogFilter.Util, "Exception in downloadFromURL: " + e.toString()); + GlobalLog.error(LogFilter.Util, "Exception in downloadFromURL: " + e.toString()); return null; } } // Deletes the file provided, if it exists. Will continue, in a blocking way, // to attempt to delete the file 10 times a second until thread termination. - public static void BlockingFileDelete(File file) + public static void blockingFileDelete(File file) { if(file == null) return; diff --git a/src/utils/OptionParser.java b/src/utils/OptionParser.java index bc23853..0313366 100644 --- a/src/utils/OptionParser.java +++ b/src/utils/OptionParser.java @@ -40,10 +40,10 @@ public class OptionParser floating = new ArrayList(); if(toParse != null && toParse.length() > 0) - Parse(toParse); + parse(toParse); } - public void Parse(String vals) + public void parse(String vals) { String[] strings = vals.split("\\s+"); @@ -84,17 +84,17 @@ public class OptionParser } } - public ArrayList GetFloating() + public ArrayList getFloating() { return floating; } - public String GetOption(String arg) + public String getOption(String arg) { - return GetOption(arg, false); + return getOption(arg, false); } - public String GetOption(String option, boolean isCaseInsensitive) + public String getOption(String option, boolean isCaseInsensitive) { if(option == null) return null; diff --git a/src/utils/StringUtils.java b/src/utils/StringUtils.java index 5b490c4..04c3dec 100644 --- a/src/utils/StringUtils.java +++ b/src/utils/StringUtils.java @@ -2,7 +2,7 @@ package utils; public class StringUtils { - public static String UnEscape(String str) + public static String unEscape(String str) { str = str.replaceAll("\\\\b", "\b"); str = str.replaceAll("\\\\n", "\n"); @@ -15,7 +15,7 @@ public class StringUtils return str; } - public static String ReEscape(String str) + public static String reEscape(String str) { str = str.replaceAll("\\\b", "\\\\\\b"); str = str.replaceAll("\\\n", "\\\\\\n"); @@ -27,7 +27,7 @@ public class StringUtils } // Finds first whitespace in the string - public static int FindFirstWhitespace(String str) + public static int findFirstWhitespace(String str) { for (int i = 0; i < str.length(); ++i) { diff --git a/src/utils/io/DirectoryMonitor.java b/src/utils/io/DirectoryMonitor.java index 28f33f2..a27d7ac 100644 --- a/src/utils/io/DirectoryMonitor.java +++ b/src/utils/io/DirectoryMonitor.java @@ -20,16 +20,16 @@ public class DirectoryMonitor // Constructs a new file monitor and logs initialization public DirectoryMonitor(String directory) { - IOLog.Log("Reading directory files for montioring in: " + directory.toString()); + IOLog.log("Reading directory files for montioring in: " + directory.toString()); this.directory = directory; - this.last = Scrape(); + this.last = scrape(); - Print(last); + print(last); } // Scrape the target directory for all files and store them as custom objects in the list - private ArrayList Scrape() + private ArrayList scrape() { ArrayList files = new ArrayList(); @@ -39,13 +39,13 @@ public class DirectoryMonitor { paths.filter(Files::isRegularFile).forEach((path)-> { - files.add(new MonitoredFile(path, FileUtils.LastModified(path))); + files.add(new MonitoredFile(path, FileUtils.lastModified(path))); }); } } catch(Exception e) { - IOLog.Error(e.getMessage()); + IOLog.error(e.getMessage()); } return files; @@ -54,10 +54,10 @@ public class DirectoryMonitor // Update function - the first callback is called if a new item is added to the directory, // second is called if an item is updated, and third is called if an item is removed. @SuppressWarnings("unchecked") - public void Update(Consumer onAdd, Consumer onUpdate, Consumer onDelete) + public void update(Consumer onAdd, Consumer onUpdate, Consumer onDelete) { // Unparsed - ArrayList active = Scrape(); + ArrayList active = scrape(); ArrayList curr = (ArrayList)active.clone(); ArrayList prev = (ArrayList)last.clone(); @@ -125,19 +125,19 @@ public class DirectoryMonitor Collections.sort(last); if(last.size() == 0) - IOLog.Warn("There's nothing at all in a FileMonitor's target folder! Folder: " + directory); + IOLog.warn("There's nothing at all in a FileMonitor's target folder! Folder: " + directory); } // Returns the current list of files the monitor is tracking in the directory. - public List GetCurrentFiles() + public List getCurrentFiles() { return last; } // Prints out an arraylist of items from a directory by path - private void Print(ArrayList toPrint) + private void print(ArrayList toPrint) { for(int i = 0; i < toPrint.size(); ++i) - IOLog.Log(toPrint.get(i).path.toString()); + IOLog.log(toPrint.get(i).path.toString()); } } diff --git a/src/utils/io/FileMonitor.java b/src/utils/io/FileMonitor.java index 80de434..f634e45 100644 --- a/src/utils/io/FileMonitor.java +++ b/src/utils/io/FileMonitor.java @@ -11,12 +11,12 @@ public class FileMonitor // Constructs file monitor for a given file at a specific path. public FileMonitor(String path) { - Long last = FileUtils.LastModified(Paths.get(path)); + Long last = FileUtils.lastModified(Paths.get(path)); if(last == null) { file = null; - IOLog.Error("Couldn't find a readable file at " + path + "!"); + IOLog.error("Couldn't find a readable file at " + path + "!"); } else { @@ -26,24 +26,24 @@ public class FileMonitor // Looks at the file and sees if it has undergone any changes. // If so, the fileChanged function provided is called! - public void Update(Consumer fileChanged) + public void update(Consumer fileChanged) { if(file == null) { - IOLog.Error("Attempted to update a file that doesn't exist"); + IOLog.error("Attempted to update a file that doesn't exist"); return; } - Long last = FileUtils.LastModified(file.path); + Long last = FileUtils.lastModified(file.path); if(last == null) { - IOLog.Error("The file previously at " + file.path + " couldn't be read!"); + IOLog.error("The file previously at " + file.path + " couldn't be read!"); return; } if(last.longValue() != file.lastModified.longValue()) { - IOLog.Log("Most recently modified at " + last + ", stored version at " + file.lastModified); + IOLog.log("Most recently modified at " + last + ", stored version at " + file.lastModified); file = new MonitoredFile(file.path, last); fileChanged.accept(file); } diff --git a/src/utils/io/FileUtils.java b/src/utils/io/FileUtils.java index 21edfd6..493409b 100644 --- a/src/utils/io/FileUtils.java +++ b/src/utils/io/FileUtils.java @@ -14,7 +14,7 @@ import utils.LogFilter; public class FileUtils { - public static void CreateDirectoryIfDoesntExist(String directoryName) + public static void createDirectoryIfDoesntExist(String directoryName) { File directory = new File(directoryName); @@ -24,8 +24,8 @@ public class FileUtils } // Reads all lines from a file as a string - public static String ReadContent(File file) { return ReadContent(file.toPath()); } - public static String ReadContent(Path filePath) + public static String readContent(File file) { return readContent(file.toPath()); } + public static String readContent(Path filePath) { StringBuilder contentBuilder = new StringBuilder(); @@ -38,14 +38,14 @@ public class FileUtils } catch (IOException e) { - GlobalLog.Error(LogFilter.Util, e.getMessage()); + GlobalLog.error(LogFilter.Util, e.getMessage()); } return contentBuilder.toString(); } // Recursively acquires all files at and below the specified directory, returning them as an arraylist of paths. - public static ArrayList AcquireAllFiles(String startingDir) + public static ArrayList acquireAllFiles(String startingDir) { ArrayList items = new ArrayList(); @@ -59,14 +59,14 @@ public class FileUtils } catch (IOException e) { - GlobalLog.Error(LogFilter.Util, e.getMessage()); + GlobalLog.error(LogFilter.Util, e.getMessage()); } return items; } // Check when a file was last modified by path - public static Long LastModified(Path path) + public static Long lastModified(Path path) { File file = new File(path.toString()); @@ -76,7 +76,7 @@ public class FileUtils } else { - GlobalLog.Error(LogFilter.Util, "File doesn't exist at path: " + path); + GlobalLog.error(LogFilter.Util, "File doesn't exist at path: " + path); return null; } } diff --git a/src/utils/io/IOLog.java b/src/utils/io/IOLog.java index 5e994c3..5246de7 100644 --- a/src/utils/io/IOLog.java +++ b/src/utils/io/IOLog.java @@ -6,7 +6,7 @@ import utils.LogFilter; // Logging shim public class IOLog { - public static void Log(String s) { GlobalLog.Log(LogFilter.Util, s); } - public static void Warn(String s) { GlobalLog.Warn(LogFilter.Util, s); } - public static void Error(String s) { GlobalLog.Error(LogFilter.Util, s); } + public static void log(String s) { GlobalLog.log(LogFilter.Util, s); } + public static void warn(String s) { GlobalLog.warn(LogFilter.Util, s); } + public static void error(String s) { GlobalLog.error(LogFilter.Util, s); } }