Formatting, added eclipse prefs file

v5stable
Ondřej Hruška 10 years ago
parent d8530f2f1a
commit 33b329486b
  1. 171
      eclipse-config.epf
  2. 1
      src/mightypork/rogue/App.java
  3. 1
      src/mightypork/rogue/AppAccess.java
  4. 1
      src/mightypork/rogue/AppAdapter.java
  5. 1
      src/mightypork/rogue/Config.java
  6. 1
      src/mightypork/rogue/Const.java
  7. 1
      src/mightypork/rogue/CrashHandler.java
  8. 1
      src/mightypork/rogue/Paths.java
  9. 4
      src/mightypork/rogue/bus/DelegatingBusClient.java
  10. 4
      src/mightypork/rogue/bus/SimpleBusClient.java
  11. 1
      src/mightypork/rogue/bus/UpdateReceiver.java
  12. 5
      src/mightypork/rogue/bus/events/KeyboardEvent.java
  13. 17
      src/mightypork/rogue/bus/events/MouseButtonEvent.java
  14. 5
      src/mightypork/rogue/bus/events/MouseMotionEvent.java
  15. 2
      src/mightypork/rogue/bus/events/ScreenChangeEvent.java
  16. 2
      src/mightypork/rogue/bus/events/UpdateEvent.java
  17. 1
      src/mightypork/rogue/display/DisplaySystem.java
  18. 10
      src/mightypork/rogue/display/Screen.java
  19. 1
      src/mightypork/rogue/display/ScreenTestAnimations.java
  20. 1
      src/mightypork/rogue/display/constraints/Bounding.java
  21. 1
      src/mightypork/rogue/display/constraints/Constraint.java
  22. 1
      src/mightypork/rogue/display/rendering/Renderable.java
  23. 1
      src/mightypork/rogue/display/rendering/ScreenLayer.java
  24. 1
      src/mightypork/rogue/fonts/Align.java
  25. 56
      src/mightypork/rogue/fonts/FontManager.java
  26. 1
      src/mightypork/rogue/fonts/Fonts.java
  27. 29
      src/mightypork/rogue/fonts/LoadedFont.java
  28. 1
      src/mightypork/rogue/input/InputSystem.java
  29. 10
      src/mightypork/rogue/input/KeyBinder.java
  30. 1
      src/mightypork/rogue/input/KeyBinding.java
  31. 10
      src/mightypork/rogue/input/KeyBindingPool.java
  32. 7
      src/mightypork/rogue/input/KeyStroke.java
  33. 55
      src/mightypork/rogue/sounds/AudioX.java
  34. 1
      src/mightypork/rogue/sounds/BaseAudioPlayer.java
  35. 1
      src/mightypork/rogue/sounds/EffectPlayer.java
  36. 4
      src/mightypork/rogue/sounds/JointVolume.java
  37. 1
      src/mightypork/rogue/sounds/LoopPlayer.java
  38. 1
      src/mightypork/rogue/sounds/NullAudio.java
  39. 76
      src/mightypork/rogue/sounds/SoundSystem.java
  40. 1
      src/mightypork/rogue/tasks/TaskTakeScreenshot.java
  41. 1
      src/mightypork/rogue/testing/TestConstraints.java
  42. 3
      src/mightypork/rogue/testing/TestMsgbus.java
  43. 7
      src/mightypork/rogue/textures/TextureManager.java
  44. 1
      src/mightypork/rogue/textures/Textures.java
  45. 1
      src/mightypork/rogue/textures/Tx.java
  46. 37
      src/mightypork/rogue/textures/TxQuad.java
  47. 505
      src/mightypork/rogue/util/RenderUtils.java
  48. 1
      src/mightypork/rogue/util/Utils.java
  49. 6
      src/mightypork/utils/files/FileTreeDiff.java
  50. 115
      src/mightypork/utils/files/FileUtils.java
  51. 4
      src/mightypork/utils/files/OsUtils.java
  52. 157
      src/mightypork/utils/files/PropertyManager.java
  53. 16
      src/mightypork/utils/files/SimpleConfig.java
  54. 29
      src/mightypork/utils/files/ZipBuilder.java
  55. 52
      src/mightypork/utils/files/ZipUtils.java
  56. 7
      src/mightypork/utils/files/ion/AbstractIonList.java
  57. 7
      src/mightypork/utils/files/ion/AbstractIonMap.java
  58. 46
      src/mightypork/utils/files/ion/Ion.java
  59. 1
      src/mightypork/utils/files/ion/IonException.java
  60. 1
      src/mightypork/utils/files/ion/IonList.java
  61. 1
      src/mightypork/utils/files/ion/IonMap.java
  62. 1
      src/mightypork/utils/files/ion/IonMarks.java
  63. 7
      src/mightypork/utils/files/ion/Ionizable.java
  64. 1
      src/mightypork/utils/files/ion/IonizableOptional.java
  65. 1
      src/mightypork/utils/files/ion/StreamUtils.java
  66. 47
      src/mightypork/utils/logging/Log.java
  67. 41
      src/mightypork/utils/logging/LogInstance.java
  68. 1
      src/mightypork/utils/logging/LogMonitor.java
  69. 1
      src/mightypork/utils/logging/LogToSysoutMonitor.java
  70. 293
      src/mightypork/utils/math/Calc.java
  71. 34
      src/mightypork/utils/math/Polar.java
  72. 25
      src/mightypork/utils/math/Range.java
  73. 16
      src/mightypork/utils/math/color/HSV.java
  74. 82
      src/mightypork/utils/math/color/RGB.java
  75. 250
      src/mightypork/utils/math/coord/Coord.java
  76. 7
      src/mightypork/utils/math/coord/CoordAnimated.java
  77. 184
      src/mightypork/utils/math/coord/Rect.java
  78. 27
      src/mightypork/utils/math/easing/Easing.java
  79. 79
      src/mightypork/utils/objects/Convertor.java
  80. 10
      src/mightypork/utils/objects/Mutable.java
  81. 13
      src/mightypork/utils/objects/ObjectUtils.java
  82. 13
      src/mightypork/utils/objects/Pair.java
  83. 22
      src/mightypork/utils/objects/Triad.java
  84. 17
      src/mightypork/utils/objects/VarargsParser.java
  85. 1
      src/mightypork/utils/patterns/Destroyable.java
  86. 7
      src/mightypork/utils/patterns/subscription/Handleable.java
  87. 22
      src/mightypork/utils/patterns/subscription/MessageBus.java
  88. 28
      src/mightypork/utils/patterns/subscription/MessageChannel.java
  89. 1
      src/mightypork/utils/patterns/subscription/clients/DelegatingClient.java
  90. 1
      src/mightypork/utils/patterns/subscription/clients/ToggleableClient.java
  91. 28
      src/mightypork/utils/string/StringUtils.java
  92. 1
      src/mightypork/utils/string/validation/CharValidator.java
  93. 1
      src/mightypork/utils/string/validation/CharValidatorRegex.java
  94. 1
      src/mightypork/utils/string/validation/CharValidatorWhitelist.java
  95. 4
      src/mightypork/utils/string/validation/FileSuffixFilter.java
  96. 1
      src/mightypork/utils/string/validation/FilenameCharValidator.java
  97. 1
      src/mightypork/utils/string/validation/StringFilter.java
  98. 4
      src/mightypork/utils/time/FpsMeter.java
  99. 1
      src/mightypork/utils/time/Pauseable.java
  100. 1
      src/mightypork/utils/time/TimerDelta.java
  101. Some files were not shown because too many files have changed in this diff Show More

File diff suppressed because one or more lines are too long

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
import java.io.File; import java.io.File;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.nio.channels.FileLock; import java.nio.channels.FileLock;

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
import mightypork.rogue.display.DisplaySystem; import mightypork.rogue.display.DisplaySystem;
import mightypork.rogue.input.InputSystem; import mightypork.rogue.input.InputSystem;
import mightypork.rogue.sounds.SoundSystem; import mightypork.rogue.sounds.SoundSystem;

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
import mightypork.rogue.display.DisplaySystem; import mightypork.rogue.display.DisplaySystem;
import mightypork.rogue.input.InputSystem; import mightypork.rogue.input.InputSystem;
import mightypork.rogue.sounds.SoundSystem; import mightypork.rogue.sounds.SoundSystem;

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
import mightypork.utils.files.PropertyManager; import mightypork.utils.files.PropertyManager;
import mightypork.utils.logging.Log; import mightypork.utils.logging.Log;

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
/** /**
* Application constants * Application constants
* *

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
import java.lang.Thread.UncaughtExceptionHandler; import java.lang.Thread.UncaughtExceptionHandler;

@ -1,5 +1,6 @@
package mightypork.rogue; package mightypork.rogue;
import java.io.File; import java.io.File;
import mightypork.utils.files.OsUtils; import mightypork.utils.files.OsUtils;

@ -1,5 +1,6 @@
package mightypork.rogue.bus; package mightypork.rogue.bus;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -60,8 +61,7 @@ public abstract class DelegatingBusClient extends AppAdapter implements Delegati
/** /**
* Remove a child subscriber * Remove a child subscriber
* *
* @param client * @param client subscriber to remove
* subscriber to remove
*/ */
public final void removeChildSubscriber(Object client) public final void removeChildSubscriber(Object client)
{ {

@ -1,5 +1,6 @@
package mightypork.rogue.bus; package mightypork.rogue.bus;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;
import mightypork.rogue.AppAdapter; import mightypork.rogue.AppAdapter;
@ -12,8 +13,7 @@ import mightypork.rogue.AppAdapter;
public class SimpleBusClient extends AppAdapter { public class SimpleBusClient extends AppAdapter {
/** /**
* @param app * @param app app access
* app access
*/ */
public SimpleBusClient(AppAccess app) { public SimpleBusClient(AppAccess app) {
super(app); super(app);

@ -1,5 +1,6 @@
package mightypork.rogue.bus; package mightypork.rogue.bus;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;
import mightypork.rogue.bus.events.UpdateEvent; import mightypork.rogue.bus.events.UpdateEvent;
import mightypork.utils.time.Updateable; import mightypork.utils.time.Updateable;

@ -1,5 +1,6 @@
package mightypork.rogue.bus.events; package mightypork.rogue.bus.events;
import mightypork.utils.patterns.subscription.Handleable; import mightypork.utils.patterns.subscription.Handleable;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@ -66,14 +67,12 @@ public class KeyboardEvent implements Handleable<KeyboardEvent.Listener> {
keh.receive(this); keh.receive(this);
} }
public interface Listener { public interface Listener {
/** /**
* Handle an event * Handle an event
* *
* @param event * @param event event
* event
*/ */
public void receive(KeyboardEvent event); public void receive(KeyboardEvent event);
} }

@ -1,5 +1,6 @@
package mightypork.rogue.bus.events; package mightypork.rogue.bus.events;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
import mightypork.utils.patterns.subscription.Handleable; import mightypork.utils.patterns.subscription.Handleable;
@ -24,14 +25,10 @@ public class MouseButtonEvent implements Handleable<MouseButtonEvent.Listener> {
/** /**
* Mouse button event * Mouse button event
* *
* @param pos * @param pos event position
* event position * @param button button id
* @param button * @param down button pressed
* button id * @param wheeld wheel change
* @param down
* button pressed
* @param wheeld
* wheel change
*/ */
public MouseButtonEvent(Coord pos, int button, boolean down, int wheeld) { public MouseButtonEvent(Coord pos, int button, boolean down, int wheeld) {
this.button = button; this.button = button;
@ -110,14 +107,12 @@ public class MouseButtonEvent implements Handleable<MouseButtonEvent.Listener> {
handler.receive(this); handler.receive(this);
} }
public interface Listener { public interface Listener {
/** /**
* Handle an event * Handle an event
* *
* @param event * @param event event
* event
*/ */
public void receive(MouseButtonEvent event); public void receive(MouseButtonEvent event);
} }

@ -1,5 +1,6 @@
package mightypork.rogue.bus.events; package mightypork.rogue.bus.events;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
import mightypork.utils.patterns.subscription.Handleable; import mightypork.utils.patterns.subscription.Handleable;
@ -40,14 +41,12 @@ public class MouseMotionEvent implements Handleable<MouseMotionEvent.Listener> {
keh.receive(this); keh.receive(this);
} }
public interface Listener { public interface Listener {
/** /**
* Handle an event * Handle an event
* *
* @param event * @param event event
* event
*/ */
public void receive(MouseMotionEvent event); public void receive(MouseMotionEvent event);
} }

@ -1,5 +1,6 @@
package mightypork.rogue.bus.events; package mightypork.rogue.bus.events;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
import mightypork.utils.patterns.subscription.Handleable; import mightypork.utils.patterns.subscription.Handleable;
@ -42,7 +43,6 @@ public class ScreenChangeEvent implements Handleable<ScreenChangeEvent.Listener>
handler.receive(this); handler.receive(this);
} }
public interface Listener { public interface Listener {
public void receive(ScreenChangeEvent event); public void receive(ScreenChangeEvent event);

@ -1,5 +1,6 @@
package mightypork.rogue.bus.events; package mightypork.rogue.bus.events;
import mightypork.utils.patterns.subscription.Handleable; import mightypork.utils.patterns.subscription.Handleable;
@ -25,7 +26,6 @@ public class UpdateEvent implements Handleable<UpdateEvent.Listener> {
handler.receive(this); handler.receive(this);
} }
public interface Listener { public interface Listener {
public void receive(UpdateEvent event); public void receive(UpdateEvent event);

@ -1,5 +1,6 @@
package mightypork.rogue.display; package mightypork.rogue.display;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;

@ -1,5 +1,6 @@
package mightypork.rogue.display; package mightypork.rogue.display;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;
import mightypork.rogue.bus.DelegatingBusClient; import mightypork.rogue.bus.DelegatingBusClient;
@ -51,8 +52,7 @@ public abstract class Screen extends DelegatingBusClient implements KeyBinder, B
/** /**
* Prepare for being shown * Prepare for being shown
* *
* @param shown * @param shown true to show, false to hide
* true to show, false to hide
*/ */
public final void setActive(boolean shown) public final void setActive(boolean shown)
{ {
@ -161,8 +161,7 @@ public abstract class Screen extends DelegatingBusClient implements KeyBinder, B
/** /**
* Update GUI for new screen size * Update GUI for new screen size
* *
* @param size * @param size screen size
* screen size
*/ */
protected void onSizeChanged(Coord size) protected void onSizeChanged(Coord size)
{ {
@ -179,8 +178,7 @@ public abstract class Screen extends DelegatingBusClient implements KeyBinder, B
/** /**
* Update animations and timing * Update animations and timing
* *
* @param delta * @param delta time elapsed
* time elapsed
*/ */
protected abstract void updateScreen(double delta); protected abstract void updateScreen(double delta);

@ -1,5 +1,6 @@
package mightypork.rogue.display; package mightypork.rogue.display;
import java.util.Random; import java.util.Random;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;

@ -1,5 +1,6 @@
package mightypork.rogue.display.constraints; package mightypork.rogue.display.constraints;
import mightypork.utils.math.coord.Rect; import mightypork.utils.math.coord.Rect;

@ -1,5 +1,6 @@
package mightypork.rogue.display.constraints; package mightypork.rogue.display.constraints;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
import mightypork.utils.math.coord.Rect; import mightypork.utils.math.coord.Rect;

@ -1,5 +1,6 @@
package mightypork.rogue.display.rendering; package mightypork.rogue.display.rendering;
public interface Renderable { public interface Renderable {
public void render(); public void render();

@ -1,5 +1,6 @@
package mightypork.rogue.display.rendering; package mightypork.rogue.display.rendering;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;
import mightypork.rogue.bus.DelegatingBusClient; import mightypork.rogue.bus.DelegatingBusClient;

@ -1,5 +1,6 @@
package mightypork.rogue.fonts; package mightypork.rogue.fonts;
/** /**
* Alignment * Alignment
* *

@ -1,5 +1,6 @@
package mightypork.rogue.fonts; package mightypork.rogue.fonts;
import java.awt.Font; import java.awt.Font;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
@ -20,7 +21,6 @@ public class FontManager {
private static final boolean DEBUG = Config.LOG_FONTS; private static final boolean DEBUG = Config.LOG_FONTS;
/** /**
* Glyph tables. * Glyph tables.
* *
@ -75,13 +75,13 @@ public class FontManager {
//@formatter:on //@formatter:on
} }
/** /**
* Font style * Font style
* *
* @author MightyPork * @author MightyPork
*/ */
public static enum Style { public static enum Style
{
/** Normal */ /** Normal */
NORMAL, NORMAL,
/** Italic */ /** Italic */
@ -112,7 +112,6 @@ public class FontManager {
OUTLINE; OUTLINE;
} }
// /** // /**
// * Preloaded font identifier [name, size, style] // * Preloaded font identifier [name, size, style]
// * // *
@ -224,12 +223,9 @@ public class FontManager {
/** /**
* Register font file. * Register font file.
* *
* @param path * @param path resource path (res/fonts/...)
* resource path (res/fonts/...) * @param name font name (for binding)
* @param name * @param style font style in this file
* font name (for binding)
* @param style
* font style in this file
*/ */
public static void registerFile(String path, String name, Style style) public static void registerFile(String path, String name, Style style)
{ {
@ -254,14 +250,10 @@ public class FontManager {
* Preload font if needed, get preloaded font.<br> * Preload font if needed, get preloaded font.<br>
* If needed file is not available, throws runtime exception. * If needed file is not available, throws runtime exception.
* *
* @param name * @param name font name (registerFile)
* font name (registerFile) * @param size font size (pt)
* @param size * @param style font style
* font size (pt) * @param glyphs glyphs needed
* @param style
* font style
* @param glyphs
* glyphs needed
* @return the loaded font. * @return the loaded font.
*/ */
public static LoadedFont loadFont(String name, double size, Style style, String glyphs) public static LoadedFont loadFont(String name, double size, Style style, String glyphs)
@ -274,24 +266,16 @@ public class FontManager {
* Preload font if needed, get preloaded font.<br> * Preload font if needed, get preloaded font.<br>
* If needed file is not available, throws runtime exception. * If needed file is not available, throws runtime exception.
* *
* @param name * @param name font name (registerFile)
* font name (registerFile) * @param size font size (pt)
* @param size * @param style font style
* font size (pt) * @param glyphs glyphs needed
* @param style * @param correctLeft left horizontal correction
* font style * @param correctRight right horizontal correction
* @param glyphs * @param scale font scale (changing aspect ratio)
* glyphs needed * @param clipTop top clip (0-1) - top part of the font to be cut off
* @param correctLeft * @param clipBottom bottom clip (0-1) - bottom part of the font to be cut
* left horizontal correction * off
* @param correctRight
* right horizontal correction
* @param scale
* font scale (changing aspect ratio)
* @param clipTop
* top clip (0-1) - top part of the font to be cut off
* @param clipBottom
* bottom clip (0-1) - bottom part of the font to be cut off
* @return the loaded font. * @return the loaded font.
*/ */
public static LoadedFont loadFont(String name, double size, Style style, String glyphs, int correctLeft, int correctRight, Coord scale, double clipTop, double clipBottom) public static LoadedFont loadFont(String name, double size, Style style, String glyphs, int correctLeft, int correctRight, Coord scale, double clipTop, double clipBottom)

@ -1,5 +1,6 @@
package mightypork.rogue.fonts; package mightypork.rogue.fonts;
import static mightypork.rogue.fonts.FontManager.Style.*; import static mightypork.rogue.fonts.FontManager.Style.*;
import mightypork.rogue.fonts.FontManager.Glyphs; import mightypork.rogue.fonts.FontManager.Glyphs;
import mightypork.utils.logging.Log; import mightypork.utils.logging.Log;

@ -1,5 +1,6 @@
package mightypork.rogue.fonts; package mightypork.rogue.fonts;
import static mightypork.rogue.fonts.Align.*; import static mightypork.rogue.fonts.Align.*;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
@ -74,7 +75,6 @@ public class LoadedFont {
private double clipVerticalT = 0; private double clipVerticalT = 0;
private double clipVerticalB = 0; private double clipVerticalB = 0;
private class CharStorageEntry { private class CharStorageEntry {
/** Character's width */ /** Character's width */
@ -572,16 +572,11 @@ public class LoadedFont {
/** /**
* Draw string with font. * Draw string with font.
* *
* @param x * @param x x coord
* x coord * @param y y coord
* @param y * @param text text to draw
* y coord * @param color render color
* @param text * @param align (-1,0,1)
* text to draw
* @param color
* render color
* @param align
* (-1,0,1)
*/ */
public void draw(double x, double y, String text, RGB color, int align) public void draw(double x, double y, String text, RGB color, int align)
{ {
@ -592,14 +587,10 @@ public class LoadedFont {
/** /**
* Draw string with font. * Draw string with font.
* *
* @param pos * @param pos coord
* coord * @param text text to draw
* @param text * @param color render color
* text to draw * @param align (-1,0,1)
* @param color
* render color
* @param align
* (-1,0,1)
*/ */
public void draw(Coord pos, String text, RGB color, int align) public void draw(Coord pos, String text, RGB color, int align)
{ {

@ -1,5 +1,6 @@
package mightypork.rogue.input; package mightypork.rogue.input;
import mightypork.rogue.AppAccess; import mightypork.rogue.AppAccess;
import mightypork.rogue.bus.DelegatingBusClient; import mightypork.rogue.bus.DelegatingBusClient;
import mightypork.rogue.bus.events.KeyboardEvent; import mightypork.rogue.bus.events.KeyboardEvent;

@ -1,14 +1,13 @@
package mightypork.rogue.input; package mightypork.rogue.input;
public interface KeyBinder { public interface KeyBinder {
/** /**
* Bind handler to a keystroke, replace current handler if any * Bind handler to a keystroke, replace current handler if any
* *
* @param stroke * @param stroke trigger keystroke
* trigger keystroke * @param task handler
* @param task
* handler
*/ */
abstract void bindKeyStroke(KeyStroke stroke, Runnable task); abstract void bindKeyStroke(KeyStroke stroke, Runnable task);
@ -16,8 +15,7 @@ public interface KeyBinder {
/** /**
* Remove handler from a keystroke (id any) * Remove handler from a keystroke (id any)
* *
* @param stroke * @param stroke stroke
* stroke
*/ */
abstract void unbindKeyStroke(KeyStroke stroke); abstract void unbindKeyStroke(KeyStroke stroke);

@ -1,5 +1,6 @@
package mightypork.rogue.input; package mightypork.rogue.input;
import mightypork.rogue.bus.events.KeyboardEvent; import mightypork.rogue.bus.events.KeyboardEvent;

@ -1,5 +1,6 @@
package mightypork.rogue.input; package mightypork.rogue.input;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
@ -21,10 +22,8 @@ public class KeyBindingPool implements KeyBinder, KeyboardEvent.Listener {
/** /**
* Bind handler to a keystroke, replace current handler if any * Bind handler to a keystroke, replace current handler if any
* *
* @param stroke * @param stroke trigger keystroke
* trigger keystroke * @param task handler
* @param task
* handler
*/ */
@Override @Override
public void bindKeyStroke(KeyStroke stroke, Runnable task) public void bindKeyStroke(KeyStroke stroke, Runnable task)
@ -44,8 +43,7 @@ public class KeyBindingPool implements KeyBinder, KeyboardEvent.Listener {
/** /**
* Remove handler from keystroke (id any) * Remove handler from keystroke (id any)
* *
* @param stroke * @param stroke stroke
* stroke
*/ */
@Override @Override
public void unbindKeyStroke(KeyStroke stroke) public void unbindKeyStroke(KeyStroke stroke)

@ -1,5 +1,6 @@
package mightypork.rogue.input; package mightypork.rogue.input;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
@ -16,10 +17,8 @@ public class KeyStroke {
/** /**
* KeyStroke * KeyStroke
* *
* @param down * @param down true for falling edge, up for rising edge
* true for falling edge, up for rising edge * @param keys keys that must be pressed
* @param keys
* keys that must be pressed
*/ */
public KeyStroke(boolean down, int... keys) { public KeyStroke(boolean down, int... keys) {
this.down = down; this.down = down;

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
import mightypork.utils.files.FileUtils; import mightypork.utils.files.FileUtils;
import mightypork.utils.logging.Log; import mightypork.utils.logging.Log;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
@ -16,7 +17,8 @@ import org.newdawn.slick.openal.SoundStore;
*/ */
public class AudioX implements Destroyable { public class AudioX implements Destroyable {
private enum PlayMode { private enum PlayMode
{
EFFECT, MUSIC; EFFECT, MUSIC;
}; };
@ -35,8 +37,7 @@ public class AudioX implements Destroyable {
/** /**
* Create deferred primitive audio player * Create deferred primitive audio player
* *
* @param resourceName * @param resourceName resource to load when needed
* resource to load when needed
*/ */
public AudioX(String resourceName) { public AudioX(String resourceName) {
this.audio = null; this.audio = null;
@ -160,12 +161,9 @@ public class AudioX implements Destroyable {
/** /**
* Play as sound effect at listener position * Play as sound effect at listener position
* *
* @param pitch * @param pitch pitch (1 = default)
* pitch (1 = default) * @param gain gain (0-1)
* @param gain * @param loop looping
* gain (0-1)
* @param loop
* looping
* @return source id * @return source id
*/ */
public int playAsEffect(double pitch, double gain, boolean loop) public int playAsEffect(double pitch, double gain, boolean loop)
@ -177,12 +175,9 @@ public class AudioX implements Destroyable {
/** /**
* Play as sound effect at given X-Y position * Play as sound effect at given X-Y position
* *
* @param pitch * @param pitch pitch (1 = default)
* pitch (1 = default) * @param gain gain (0-1)
* @param gain * @param loop looping
* gain (0-1)
* @param loop
* looping
* @param x * @param x
* @param y * @param y
* @return source id * @return source id
@ -196,12 +191,9 @@ public class AudioX implements Destroyable {
/** /**
* Play as sound effect at given position * Play as sound effect at given position
* *
* @param pitch * @param pitch pitch (1 = default)
* pitch (1 = default) * @param gain gain (0-1)
* @param gain * @param loop looping
* gain (0-1)
* @param loop
* looping
* @param x * @param x
* @param y * @param y
* @param z * @param z
@ -222,14 +214,10 @@ public class AudioX implements Destroyable {
/** /**
* Play as sound effect at given position * Play as sound effect at given position
* *
* @param pitch * @param pitch pitch (1 = default)
* pitch (1 = default) * @param gain gain (0-1)
* @param gain * @param loop looping
* gain (0-1) * @param pos coord
* @param loop
* looping
* @param pos
* coord
* @return source id * @return source id
*/ */
public int playAsEffect(double pitch, double gain, boolean loop, Coord pos) public int playAsEffect(double pitch, double gain, boolean loop, Coord pos)
@ -244,12 +232,9 @@ public class AudioX implements Destroyable {
* Play as music using source 0.<br> * Play as music using source 0.<br>
* Discouraged, since this does not allow cross-fading. * Discouraged, since this does not allow cross-fading.
* *
* @param pitch * @param pitch play pitch
* play pitch * @param gain play gain
* @param gain * @param loop looping
* play gain
* @param loop
* looping
* @return source * @return source
*/ */
public int playAsMusic(double pitch, double gain, boolean loop) public int playAsMusic(double pitch, double gain, boolean loop)

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
import mightypork.utils.objects.Mutable; import mightypork.utils.objects.Mutable;

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
import mightypork.utils.objects.Mutable; import mightypork.utils.objects.Mutable;

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
import mightypork.utils.objects.Mutable; import mightypork.utils.objects.Mutable;
@ -17,8 +18,7 @@ public class JointVolume extends Mutable<Double> {
/** /**
* Create joint volume with master gain of 1 * Create joint volume with master gain of 1
* *
* @param volumes * @param volumes individual volumes to join
* individual volumes to join
*/ */
public JointVolume(Mutable<Double>... volumes) { public JointVolume(Mutable<Double>... volumes) {
super(1D); super(1D);

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
import mightypork.utils.objects.Mutable; import mightypork.utils.objects.Mutable;
import mightypork.utils.time.Pauseable; import mightypork.utils.time.Pauseable;
import mightypork.utils.time.Updateable; import mightypork.utils.time.Updateable;

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
public class NullAudio extends AudioX { public class NullAudio extends AudioX {
public NullAudio() { public NullAudio() {

@ -1,5 +1,6 @@
package mightypork.rogue.sounds; package mightypork.rogue.sounds;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -118,14 +119,10 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Register effect resource * Register effect resource
* *
* @param key * @param key sound key
* sound key * @param resource resource path
* @param resource * @param pitch default pitch (1 = unchanged)
* resource path * @param gain default gain (0-1)
* @param pitch
* default pitch (1 = unchanged)
* @param gain
* default gain (0-1)
*/ */
public void addEffect(String key, String resource, double pitch, double gain) public void addEffect(String key, String resource, double pitch, double gain)
{ {
@ -137,18 +134,12 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Register loop resource (music / effect loop) * Register loop resource (music / effect loop)
* *
* @param key * @param key sound key
* sound key * @param resource resource path
* @param resource * @param pitch default pitch (1 = unchanged)
* resource path * @param gain default gain (0-1)
* @param pitch * @param fadeIn default time for fadeIn
* default pitch (1 = unchanged) * @param fadeOut default time for fadeOut
* @param gain
* default gain (0-1)
* @param fadeIn
* default time for fadeIn
* @param fadeOut
* default time for fadeOut
*/ */
public void addLoop(String key, String resource, double pitch, double gain, double fadeIn, double fadeOut) public void addLoop(String key, String resource, double pitch, double gain, double fadeIn, double fadeOut)
{ {
@ -161,11 +152,9 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Create {@link AudioX} for a resource * Create {@link AudioX} for a resource
* *
* @param res * @param res a resource name
* a resource name
* @return the resource * @return the resource
* @throws IllegalArgumentException * @throws IllegalArgumentException if resource is already registered
* if resource is already registered
*/ */
private AudioX getResource(String res) private AudioX getResource(String res)
{ {
@ -179,8 +168,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Get a loop player for key * Get a loop player for key
* *
* @param key * @param key sound key
* sound key
* @return loop player * @return loop player
*/ */
public LoopPlayer getLoop(String key) public LoopPlayer getLoop(String key)
@ -197,8 +185,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Get a effect player for key * Get a effect player for key
* *
* @param key * @param key sound key
* sound key
* @return effect player * @return effect player
*/ */
public EffectPlayer getEffect(String key) public EffectPlayer getEffect(String key)
@ -226,8 +213,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Fade in a loop (with default time) * Fade in a loop (with default time)
* *
* @param key * @param key sound key
* sound key
*/ */
public void fadeInLoop(String key) public void fadeInLoop(String key)
{ {
@ -238,10 +224,8 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Fade in a loop * Fade in a loop
* *
* @param key * @param key sound key
* sound key * @param seconds fade-in duration
* @param seconds
* fade-in duration
*/ */
public void fadeInLoop(String key, double seconds) public void fadeInLoop(String key, double seconds)
{ {
@ -252,8 +236,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Fade out a loop (with default time) * Fade out a loop (with default time)
* *
* @param key * @param key sound key
* sound key
*/ */
public void fadeOutLoop(String key) public void fadeOutLoop(String key)
{ {
@ -264,10 +247,8 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Fade out a loop * Fade out a loop
* *
* @param key * @param key sound key
* sound key * @param seconds fade-out duration
* @param seconds
* fade-out duration
*/ */
public void fadeOutLoop(String key, double seconds) public void fadeOutLoop(String key, double seconds)
{ {
@ -278,8 +259,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Pause a loop * Pause a loop
* *
* @param key * @param key sound key
* sound key
*/ */
public void pauseLoop(String key) public void pauseLoop(String key)
{ {
@ -301,8 +281,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Resume a loop * Resume a loop
* *
* @param key * @param key sound key
* sound key
*/ */
public void resumeLoop(String key) public void resumeLoop(String key)
{ {
@ -313,8 +292,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Set level of master volume * Set level of master volume
* *
* @param d * @param d level
* level
*/ */
public void setMasterVolume(double d) public void setMasterVolume(double d)
{ {
@ -325,8 +303,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Set level of effects volume * Set level of effects volume
* *
* @param d * @param d level
* level
*/ */
public void setEffectsVolume(double d) public void setEffectsVolume(double d)
{ {
@ -337,8 +314,7 @@ public class SoundSystem extends DelegatingBusClient {
/** /**
* Set level of music volume * Set level of music volume
* *
* @param d * @param d level
* level
*/ */
public void setMusicVolume(double d) public void setMusicVolume(double d)
{ {

@ -1,5 +1,6 @@
package mightypork.rogue.tasks; package mightypork.rogue.tasks;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

@ -1,5 +1,6 @@
package mightypork.rogue.testing; package mightypork.rogue.testing;
import mightypork.rogue.display.constraints.Bounding; import mightypork.rogue.display.constraints.Bounding;
import mightypork.rogue.display.constraints.Constraint; import mightypork.rogue.display.constraints.Constraint;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;

@ -1,5 +1,6 @@
package mightypork.rogue.testing; package mightypork.rogue.testing;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -181,7 +182,6 @@ class StringMessage implements Handleable<StringMessage.Listener> {
this.s = str; this.s = str;
} }
public interface Listener { public interface Listener {
public void receive(StringMessage message); public void receive(StringMessage message);
@ -205,7 +205,6 @@ class IntMessage implements Handleable<IntMessage.Listener> {
this.i = i; this.i = i;
} }
public interface Listener { public interface Listener {
public void receive(IntMessage message); public void receive(IntMessage message);

@ -1,5 +1,6 @@
package mightypork.rogue.textures; package mightypork.rogue.textures;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import java.io.IOException; import java.io.IOException;
@ -51,10 +52,8 @@ public class TextureManager {
/** /**
* Bind texture * Bind texture
* *
* @param texture * @param texture the texture
* the texture * @throws RuntimeException if not loaded yet
* @throws RuntimeException
* if not loaded yet
*/ */
public static void bind(Texture texture) throws RuntimeException public static void bind(Texture texture) throws RuntimeException
{ {

@ -1,5 +1,6 @@
package mightypork.rogue.textures; package mightypork.rogue.textures;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import org.newdawn.slick.opengl.Texture; import org.newdawn.slick.opengl.Texture;

@ -1,5 +1,6 @@
package mightypork.rogue.textures; package mightypork.rogue.textures;
// TODO rewrite // TODO rewrite
/** /**

@ -1,5 +1,6 @@
package mightypork.rogue.textures; package mightypork.rogue.textures;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
import mightypork.utils.math.coord.Rect; import mightypork.utils.math.coord.Rect;
@ -24,16 +25,11 @@ public class TxQuad {
/** /**
* Create TxQuad from left top coord and rect size * Create TxQuad from left top coord and rect size
* *
* @param tx * @param tx texture
* texture * @param x1 left top X
* @param x1 * @param y1 left top Y
* left top X * @param width area width
* @param y1 * @param height area height
* left top Y
* @param width
* area width
* @param height
* area height
* @return new TxQuad * @return new TxQuad
*/ */
public static TxQuad fromSize(Texture tx, int x1, int y1, int width, int height) public static TxQuad fromSize(Texture tx, int x1, int y1, int width, int height)
@ -43,10 +39,8 @@ public class TxQuad {
/** /**
* @param tx * @param tx Texture
* Texture * @param uvs Rect of texturwe UVs (pixels - from left top)
* @param uvs
* Rect of texturwe UVs (pixels - from left top)
*/ */
public TxQuad(Texture tx, Rect uvs) { public TxQuad(Texture tx, Rect uvs) {
this.tx = tx; this.tx = tx;
@ -58,16 +52,11 @@ public class TxQuad {
/** /**
* Make of coords * Make of coords
* *
* @param tx * @param tx texture
* texture * @param x1 x1
* @param x1 * @param y1 y1
* x1 * @param x2 x2
* @param y1 * @param y2 y2
* y1
* @param x2
* x2
* @param y2
* y2
*/ */
public TxQuad(Texture tx, int x1, int y1, int x2, int y2) { public TxQuad(Texture tx, int x1, int y1, int x2, int y2) {
this.tx = tx; this.tx = tx;

@ -1,5 +1,6 @@
package mightypork.rogue.util; package mightypork.rogue.util;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import mightypork.rogue.textures.TextureManager; import mightypork.rogue.textures.TextureManager;
import mightypork.rogue.textures.TxQuad; import mightypork.rogue.textures.TxQuad;
@ -26,10 +27,8 @@ public class RenderUtils {
/** /**
* Render quad 2D * Render quad 2D
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max
* max coord
*/ */
public static void quadCoord(Coord min, Coord max) public static void quadCoord(Coord min, Coord max)
{ {
@ -40,14 +39,10 @@ public class RenderUtils {
/** /**
* Render quad with absolute coords (from screen bottom) * Render quad with absolute coords (from screen bottom)
* *
* @param left * @param left left x
* left x * @param bottom bottom y
* @param bottom * @param right right x
* bottom y * @param top top y
* @param right
* right x
* @param top
* top y
*/ */
public static void quadCoord(double left, double bottom, double right, double top) public static void quadCoord(double left, double bottom, double right, double top)
{ {
@ -63,16 +58,11 @@ public class RenderUtils {
/** /**
* Render quad with coloured border * Render quad with coloured border
* *
* @param min * @param min min
* min * @param max max
* @param max * @param border border width
* max * @param borderColor border color
* @param border * @param insideColor filling color
* border width
* @param borderColor
* border color
* @param insideColor
* filling color
*/ */
public static void quadCoordBorder(Coord min, Coord max, double border, RGB borderColor, RGB insideColor) public static void quadCoordBorder(Coord min, Coord max, double border, RGB borderColor, RGB insideColor)
{ {
@ -83,20 +73,13 @@ public class RenderUtils {
/** /**
* Render quad with coloured border * Render quad with coloured border
* *
* @param minX * @param minX min x
* min x * @param minY min y
* @param minY * @param maxX max x
* min y * @param maxY max y
* @param maxX * @param border border width
* max x * @param borderColor border color
* @param maxY * @param insideColor filling color
* max y
* @param border
* border width
* @param borderColor
* border color
* @param insideColor
* filling color
*/ */
public static void quadCoordBorder(double minX, double minY, double maxX, double maxY, double border, RGB borderColor, RGB insideColor) public static void quadCoordBorder(double minX, double minY, double maxX, double maxY, double border, RGB borderColor, RGB insideColor)
{ {
@ -121,14 +104,10 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient horizontal * Render quad 2D with gradient horizontal
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max * @param colorLeft color left
* max coord * @param colorRight color right
* @param colorLeft
* color left
* @param colorRight
* color right
*/ */
public static void quadCoordGradH(Coord min, Coord max, RGB colorLeft, RGB colorRight) public static void quadCoordGradH(Coord min, Coord max, RGB colorLeft, RGB colorRight)
{ {
@ -139,18 +118,12 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient horizontal * Render quad 2D with gradient horizontal
* *
* @param minX * @param minX units from left
* units from left * @param minY units from bottom
* @param minY * @param maxX quad width
* units from bottom * @param maxY quad height
* @param maxX * @param colorLeft color left
* quad width * @param colorRight color right
* @param maxY
* quad height
* @param colorLeft
* color left
* @param colorRight
* color right
*/ */
public static void quadCoordGradH(double minX, double minY, double maxX, double maxY, RGB colorLeft, RGB colorRight) public static void quadCoordGradH(double minX, double minY, double maxX, double maxY, RGB colorLeft, RGB colorRight)
{ {
@ -171,14 +144,10 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient horizontal * Render quad 2D with gradient horizontal
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max * @param colorOuter color outer
* max coord * @param colorMiddle color inner
* @param colorOuter
* color outer
* @param colorMiddle
* color inner
*/ */
public static void quadCoordGradHBilinear(Coord min, Coord max, RGB colorOuter, RGB colorMiddle) public static void quadCoordGradHBilinear(Coord min, Coord max, RGB colorOuter, RGB colorMiddle)
{ {
@ -189,18 +158,12 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient horizontal * Render quad 2D with gradient horizontal
* *
* @param minX * @param minX min x
* min x * @param minY min y
* @param minY * @param maxX max x
* min y * @param maxY max y
* @param maxX * @param colorOuter color outer
* max x * @param colorMiddle color inner
* @param maxY
* max y
* @param colorOuter
* color outer
* @param colorMiddle
* color inner
*/ */
public static void quadCoordGradHBilinear(double minX, double minY, double maxX, double maxY, RGB colorOuter, RGB colorMiddle) public static void quadCoordGradHBilinear(double minX, double minY, double maxX, double maxY, RGB colorOuter, RGB colorMiddle)
{ {
@ -231,14 +194,10 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient vertical * Render quad 2D with gradient vertical
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max * @param colorTop top color
* max coord * @param colorBottom bottom color
* @param colorTop
* top color
* @param colorBottom
* bottom color
*/ */
public static void quadCoordGradV(Coord min, Coord max, RGB colorTop, RGB colorBottom) public static void quadCoordGradV(Coord min, Coord max, RGB colorTop, RGB colorBottom)
{ {
@ -249,18 +208,12 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient vertical * Render quad 2D with gradient vertical
* *
* @param minX * @param minX min X
* min X * @param minY min Y
* @param minY * @param maxX max X
* min Y * @param maxY max Y
* @param maxX * @param colorTop top color
* max X * @param colorBottom bottom color
* @param maxY
* max Y
* @param colorTop
* top color
* @param colorBottom
* bottom color
*/ */
public static void quadCoordGradV(double minX, double minY, double maxX, double maxY, RGB colorTop, RGB colorBottom) public static void quadCoordGradV(double minX, double minY, double maxX, double maxY, RGB colorTop, RGB colorBottom)
{ {
@ -280,14 +233,10 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient vertical * Render quad 2D with gradient vertical
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max * @param colorOuter outer color
* max coord * @param colorMiddle middle color
* @param colorOuter
* outer color
* @param colorMiddle
* middle color
*/ */
public static void quadCoordGradVBilinear(Coord min, Coord max, RGB colorOuter, RGB colorMiddle) public static void quadCoordGradVBilinear(Coord min, Coord max, RGB colorOuter, RGB colorMiddle)
{ {
@ -298,18 +247,12 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient vertical * Render quad 2D with gradient vertical
* *
* @param minX * @param minX min X
* min X * @param minY min Y
* @param minY * @param maxX max X
* min Y * @param maxY max Y
* @param maxX * @param colorOuter outer color
* max X * @param colorMiddle middle color
* @param maxY
* max Y
* @param colorOuter
* outer color
* @param colorMiddle
* middle color
*/ */
public static void quadCoordGradVBilinear(double minX, double minY, double maxX, double maxY, RGB colorOuter, RGB colorMiddle) public static void quadCoordGradVBilinear(double minX, double minY, double maxX, double maxY, RGB colorOuter, RGB colorMiddle)
{ {
@ -338,16 +281,11 @@ public class RenderUtils {
/** /**
* Render quad with coloured border with outset effect * Render quad with coloured border with outset effect
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max * @param border border width
* max coord * @param fill fill color
* @param border * @param inset true for inset, false for outset
* border width
* @param fill
* fill color
* @param inset
* true for inset, false for outset
*/ */
public static void quadCoordOutset(Coord min, Coord max, double border, RGB fill, boolean inset) public static void quadCoordOutset(Coord min, Coord max, double border, RGB fill, boolean inset)
{ {
@ -358,20 +296,13 @@ public class RenderUtils {
/** /**
* Render quad with coloured border with outset effect * Render quad with coloured border with outset effect
* *
* @param minX * @param minX left X
* left X * @param minY bottom Y
* @param minY * @param maxX right X
* bottom Y * @param maxY top Y
* @param maxX * @param border border width
* right X * @param fill fill color
* @param maxY * @param inset true for inset, false for outset
* top Y
* @param border
* border width
* @param fill
* fill color
* @param inset
* true for inset, false for outset
*/ */
public static void quadCoordOutset(double minX, double minY, double maxX, double maxY, double border, RGB fill, boolean inset) public static void quadCoordOutset(double minX, double minY, double maxX, double maxY, double border, RGB fill, boolean inset)
{ {
@ -436,8 +367,7 @@ public class RenderUtils {
/** /**
* Render quad 2D * Render quad 2D
* *
* @param rect * @param rect rectangle
* rectangle
*/ */
public static void quadRect(Rect rect) public static void quadRect(Rect rect)
{ {
@ -448,10 +378,8 @@ public class RenderUtils {
/** /**
* Render quad 2D * Render quad 2D
* *
* @param rect * @param rect rectangle
* rectangle * @param color draw color
* @param color
* draw color
*/ */
public static void quadRect(Rect rect, RGB color) public static void quadRect(Rect rect, RGB color)
{ {
@ -463,14 +391,10 @@ public class RenderUtils {
/** /**
* Render quad with coloured border * Render quad with coloured border
* *
* @param rect * @param rect rect
* rect * @param border border width
* @param border * @param borderColor border color
* border width * @param insideColor filling color
* @param borderColor
* border color
* @param insideColor
* filling color
*/ */
public static void quadBorder(Rect rect, double border, RGB borderColor, RGB insideColor) public static void quadBorder(Rect rect, double border, RGB borderColor, RGB insideColor)
{ {
@ -481,12 +405,9 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient horizontal * Render quad 2D with gradient horizontal
* *
* @param rect * @param rect rect
* rect * @param colorLeft color left
* @param colorLeft * @param colorRight color right
* color left
* @param colorRight
* color right
*/ */
public static void quadGradH(Rect rect, RGB colorLeft, RGB colorRight) public static void quadGradH(Rect rect, RGB colorLeft, RGB colorRight)
{ {
@ -497,12 +418,9 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient horizontal * Render quad 2D with gradient horizontal
* *
* @param rect * @param rect rect
* rect * @param colorOuter color outer
* @param colorOuter * @param colorMiddle color inner
* color outer
* @param colorMiddle
* color inner
*/ */
public static void quadGradHBilinear(Rect rect, RGB colorOuter, RGB colorMiddle) public static void quadGradHBilinear(Rect rect, RGB colorOuter, RGB colorMiddle)
{ {
@ -513,12 +431,9 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient vertical * Render quad 2D with gradient vertical
* *
* @param rect * @param rect rect
* rect * @param colorTop top color
* @param colorTop * @param colorBottom bottom color
* top color
* @param colorBottom
* bottom color
*/ */
public static void quadGradV(Rect rect, RGB colorTop, RGB colorBottom) public static void quadGradV(Rect rect, RGB colorTop, RGB colorBottom)
{ {
@ -529,12 +444,9 @@ public class RenderUtils {
/** /**
* Render quad 2D with gradient vertical * Render quad 2D with gradient vertical
* *
* @param rect * @param rect rect
* rect * @param colorOuter outer color
* @param colorOuter * @param colorMiddle middle color
* outer color
* @param colorMiddle
* middle color
*/ */
public static void quadGradVBilinear(Rect rect, RGB colorOuter, RGB colorMiddle) public static void quadGradVBilinear(Rect rect, RGB colorOuter, RGB colorMiddle)
{ {
@ -545,14 +457,10 @@ public class RenderUtils {
/** /**
* Render quad with coloured border with outset effect * Render quad with coloured border with outset effect
* *
* @param rect * @param rect rectangle
* rectangle * @param border border width
* @param border * @param fill fill color
* border width * @param inset true for inset, false for outset
* @param fill
* fill color
* @param inset
* true for inset, false for outset
*/ */
public static void quadRectOutset(Rect rect, double border, RGB fill, boolean inset) public static void quadRectOutset(Rect rect, double border, RGB fill, boolean inset)
{ {
@ -563,10 +471,8 @@ public class RenderUtils {
/** /**
* Render textured rect (texture must be binded already) * Render textured rect (texture must be binded already)
* *
* @param quad * @param quad rectangle (px)
* rectangle (px) * @param textureCoords texture coords (0-1)
* @param textureCoords
* texture coords (0-1)
*/ */
public static void quadTexturedAbs(Rect quad, Rect textureCoords) public static void quadTexturedAbs(Rect quad, Rect textureCoords)
{ {
@ -596,12 +502,9 @@ public class RenderUtils {
/** /**
* Render textured rect * Render textured rect
* *
* @param quad * @param quad rectangle (px)
* rectangle (px) * @param txCoords texture coords rectangle (px)
* @param txCoords * @param texture texture instance
* texture coords rectangle (px)
* @param texture
* texture instance
*/ */
public static void quadTextured(Rect quad, Rect txCoords, Texture texture) public static void quadTextured(Rect quad, Rect txCoords, Texture texture)
{ {
@ -612,14 +515,10 @@ public class RenderUtils {
/** /**
* Render textured rect * Render textured rect
* *
* @param quad * @param quad rectangle (px)
* rectangle (px) * @param txCoords texture coords rectangle (px)
* @param txCoords * @param texture texture instance
* texture coords rectangle (px) * @param tint color tint
* @param texture
* texture instance
* @param tint
* color tint
*/ */
public static void quadTextured(Rect quad, Rect txCoords, Texture texture, RGB tint) public static void quadTextured(Rect quad, Rect txCoords, Texture texture, RGB tint)
{ {
@ -637,10 +536,8 @@ public class RenderUtils {
/** /**
* Render textured rect * Render textured rect
* *
* @param quad * @param quad rectangle (px)
* rectangle (px) * @param txquad texture quad
* @param txquad
* texture quad
*/ */
public static void quadTextured(Rect quad, TxQuad txquad) public static void quadTextured(Rect quad, TxQuad txquad)
{ {
@ -651,12 +548,9 @@ public class RenderUtils {
/** /**
* Render textured rect * Render textured rect
* *
* @param quad * @param quad rectangle (px)
* rectangle (px) * @param txquad texture instance
* @param txquad * @param tint color tint
* texture instance
* @param tint
* color tint
*/ */
public static void quadTextured(Rect quad, TxQuad txquad, RGB tint) public static void quadTextured(Rect quad, TxQuad txquad, RGB tint)
{ {
@ -667,14 +561,10 @@ public class RenderUtils {
/** /**
* Render textured frame with borders * Render textured frame with borders
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param yOffsetTimes offset count (move frame down n times)
* rectangle in texture with the basic frame (px) * @param texture the texture
* @param yOffsetTimes
* offset count (move frame down n times)
* @param texture
* the texture
*/ */
public static void quadTexturedFrame(Rect quadRect, Rect textureRect, int yOffsetTimes, Texture texture) public static void quadTexturedFrame(Rect quadRect, Rect textureRect, int yOffsetTimes, Texture texture)
{ {
@ -685,16 +575,11 @@ public class RenderUtils {
/** /**
* Render textured frame with borders * Render textured frame with borders
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param yOffsetTimes offset count (move frame down n times)
* rectangle in texture with the basic frame (px) * @param texture the texture
* @param yOffsetTimes * @param tint color tint
* offset count (move frame down n times)
* @param texture
* the texture
* @param tint
* color tint
*/ */
public static void quadTexturedFrame(Rect quadRect, Rect textureRect, int yOffsetTimes, Texture texture, RGB tint) public static void quadTexturedFrame(Rect quadRect, Rect textureRect, int yOffsetTimes, Texture texture, RGB tint)
{ {
@ -755,12 +640,9 @@ public class RenderUtils {
/** /**
* Render textured frame with borders * Render textured frame with borders
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param texture the texture
* rectangle in texture with the basic frame (px)
* @param texture
* the texture
*/ */
public static void quadTexturedFrame(Rect quadRect, Rect textureRect, Texture texture) public static void quadTexturedFrame(Rect quadRect, Rect textureRect, Texture texture)
{ {
@ -771,10 +653,8 @@ public class RenderUtils {
/** /**
* Render textured frame with borders * Render textured frame with borders
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad
* texture quad
*/ */
public static void quadTexturedFrame(Rect quadRect, TxQuad txquad) public static void quadTexturedFrame(Rect quadRect, TxQuad txquad)
{ {
@ -785,12 +665,9 @@ public class RenderUtils {
/** /**
* Render textured frame with borders * Render textured frame with borders
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad * @param yOffsetTimes offset count (move frame down n times)
* texture quad
* @param yOffsetTimes
* offset count (move frame down n times)
*/ */
public static void quadTexturedFrame(Rect quadRect, TxQuad txquad, int yOffsetTimes) public static void quadTexturedFrame(Rect quadRect, TxQuad txquad, int yOffsetTimes)
{ {
@ -801,14 +678,10 @@ public class RenderUtils {
/** /**
* Render textured frame with borders * Render textured frame with borders
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad * @param yOffsetTimes offset count (move frame down n times)
* texture quad * @param tint color tint
* @param yOffsetTimes
* offset count (move frame down n times)
* @param tint
* color tint
*/ */
public static void quadTexturedFrame(Rect quadRect, TxQuad txquad, int yOffsetTimes, RGB tint) public static void quadTexturedFrame(Rect quadRect, TxQuad txquad, int yOffsetTimes, RGB tint)
{ {
@ -820,14 +693,10 @@ public class RenderUtils {
* Render textured frame stretching horizontally (rect height = texture rect * Render textured frame stretching horizontally (rect height = texture rect
* height) * height)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param borderSize size of the unstretched horizontal border
* rectangle in texture with the basic frame (px) * @param texture the texture
* @param borderSize
* size of the unstretched horizontal border
* @param texture
* the texture
*/ */
public static void quadTexturedStretchH(Rect quadRect, Rect textureRect, int borderSize, Texture texture) public static void quadTexturedStretchH(Rect quadRect, Rect textureRect, int borderSize, Texture texture)
{ {
@ -839,16 +708,11 @@ public class RenderUtils {
* Render textured frame stretching horizontally (rect height = texture rect * Render textured frame stretching horizontally (rect height = texture rect
* height) * height)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param borderSize size of the unstretched horizontal border
* rectangle in texture with the basic frame (px) * @param texture the texture
* @param borderSize * @param tint color tint
* size of the unstretched horizontal border
* @param texture
* the texture
* @param tint
* color tint
*/ */
public static void quadTexturedStretchH(Rect quadRect, Rect textureRect, int borderSize, Texture texture, RGB tint) public static void quadTexturedStretchH(Rect quadRect, Rect textureRect, int borderSize, Texture texture, RGB tint)
{ {
@ -889,12 +753,9 @@ public class RenderUtils {
* Render textured frame stretching horizontally (rect height = texture rect * Render textured frame stretching horizontally (rect height = texture rect
* height) * height)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad * @param borderSize size of the unstretched horizontal border
* texture quad
* @param borderSize
* size of the unstretched horizontal border
*/ */
public static void quadTexturedStretchH(Rect quadRect, TxQuad txquad, int borderSize) public static void quadTexturedStretchH(Rect quadRect, TxQuad txquad, int borderSize)
{ {
@ -906,14 +767,10 @@ public class RenderUtils {
* Render textured frame stretching horizontally (rect height = texture rect * Render textured frame stretching horizontally (rect height = texture rect
* height) * height)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad * @param borderSize size of the unstretched horizontal border
* texture quad * @param tint color tint
* @param borderSize
* size of the unstretched horizontal border
* @param tint
* color tint
*/ */
public static void quadTexturedStretchH(Rect quadRect, TxQuad txquad, int borderSize, RGB tint) public static void quadTexturedStretchH(Rect quadRect, TxQuad txquad, int borderSize, RGB tint)
{ {
@ -925,14 +782,10 @@ public class RenderUtils {
* Render textured frame stretching vertically (rect width = texture rect * Render textured frame stretching vertically (rect width = texture rect
* width) * width)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param borderSize size of the unstretched horizontal border
* rectangle in texture with the basic frame (px) * @param texture the texture
* @param borderSize
* size of the unstretched horizontal border
* @param texture
* the texture
*/ */
public static void quadTexturedStretchV(Rect quadRect, Rect textureRect, int borderSize, Texture texture) public static void quadTexturedStretchV(Rect quadRect, Rect textureRect, int borderSize, Texture texture)
{ {
@ -944,16 +797,11 @@ public class RenderUtils {
* Render textured frame stretching vertically (rect width = texture rect * Render textured frame stretching vertically (rect width = texture rect
* width) * width)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param textureRect rectangle in texture with the basic frame (px)
* @param textureRect * @param borderSize size of the unstretched horizontal border
* rectangle in texture with the basic frame (px) * @param texture the texture
* @param borderSize * @param tint color tint
* size of the unstretched horizontal border
* @param texture
* the texture
* @param tint
* color tint
*/ */
public static void quadTexturedStretchV(Rect quadRect, Rect textureRect, int borderSize, Texture texture, RGB tint) public static void quadTexturedStretchV(Rect quadRect, Rect textureRect, int borderSize, Texture texture, RGB tint)
{ {
@ -996,12 +844,9 @@ public class RenderUtils {
* Render textured frame stretching vertically (rect width = texture rect * Render textured frame stretching vertically (rect width = texture rect
* width) * width)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad * @param borderSize size of the unstretched horizontal border
* texture quad
* @param borderSize
* size of the unstretched horizontal border
*/ */
public static void quadTexturedStretchV(Rect quadRect, TxQuad txquad, int borderSize) public static void quadTexturedStretchV(Rect quadRect, TxQuad txquad, int borderSize)
{ {
@ -1013,14 +858,10 @@ public class RenderUtils {
* Render textured frame stretching vertically (rect width = texture rect * Render textured frame stretching vertically (rect width = texture rect
* width) * width)
* *
* @param quadRect * @param quadRect drawn rectangle (px)
* drawn rectangle (px) * @param txquad texture quad
* @param txquad * @param borderSize size of the unstretched horizontal border
* texture quad * @param tint color tint
* @param borderSize
* size of the unstretched horizontal border
* @param tint
* color tint
*/ */
public static void quadTexturedStretchV(Rect quadRect, TxQuad txquad, int borderSize, RGB tint) public static void quadTexturedStretchV(Rect quadRect, TxQuad txquad, int borderSize, RGB tint)
{ {
@ -1032,14 +873,10 @@ public class RenderUtils {
/** /**
* Render quad 2D * Render quad 2D
* *
* @param left * @param left units from left
* units from left * @param bottom units from bottom
* @param bottom * @param width quad width
* units from bottom * @param height quad height
* @param width
* quad width
* @param height
* quad height
*/ */
public static void quadSize(double left, double bottom, double width, double height) public static void quadSize(double left, double bottom, double width, double height)
{ {
@ -1055,8 +892,7 @@ public class RenderUtils {
/** /**
* Bind GL color * Bind GL color
* *
* @param color * @param color RGB color
* RGB color
*/ */
public static void setColor(RGB color) public static void setColor(RGB color)
{ {
@ -1067,10 +903,8 @@ public class RenderUtils {
/** /**
* Bind GL color * Bind GL color
* *
* @param color * @param color RGB color
* RGB color * @param alpha alpha multiplier
* @param alpha
* alpha multiplier
*/ */
public static void setColor(RGB color, double alpha) public static void setColor(RGB color, double alpha)
{ {
@ -1081,8 +915,7 @@ public class RenderUtils {
/** /**
* Translate with coord * Translate with coord
* *
* @param coord * @param coord coord
* coord
*/ */
public static void translate(Coord coord) public static void translate(Coord coord)
{ {

@ -1,5 +1,6 @@
package mightypork.rogue.util; package mightypork.rogue.util;
/** /**
* Utils class * Utils class
* *

@ -1,5 +1,6 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
@ -91,8 +92,7 @@ public class FileTreeDiff {
if (read1 == -1) break; if (read1 == -1) break;
} }
} catch (IOException e) { } catch (IOException e) {} finally {
} finally {
try { try {
if (cin1 != null) cin1.close(); if (cin1 != null) cin1.close();
} catch (IOException e) { } catch (IOException e) {
@ -140,7 +140,6 @@ public class FileTreeDiff {
} }
} }
private class NotEqualException extends Exception { private class NotEqualException extends Exception {
public NotEqualException(String msg) { public NotEqualException(String msg) {
@ -149,7 +148,6 @@ public class FileTreeDiff {
} }
private class Tuple<T> { private class Tuple<T> {
public T a; public T a;

@ -1,5 +1,6 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -14,12 +15,9 @@ public class FileUtils {
/** /**
* Copy directory recursively. * Copy directory recursively.
* *
* @param source * @param source source file
* source file * @param target target file
* @param target * @throws IOException on error
* target file
* @throws IOException
* on error
*/ */
public static void copyDirectory(File source, File target) throws IOException public static void copyDirectory(File source, File target) throws IOException
{ {
@ -30,16 +28,11 @@ public class FileUtils {
/** /**
* Copy directory recursively - advanced variant. * Copy directory recursively - advanced variant.
* *
* @param source * @param source source file
* source file * @param target target file
* @param target * @param filter filter accepting only files and dirs to be copied
* target file * @param filesCopied list into which all the target files will be added
* @param filter * @throws IOException on error
* filter accepting only files and dirs to be copied
* @param filesCopied
* list into which all the target files will be added
* @throws IOException
* on error
*/ */
public static void copyDirectory(File source, File target, FileFilter filter, List<File> filesCopied) throws IOException public static void copyDirectory(File source, File target, FileFilter filter, List<File> filesCopied) throws IOException
{ {
@ -69,14 +62,10 @@ public class FileUtils {
/** /**
* List directory recursively * List directory recursively
* *
* @param source * @param source source file
* source file * @param filter filter accepting only files and dirs to be copied (or null)
* @param filter * @param files list of the found files
* filter accepting only files and dirs to be copied (or null) * @throws IOException on error
* @param files
* list of the found files
* @throws IOException
* on error
*/ */
public static void listDirectoryRecursive(File source, StringFilter filter, List<File> files) throws IOException public static void listDirectoryRecursive(File source, StringFilter filter, List<File> files) throws IOException
{ {
@ -99,12 +88,9 @@ public class FileUtils {
/** /**
* Copy file using streams. Make sure target directory exists! * Copy file using streams. Make sure target directory exists!
* *
* @param source * @param source source file
* source file * @param target target file
* @param target * @throws IOException on error
* target file
* @throws IOException
* on error
*/ */
public static void copyFile(File source, File target) throws IOException public static void copyFile(File source, File target) throws IOException
{ {
@ -134,12 +120,9 @@ public class FileUtils {
/** /**
* Copy bytes from input to output stream, leaving out stream open * Copy bytes from input to output stream, leaving out stream open
* *
* @param in * @param in input stream
* input stream * @param out output stream
* @param out * @throws IOException on error
* output stream
* @throws IOException
* on error
*/ */
public static void copyStream(InputStream in, OutputStream out) throws IOException public static void copyStream(InputStream in, OutputStream out) throws IOException
{ {
@ -162,10 +145,8 @@ public class FileUtils {
/** /**
* Improved delete * Improved delete
* *
* @param path * @param path deleted path
* deleted path * @param recursive recursive delete
* @param recursive
* recursive delete
* @return success * @return success
*/ */
public static boolean delete(File path, boolean recursive) public static boolean delete(File path, boolean recursive)
@ -188,8 +169,7 @@ public class FileUtils {
/** /**
* Read entire file to a string. * Read entire file to a string.
* *
* @param file * @param file file
* file
* @return file contents * @return file contents
* @throws IOException * @throws IOException
*/ */
@ -204,8 +184,7 @@ public class FileUtils {
/** /**
* Get files in a folder (create folder if needed) * Get files in a folder (create folder if needed)
* *
* @param dir * @param dir folder
* folder
* @return list of files * @return list of files
*/ */
public static List<File> listDirectory(File dir) public static List<File> listDirectory(File dir)
@ -217,10 +196,8 @@ public class FileUtils {
/** /**
* Get files in a folder (create folder if needed) * Get files in a folder (create folder if needed)
* *
* @param dir * @param dir folder
* folder * @param filter file filter
* @param filter
* file filter
* @return list of files * @return list of files
*/ */
public static List<File> listDirectory(File dir, FileFilter filter) public static List<File> listDirectory(File dir, FileFilter filter)
@ -248,8 +225,7 @@ public class FileUtils {
/** /**
* Remove extension. * Remove extension.
* *
* @param file * @param file file
* file
* @return filename without extension * @return filename without extension
*/ */
public static String[] getFilenameParts(File file) public static String[] getFilenameParts(File file)
@ -300,8 +276,7 @@ public class FileUtils {
/** /**
* Read entire input stream to a string, and close it. * Read entire input stream to a string, and close it.
* *
* @param in * @param in input stream
* input stream
* @return file contents * @return file contents
*/ */
public static String streamToString(InputStream in) public static String streamToString(InputStream in)
@ -313,10 +288,8 @@ public class FileUtils {
/** /**
* Read input stream to a string, and close it. * Read input stream to a string, and close it.
* *
* @param in * @param in input stream
* input stream * @param lines max number of lines (-1 to disable limit)
* @param lines
* max number of lines (-1 to disable limit)
* @return file contents * @return file contents
*/ */
public static String streamToString(InputStream in, int lines) public static String streamToString(InputStream in, int lines)
@ -384,12 +357,9 @@ public class FileUtils {
/** /**
* Save string to file * Save string to file
* *
* @param file * @param file file
* file * @param text string
* @param text * @throws IOException on error
* string
* @throws IOException
* on error
*/ */
public static void stringToFile(File file, String text) throws IOException public static void stringToFile(File file, String text) throws IOException
{ {
@ -427,8 +397,7 @@ public class FileUtils {
/** /**
* Replace special characters with place holders in a filename. * Replace special characters with place holders in a filename.
* *
* @param filestring * @param filestring filename string
* filename string
* @return escaped * @return escaped
*/ */
public static String escapeFileString(String filestring) public static String escapeFileString(String filestring)
@ -458,8 +427,7 @@ public class FileUtils {
/** /**
* Unescape filename string obtained by escapeFileString(). * Unescape filename string obtained by escapeFileString().
* *
* @param filestring * @param filestring escaped string
* escaped string
* @return clean string * @return clean string
*/ */
public static String unescapeFileString(String filestring) public static String unescapeFileString(String filestring)
@ -474,8 +442,7 @@ public class FileUtils {
/** /**
* Escape filename, keeping the same extension * Escape filename, keeping the same extension
* *
* @param filename * @param filename filename
* filename
* @return escaped * @return escaped
*/ */
public static String escapeFilename(String filename) public static String escapeFilename(String filename)
@ -489,8 +456,7 @@ public class FileUtils {
/** /**
* Unescape filename, keeping the same extension * Unescape filename, keeping the same extension
* *
* @param filename * @param filename escaped filename
* escaped filename
* @return unesaped * @return unesaped
*/ */
public static String unescapeFilename(String filename) public static String unescapeFilename(String filename)
@ -516,10 +482,8 @@ public class FileUtils {
/** /**
* Copy resource to file * Copy resource to file
* *
* @param resname * @param resname resource name
* resource name * @param file out file
* @param file
* out file
* @throws IOException * @throws IOException
*/ */
public static void resourceToFile(String resname, File file) throws IOException public static void resourceToFile(String resname, File file) throws IOException
@ -552,8 +516,7 @@ public class FileUtils {
/** /**
* Get resource as string, safely closing streams. * Get resource as string, safely closing streams.
* *
* @param resname * @param resname resource name
* resource name
* @return resource as string, empty string on failure * @return resource as string, empty string on failure
*/ */
public static String resourceToString(String resname) public static String resourceToString(String resname)

@ -1,11 +1,13 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.File; import java.io.File;
public class OsUtils { public class OsUtils {
public static enum EnumOS { public static enum EnumOS
{
linux, macos, solaris, unknown, windows; linux, macos, solaris, unknown, windows;
public boolean isLinux() public boolean isLinux()

@ -1,5 +1,6 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -195,10 +196,8 @@ public class PropertyManager {
/** /**
* Set additional comment to a key * Set additional comment to a key
* *
* @param key * @param key key for comment
* key for comment * @param comment the comment
* @param comment
* the comment
*/ */
public void setKeyComment(String key, String comment) public void setKeyComment(String key, String comment)
{ {
@ -264,7 +263,6 @@ public class PropertyManager {
} }
} }
/** /**
* Helper class which loads Properties from UTF-8 file (Properties use * Helper class which loads Properties from UTF-8 file (Properties use
* "ISO-8859-1" by default) * "ISO-8859-1" by default)
@ -339,7 +337,6 @@ public class PropertyManager {
} }
} }
/** /**
* Property entry in Property manager. * Property entry in Property manager.
* *
@ -366,14 +363,10 @@ public class PropertyManager {
/** /**
* Property * Property
* *
* @param key * @param key key
* key * @param default_value default value
* @param default_value * @param entry_type type
* default value * @param entry_comment entry comment
* @param entry_type
* type
* @param entry_comment
* entry comment
*/ */
public Property(String key, boolean default_value, PropertyType entry_type, String entry_comment) { public Property(String key, boolean default_value, PropertyType entry_type, String entry_comment) {
name = key; name = key;
@ -386,14 +379,10 @@ public class PropertyManager {
/** /**
* Property entry * Property entry
* *
* @param key * @param key property key
* property key * @param default_value default value
* @param default_value * @param entry_type property type from enum
* default value * @param entry_comment property comment or null
* @param entry_type
* property type from enum
* @param entry_comment
* property comment or null
*/ */
public Property(String key, double default_value, PropertyType entry_type, String entry_comment) { public Property(String key, double default_value, PropertyType entry_type, String entry_comment) {
name = key; name = key;
@ -406,14 +395,10 @@ public class PropertyManager {
/** /**
* Property * Property
* *
* @param key * @param key key
* key * @param default_value default value
* @param default_value * @param entry_type type
* default value * @param entry_comment entry comment
* @param entry_type
* type
* @param entry_comment
* entry comment
*/ */
public Property(String key, String default_value, PropertyType entry_type, String entry_comment) { public Property(String key, String default_value, PropertyType entry_type, String entry_comment) {
name = key; name = key;
@ -491,8 +476,7 @@ public class PropertyManager {
/** /**
* Load property value from a file * Load property value from a file
* *
* @param string * @param string the string loaded
* the string loaded
* @return was OK * @return was OK
*/ */
public boolean parse(String string) public boolean parse(String string)
@ -597,11 +581,11 @@ public class PropertyManager {
} }
} }
/** /**
* Property types * Property types
*/ */
private enum PropertyType { private enum PropertyType
{
BOOLEAN, INT, STRING, DOUBLE; BOOLEAN, INT, STRING, DOUBLE;
} }
@ -626,10 +610,8 @@ public class PropertyManager {
/** /**
* Create property manager from file path and an initial comment. * Create property manager from file path and an initial comment.
* *
* @param file * @param file file with the props
* file with the props * @param comment the initial comment. Use \n in it if you want.
* @param comment
* the initial comment. Use \n in it if you want.
*/ */
public PropertyManager(File file, String comment) { public PropertyManager(File file, String comment) {
this.file = file; this.file = file;
@ -729,8 +711,7 @@ public class PropertyManager {
/** /**
* @param newlineBeforeComments * @param newlineBeforeComments put newline before comments
* put newline before comments
*/ */
public void cfgNewlineBeforeComments(boolean newlineBeforeComments) public void cfgNewlineBeforeComments(boolean newlineBeforeComments)
{ {
@ -739,8 +720,7 @@ public class PropertyManager {
/** /**
* @param separateSections * @param separateSections do separate sections by newline
* do separate sections by newline
*/ */
public void cfgSeparateSections(boolean separateSections) public void cfgSeparateSections(boolean separateSections)
{ {
@ -749,8 +729,7 @@ public class PropertyManager {
/** /**
* @param forceSave * @param forceSave save even if unchanged.
* save even if unchanged.
*/ */
public void cfgForceSave(boolean forceSave) public void cfgForceSave(boolean forceSave)
{ {
@ -759,8 +738,7 @@ public class PropertyManager {
/** /**
* @param validate * @param validate enable validation
* enable validation
*/ */
public void enableValidation(boolean validate) public void enableValidation(boolean validate)
{ {
@ -771,8 +749,7 @@ public class PropertyManager {
/** /**
* Get a property entry (rarely used) * Get a property entry (rarely used)
* *
* @param n * @param n key
* key
* @return the entry * @return the entry
*/ */
private Property get(String n) private Property get(String n)
@ -788,8 +765,7 @@ public class PropertyManager {
/** /**
* Get boolean property * Get boolean property
* *
* @param n * @param n key
* key
* @return the boolean found, or false * @return the boolean found, or false
*/ */
public Boolean getBoolean(String n) public Boolean getBoolean(String n)
@ -805,8 +781,7 @@ public class PropertyManager {
/** /**
* Get numeric property * Get numeric property
* *
* @param n * @param n key
* key
* @return the int found, or null * @return the int found, or null
*/ */
public Integer getInteger(String n) public Integer getInteger(String n)
@ -822,8 +797,7 @@ public class PropertyManager {
/** /**
* Get numeric property as double * Get numeric property as double
* *
* @param n * @param n key
* key
* @return the double found, or null * @return the double found, or null
*/ */
public Double getDouble(String n) public Double getDouble(String n)
@ -839,8 +813,7 @@ public class PropertyManager {
/** /**
* Get string property * Get string property
* *
* @param n * @param n key
* key
* @return the string found, or null * @return the string found, or null
*/ */
public String getString(String n) public String getString(String n)
@ -856,10 +829,8 @@ public class PropertyManager {
/** /**
* Add a boolean property * Add a boolean property
* *
* @param n * @param n key
* key * @param d default value
* @param d
* default value
*/ */
public void putBoolean(String n, boolean d) public void putBoolean(String n, boolean d)
{ {
@ -871,12 +842,9 @@ public class PropertyManager {
/** /**
* Add a boolean property * Add a boolean property
* *
* @param n * @param n key
* key * @param d default value
* @param d * @param comment the in-file comment
* default value
* @param comment
* the in-file comment
*/ */
public void putBoolean(String n, boolean d, String comment) public void putBoolean(String n, boolean d, String comment)
{ {
@ -888,10 +856,8 @@ public class PropertyManager {
/** /**
* Add a numeric property (double) * Add a numeric property (double)
* *
* @param n * @param n key
* key * @param d default value
* @param d
* default value
*/ */
public void putDouble(String n, int d) public void putDouble(String n, int d)
{ {
@ -903,12 +869,9 @@ public class PropertyManager {
/** /**
* Add a numeric property (double) * Add a numeric property (double)
* *
* @param n * @param n key
* key * @param d default value
* @param d * @param comment the in-file comment
* default value
* @param comment
* the in-file comment
*/ */
public void putDouble(String n, int d, String comment) public void putDouble(String n, int d, String comment)
{ {
@ -920,10 +883,8 @@ public class PropertyManager {
/** /**
* Add a numeric property * Add a numeric property
* *
* @param n * @param n key
* key * @param d default value
* @param d
* default value
*/ */
public void putInteger(String n, int d) public void putInteger(String n, int d)
{ {
@ -935,12 +896,9 @@ public class PropertyManager {
/** /**
* Add a numeric property * Add a numeric property
* *
* @param n * @param n key
* key * @param d default value
* @param d * @param comment the in-file comment
* default value
* @param comment
* the in-file comment
*/ */
public void putInteger(String n, int d, String comment) public void putInteger(String n, int d, String comment)
{ {
@ -952,10 +910,8 @@ public class PropertyManager {
/** /**
* Add a string property * Add a string property
* *
* @param n * @param n key
* key * @param d default value
* @param d
* default value
*/ */
public void putString(String n, String d) public void putString(String n, String d)
{ {
@ -967,12 +923,9 @@ public class PropertyManager {
/** /**
* Add a string property * Add a string property
* *
* @param n * @param n key
* key * @param d default value
* @param d * @param comment the in-file comment
* default value
* @param comment
* the in-file comment
*/ */
public void putString(String n, String d, String comment) public void putString(String n, String d, String comment)
{ {
@ -984,10 +937,8 @@ public class PropertyManager {
/** /**
* Rename key before doing "apply"; value is preserved * Rename key before doing "apply"; value is preserved
* *
* @param oldKey * @param oldKey old key
* old key * @param newKey new key
* @param newKey
* new key
*/ */
public void renameKey(String oldKey, String newKey) public void renameKey(String oldKey, String newKey)
{ {
@ -1000,10 +951,8 @@ public class PropertyManager {
* Set value saved to certain key; use to save runtime-changed configuration * Set value saved to certain key; use to save runtime-changed configuration
* values. * values.
* *
* @param key * @param key key
* key * @param value the saved value
* @param value
* the saved value
*/ */
public void setValue(String key, Object value) public void setValue(String key, Object value)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -25,8 +26,7 @@ public class SimpleConfig {
/** /**
* Load list from file * Load list from file
* *
* @param file * @param file file
* file
* @return map of keys and values * @return map of keys and values
* @throws IOException * @throws IOException
*/ */
@ -41,8 +41,7 @@ public class SimpleConfig {
/** /**
* Load map from file * Load map from file
* *
* @param file * @param file file
* file
* @return map of keys and values * @return map of keys and values
* @throws IOException * @throws IOException
*/ */
@ -57,8 +56,7 @@ public class SimpleConfig {
/** /**
* Load list from string * Load list from string
* *
* @param text * @param text text of the file
* text of the file
* @return map of keys and values * @return map of keys and values
*/ */
public static List<String> listFromString(String text) public static List<String> listFromString(String text)
@ -88,8 +86,7 @@ public class SimpleConfig {
/** /**
* Load map from string * Load map from string
* *
* @param text * @param text text of the file
* text of the file
* @return map of keys and values * @return map of keys and values
*/ */
public static Map<String, String> mapFromString(String text) public static Map<String, String> mapFromString(String text)
@ -145,8 +142,7 @@ public class SimpleConfig {
* *
* @param target * @param target
* @param data * @param data
* @param allowNulls * @param allowNulls allow nulls.
* allow nulls.
* @throws IOException * @throws IOException
*/ */
public static void mapToFile(File target, Map<String, String> data, boolean allowNulls) throws IOException public static void mapToFile(File target, Map<String, String> data, boolean allowNulls) throws IOException

@ -1,5 +1,6 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.*; import java.io.*;
import java.util.HashSet; import java.util.HashSet;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
@ -20,10 +21,9 @@ public class ZipBuilder {
/** /**
* @param target * @param target target zip file
* target zip file * @throws FileNotFoundException if the file is directory or cannot be
* @throws FileNotFoundException * created
* if the file is directory or cannot be created
*/ */
public ZipBuilder(File target) throws FileNotFoundException { public ZipBuilder(File target) throws FileNotFoundException {
target.getParentFile().mkdirs(); target.getParentFile().mkdirs();
@ -36,10 +36,8 @@ public class ZipBuilder {
/** /**
* Add stream to a path * Add stream to a path
* *
* @param path * @param path path
* path * @param in stream
* @param in
* stream
* @throws IOException * @throws IOException
*/ */
public void addStream(String path, InputStream in) throws IOException public void addStream(String path, InputStream in) throws IOException
@ -60,10 +58,8 @@ public class ZipBuilder {
/** /**
* Add string as a file * Add string as a file
* *
* @param path * @param path path
* path * @param text text to write
* @param text
* text to write
* @throws IOException * @throws IOException
*/ */
public void addString(String path, String text) throws IOException public void addString(String path, String text) throws IOException
@ -82,10 +78,8 @@ public class ZipBuilder {
/** /**
* Add resource obtained via FileUtils.getResource() * Add resource obtained via FileUtils.getResource()
* *
* @param path * @param path path
* path * @param resPath resource path
* @param resPath
* resource path
* @throws IOException * @throws IOException
*/ */
public void addResource(String path, String resPath) throws IOException public void addResource(String path, String resPath) throws IOException
@ -104,8 +98,7 @@ public class ZipBuilder {
/** /**
* Normalize path * Normalize path
* *
* @param path * @param path original path
* original path
* @return normalized path * @return normalized path
*/ */
private String preparePath(String path) private String preparePath(String path)

@ -1,5 +1,6 @@
package mightypork.utils.files; package mightypork.utils.files;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.File; import java.io.File;
@ -27,12 +28,9 @@ public class ZipUtils {
/** /**
* Extract zip file to target directory * Extract zip file to target directory
* *
* @param file * @param file zip file
* zip file * @param outputDir target directory
* @param outputDir * @param filter string filter (will be used to test entry names (paths))
* target directory
* @param filter
* string filter (will be used to test entry names (paths))
* @return list of entries extracted (paths) * @return list of entries extracted (paths)
* @throws IOException * @throws IOException
*/ */
@ -57,12 +55,9 @@ public class ZipUtils {
/** /**
* Extract zip file to target directory * Extract zip file to target directory
* *
* @param zip * @param zip open zip file
* open zip file * @param outputDir target directory
* @param outputDir * @param filter string filter (will be used to test entry names (paths))
* target directory
* @param filter
* string filter (will be used to test entry names (paths))
* @return list of entries extracted (paths) * @return list of entries extracted (paths)
* @throws IOException * @throws IOException
*/ */
@ -101,11 +96,9 @@ public class ZipUtils {
/** /**
* Read zip entries and add their paths to a list * Read zip entries and add their paths to a list
* *
* @param zipFile * @param zipFile open zip file
* open zip file
* @return list of entry names * @return list of entry names
* @throws IOException * @throws IOException on error
* on error
*/ */
public static List<String> listZip(File zipFile) throws IOException public static List<String> listZip(File zipFile) throws IOException
{ {
@ -126,11 +119,9 @@ public class ZipUtils {
/** /**
* Read zip entries and add their paths to a list * Read zip entries and add their paths to a list
* *
* @param zip * @param zip open zip file
* open zip file
* @return list of entry names * @return list of entry names
* @throws IOException * @throws IOException on error
* on error
*/ */
public static List<String> listZip(ZipFile zip) throws IOException public static List<String> listZip(ZipFile zip) throws IOException
{ {
@ -154,14 +145,10 @@ public class ZipUtils {
/** /**
* Extract one zip entry to target file * Extract one zip entry to target file
* *
* @param zip * @param zip open zip file
* open zip file * @param entry entry from the zip file
* @param entry * @param destFile destination file ((NOT directory!)
* entry from the zip file * @throws IOException on error
* @param destFile
* destination file ((NOT directory!)
* @throws IOException
* on error
*/ */
public static void extractZipEntry(ZipFile zip, ZipEntry entry, File destFile) throws IOException public static void extractZipEntry(ZipFile zip, ZipEntry entry, File destFile) throws IOException
{ {
@ -197,13 +184,10 @@ public class ZipUtils {
/** /**
* Load zip entry to String * Load zip entry to String
* *
* @param zip * @param zip open zip file
* open zip file * @param entry entry from the zip file
* @param entry
* entry from the zip file
* @return loaded string * @return loaded string
* @throws IOException * @throws IOException on error
* on error
*/ */
public static String zipEntryToString(ZipFile zip, ZipEntry entry) throws IOException public static String zipEntryToString(ZipFile zip, ZipEntry entry) throws IOException
{ {

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -58,8 +59,7 @@ public abstract class AbstractIonList<T> extends ArrayList<T> implements Ionizab
/** /**
* Read custom data of this AbstractIonList implementation * Read custom data of this AbstractIonList implementation
* *
* @param in * @param in input stream
* input stream
*/ */
public void ionReadCustomData(InputStream in) public void ionReadCustomData(InputStream in)
{ {
@ -69,8 +69,7 @@ public abstract class AbstractIonList<T> extends ArrayList<T> implements Ionizab
/** /**
* Write custom data of this AbstractIonList implementation * Write custom data of this AbstractIonList implementation
* *
* @param out * @param out output stream
* output stream
*/ */
public void ionWriteCustomData(OutputStream out) public void ionWriteCustomData(OutputStream out)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -74,8 +75,7 @@ public abstract class AbstractIonMap<V> extends LinkedHashMap<String, V> impleme
/** /**
* Read custom data of this AbstractIonMap implementation * Read custom data of this AbstractIonMap implementation
* *
* @param in * @param in input stream
* input stream
*/ */
public void ionReadCustomData(InputStream in) public void ionReadCustomData(InputStream in)
{ {
@ -85,8 +85,7 @@ public abstract class AbstractIonMap<V> extends LinkedHashMap<String, V> impleme
/** /**
* Write custom data of this AbstractIonMap implementation * Write custom data of this AbstractIonMap implementation
* *
* @param out * @param out output stream
* output stream
*/ */
public void ionWriteCustomData(OutputStream out) public void ionWriteCustomData(OutputStream out)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
import java.io.*; import java.io.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -31,10 +32,8 @@ public class Ion {
/** /**
* Register new Ionizable for direct reconstructing. * Register new Ionizable for direct reconstructing.
* *
* @param mark * @param mark byte mark to be used, see {@link IonMarks} for reference.
* byte mark to be used, see {@link IonMarks} for reference. * @param objClass class of the registered Ionizable
* @param objClass
* class of the registered Ionizable
* @throws IonException * @throws IonException
*/ */
public static void registerIonizable(byte mark, Class<?> objClass) throws IonException public static void registerIonizable(byte mark, Class<?> objClass) throws IonException
@ -49,8 +48,7 @@ public class Ion {
/** /**
* Load Ion object from file. * Load Ion object from file.
* *
* @param file * @param file file path
* file path
* @return the loaded object * @return the loaded object
* @throws IonException * @throws IonException
*/ */
@ -63,11 +61,9 @@ public class Ion {
/** /**
* Load Ion object from file. * Load Ion object from file.
* *
* @param file * @param file file
* file
* @return the loaded object * @return the loaded object
* @throws IonException * @throws IonException on failure
* on failure
*/ */
public static Object fromFile(File file) throws IonException public static Object fromFile(File file) throws IonException
{ {
@ -94,8 +90,7 @@ public class Ion {
/** /**
* Load Ion object from stream. * Load Ion object from stream.
* *
* @param in * @param in input stream
* input stream
* @return the loaded object * @return the loaded object
* @throws IonException * @throws IonException
*/ */
@ -108,10 +103,8 @@ public class Ion {
/** /**
* Store Ion object to file. * Store Ion object to file.
* *
* @param path * @param path file path
* file path * @param obj object to store
* @param obj
* object to store
* @throws IonException * @throws IonException
*/ */
public static void toFile(String path, Object obj) throws IonException public static void toFile(String path, Object obj) throws IonException
@ -123,10 +116,8 @@ public class Ion {
/** /**
* Store Ion object to file. * Store Ion object to file.
* *
* @param path * @param path file path
* file path * @param obj object to store
* @param obj
* object to store
* @throws IonException * @throws IonException
*/ */
public static void toFile(File path, Object obj) throws IonException public static void toFile(File path, Object obj) throws IonException
@ -162,10 +153,8 @@ public class Ion {
/** /**
* Store Ion object to output stream. * Store Ion object to output stream.
* *
* @param out * @param out output stream *
* output stream * * @param obj object to store
* @param obj
* object to store
* @throws IonException * @throws IonException
*/ */
public static void toStream(OutputStream out, Object obj) throws IonException public static void toStream(OutputStream out, Object obj) throws IonException
@ -177,8 +166,7 @@ public class Ion {
/** /**
* Read single ionizable or primitive object from input stream * Read single ionizable or primitive object from input stream
* *
* @param in * @param in input stream
* input stream
* @return the loaded object * @return the loaded object
* @throws IonException * @throws IonException
*/ */
@ -233,10 +221,8 @@ public class Ion {
/** /**
* Write single ionizable or primitive object to output stream * Write single ionizable or primitive object to output stream
* *
* @param out * @param out output stream
* output stream * @param obj stored object
* @param obj
* stored object
* @throws IonException * @throws IonException
*/ */
public static void writeObject(OutputStream out, Object obj) throws IonException public static void writeObject(OutputStream out, Object obj) throws IonException

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
public class IonException extends Exception { public class IonException extends Exception {
public IonException() { public IonException() {

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
/** /**
* Ionizable Arraylist * Ionizable Arraylist
* *

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
/** /**
* Ionizable HashMap * Ionizable HashMap
* *

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
/** /**
* Byte marks used to structure data in Ion files. * Byte marks used to structure data in Ion files.
* *

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -17,8 +18,7 @@ public interface Ionizable {
* Load data from the input stream. Mark has already been read, begin * Load data from the input stream. Mark has already been read, begin
* reading right after it. * reading right after it.
* *
* @param in * @param in input stream
* input stream
* @throws IonException * @throws IonException
*/ */
public void ionRead(InputStream in) throws IonException; public void ionRead(InputStream in) throws IonException;
@ -28,8 +28,7 @@ public interface Ionizable {
* Store data to output stream. mark has already been written, begin right * Store data to output stream. mark has already been written, begin right
* after it. * after it.
* *
* @param out * @param out Output stream
* Output stream
* @throws IonException * @throws IonException
*/ */
public void ionWrite(OutputStream out) throws IonException; public void ionWrite(OutputStream out) throws IonException;

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
/** /**
* Optional ionizable * Optional ionizable
* *

@ -1,5 +1,6 @@
package mightypork.utils.files.ion; package mightypork.utils.files.ion;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;

@ -1,5 +1,6 @@
package mightypork.utils.logging; package mightypork.utils.logging;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
@ -13,8 +14,7 @@ public class Log {
/** /**
* Log FINE message in main logger * Log FINE message in main logger
* *
* @param msg * @param msg message
* message
*/ */
public static void f1(String msg) public static void f1(String msg)
{ {
@ -25,8 +25,7 @@ public class Log {
/** /**
* Log FINER message in main logger * Log FINER message in main logger
* *
* @param msg * @param msg message
* message
*/ */
public static void f2(String msg) public static void f2(String msg)
{ {
@ -37,8 +36,7 @@ public class Log {
/** /**
* Log FINEST message in main logger * Log FINEST message in main logger
* *
* @param msg * @param msg message
* message
*/ */
public static void f3(String msg) public static void f3(String msg)
{ {
@ -49,8 +47,7 @@ public class Log {
/** /**
* Log INFO message in main logger * Log INFO message in main logger
* *
* @param msg * @param msg message
* message
*/ */
public static void i(String msg) public static void i(String msg)
{ {
@ -61,8 +58,7 @@ public class Log {
/** /**
* Log WARNING message in main logger * Log WARNING message in main logger
* *
* @param msg * @param msg message
* message
*/ */
public static void w(String msg) public static void w(String msg)
{ {
@ -73,8 +69,7 @@ public class Log {
/** /**
* Log ERROR message in main logger * Log ERROR message in main logger
* *
* @param msg * @param msg message
* message
*/ */
public static void e(String msg) public static void e(String msg)
{ {
@ -85,10 +80,8 @@ public class Log {
/** /**
* Log EXCEPTION and ERROR message in main logger * Log EXCEPTION and ERROR message in main logger
* *
* @param msg * @param msg message
* message * @param thrown thrown exception
* @param thrown
* thrown exception
*/ */
public static void e(String msg, Throwable thrown) public static void e(String msg, Throwable thrown)
{ {
@ -99,8 +92,7 @@ public class Log {
/** /**
* Log EXCEPTION in main logger * Log EXCEPTION in main logger
* *
* @param thrown * @param thrown thrown exception
* thrown exception
*/ */
public static void e(Throwable thrown) public static void e(Throwable thrown)
{ {
@ -117,8 +109,7 @@ public class Log {
/** /**
* Enable / disable static log delegate methods * Enable / disable static log delegate methods
* *
* @param flag * @param flag enable
* enable
*/ */
public static void enableStaticLogging(boolean flag) public static void enableStaticLogging(boolean flag)
{ {
@ -133,12 +124,10 @@ public class Log {
* Create a logger. If this is the first logger made, then it'll be made * Create a logger. If this is the first logger made, then it'll be made
* available via the static methods. * available via the static methods.
* *
* @param logName * @param logName log name (used for filename, must be application-unique)
* log name (used for filename, must be application-unique) * @param logsDir directory to store logs in
* @param logsDir * @param oldLogsCount number of old logs to keep, -1 for infinite, 0 for
* directory to store logs in * none.
* @param oldLogsCount
* number of old logs to keep, -1 for infinite, 0 for none.
* @return the created Log instance * @return the created Log instance
*/ */
public static synchronized LogInstance create(String logName, File logsDir, int oldLogsCount) public static synchronized LogInstance create(String logName, File logsDir, int oldLogsCount)
@ -157,10 +146,8 @@ public class Log {
* available via the static methods.<br> * available via the static methods.<br>
* Old logs will be kept. * Old logs will be kept.
* *
* @param logName * @param logName log name (used for filename, must be application-unique)
* log name (used for filename, must be application-unique) * @param logsDir directory to store logs in
* @param logsDir
* directory to store logs in
* @return the created Log instance * @return the created Log instance
*/ */
public static synchronized LogInstance create(String logName, File logsDir) public static synchronized LogInstance create(String logName, File logsDir)

@ -1,5 +1,6 @@
package mightypork.utils.logging; package mightypork.utils.logging;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -150,8 +151,7 @@ public class LogInstance {
/** /**
* Add log monitor * Add log monitor
* *
* @param mon * @param mon monitor
* monitor
* @return assigned ID * @return assigned ID
*/ */
public synchronized int addMonitor(LogMonitor mon) public synchronized int addMonitor(LogMonitor mon)
@ -166,8 +166,7 @@ public class LogInstance {
/** /**
* Remove a monitor by ID * Remove a monitor by ID
* *
* @param id * @param id monitor ID
* monitor ID
*/ */
public synchronized void removeMonitor(int id) public synchronized void removeMonitor(int id)
{ {
@ -178,8 +177,7 @@ public class LogInstance {
/** /**
* Enable logging. * Enable logging.
* *
* @param flag * @param flag do enable logging
* do enable logging
*/ */
public void enable(boolean flag) public void enable(boolean flag)
{ {
@ -190,8 +188,7 @@ public class LogInstance {
/** /**
* Enable printing logs to sysout * Enable printing logs to sysout
* *
* @param flag * @param flag do enable logging
* do enable logging
*/ */
public void enableSysout(boolean flag) public void enableSysout(boolean flag)
{ {
@ -203,8 +200,7 @@ public class LogInstance {
/** /**
* Log FINE message * Log FINE message
* *
* @param msg * @param msg message
* message
*/ */
public void f1(String msg) public void f1(String msg)
{ {
@ -215,8 +211,7 @@ public class LogInstance {
/** /**
* Log FINER message * Log FINER message
* *
* @param msg * @param msg message
* message
*/ */
public void f2(String msg) public void f2(String msg)
{ {
@ -227,8 +222,7 @@ public class LogInstance {
/** /**
* Log FINEST message * Log FINEST message
* *
* @param msg * @param msg message
* message
*/ */
public void f3(String msg) public void f3(String msg)
{ {
@ -239,8 +233,7 @@ public class LogInstance {
/** /**
* Log INFO message * Log INFO message
* *
* @param msg * @param msg message
* message
*/ */
public void i(String msg) public void i(String msg)
{ {
@ -251,8 +244,7 @@ public class LogInstance {
/** /**
* Log WARNING message (less severe than ERROR) * Log WARNING message (less severe than ERROR)
* *
* @param msg * @param msg message
* message
*/ */
public void w(String msg) public void w(String msg)
{ {
@ -263,8 +255,7 @@ public class LogInstance {
/** /**
* Log ERROR message * Log ERROR message
* *
* @param msg * @param msg message
* message
*/ */
public void e(String msg) public void e(String msg)
{ {
@ -275,10 +266,8 @@ public class LogInstance {
/** /**
* Log THROWING message * Log THROWING message
* *
* @param msg * @param msg message
* message * @param thrown thrown exception
* @param thrown
* thrown exception
*/ */
public void e(String msg, Throwable thrown) public void e(String msg, Throwable thrown)
{ {
@ -289,8 +278,7 @@ public class LogInstance {
/** /**
* Log exception thrown * Log exception thrown
* *
* @param thrown * @param thrown thrown exception
* thrown exception
*/ */
public void e(Throwable thrown) public void e(Throwable thrown)
{ {
@ -314,7 +302,6 @@ public class LogInstance {
return sw.toString(); return sw.toString();
} }
/** /**
* PowerCraft Log file formatter. * PowerCraft Log file formatter.
* *

@ -1,5 +1,6 @@
package mightypork.utils.logging; package mightypork.utils.logging;
import java.util.logging.Level; import java.util.logging.Level;

@ -1,5 +1,6 @@
package mightypork.utils.logging; package mightypork.utils.logging;
import java.util.logging.Level; import java.util.logging.Level;

@ -1,5 +1,6 @@
package mightypork.utils.math; package mightypork.utils.math;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,12 +26,9 @@ public class Calc {
/** /**
* Get distance from 2D line to 2D point [X,Y] * Get distance from 2D line to 2D point [X,Y]
* *
* @param lineDirVec * @param lineDirVec line directional vector
* line directional vector * @param linePoint point of line
* @param linePoint * @param point point coordinate
* point of line
* @param point
* point coordinate
* @return distance * @return distance
*/ */
public static double linePointDist(Coord lineDirVec, Coord linePoint, Coord point) public static double linePointDist(Coord lineDirVec, Coord linePoint, Coord point)
@ -56,12 +54,9 @@ public class Calc {
/** /**
* Get distance from 2D line to 2D point [X,Z] * Get distance from 2D line to 2D point [X,Z]
* *
* @param lineDirVec * @param lineDirVec line directional vector
* line directional vector * @param linePoint point of line
* @param linePoint * @param point point coordinate
* point of line
* @param point
* point coordinate
* @return distance * @return distance
*/ */
public static double linePointDistXZ(Coord lineDirVec, Coord linePoint, Coord point) public static double linePointDistXZ(Coord lineDirVec, Coord linePoint, Coord point)
@ -73,10 +68,8 @@ public class Calc {
/** /**
* Get longest side of a right-angled triangle * Get longest side of a right-angled triangle
* *
* @param a * @param a side a (opposite)
* side a (opposite) * @param b side b (adjacent)
* @param b
* side b (adjacent)
* @return longest side (hypotenuse) * @return longest side (hypotenuse)
*/ */
public static double pythC(double a, double b) public static double pythC(double a, double b)
@ -88,10 +81,8 @@ public class Calc {
/** /**
* Get adjacent side of a right-angled triangle * Get adjacent side of a right-angled triangle
* *
* @param a * @param a side a (opposite)
* side a (opposite) * @param c side c (hypotenuse)
* @param c
* side c (hypotenuse)
* @return side b (adjacent) * @return side b (adjacent)
*/ */
public static double pythB(double a, double c) public static double pythB(double a, double c)
@ -103,10 +94,8 @@ public class Calc {
/** /**
* Get opposite side of a right-angled triangle * Get opposite side of a right-angled triangle
* *
* @param b * @param b side b (adjacent)
* side b (adjacent) * @param c side c (hypotenuse)
* @param c
* side c (hypotenuse)
* @return side a (opposite) * @return side a (opposite)
*/ */
public static double pythA(double b, double c) public static double pythA(double b, double c)
@ -114,7 +103,6 @@ public class Calc {
return Math.sqrt(square(c) - square(b)); return Math.sqrt(square(c) - square(b));
} }
private static class Angles { private static class Angles {
public static double delta(double alpha, double beta, double a360) public static double delta(double alpha, double beta, double a360)
@ -138,7 +126,6 @@ public class Calc {
} }
} }
/** /**
* Calc subclass with buffer utils. * Calc subclass with buffer utils.
* *
@ -149,8 +136,7 @@ public class Calc {
/** /**
* Create java.nio.FloatBuffer of given floats, and flip it. * Create java.nio.FloatBuffer of given floats, and flip it.
* *
* @param obj * @param obj floats or float array
* floats or float array
* @return float buffer * @return float buffer
*/ */
public static FloatBuffer mkFillBuff(float... obj) public static FloatBuffer mkFillBuff(float... obj)
@ -175,8 +161,7 @@ public class Calc {
/** /**
* Create new java.nio.FloatBuffer of given length * Create new java.nio.FloatBuffer of given length
* *
* @param count * @param count elements
* elements
* @return the new java.nio.FloatBuffer * @return the new java.nio.FloatBuffer
*/ */
public static FloatBuffer alloc(int count) public static FloatBuffer alloc(int count)
@ -186,7 +171,6 @@ public class Calc {
} }
/** /**
* Angle calculations for degrees. * Angle calculations for degrees.
* *
@ -209,10 +193,8 @@ public class Calc {
/** /**
* Subtract two angles alpha - beta * Subtract two angles alpha - beta
* *
* @param alpha * @param alpha first angle
* first angle * @param beta second angle
* @param beta
* second angle
* @return (alpha - beta) in degrees * @return (alpha - beta) in degrees
*/ */
public static double delta(double alpha, double beta) public static double delta(double alpha, double beta)
@ -224,10 +206,8 @@ public class Calc {
/** /**
* Difference of two angles (absolute value of delta) * Difference of two angles (absolute value of delta)
* *
* @param alpha * @param alpha first angle
* first angle * @param beta second angle
* @param beta
* second angle
* @return difference in radians * @return difference in radians
*/ */
public static double diff(double alpha, double beta) public static double diff(double alpha, double beta)
@ -239,8 +219,7 @@ public class Calc {
/** /**
* Cosinus in degrees * Cosinus in degrees
* *
* @param deg * @param deg angle in degrees
* angle in degrees
* @return cosinus * @return cosinus
*/ */
public static double cos(double deg) public static double cos(double deg)
@ -252,8 +231,7 @@ public class Calc {
/** /**
* Sinus in degrees * Sinus in degrees
* *
* @param deg * @param deg angle in degrees
* angle in degrees
* @return sinus * @return sinus
*/ */
public static double sin(double deg) public static double sin(double deg)
@ -265,8 +243,7 @@ public class Calc {
/** /**
* Tangents in degrees * Tangents in degrees
* *
* @param deg * @param deg angle in degrees
* angle in degrees
* @return tangents * @return tangents
*/ */
public static double tan(double deg) public static double tan(double deg)
@ -278,8 +255,7 @@ public class Calc {
/** /**
* Angle normalized to 0-360 range * Angle normalized to 0-360 range
* *
* @param angle * @param angle angle to normalize
* angle to normalize
* @return normalized angle * @return normalized angle
*/ */
public static double norm(double angle) public static double norm(double angle)
@ -291,8 +267,7 @@ public class Calc {
/** /**
* Convert to radians * Convert to radians
* *
* @param deg * @param deg degrees
* degrees
* @return radians * @return radians
*/ */
public static double toRad(double deg) public static double toRad(double deg)
@ -304,10 +279,8 @@ public class Calc {
/** /**
* Round angle to 0,45,90,135... * Round angle to 0,45,90,135...
* *
* @param deg * @param deg angle in deg. to round
* angle in deg. to round * @param x rounding increment (45 - round to 0,45,90...)
* @param x
* rounding increment (45 - round to 0,45,90...)
* @return rounded * @return rounded
*/ */
public static int roundX(double deg, double x) public static int roundX(double deg, double x)
@ -325,8 +298,7 @@ public class Calc {
/** /**
* Round angle to 0,45,90,135... * Round angle to 0,45,90,135...
* *
* @param deg * @param deg angle in deg. to round
* angle in deg. to round
* @return rounded * @return rounded
*/ */
public static int round45(double deg) public static int round45(double deg)
@ -338,8 +310,7 @@ public class Calc {
/** /**
* Round angle to 0,90,180,270 * Round angle to 0,90,180,270
* *
* @param deg * @param deg angle in deg. to round
* angle in deg. to round
* @return rounded * @return rounded
*/ */
public static int round90(double deg) public static int round90(double deg)
@ -351,8 +322,7 @@ public class Calc {
/** /**
* Round angle to 0,15,30,45,60,75,90... * Round angle to 0,15,30,45,60,75,90...
* *
* @param deg * @param deg angle in deg to round
* angle in deg to round
* @return rounded * @return rounded
*/ */
public static int round15(double deg) public static int round15(double deg)
@ -361,7 +331,6 @@ public class Calc {
} }
} }
/** /**
* Angle calculations for radians. * Angle calculations for radians.
* *
@ -384,10 +353,8 @@ public class Calc {
/** /**
* Subtract two angles alpha - beta * Subtract two angles alpha - beta
* *
* @param alpha * @param alpha first angle
* first angle * @param beta second angle
* @param beta
* second angle
* @return (alpha - beta) in radians * @return (alpha - beta) in radians
*/ */
public static double delta(double alpha, double beta) public static double delta(double alpha, double beta)
@ -399,10 +366,8 @@ public class Calc {
/** /**
* Difference of two angles (absolute value of delta) * Difference of two angles (absolute value of delta)
* *
* @param alpha * @param alpha first angle
* first angle * @param beta second angle
* @param beta
* second angle
* @return difference in radians * @return difference in radians
*/ */
public static double diff(double alpha, double beta) public static double diff(double alpha, double beta)
@ -414,8 +379,7 @@ public class Calc {
/** /**
* Cos * Cos
* *
* @param rad * @param rad angle in rads
* angle in rads
* @return cos * @return cos
*/ */
public static double cos(double rad) public static double cos(double rad)
@ -427,8 +391,7 @@ public class Calc {
/** /**
* Sin * Sin
* *
* @param rad * @param rad angle in rads
* angle in rads
* @return sin * @return sin
*/ */
public static double sin(double rad) public static double sin(double rad)
@ -440,8 +403,7 @@ public class Calc {
/** /**
* Tan * Tan
* *
* @param rad * @param rad angle in rads
* angle in rads
* @return tan * @return tan
*/ */
public static double tan(double rad) public static double tan(double rad)
@ -453,8 +415,7 @@ public class Calc {
/** /**
* Angle normalized to 0-2*PI range * Angle normalized to 0-2*PI range
* *
* @param angle * @param angle angle to normalize
* angle to normalize
* @return normalized angle * @return normalized angle
*/ */
public static double norm(double angle) public static double norm(double angle)
@ -466,8 +427,7 @@ public class Calc {
/** /**
* Convert to degrees * Convert to degrees
* *
* @param rad * @param rad radians
* radians
* @return degrees * @return degrees
*/ */
public static double toDeg(double rad) public static double toDeg(double rad)
@ -482,8 +442,7 @@ public class Calc {
/** /**
* Get volume of a sphere * Get volume of a sphere
* *
* @param radius * @param radius sphere radius
* sphere radius
* @return volume in cubic units * @return volume in cubic units
*/ */
public static double sphereGetVolume(double radius) public static double sphereGetVolume(double radius)
@ -495,8 +454,7 @@ public class Calc {
/** /**
* Get radius of a sphere * Get radius of a sphere
* *
* @param volume * @param volume sphere volume
* sphere volume
* @return radius in units * @return radius in units
*/ */
public static double sphereGetRadius(double volume) public static double sphereGetRadius(double volume)
@ -508,8 +466,7 @@ public class Calc {
/** /**
* Get surface of a circle * Get surface of a circle
* *
* @param radius * @param radius circle radius
* circle radius
* @return volume in square units * @return volume in square units
*/ */
public static double circleGetSurface(double radius) public static double circleGetSurface(double radius)
@ -521,8 +478,7 @@ public class Calc {
/** /**
* Get radius of a circle * Get radius of a circle
* *
* @param surface * @param surface circle volume
* circle volume
* @return radius in units * @return radius in units
*/ */
public static double circleGetRadius(double surface) public static double circleGetRadius(double surface)
@ -547,12 +503,9 @@ public class Calc {
/** /**
* Private clamping helper. * Private clamping helper.
* *
* @param number * @param number number to be clamped
* number to be clamped * @param min min value
* @param min * @param max max value
* min value
* @param max
* max value
* @return clamped double * @return clamped double
*/ */
private static double clamp_double(Number number, Number min, Number max) private static double clamp_double(Number number, Number min, Number max)
@ -570,10 +523,8 @@ public class Calc {
/** /**
* Private clamping helper. * Private clamping helper.
* *
* @param number * @param number number to be clamped
* number to be clamped * @param min min value
* @param min
* min value
* @return clamped double * @return clamped double
*/ */
private static double clamp_double(Number number, Number min) private static double clamp_double(Number number, Number min)
@ -589,12 +540,9 @@ public class Calc {
* Clamp number to min and max bounds, inclusive.<br> * Clamp number to min and max bounds, inclusive.<br>
* DOUBLE version * DOUBLE version
* *
* @param number * @param number clamped number
* clamped number * @param min minimal allowed value
* @param min * @param max maximal allowed value
* minimal allowed value
* @param max
* maximal allowed value
* @return result * @return result
*/ */
public static double clampd(Number number, Number min, Number max) public static double clampd(Number number, Number min, Number max)
@ -607,12 +555,9 @@ public class Calc {
* Clamp number to min and max bounds, inclusive.<br> * Clamp number to min and max bounds, inclusive.<br>
* FLOAT version * FLOAT version
* *
* @param number * @param number clamped number
* clamped number * @param min minimal allowed value
* @param min * @param max maximal allowed value
* minimal allowed value
* @param max
* maximal allowed value
* @return result * @return result
*/ */
public static float clampf(Number number, Number min, Number max) public static float clampf(Number number, Number min, Number max)
@ -625,12 +570,9 @@ public class Calc {
* Clamp number to min and max bounds, inclusive.<br> * Clamp number to min and max bounds, inclusive.<br>
* INTEGER version * INTEGER version
* *
* @param number * @param number clamped number
* clamped number * @param min minimal allowed value
* @param min * @param max maximal allowed value
* minimal allowed value
* @param max
* maximal allowed value
* @return result * @return result
*/ */
public static int clampi(Number number, Number min, Number max) public static int clampi(Number number, Number min, Number max)
@ -643,10 +585,8 @@ public class Calc {
* Clamp number to min and max bounds, inclusive.<br> * Clamp number to min and max bounds, inclusive.<br>
* INTEGER version * INTEGER version
* *
* @param number * @param number clamped number
* clamped number * @param range range
* @param range
* range
* @return result * @return result
*/ */
public static int clampi(Number number, Range range) public static int clampi(Number number, Range range)
@ -659,10 +599,8 @@ public class Calc {
* Clamp number to min and max bounds, inclusive.<br> * Clamp number to min and max bounds, inclusive.<br>
* DOUBLE version * DOUBLE version
* *
* @param number * @param number clamped number
* clamped number * @param range range
* @param range
* range
* @return result * @return result
*/ */
public static double clampd(Number number, Range range) public static double clampd(Number number, Range range)
@ -675,10 +613,8 @@ public class Calc {
* Clamp number to min and max bounds, inclusive.<br> * Clamp number to min and max bounds, inclusive.<br>
* FLOAT version * FLOAT version
* *
* @param number * @param number clamped number
* clamped number * @param range range
* @param range
* range
* @return result * @return result
*/ */
public static float clampf(Number number, Range range) public static float clampf(Number number, Range range)
@ -691,10 +627,8 @@ public class Calc {
* Clamp number to min and infinite bounds, inclusive.<br> * Clamp number to min and infinite bounds, inclusive.<br>
* DOUBLE version * DOUBLE version
* *
* @param number * @param number clamped number
* clamped number * @param min minimal allowed value
* @param min
* minimal allowed value
* @return result * @return result
*/ */
public static double clampd(Number number, Number min) public static double clampd(Number number, Number min)
@ -707,10 +641,8 @@ public class Calc {
* Clamp number to min and infinite bounds, inclusive.<br> * Clamp number to min and infinite bounds, inclusive.<br>
* FLOAT version * FLOAT version
* *
* @param number * @param number clamped number
* clamped number * @param min minimal allowed value
* @param min
* minimal allowed value
* @return result * @return result
*/ */
public static float clampf(Number number, Number min) public static float clampf(Number number, Number min)
@ -723,10 +655,8 @@ public class Calc {
* Clamp number to min and infinite bounds, inclusive.<br> * Clamp number to min and infinite bounds, inclusive.<br>
* INTEGER version * INTEGER version
* *
* @param number * @param number clamped number
* clamped number * @param min minimal allowed value
* @param min
* minimal allowed value
* @return result * @return result
*/ */
public static int clampi(Number number, Number min) public static int clampi(Number number, Number min)
@ -738,8 +668,7 @@ public class Calc {
/** /**
* Get class simple name * Get class simple name
* *
* @param obj * @param obj object
* object
* @return simple name * @return simple name
*/ */
public static String cname(Object obj) public static String cname(Object obj)
@ -752,8 +681,7 @@ public class Calc {
/** /**
* Cube a double * Cube a double
* *
* @param a * @param a squared double
* squared double
* @return square * @return square
*/ */
public static double cube(double a) public static double cube(double a)
@ -765,8 +693,7 @@ public class Calc {
/** /**
* Convert double to string, remove the mess at the end. * Convert double to string, remove the mess at the end.
* *
* @param d * @param d double
* double
* @return string * @return string
*/ */
public static String doubleToString(double d) public static String doubleToString(double d)
@ -782,8 +709,7 @@ public class Calc {
/** /**
* Convert float to string, remove the mess at the end. * Convert float to string, remove the mess at the end.
* *
* @param f * @param f float
* float
* @return string * @return string
*/ */
public static String floatToString(float f) public static String floatToString(float f)
@ -799,12 +725,9 @@ public class Calc {
/** /**
* Check if number is in range * Check if number is in range
* *
* @param number * @param number checked
* checked * @param left lower end
* @param left * @param right upper end
* lower end
* @param right
* upper end
* @return is in range * @return is in range
*/ */
public static boolean inRange(double number, double left, double right) public static boolean inRange(double number, double left, double right)
@ -816,14 +739,10 @@ public class Calc {
/** /**
* Get number from A to B at delta time (tween A to B) * Get number from A to B at delta time (tween A to B)
* *
* @param from * @param from last number
* last number * @param to new number
* @param to * @param time time 0..1
* new number * @param easing easing function
* @param time
* time 0..1
* @param easing
* easing function
* @return current number to render * @return current number to render
*/ */
public static double interpolate(double from, double to, double time, Easing easing) public static double interpolate(double from, double to, double time, Easing easing)
@ -835,14 +754,10 @@ public class Calc {
/** /**
* Get angle [degrees] from A to B at delta time (tween A to B) * Get angle [degrees] from A to B at delta time (tween A to B)
* *
* @param from * @param from last angle
* last angle * @param to new angle
* @param to * @param time time 0..1
* new angle * @param easing easing function
* @param time
* time 0..1
* @param easing
* easing function
* @return current angle to render * @return current angle to render
*/ */
public static double interpolateDeg(double from, double to, double time, Easing easing) public static double interpolateDeg(double from, double to, double time, Easing easing)
@ -854,14 +769,10 @@ public class Calc {
/** /**
* Get angle [radians] from A to B at delta time (tween A to B) * Get angle [radians] from A to B at delta time (tween A to B)
* *
* @param from * @param from last angle
* last angle * @param to new angle
* @param to * @param time time 0..1
* new angle * @param easing easing function
* @param time
* time 0..1
* @param easing
* easing function
* @return current angle to render * @return current angle to render
*/ */
public static double interpolateRad(double from, double to, double time, Easing easing) public static double interpolateRad(double from, double to, double time, Easing easing)
@ -873,8 +784,7 @@ public class Calc {
/** /**
* Get highest number of a list * Get highest number of a list
* *
* @param numbers * @param numbers numbers
* numbers
* @return lowest * @return lowest
*/ */
public static double max(double... numbers) public static double max(double... numbers)
@ -890,8 +800,7 @@ public class Calc {
/** /**
* Get highest number of a list * Get highest number of a list
* *
* @param numbers * @param numbers numbers
* numbers
* @return lowest * @return lowest
*/ */
public static float max(float... numbers) public static float max(float... numbers)
@ -907,8 +816,7 @@ public class Calc {
/** /**
* Get highest number of a list * Get highest number of a list
* *
* @param numbers * @param numbers numbers
* numbers
* @return lowest * @return lowest
*/ */
public static int max(int... numbers) public static int max(int... numbers)
@ -924,8 +832,7 @@ public class Calc {
/** /**
* Get lowest number of a list * Get lowest number of a list
* *
* @param numbers * @param numbers numbers
* numbers
* @return lowest * @return lowest
*/ */
public static double min(double... numbers) public static double min(double... numbers)
@ -941,8 +848,7 @@ public class Calc {
/** /**
* Get lowest number of a list * Get lowest number of a list
* *
* @param numbers * @param numbers numbers
* numbers
* @return lowest * @return lowest
*/ */
public static float min(float... numbers) public static float min(float... numbers)
@ -958,8 +864,7 @@ public class Calc {
/** /**
* Get lowest number of a list * Get lowest number of a list
* *
* @param numbers * @param numbers numbers
* numbers
* @return lowest * @return lowest
*/ */
public static int min(int... numbers) public static int min(int... numbers)
@ -975,8 +880,7 @@ public class Calc {
/** /**
* Split comma separated list of integers. * Split comma separated list of integers.
* *
* @param list * @param list String containing the list.
* String containing the list.
* @return array of integers or null. * @return array of integers or null.
*/ */
public static List<Integer> parseIntList(String list) public static List<Integer> parseIntList(String list)
@ -991,8 +895,7 @@ public class Calc {
for (String part : parts) { for (String part : parts) {
try { try {
intList.add(Integer.parseInt(part)); intList.add(Integer.parseInt(part));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {}
}
} }
return intList; return intList;
@ -1003,8 +906,7 @@ public class Calc {
/** /**
* Pick random element from a given list. * Pick random element from a given list.
* *
* @param list * @param list list of choices
* list of choices
* @return picked element * @return picked element
*/ */
public static Object pick(List<?> list) public static Object pick(List<?> list)
@ -1017,8 +919,7 @@ public class Calc {
/** /**
* Square a double * Square a double
* *
* @param a * @param a squared double
* squared double
* @return square * @return square
*/ */
public static double square(double a) public static double square(double a)

@ -1,5 +1,6 @@
package mightypork.utils.math; package mightypork.utils.math;
import mightypork.utils.math.Calc.Deg; import mightypork.utils.math.Calc.Deg;
import mightypork.utils.math.Calc.Rad; import mightypork.utils.math.Calc.Rad;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
@ -22,10 +23,8 @@ public class Polar {
/** /**
* Create a polar * Create a polar
* *
* @param angle * @param angle angle in RAD
* angle in RAD * @param distance distance from origin
* @param distance
* distance from origin
*/ */
public Polar(double angle, double distance) { public Polar(double angle, double distance) {
this(angle, false, distance); this(angle, false, distance);
@ -35,12 +34,9 @@ public class Polar {
/** /**
* Create a polar * Create a polar
* *
* @param angle * @param angle angle
* angle * @param deg angle is in DEG
* @param deg * @param distance radius
* angle is in DEG
* @param distance
* radius
*/ */
public Polar(double angle, boolean deg, double distance) { public Polar(double angle, boolean deg, double distance) {
this.radius = distance; this.radius = distance;
@ -67,8 +63,7 @@ public class Polar {
/** /**
* @param angle * @param angle angle in RAD
* angle in RAD
*/ */
public void setAngle(double angle) public void setAngle(double angle)
{ {
@ -77,8 +72,7 @@ public class Polar {
/** /**
* @param angle * @param angle angle in DEG
* angle in DEG
*/ */
public void setAngleDeg(double angle) public void setAngleDeg(double angle)
{ {
@ -96,8 +90,7 @@ public class Polar {
/** /**
* @param r * @param r radius
* radius
*/ */
public void setRadius(double r) public void setRadius(double r)
{ {
@ -108,8 +101,7 @@ public class Polar {
/** /**
* Make polar from coord * Make polar from coord
* *
* @param coord * @param coord coord
* coord
* @return polar * @return polar
*/ */
public static Polar fromCoord(Coord coord) public static Polar fromCoord(Coord coord)
@ -121,10 +113,8 @@ public class Polar {
/** /**
* Make polar from coords * Make polar from coords
* *
* @param x * @param x x coord
* x coord * @param y y coord
* @param y
* y coord
* @return polar * @return polar
*/ */
public static Polar fromCoord(double x, double y) public static Polar fromCoord(double x, double y)

@ -1,5 +1,6 @@
package mightypork.utils.math; package mightypork.utils.math;
import java.util.Random; import java.util.Random;
@ -26,10 +27,8 @@ public class Range {
/** /**
* Create new range * Create new range
* *
* @param min * @param min min number
* min number * @param max max number
* @param max
* max number
*/ */
public Range(double min, double max) { public Range(double min, double max) {
if (min > max) { if (min > max) {
@ -45,8 +44,7 @@ public class Range {
/** /**
* Create new range * Create new range
* *
* @param minmax * @param minmax min = max number
* min = max number
*/ */
public Range(double minmax) { public Range(double minmax) {
this.min = minmax; this.min = minmax;
@ -123,8 +121,7 @@ public class Range {
/** /**
* Set min * Set min
* *
* @param min * @param min min value
* min value
*/ */
public void setMin(double min) public void setMin(double min)
{ {
@ -135,8 +132,7 @@ public class Range {
/** /**
* Set max * Set max
* *
* @param max * @param max max value
* max value
*/ */
public void setMax(double max) public void setMax(double max)
{ {
@ -165,8 +161,7 @@ public class Range {
/** /**
* Set to value of other range * Set to value of other range
* *
* @param other * @param other copied range
* copied range
*/ */
public void setTo(Range other) public void setTo(Range other)
{ {
@ -185,10 +180,8 @@ public class Range {
/** /**
* Set to min-max values * Set to min-max values
* *
* @param min * @param min min value
* min value * @param max max value
* @param max
* max value
*/ */
public void setTo(double min, double max) public void setTo(double min, double max)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.math.color; package mightypork.utils.math.color;
import java.awt.Color; import java.awt.Color;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
@ -72,8 +73,7 @@ public class HSV {
/** /**
* Set color to other color * Set color to other color
* *
* @param copied * @param copied copied color
* copied color
* @return this * @return this
*/ */
public HSV setTo(HSV copied) public HSV setTo(HSV copied)
@ -90,12 +90,9 @@ public class HSV {
/** /**
* Set to H,S,V 0-1 * Set to H,S,V 0-1
* *
* @param h * @param h hue
* hue * @param s saturation
* @param s * @param v value
* saturation
* @param v
* value
* @return this * @return this
*/ */
public HSV setTo(Number h, Number s, Number v) public HSV setTo(Number h, Number s, Number v)
@ -137,8 +134,7 @@ public class HSV {
/** /**
* Make from RGB * Make from RGB
* *
* @param color * @param color RGB
* RGB
* @return HSV * @return HSV
*/ */
public static HSV fromRGB(RGB color) public static HSV fromRGB(RGB color)

@ -1,5 +1,6 @@
package mightypork.utils.math.color; package mightypork.utils.math.color;
import java.awt.Color; import java.awt.Color;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
@ -53,8 +54,7 @@ public class RGB {
/** /**
* Get copy with custom alpha * Get copy with custom alpha
* *
* @param alpha * @param alpha alpha to set
* alpha to set
* @return copy w/ alpha * @return copy w/ alpha
*/ */
public RGB setAlpha(double alpha) public RGB setAlpha(double alpha)
@ -66,8 +66,7 @@ public class RGB {
/** /**
* set alpha IP * set alpha IP
* *
* @param alpha * @param alpha alpha to set
* alpha to set
* @return this * @return this
*/ */
public RGB setAlpha_ip(double alpha) public RGB setAlpha_ip(double alpha)
@ -92,8 +91,7 @@ public class RGB {
/** /**
* Get copy with alpha multiplied by custom value * Get copy with alpha multiplied by custom value
* *
* @param alpha * @param alpha alpha to set
* alpha to set
* @return copy w/ alpha * @return copy w/ alpha
*/ */
public RGB mulAlpha(double alpha) public RGB mulAlpha(double alpha)
@ -105,8 +103,7 @@ public class RGB {
/** /**
* Multiply alpha by given number * Multiply alpha by given number
* *
* @param alpha * @param alpha alpha multiplier
* alpha multiplier
* @return this * @return this
*/ */
public RGB mulAlpha_ip(double alpha) public RGB mulAlpha_ip(double alpha)
@ -120,12 +117,9 @@ public class RGB {
/** /**
* Color from RGB 0-1 * Color from RGB 0-1
* *
* @param r * @param r red
* red * @param g green
* @param g * @param b blue
* green
* @param b
* blue
*/ */
public RGB(Number r, Number g, Number b) { public RGB(Number r, Number g, Number b) {
this.r = r.doubleValue(); this.r = r.doubleValue();
@ -138,14 +132,10 @@ public class RGB {
/** /**
* Color from RGB 0-1 * Color from RGB 0-1
* *
* @param r * @param r red
* red * @param g green
* @param g * @param b blue
* green * @param a alpha
* @param b
* blue
* @param a
* alpha
*/ */
public RGB(Number r, Number g, Number b, Number a) { public RGB(Number r, Number g, Number b, Number a) {
this.r = r.doubleValue(); this.r = r.doubleValue();
@ -159,8 +149,7 @@ public class RGB {
/** /**
* Color from hex 0xRRGGBB * Color from hex 0xRRGGBB
* *
* @param hex * @param hex hex integer
* hex integer
*/ */
public RGB(int hex) { public RGB(int hex) {
setTo(RGB.fromHex(hex)); setTo(RGB.fromHex(hex));
@ -171,10 +160,8 @@ public class RGB {
/** /**
* Color from hex 0xRRGGBB * Color from hex 0xRRGGBB
* *
* @param hex * @param hex hex integer
* hex integer * @param alpha alpha color
* @param alpha
* alpha color
*/ */
public RGB(int hex, double alpha) { public RGB(int hex, double alpha) {
setTo(RGB.fromHex(hex)); setTo(RGB.fromHex(hex));
@ -186,10 +173,8 @@ public class RGB {
/** /**
* Color from other RGB and alpha channel * Color from other RGB and alpha channel
* *
* @param color * @param color other RGB color
* other RGB color * @param alpha new alpha channel
* @param alpha
* new alpha channel
*/ */
public RGB(RGB color, double alpha) { public RGB(RGB color, double alpha) {
setTo(color); setTo(color);
@ -236,8 +221,7 @@ public class RGB {
/** /**
* Set color to other color * Set color to other color
* *
* @param copied * @param copied copied color
* copied color
* @return this * @return this
*/ */
public RGB setTo(RGB copied) public RGB setTo(RGB copied)
@ -255,8 +239,7 @@ public class RGB {
/** /**
* Set to represent hex color * Set to represent hex color
* *
* @param hex * @param hex hex integer RRGGBB
* hex integer RRGGBB
* @return this * @return this
*/ */
public RGB setTo(int hex) public RGB setTo(int hex)
@ -270,14 +253,10 @@ public class RGB {
/** /**
* Set to R,G,B 0-1 * Set to R,G,B 0-1
* *
* @param r * @param r red
* red * @param g green
* @param g * @param b blue
* green * @param a alpha
* @param b
* blue
* @param a
* alpha
* @return this * @return this
*/ */
public RGB setTo(Number r, Number g, Number b, Number a) public RGB setTo(Number r, Number g, Number b, Number a)
@ -294,12 +273,9 @@ public class RGB {
/** /**
* Set to R,G,B 0-1 * Set to R,G,B 0-1
* *
* @param r * @param r red
* red * @param g green
* @param g * @param b blue
* green
* @param b
* blue
* @return this * @return this
*/ */
public RGB setTo(Number r, Number g, Number b) public RGB setTo(Number r, Number g, Number b)
@ -358,8 +334,7 @@ public class RGB {
/** /**
* Create color from hex 0xRRGGBB * Create color from hex 0xRRGGBB
* *
* @param hex * @param hex hex RRGGBB
* hex RRGGBB
* @return the new color * @return the new color
*/ */
public static RGB fromHex(int hex) public static RGB fromHex(int hex)
@ -374,8 +349,7 @@ public class RGB {
/** /**
* Make from HSV * Make from HSV
* *
* @param color * @param color HSV color
* HSV color
* @return RGB * @return RGB
*/ */
public static RGB fromHSV(HSV color) public static RGB fromHSV(HSV color)

@ -1,5 +1,6 @@
package mightypork.utils.math.coord; package mightypork.utils.math.coord;
import java.util.Random; import java.util.Random;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
@ -18,10 +19,8 @@ public class Coord {
/** /**
* Get distance to other point * Get distance to other point
* *
* @param a * @param a point a
* point a * @param b point b
* @param b
* point b
* @return distance in units * @return distance in units
*/ */
public static double dist(Coord a, Coord b) public static double dist(Coord a, Coord b)
@ -49,8 +48,7 @@ public class Coord {
/** /**
* Create coord as a copy of another * Create coord as a copy of another
* *
* @param copied * @param copied copied coord
* copied coord
*/ */
public Coord(Coord copied) { public Coord(Coord copied) {
setTo(copied); setTo(copied);
@ -60,10 +58,8 @@ public class Coord {
/** /**
* Create 2D coord * Create 2D coord
* *
* @param x * @param x x coordinate
* x coordinate * @param y y coordinate
* @param y
* y coordinate
*/ */
public Coord(Number x, Number y) { public Coord(Number x, Number y) {
setTo(x, y); setTo(x, y);
@ -73,12 +69,9 @@ public class Coord {
/** /**
* Create 3D coord * Create 3D coord
* *
* @param x * @param x x coordinate
* x coordinate * @param y y coordinate
* @param y * @param z z coordinate
* y coordinate
* @param z
* z coordinate
*/ */
public Coord(Number x, Number y, Number z) { public Coord(Number x, Number y, Number z) {
setTo(x, y, z); setTo(x, y, z);
@ -88,8 +81,7 @@ public class Coord {
/** /**
* Add a vector, in a copy * Add a vector, in a copy
* *
* @param vec * @param vec offset
* offset
* @return changed copy * @return changed copy
*/ */
public Coord add(Coord vec) public Coord add(Coord vec)
@ -101,8 +93,7 @@ public class Coord {
/** /**
* Add a vector, in place * Add a vector, in place
* *
* @param vec * @param vec offset
* offset
* @return this * @return this
*/ */
public Coord add_ip(Coord vec) public Coord add_ip(Coord vec)
@ -115,10 +106,8 @@ public class Coord {
* Add to each component, in a copy.<br> * Add to each component, in a copy.<br>
* Z is unchanged. * Z is unchanged.
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y
* y offset
* @return changed copy * @return changed copy
*/ */
public Coord add(Number x, Number y) public Coord add(Number x, Number y)
@ -131,10 +120,8 @@ public class Coord {
* Add to each component, in place.<br> * Add to each component, in place.<br>
* Z is unchanged. * Z is unchanged.
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y
* y offset
* @return this * @return this
*/ */
public Coord add_ip(Number x, Number y) public Coord add_ip(Number x, Number y)
@ -146,12 +133,9 @@ public class Coord {
/** /**
* Add to each component, in a copy. * Add to each component, in a copy.
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y * @param z z offset
* y offset
* @param z
* z offset
* @return changed copy * @return changed copy
*/ */
public Coord add(Number x, Number y, Number z) public Coord add(Number x, Number y, Number z)
@ -163,12 +147,9 @@ public class Coord {
/** /**
* Add to each component, in place. * Add to each component, in place.
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y * @param z z offset
* y offset
* @param z
* z offset
* @return this * @return this
*/ */
public Coord add_ip(Number x, Number y, Number z) public Coord add_ip(Number x, Number y, Number z)
@ -194,8 +175,7 @@ public class Coord {
/** /**
* Get distance to other point * Get distance to other point
* *
* @param point * @param point other point
* other point
* @return distance in units * @return distance in units
*/ */
public double distTo(Coord point) public double distTo(Coord point)
@ -207,8 +187,7 @@ public class Coord {
/** /**
* Check if this rectangle in inside a rectangular zone * Check if this rectangle in inside a rectangular zone
* *
* @param rect * @param rect checked rect.
* checked rect.
* @return is inside * @return is inside
*/ */
public boolean isInRect(Rect rect) public boolean isInRect(Rect rect)
@ -220,10 +199,8 @@ public class Coord {
/** /**
* Check if this rectangle in inside a rectangular zone * Check if this rectangle in inside a rectangular zone
* *
* @param min * @param min min coord
* min coord * @param max max coord
* @param max
* max coord
* @return is inside * @return is inside
*/ */
public boolean isInRect(Coord min, Coord max) public boolean isInRect(Coord min, Coord max)
@ -235,8 +212,7 @@ public class Coord {
/** /**
* Get middle of line to other point * Get middle of line to other point
* *
* @param other * @param other other point
* other point
* @return middle * @return middle
*/ */
public Coord midTo(Coord other) public Coord midTo(Coord other)
@ -271,8 +247,7 @@ public class Coord {
/** /**
* Multiply each component, in a copy. * Multiply each component, in a copy.
* *
* @param d * @param d multiplier
* multiplier
* @return changed copy * @return changed copy
*/ */
public Coord mul(double d) public Coord mul(double d)
@ -284,8 +259,7 @@ public class Coord {
/** /**
* Multiply each component, in place. * Multiply each component, in place.
* *
* @param d * @param d multiplier
* multiplier
* @return this * @return this
*/ */
public Coord mul_ip(double d) public Coord mul_ip(double d)
@ -297,8 +271,7 @@ public class Coord {
/** /**
* Multiply each component, in a copy. * Multiply each component, in a copy.
* *
* @param vec * @param vec vector of multipliers
* vector of multipliers
* @return changed copy * @return changed copy
*/ */
public Coord mul(Coord vec) public Coord mul(Coord vec)
@ -311,10 +284,8 @@ public class Coord {
* Multiply each component, in a copy.<br> * Multiply each component, in a copy.<br>
* Z is unchanged. * Z is unchanged.
* *
* @param x * @param x x multiplier
* x multiplier * @param y y multiplier
* @param y
* y multiplier
* @return changed copy * @return changed copy
*/ */
public Coord mul(double x, int y) public Coord mul(double x, int y)
@ -327,10 +298,8 @@ public class Coord {
* Multiply each component, in place.<br> * Multiply each component, in place.<br>
* Z is unchanged. * Z is unchanged.
* *
* @param x * @param x x multiplier
* x multiplier * @param y y multiplier
* @param y
* y multiplier
* @return this * @return this
*/ */
public Coord mul_ip(double x, double y) public Coord mul_ip(double x, double y)
@ -342,12 +311,9 @@ public class Coord {
/** /**
* Multiply each component, in a copy. * Multiply each component, in a copy.
* *
* @param x * @param x x multiplier
* x multiplier * @param y y multiplier
* @param y * @param z z multiplier
* y multiplier
* @param z
* z multiplier
* @return changed copy * @return changed copy
*/ */
public Coord mul(double x, double y, double z) public Coord mul(double x, double y, double z)
@ -359,8 +325,7 @@ public class Coord {
/** /**
* Multiply each component, in place. * Multiply each component, in place.
* *
* @param vec * @param vec vector of multipliers
* vector of multipliers
* @return this * @return this
*/ */
public Coord mul_ip(Coord vec) public Coord mul_ip(Coord vec)
@ -372,12 +337,9 @@ public class Coord {
/** /**
* Multiply each component, in place. * Multiply each component, in place.
* *
* @param x * @param x x multiplier
* x multiplier * @param y y multiplier
* @param y * @param z z multiplier
* y multiplier
* @param z
* z multiplier
* @return this * @return this
*/ */
public Coord mul_ip(double x, double y, double z) public Coord mul_ip(double x, double y, double z)
@ -398,8 +360,7 @@ public class Coord {
/** /**
* offset randomly in place * offset randomly in place
* *
* @param max * @param max max +- offset
* max +- offset
* @return this * @return this
*/ */
public Coord random_offset_ip(double max) public Coord random_offset_ip(double max)
@ -411,10 +372,8 @@ public class Coord {
/** /**
* offset randomly * offset randomly
* *
* @param min * @param min min offset
* min offset * @param max max offset
* @param max
* max offset
* @return offset coord * @return offset coord
*/ */
public Coord random_offset(double min, double max) public Coord random_offset(double min, double max)
@ -426,10 +385,8 @@ public class Coord {
/** /**
* offset randomly in place * offset randomly in place
* *
* @param min * @param min min offset
* min offset * @param max max offset
* @param max
* max offset
* @return this * @return this
*/ */
public Coord random_offset_ip(double min, double max) public Coord random_offset_ip(double min, double max)
@ -467,8 +424,7 @@ public class Coord {
/** /**
* Set to max values of this and other coord * Set to max values of this and other coord
* *
* @param other * @param other other coord
* other coord
*/ */
public void setToMax(Coord other) public void setToMax(Coord other)
{ {
@ -481,8 +437,7 @@ public class Coord {
/** /**
* Set to min values of this and other coord * Set to min values of this and other coord
* *
* @param other * @param other other coord
* other coord
*/ */
public void setToMin(Coord other) public void setToMin(Coord other)
{ {
@ -495,8 +450,7 @@ public class Coord {
/** /**
* Set coordinates to match other coord * Set coordinates to match other coord
* *
* @param copied * @param copied coord whose coordinates are used
* coord whose coordinates are used
* @return this * @return this
*/ */
public Coord setTo(Coord copied) public Coord setTo(Coord copied)
@ -508,10 +462,8 @@ public class Coord {
/** /**
* Set 2D coordinates to * Set 2D coordinates to
* *
* @param x * @param x x coordinate
* x coordinate * @param y y coordinate
* @param y
* y coordinate
* @return this * @return this
*/ */
public Coord setTo(Number x, Number y) public Coord setTo(Number x, Number y)
@ -523,12 +475,9 @@ public class Coord {
/** /**
* Set 3D coordinates to * Set 3D coordinates to
* *
* @param x * @param x x coordinate
* x coordinate * @param y y coordinate
* @param y * @param z z coordinate
* y coordinate
* @param z
* z coordinate
* @return this * @return this
*/ */
public Coord setTo(Number x, Number y, Number z) public Coord setTo(Number x, Number y, Number z)
@ -543,8 +492,7 @@ public class Coord {
/** /**
* Set X coordinate in a copy * Set X coordinate in a copy
* *
* @param x * @param x x coordinate
* x coordinate
* @return copy with set coordinate * @return copy with set coordinate
*/ */
public Coord setX(Number x) public Coord setX(Number x)
@ -556,8 +504,7 @@ public class Coord {
/** /**
* Set X coordinate in place * Set X coordinate in place
* *
* @param x * @param x x coordinate
* x coordinate
* @return this * @return this
*/ */
public Coord setX_ip(Number x) public Coord setX_ip(Number x)
@ -570,8 +517,7 @@ public class Coord {
/** /**
* Set Y coordinate in a copy * Set Y coordinate in a copy
* *
* @param y * @param y y coordinate
* y coordinate
* @return copy with set coordinate * @return copy with set coordinate
*/ */
public Coord setY(Number y) public Coord setY(Number y)
@ -583,8 +529,7 @@ public class Coord {
/** /**
* Set Y coordinate in place * Set Y coordinate in place
* *
* @param y * @param y y coordinate
* y coordinate
* @return this * @return this
*/ */
public Coord setY_ip(Number y) public Coord setY_ip(Number y)
@ -597,8 +542,7 @@ public class Coord {
/** /**
* Set Z coordinate in a copy * Set Z coordinate in a copy
* *
* @param z * @param z z coordinate
* z coordinate
* @return copy with set coordinate * @return copy with set coordinate
*/ */
public Coord setZ(Number z) public Coord setZ(Number z)
@ -610,8 +554,7 @@ public class Coord {
/** /**
* Set Z coordinate in place * Set Z coordinate in place
* *
* @param z * @param z z coordinate
* z coordinate
* @return this * @return this
*/ */
public Coord setZ_ip(Number z) public Coord setZ_ip(Number z)
@ -624,8 +567,7 @@ public class Coord {
/** /**
* Get a copy subtracted by vector * Get a copy subtracted by vector
* *
* @param vec * @param vec offset
* offset
* @return the offset copy * @return the offset copy
*/ */
public Coord sub(Coord vec) public Coord sub(Coord vec)
@ -637,10 +579,8 @@ public class Coord {
/** /**
* Get a copy subtracted by 2D coordinate * Get a copy subtracted by 2D coordinate
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y
* y offset
* @return the offset copy * @return the offset copy
*/ */
public Coord sub(Number x, Number y) public Coord sub(Number x, Number y)
@ -652,12 +592,9 @@ public class Coord {
/** /**
* Get a copy subtracted by 3D coordinate * Get a copy subtracted by 3D coordinate
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y * @param z z offset
* y offset
* @param z
* z offset
* @return the offset copy * @return the offset copy
*/ */
public Coord sub(Number x, Number y, Number z) public Coord sub(Number x, Number y, Number z)
@ -669,8 +606,7 @@ public class Coord {
/** /**
* Offset by vector in place * Offset by vector in place
* *
* @param vec * @param vec offset
* offset
* @return this * @return this
*/ */
public Coord sub_ip(Coord vec) public Coord sub_ip(Coord vec)
@ -682,10 +618,8 @@ public class Coord {
/** /**
* Offset by 2D coordinate in place * Offset by 2D coordinate in place
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y
* y offset
* @return this * @return this
*/ */
public Coord sub_ip(Number x, Number y) public Coord sub_ip(Number x, Number y)
@ -697,12 +631,9 @@ public class Coord {
/** /**
* Offset by 3D coordinate in place * Offset by 3D coordinate in place
* *
* @param x * @param x x offset
* x offset * @param y y offset
* @param y * @param z z offset
* y offset
* @param z
* z offset
* @return this * @return this
*/ */
public Coord sub_ip(Number x, Number y, Number z) public Coord sub_ip(Number x, Number y, Number z)
@ -717,8 +648,7 @@ public class Coord {
/** /**
* Create vector from this point to other point * Create vector from this point to other point
* *
* @param point * @param point second point
* second point
* @return vector * @return vector
*/ */
public Coord vecTo(Coord point) public Coord vecTo(Coord point)
@ -784,10 +714,8 @@ public class Coord {
/** /**
* Get cross product of two vectors * Get cross product of two vectors
* *
* @param a * @param a 1st vector
* 1st vector * @param b 2nd vector
* @param b
* 2nd vector
* @return cross product * @return cross product
*/ */
public static Coord cross(Coord a, Coord b) public static Coord cross(Coord a, Coord b)
@ -799,10 +727,8 @@ public class Coord {
/** /**
* Get dot product of two vectors * Get dot product of two vectors
* *
* @param a * @param a 1st vector
* 1st vector * @param b 2nd vector
* @param b
* 2nd vector
* @return dot product * @return dot product
*/ */
public static double dot(Coord a, Coord b) public static double dot(Coord a, Coord b)
@ -814,8 +740,7 @@ public class Coord {
/** /**
* Multiply by other vector, vector multiplication * Multiply by other vector, vector multiplication
* *
* @param vec * @param vec other vector
* other vector
* @return changed copy * @return changed copy
*/ */
public Coord cross(Coord vec) public Coord cross(Coord vec)
@ -827,8 +752,7 @@ public class Coord {
/** /**
* Multiply by other vector, vector multiplication; in place * Multiply by other vector, vector multiplication; in place
* *
* @param vec * @param vec other vector
* other vector
* @return this * @return this
*/ */
public Coord cross_ip(Coord vec) public Coord cross_ip(Coord vec)
@ -847,8 +771,7 @@ public class Coord {
/** /**
* Get dot product * Get dot product
* *
* @param vec * @param vec other vector
* other vector
* @return dot product * @return dot product
*/ */
public double dot(Coord vec) public double dot(Coord vec)
@ -883,8 +806,7 @@ public class Coord {
/** /**
* Scale vector to given size * Scale vector to given size
* *
* @param size * @param size size we need
* size we need
* @return scaled vector * @return scaled vector
*/ */
public Coord norm(double size) public Coord norm(double size)
@ -897,8 +819,7 @@ public class Coord {
* Scale vector to given size, in place.<br> * Scale vector to given size, in place.<br>
* Zero vector remains zero. * Zero vector remains zero.
* *
* @param size * @param size size we need
* size we need
* @return scaled vector * @return scaled vector
*/ */
public Coord norm_ip(double size) public Coord norm_ip(double size)
@ -994,8 +915,7 @@ public class Coord {
/** /**
* Generate random coord (gaussian) * Generate random coord (gaussian)
* *
* @param max * @param max max distance from 0
* max distance from 0
* @return new coord * @return new coord
*/ */
public static Coord random(double max) public static Coord random(double max)
@ -1013,10 +933,8 @@ public class Coord {
/** /**
* Generate random coord (min-max) * Generate random coord (min-max)
* *
* @param min * @param min min offset
* min offset * @param max max offset
* @param max
* max offset
* @return new coord * @return new coord
*/ */
public static Coord random(double min, double max) public static Coord random(double min, double max)

@ -1,5 +1,6 @@
package mightypork.utils.math.coord; package mightypork.utils.math.coord;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
import mightypork.utils.time.Updateable; import mightypork.utils.time.Updateable;
@ -20,8 +21,7 @@ public class CoordAnimated extends Coord implements Updateable {
/** /**
* Update delta timing * Update delta timing
* *
* @param delta * @param delta delta time to add
* delta time to add
*/ */
@Override @Override
public void update(double delta) public void update(double delta)
@ -52,8 +52,7 @@ public class CoordAnimated extends Coord implements Updateable {
/** /**
* Start animation * Start animation
* *
* @param time * @param time anim length
* anim length
*/ */
public void animStart(double time) public void animStart(double time)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.math.coord; package mightypork.utils.math.coord;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
@ -19,10 +20,8 @@ public class Rect {
/** /**
* Rectangle from size * Rectangle from size
* *
* @param min * @param min min coord
* min coord * @param size rect size
* @param size
* rect size
* @return the rect * @return the rect
*/ */
public static Rect fromSize(Coord min, Coord size) public static Rect fromSize(Coord min, Coord size)
@ -34,12 +33,9 @@ public class Rect {
/** /**
* Make rect from min coord and size * Make rect from min coord and size
* *
* @param min * @param min min coord
* min coord * @param width size x
* @param width * @param height size y
* size x
* @param height
* size y
* @return the new rect * @return the new rect
*/ */
public static Rect fromSize(Coord min, double width, double height) public static Rect fromSize(Coord min, double width, double height)
@ -51,12 +47,9 @@ public class Rect {
/** /**
* Rectangle from size * Rectangle from size
* *
* @param x * @param x min X
* min X * @param y min Y
* @param y * @param size rect size
* min Y
* @param size
* rect size
* @return the rect * @return the rect
*/ */
public static Rect fromSize(int x, int y, Coord size) public static Rect fromSize(int x, int y, Coord size)
@ -68,14 +61,10 @@ public class Rect {
/** /**
* Make rect from min coord and size * Make rect from min coord and size
* *
* @param xMin * @param xMin min x
* min x * @param yMin min y
* @param yMin * @param width size x
* min y * @param height size y
* @param width
* size x
* @param height
* size y
* @return the new rect * @return the new rect
*/ */
public static Rect fromSize(double xMin, double yMin, double width, double height) public static Rect fromSize(double xMin, double yMin, double width, double height)
@ -101,8 +90,7 @@ public class Rect {
/** /**
* Rect [0, 0, size.x, size.y] * Rect [0, 0, size.x, size.y]
* *
* @param size * @param size size coord
* size coord
*/ */
public Rect(Coord size) { public Rect(Coord size) {
this(0, 0, size.x, size.y); this(0, 0, size.x, size.y);
@ -112,10 +100,8 @@ public class Rect {
/** /**
* New rect of two coords * New rect of two coords
* *
* @param c1 * @param c1 coord 1
* coord 1 * @param c2 coord 2
* @param c2
* coord 2
*/ */
public Rect(Coord c1, Coord c2) { public Rect(Coord c1, Coord c2) {
this(c1.x, c1.y, c2.x, c2.y); this(c1.x, c1.y, c2.x, c2.y);
@ -125,14 +111,10 @@ public class Rect {
/** /**
* New Rect * New Rect
* *
* @param x1 * @param x1 lower x
* lower x * @param y1 lower y
* @param y1 * @param x2 upper x
* lower y * @param y2 upper y
* @param x2
* upper x
* @param y2
* upper y
*/ */
public Rect(double x1, double y1, double x2, double y2) { public Rect(double x1, double y1, double x2, double y2) {
setTo(x1, y1, x2, y2); setTo(x1, y1, x2, y2);
@ -142,10 +124,8 @@ public class Rect {
/** /**
* Rect [0, 0, x, y] * Rect [0, 0, x, y]
* *
* @param x * @param x width
* width * @param y height
* @param y
* height
*/ */
public Rect(double x, double y) { public Rect(double x, double y) {
this(0, 0, x, y); this(0, 0, x, y);
@ -155,8 +135,7 @@ public class Rect {
/** /**
* New rect as a copy of other rect * New rect as a copy of other rect
* *
* @param r * @param r other rect
* other rect
*/ */
public Rect(Rect r) { public Rect(Rect r) {
this(r.min.x, r.min.y, r.max.x, r.max.y); this(r.min.x, r.min.y, r.max.x, r.max.y);
@ -166,8 +145,7 @@ public class Rect {
/** /**
* Get offset copy (add) * Get offset copy (add)
* *
* @param move * @param move offset vector
* offset vector
* @return offset copy * @return offset copy
*/ */
public Rect add(Coord move) public Rect add(Coord move)
@ -179,10 +157,8 @@ public class Rect {
/** /**
* Add X and Y to all coordinates in a copy * Add X and Y to all coordinates in a copy
* *
* @param x * @param x x to add
* x to add * @param y y to add
* @param y
* y to add
* @return copy changed * @return copy changed
*/ */
public Rect add(double x, double y) public Rect add(double x, double y)
@ -194,8 +170,7 @@ public class Rect {
/** /**
* Offset in place (add) * Offset in place (add)
* *
* @param move * @param move offset vector
* offset vector
* @return this * @return this
*/ */
public Rect add_ip(Coord move) public Rect add_ip(Coord move)
@ -209,10 +184,8 @@ public class Rect {
/** /**
* Add X and Y to all coordinates in place * Add X and Y to all coordinates in place
* *
* @param x * @param x x to add
* x to add * @param y y to add
* @param y
* y to add
* @return this * @return this
*/ */
public Rect add_ip(double x, double y) public Rect add_ip(double x, double y)
@ -429,8 +402,7 @@ public class Rect {
/** /**
* Grow to sides in copy * Grow to sides in copy
* *
* @param grow * @param grow grow size (added to each side)
* grow size (added to each side)
* @return grown copy * @return grown copy
*/ */
public Rect grow(Coord grow) public Rect grow(Coord grow)
@ -442,10 +414,8 @@ public class Rect {
/** /**
* Grow to sides in copy * Grow to sides in copy
* *
* @param x * @param x x to add
* x to add * @param y y to add
* @param y
* y to add
* @return grown copy * @return grown copy
*/ */
public Rect grow(double x, double y) public Rect grow(double x, double y)
@ -457,8 +427,7 @@ public class Rect {
/** /**
* Grow to sides in place * Grow to sides in place
* *
* @param grow * @param grow grow size (added to each side)
* grow size (added to each side)
* @return this * @return this
*/ */
public Rect grow_ip(Coord grow) public Rect grow_ip(Coord grow)
@ -472,10 +441,8 @@ public class Rect {
/** /**
* Grow to sides in place * Grow to sides in place
* *
* @param x * @param x x to add
* x to add * @param y y to add
* @param y
* y to add
* @return this * @return this
*/ */
public Rect grow_ip(double x, double y) public Rect grow_ip(double x, double y)
@ -489,8 +456,7 @@ public class Rect {
/** /**
* Grow down in copy * Grow down in copy
* *
* @param down * @param down added pixels
* added pixels
* @return grown copy * @return grown copy
*/ */
public Rect growDown(double down) public Rect growDown(double down)
@ -502,8 +468,7 @@ public class Rect {
/** /**
* Grow down in place * Grow down in place
* *
* @param down * @param down added pixels
* added pixels
* @return this * @return this
*/ */
public Rect growDown_ip(double down) public Rect growDown_ip(double down)
@ -516,8 +481,7 @@ public class Rect {
/** /**
* Grow to left in copy * Grow to left in copy
* *
* @param left * @param left added pixels
* added pixels
* @return grown copy * @return grown copy
*/ */
public Rect growLeft(double left) public Rect growLeft(double left)
@ -529,8 +493,7 @@ public class Rect {
/** /**
* Grow to left in place * Grow to left in place
* *
* @param left * @param left added pixels
* added pixels
* @return this * @return this
*/ */
public Rect growLeft_ip(double left) public Rect growLeft_ip(double left)
@ -543,8 +506,7 @@ public class Rect {
/** /**
* Grow to right in copy * Grow to right in copy
* *
* @param right * @param right added pixels
* added pixels
* @return grown copy * @return grown copy
*/ */
public Rect growRight(double right) public Rect growRight(double right)
@ -556,8 +518,7 @@ public class Rect {
/** /**
* Grow to right in place * Grow to right in place
* *
* @param right * @param right added pixels
* added pixels
* @return this * @return this
*/ */
public Rect growRight_ip(double right) public Rect growRight_ip(double right)
@ -570,8 +531,7 @@ public class Rect {
/** /**
* Grow up in copy * Grow up in copy
* *
* @param add * @param add added pixels
* added pixels
* @return grown copy * @return grown copy
*/ */
public Rect growUp(double add) public Rect growUp(double add)
@ -583,8 +543,7 @@ public class Rect {
/** /**
* Grow up in place * Grow up in place
* *
* @param add * @param add added pixels
* added pixels
* @return this * @return this
*/ */
public Rect growUp_ip(double add) public Rect growUp_ip(double add)
@ -597,8 +556,7 @@ public class Rect {
/** /**
* Check if point is inside this rectangle * Check if point is inside this rectangle
* *
* @param point * @param point point to test
* point to test
* @return is inside * @return is inside
*/ */
public boolean isInside(Coord point) public boolean isInside(Coord point)
@ -610,8 +568,7 @@ public class Rect {
/** /**
* Multiply in copy * Multiply in copy
* *
* @param factor * @param factor multiplier
* multiplier
* @return offset copy * @return offset copy
*/ */
public Rect mul(double factor) public Rect mul(double factor)
@ -623,10 +580,8 @@ public class Rect {
/** /**
* Multiply by number (useful for centered rects) * Multiply by number (useful for centered rects)
* *
* @param x * @param x x multiplier
* x multiplier * @param y y multiplier
* @param y
* y multiplier
* @return copy multiplied * @return copy multiplied
*/ */
public Rect mul(double x, double y) public Rect mul(double x, double y)
@ -638,8 +593,7 @@ public class Rect {
/** /**
* Multiply coord in place * Multiply coord in place
* *
* @param factor * @param factor multiplier
* multiplier
* @return this * @return this
*/ */
public Rect mul_ip(double factor) public Rect mul_ip(double factor)
@ -653,10 +607,8 @@ public class Rect {
/** /**
* Multiply coord in place * Multiply coord in place
* *
* @param x * @param x multiplier x
* multiplier x * @param y multiplier y
* @param y
* multiplier y
* @return this * @return this
*/ */
public Rect mul_ip(double x, double y) public Rect mul_ip(double x, double y)
@ -694,8 +646,7 @@ public class Rect {
/** /**
* Set to [0,0,coord.x,coord.y] * Set to [0,0,coord.x,coord.y]
* *
* @param coord * @param coord size coord
* size coord
*/ */
public void setTo(Coord coord) public void setTo(Coord coord)
{ {
@ -706,14 +657,10 @@ public class Rect {
/** /**
* Set to coordinates * Set to coordinates
* *
* @param x1 * @param x1 lower x
* lower x * @param y1 lower y
* @param y1 * @param x2 upper x
* lower y * @param y2 upper y
* @param x2
* upper x
* @param y2
* upper y
*/ */
public void setTo(double x1, double y1, double x2, double y2) public void setTo(double x1, double y1, double x2, double y2)
{ {
@ -727,8 +674,7 @@ public class Rect {
/** /**
* Set to other rect's coordinates * Set to other rect's coordinates
* *
* @param r * @param r other rect
* other rect
*/ */
public void setTo(Rect r) public void setTo(Rect r)
{ {
@ -740,10 +686,8 @@ public class Rect {
/** /**
* Subtract X and Y from all coordinates in a copy * Subtract X and Y from all coordinates in a copy
* *
* @param x * @param x x to subtract
* x to subtract * @param y y to subtract
* @param y
* y to subtract
* @return copy changed * @return copy changed
*/ */
public Rect sub(double x, double y) public Rect sub(double x, double y)
@ -755,8 +699,7 @@ public class Rect {
/** /**
* Get offset copy (subtract) * Get offset copy (subtract)
* *
* @param move * @param move offset vector
* offset vector
* @return offset copy * @return offset copy
*/ */
public Rect sub(Coord move) public Rect sub(Coord move)
@ -768,10 +711,8 @@ public class Rect {
/** /**
* Subtract X and Y from all coordinates in place * Subtract X and Y from all coordinates in place
* *
* @param x * @param x x to subtract
* x to subtract * @param y y to subtract
* @param y
* y to subtract
* @return this * @return this
*/ */
public Rect sub_ip(double x, double y) public Rect sub_ip(double x, double y)
@ -783,8 +724,7 @@ public class Rect {
/** /**
* Offset in place (subtract) * Offset in place (subtract)
* *
* @param move * @param move offset vector
* offset vector
* @return this * @return this
*/ */
public Rect sub_ip(Coord move) public Rect sub_ip(Coord move)

@ -1,5 +1,6 @@
package mightypork.utils.math.easing; package mightypork.utils.math.easing;
/** /**
* EasingFunction function. * EasingFunction function.
* *
@ -10,8 +11,7 @@ public abstract class Easing {
/** /**
* Get value at time t. * Get value at time t.
* *
* @param t * @param t time parameter (t = 1..1)
* time parameter (t = 1..1)
* @return value at given t (0..1, can exceed if needed) * @return value at given t (0..1, can exceed if needed)
*/ */
public abstract double get(double t); public abstract double get(double t);
@ -20,8 +20,7 @@ public abstract class Easing {
/** /**
* Reverse an easing * Reverse an easing
* *
* @param original * @param original original easing
* original easing
* @return reversed easing * @return reversed easing
*/ */
public static Easing reverse(Easing original) public static Easing reverse(Easing original)
@ -33,10 +32,8 @@ public abstract class Easing {
/** /**
* Combine two easings * Combine two easings
* *
* @param in * @param in initial easing
* initial easing * @param out terminal easing
* @param out
* terminal easing
* @return product * @return product
*/ */
public static Easing combine(Easing in, Easing out) public static Easing combine(Easing in, Easing out)
@ -48,8 +45,7 @@ public abstract class Easing {
/** /**
* Create "bilinear" easing - compose of straight and reverse. * Create "bilinear" easing - compose of straight and reverse.
* *
* @param in * @param in initial easing
* initial easing
* @return product * @return product
*/ */
public static Easing inOut(Easing in) public static Easing inOut(Easing in)
@ -57,7 +53,6 @@ public abstract class Easing {
return combine(in, reverse(in)); return combine(in, reverse(in));
} }
/** /**
* Reverse EasingFunction * Reverse EasingFunction
* *
@ -69,8 +64,7 @@ public abstract class Easing {
/** /**
* @param in * @param in Easing to reverse
* Easing to reverse
*/ */
public Reverse(Easing in) { public Reverse(Easing in) {
this.ea = in; this.ea = in;
@ -84,7 +78,6 @@ public abstract class Easing {
} }
} }
/** /**
* Composite EasingFunction (0-0.5 EasingFunction A, 0.5-1 EasingFunction B) * Composite EasingFunction (0-0.5 EasingFunction A, 0.5-1 EasingFunction B)
* *
@ -99,10 +92,8 @@ public abstract class Easing {
/** /**
* Create a composite EasingFunction * Create a composite EasingFunction
* *
* @param in * @param in initial EasingFunction
* initial EasingFunction * @param out terminal EasingFunction
* @param out
* terminal EasingFunction
*/ */
public Composite(Easing in, Easing out) { public Composite(Easing in, Easing out) {
this.in = in; this.in = in;

@ -1,5 +1,6 @@
package mightypork.utils.objects; package mightypork.utils.objects;
import mightypork.utils.logging.Log; import mightypork.utils.logging.Log;
import mightypork.utils.math.Range; import mightypork.utils.math.Range;
import mightypork.utils.math.coord.Coord; import mightypork.utils.math.coord.Coord;
@ -16,10 +17,8 @@ public class Convertor {
/** /**
* Get INTEGER * Get INTEGER
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return integer * @return integer
*/ */
public static int getInteger(Object o, Integer def) public static int getInteger(Object o, Integer def)
@ -30,8 +29,7 @@ public class Convertor {
if (o instanceof Number) return ((Number) o).intValue(); if (o instanceof Number) return ((Number) o).intValue();
if (o instanceof Range) return ((Range) o).randInt(); if (o instanceof Range) return ((Range) o).randInt();
if (o instanceof Boolean) return ((Boolean) o) ? 1 : 0; if (o instanceof Boolean) return ((Boolean) o) ? 1 : 0;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {}
}
Log.w("Cannot convert " + o + " to Integer."); Log.w("Cannot convert " + o + " to Integer.");
return def; return def;
} }
@ -40,10 +38,8 @@ public class Convertor {
/** /**
* Get DOUBLE * Get DOUBLE
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return double * @return double
*/ */
public static double getDouble(Object o, Double def) public static double getDouble(Object o, Double def)
@ -54,8 +50,7 @@ public class Convertor {
if (o instanceof Number) return ((Number) o).doubleValue(); if (o instanceof Number) return ((Number) o).doubleValue();
if (o instanceof Range) return ((Range) o).randDouble(); if (o instanceof Range) return ((Range) o).randDouble();
if (o instanceof Boolean) return ((Boolean) o) ? 1 : 0; if (o instanceof Boolean) return ((Boolean) o) ? 1 : 0;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {}
}
Log.w("Cannot convert " + o + " to Double."); Log.w("Cannot convert " + o + " to Double.");
return def; return def;
} }
@ -64,10 +59,8 @@ public class Convertor {
/** /**
* Get FLOAT * Get FLOAT
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return float * @return float
*/ */
public static double getFloat(Object o, Float def) public static double getFloat(Object o, Float def)
@ -75,8 +68,7 @@ public class Convertor {
try { try {
if (o == null) return def; if (o == null) return def;
if (o instanceof Number) return ((Number) o).floatValue(); if (o instanceof Number) return ((Number) o).floatValue();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {}
}
Log.w("Cannot convert " + o + " to Float."); Log.w("Cannot convert " + o + " to Float.");
return def; return def;
} }
@ -85,10 +77,8 @@ public class Convertor {
/** /**
* Get BOOLEAN * Get BOOLEAN
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return boolean * @return boolean
*/ */
public static boolean getBoolean(Object o, Boolean def) public static boolean getBoolean(Object o, Boolean def)
@ -102,8 +92,7 @@ public class Convertor {
try { try {
double n = Double.parseDouble(s); double n = Double.parseDouble(s);
return n != 0; return n != 0;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {}
}
if (s.equals("true")) return true; if (s.equals("true")) return true;
if (s.equals("yes")) return true; if (s.equals("yes")) return true;
@ -126,10 +115,8 @@ public class Convertor {
/** /**
* Get STRING * Get STRING
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return String * @return String
*/ */
public static String getString(Object o, String def) public static String getString(Object o, String def)
@ -145,10 +132,8 @@ public class Convertor {
* Get AI_COORD<br> * Get AI_COORD<br>
* Converts special constants to magic coordinate instances. * Converts special constants to magic coordinate instances.
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return AiCoord * @return AiCoord
*/ */
public static Coord getCoord(Object o, Coord def) public static Coord getCoord(Object o, Coord def)
@ -179,10 +164,8 @@ public class Convertor {
/** /**
* Get RANGE * Get RANGE
* *
* @param o * @param o object
* object * @param def default value
* @param def
* default value
* @return AiCoord * @return AiCoord
*/ */
public static Range getRange(Object o, Range def) public static Range getRange(Object o, Range def)
@ -207,8 +190,7 @@ public class Convertor {
} }
if (o instanceof Range) return (Range) o; if (o instanceof Range) return (Range) o;
} catch (NumberFormatException e) { } catch (NumberFormatException e) {}
}
Log.w("Cannot convert " + o + " to Range."); Log.w("Cannot convert " + o + " to Range.");
return def; return def;
} }
@ -217,8 +199,7 @@ public class Convertor {
/** /**
* Get INTEGER * Get INTEGER
* *
* @param o * @param o object
* object
* @return integer * @return integer
*/ */
public static int getInteger(Object o) public static int getInteger(Object o)
@ -230,8 +211,7 @@ public class Convertor {
/** /**
* Get DOUBLE * Get DOUBLE
* *
* @param o * @param o object
* object
* @return double * @return double
*/ */
public static double getDouble(Object o) public static double getDouble(Object o)
@ -243,8 +223,7 @@ public class Convertor {
/** /**
* Get FLOAT * Get FLOAT
* *
* @param o * @param o object
* object
* @return float * @return float
*/ */
public static double getFloat(Object o) public static double getFloat(Object o)
@ -256,8 +235,7 @@ public class Convertor {
/** /**
* Get BOOLEAN * Get BOOLEAN
* *
* @param o * @param o object
* object
* @return boolean * @return boolean
*/ */
public static boolean getBoolean(Object o) public static boolean getBoolean(Object o)
@ -269,8 +247,7 @@ public class Convertor {
/** /**
* Get STRING * Get STRING
* *
* @param o * @param o object
* object
* @return String * @return String
*/ */
public static String getString(Object o) public static String getString(Object o)
@ -283,8 +260,7 @@ public class Convertor {
* Get AI_COORD (if special string constant is present instead, build coord * Get AI_COORD (if special string constant is present instead, build coord
* of it) * of it)
* *
* @param o * @param o object
* object
* @return AiCoord * @return AiCoord
*/ */
public static Coord getCoord(Object o) public static Coord getCoord(Object o)
@ -296,8 +272,7 @@ public class Convertor {
/** /**
* Get RANGE * Get RANGE
* *
* @param o * @param o object
* object
* @return AiCoord * @return AiCoord
*/ */
public static Range getRange(Object o) public static Range getRange(Object o)

@ -1,11 +1,11 @@
package mightypork.utils.objects; package mightypork.utils.objects;
/** /**
* Mutable object * Mutable object
* *
* @author MightyPork * @author MightyPork
* @param <T> * @param <T> type
* type
*/ */
public class Mutable<T> { public class Mutable<T> {
@ -16,8 +16,7 @@ public class Mutable<T> {
/** /**
* New mutable object * New mutable object
* *
* @param o * @param o value
* value
*/ */
public Mutable(T o) { public Mutable(T o) {
this.o = o; this.o = o;
@ -38,8 +37,7 @@ public class Mutable<T> {
/** /**
* Set value * Set value
* *
* @param o * @param o new value to set
* new value to set
*/ */
public void set(T o) public void set(T o)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.objects; package mightypork.utils.objects;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -23,10 +24,8 @@ public class ObjectUtils {
/** /**
* Sort a map by keys, maintaining key-value pairs. * Sort a map by keys, maintaining key-value pairs.
* *
* @param map * @param map map to be sorted
* map to be sorted * @param comparator a comparator, or null for natural ordering
* @param comparator
* a comparator, or null for natural ordering
* @return linked hash map with sorted entries * @return linked hash map with sorted entries
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@ -54,10 +53,8 @@ public class ObjectUtils {
/** /**
* Sort a map by values, maintaining key-value pairs. * Sort a map by values, maintaining key-value pairs.
* *
* @param map * @param map map to be sorted
* map to be sorted * @param comparator a comparator, or null for natural ordering
* @param comparator
* a comparator, or null for natural ordering
* @return linked hash map with sorted entries * @return linked hash map with sorted entries
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")

@ -1,5 +1,6 @@
package mightypork.utils.objects; package mightypork.utils.objects;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
@ -8,10 +9,8 @@ import mightypork.utils.math.Calc;
* *
* @author MightyPork * @author MightyPork
* @copy (c) 2012 * @copy (c) 2012
* @param <T1> * @param <T1> 1st object class
* 1st object class * @param <T2> 2nd object class
* @param <T2>
* 2nd object class
*/ */
public class Pair<T1, T2> { public class Pair<T1, T2> {
@ -29,10 +28,8 @@ public class Pair<T1, T2> {
/** /**
* Make structure of 2 objects * Make structure of 2 objects
* *
* @param first * @param first 1st object
* 1st object * @param second 2nd object
* @param second
* 2nd object
*/ */
public Pair(T1 first, T2 second) { public Pair(T1 first, T2 second) {
this.first = first; this.first = first;

@ -1,5 +1,6 @@
package mightypork.utils.objects; package mightypork.utils.objects;
import mightypork.utils.math.Calc; import mightypork.utils.math.Calc;
@ -8,12 +9,9 @@ import mightypork.utils.math.Calc;
* *
* @author MightyPork * @author MightyPork
* @copy (c) 2012 * @copy (c) 2012
* @param <T1> * @param <T1> 1st object class
* 1st object class * @param <T2> 2nd object class
* @param <T2> * @param <T3> 3rd object class
* 2nd object class
* @param <T3>
* 3rd object class
*/ */
public class Triad<T1, T2, T3> extends Pair<T1, T2> { public class Triad<T1, T2, T3> extends Pair<T1, T2> {
@ -26,12 +24,9 @@ public class Triad<T1, T2, T3> extends Pair<T1, T2> {
/** /**
* Make structure of 3 objects * Make structure of 3 objects
* *
* @param objA * @param objA 1st object
* 1st object * @param objB 2nd object
* @param objB * @param objC 3rd object
* 2nd object
* @param objC
* 3rd object
*/ */
public Triad(T1 objA, T2 objB, T3 objC) { public Triad(T1 objA, T2 objB, T3 objC) {
super(objA, objB); super(objA, objB);
@ -51,8 +46,7 @@ public class Triad<T1, T2, T3> extends Pair<T1, T2> {
/** /**
* Set 1st object * Set 1st object
* *
* @param obj * @param obj 1st object
* 1st object
*/ */
public void setThird(T3 obj) public void setThird(T3 obj)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.objects; package mightypork.utils.objects;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
@ -20,28 +21,24 @@ import java.util.Map;
* *
* *
* *
*
* Object[] array = { &quot;one&quot;, 1, &quot;two&quot;, 4, &quot;three&quot;, 9, &quot;four&quot;, 16 }; * Object[] array = { &quot;one&quot;, 1, &quot;two&quot;, 4, &quot;three&quot;, 9, &quot;four&quot;, 16 };
* Map&lt;String, Integer&gt; args = new VarargsParser&lt;String, Integer&gt;().parse(array); * Map&lt;String, Integer&gt; args = new VarargsParser&lt;String, Integer&gt;().parse(array);
* </pre> * </pre>
* *
* @author MightyPork * @author MightyPork
* @param <K> * @param <K> Type for Map keys
* Type for Map keys * @param <V> Type for Map values
* @param <V>
* Type for Map values
*/ */
public class VarargsParser<K, V> { public class VarargsParser<K, V> {
/** /**
* Parse array of vararg key, value pairs to a LinkedHashMap. * Parse array of vararg key, value pairs to a LinkedHashMap.
* *
* @param args * @param args varargs
* varargs
* @return LinkedHashMap * @return LinkedHashMap
* @throws ClassCastException * @throws ClassCastException in case of incompatible type in the array
* in case of incompatible type in the array * @throws IllegalArgumentException in case of invalid array length (odd)
* @throws IllegalArgumentException
* in case of invalid array length (odd)
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Map<K, V> parse(Object... args) throws ClassCastException, IllegalArgumentException public Map<K, V> parse(Object... args) throws ClassCastException, IllegalArgumentException

@ -1,5 +1,6 @@
package mightypork.utils.patterns; package mightypork.utils.patterns;
/** /**
* Object that can be destroyed (free resources etc) * Object that can be destroyed (free resources etc)
* *

@ -1,19 +1,18 @@
package mightypork.utils.patterns.subscription; package mightypork.utils.patterns.subscription;
/** /**
* Something that can be handled by HANDLER. * Something that can be handled by HANDLER.
* *
* @author MightyPork * @author MightyPork
* @param <HANDLER> * @param <HANDLER> handler type
* handler type
*/ */
public interface Handleable<HANDLER> { public interface Handleable<HANDLER> {
/** /**
* Ask handler to handle this message. * Ask handler to handle this message.
* *
* @param handler * @param handler handler instance
* handler instance
*/ */
public void handleBy(HANDLER handler); public void handleBy(HANDLER handler);
} }

@ -1,5 +1,6 @@
package mightypork.utils.patterns.subscription; package mightypork.utils.patterns.subscription;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
@ -24,8 +25,7 @@ final public class MessageBus {
* Add a {@link MessageChannel} to this bus.<br> * Add a {@link MessageChannel} to this bus.<br>
* If a channel of matching types is already added, it is returned instead. * If a channel of matching types is already added, it is returned instead.
* *
* @param channel * @param channel channel to be added
* channel to be added
* @return the channel that's now in the bus * @return the channel that's now in the bus
*/ */
public MessageChannel<?, ?> addChannel(MessageChannel<?, ?> channel) public MessageChannel<?, ?> addChannel(MessageChannel<?, ?> channel)
@ -47,8 +47,7 @@ final public class MessageBus {
/** /**
* Remove a {@link MessageChannel} from this bus * Remove a {@link MessageChannel} from this bus
* *
* @param channel * @param channel true if channel was removed
* true if channel was removed
*/ */
public void removeChannel(MessageChannel<?, ?> channel) public void removeChannel(MessageChannel<?, ?> channel)
{ {
@ -59,8 +58,7 @@ final public class MessageBus {
/** /**
* Broadcast a message * Broadcast a message
* *
* @param message * @param message message
* message
* @return true if message was accepted by at least one channel * @return true if message was accepted by at least one channel
*/ */
public boolean broadcast(Object message) public boolean broadcast(Object message)
@ -81,8 +79,7 @@ final public class MessageBus {
* Connect a client to the bus. The client will be connected to all current * Connect a client to the bus. The client will be connected to all current
* and future channels, until removed from the bus. * and future channels, until removed from the bus.
* *
* @param client * @param client the client
* the client
* @return true on success * @return true on success
*/ */
public boolean subscribe(Object client) public boolean subscribe(Object client)
@ -98,8 +95,7 @@ final public class MessageBus {
/** /**
* Disconnect a client from the bus. * Disconnect a client from the bus.
* *
* @param client * @param client the client
* the client
*/ */
public void unsubscribe(Object client) public void unsubscribe(Object client)
{ {
@ -121,10 +117,8 @@ final public class MessageBus {
/** /**
* Add a channel for given message and client type. * Add a channel for given message and client type.
* *
* @param messageClass * @param messageClass message type
* message type * @param clientClass client type
* @param clientClass
* client type
* @return the created channel instance * @return the created channel instance
*/ */
public <F_MESSAGE extends Handleable<F_CLIENT>, F_CLIENT> MessageChannel<?, ?> createChannel(Class<F_MESSAGE> messageClass, Class<F_CLIENT> clientClass) public <F_MESSAGE extends Handleable<F_CLIENT>, F_CLIENT> MessageChannel<?, ?> createChannel(Class<F_MESSAGE> messageClass, Class<F_CLIENT> clientClass)

@ -1,5 +1,6 @@
package mightypork.utils.patterns.subscription; package mightypork.utils.patterns.subscription;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
@ -12,10 +13,8 @@ import mightypork.utils.patterns.subscription.clients.ToggleableClient;
* Message channel, module of {@link MessageBus} * Message channel, module of {@link MessageBus}
* *
* @author MightyPork * @author MightyPork
* @param <MESSAGE> * @param <MESSAGE> message type
* message type * @param <CLIENT> client (subscriber) type
* @param <CLIENT>
* client (subscriber) type
*/ */
final public class MessageChannel<MESSAGE extends Handleable<CLIENT>, CLIENT> { final public class MessageChannel<MESSAGE extends Handleable<CLIENT>, CLIENT> {
@ -36,10 +35,8 @@ final public class MessageChannel<MESSAGE extends Handleable<CLIENT>, CLIENT> {
* Try to broadcast a message.<br> * Try to broadcast a message.<br>
* If message is of wrong type, <code>false</code> is returned. * If message is of wrong type, <code>false</code> is returned.
* *
* @param message * @param message a message to be sent
* a message to be sent * @param clients collection of clients
* @param clients
* collection of clients
* @return true if message was accepted by this channel * @return true if message was accepted by this channel
*/ */
public boolean broadcast(Object message, Collection<Object> clients) public boolean broadcast(Object message, Collection<Object> clients)
@ -86,10 +83,8 @@ final public class MessageChannel<MESSAGE extends Handleable<CLIENT>, CLIENT> {
/** /**
* Send a message to a client. * Send a message to a client.
* *
* @param client * @param client target client
* target client * @param message message to send
* @param message
* message to send
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void sendTo(Object client, MESSAGE message) private void sendTo(Object client, MESSAGE message)
@ -104,8 +99,7 @@ final public class MessageChannel<MESSAGE extends Handleable<CLIENT>, CLIENT> {
* Check if the given message can be broadcasted by this * Check if the given message can be broadcasted by this
* {@link MessageChannel} * {@link MessageChannel}
* *
* @param message * @param message event object
* event object
* @return can be broadcasted * @return can be broadcasted
*/ */
public boolean canBroadcast(Object message) public boolean canBroadcast(Object message)
@ -152,10 +146,8 @@ final public class MessageChannel<MESSAGE extends Handleable<CLIENT>, CLIENT> {
/** /**
* Create an instance for given types * Create an instance for given types
* *
* @param messageClass * @param messageClass event class
* event class * @param clientClass client class
* @param clientClass
* client class
* @return the broadcaster * @return the broadcaster
*/ */
public static <F_MESSAGE extends Handleable<F_CLIENT>, F_CLIENT> MessageChannel<F_MESSAGE, F_CLIENT> create(Class<F_MESSAGE> messageClass, Class<F_CLIENT> clientClass) public static <F_MESSAGE extends Handleable<F_CLIENT>, F_CLIENT> MessageChannel<F_MESSAGE, F_CLIENT> create(Class<F_MESSAGE> messageClass, Class<F_CLIENT> clientClass)

@ -1,5 +1,6 @@
package mightypork.utils.patterns.subscription.clients; package mightypork.utils.patterns.subscription.clients;
import java.util.Collection; import java.util.Collection;

@ -1,5 +1,6 @@
package mightypork.utils.patterns.subscription.clients; package mightypork.utils.patterns.subscription.clients;
/** /**
* Client that can toggle receiving messages. * Client that can toggle receiving messages.
* *

@ -1,5 +1,6 @@
package mightypork.utils.string; package mightypork.utils.string;
/** /**
* General purpose string utilities * General purpose string utilities
* *
@ -10,12 +11,9 @@ public class StringUtils {
/** /**
* Get if string is in array * Get if string is in array
* *
* @param needle * @param needle checked string
* checked string * @param case_sensitive case sensitive comparision
* @param case_sensitive * @param haystack array of possible values
* case sensitive comparision
* @param haystack
* array of possible values
* @return is in array * @return is in array
*/ */
public static boolean isInArray(String needle, boolean case_sensitive, String... haystack) public static boolean isInArray(String needle, boolean case_sensitive, String... haystack)
@ -63,8 +61,7 @@ public class StringUtils {
/** /**
* Repeat a string * Repeat a string
* *
* @param repeated * @param repeated string
* string
* @param count * @param count
* @return output * @return output
*/ */
@ -80,8 +77,7 @@ public class StringUtils {
/** /**
* convert string to a same-length sequence of # marks * convert string to a same-length sequence of # marks
* *
* @param password * @param password password
* password
* @return encoded * @return encoded
*/ */
public static String passwordify(String password) public static String passwordify(String password)
@ -93,10 +89,8 @@ public class StringUtils {
/** /**
* convert string to a same-length sequence of chars * convert string to a same-length sequence of chars
* *
* @param password * @param password password
* password * @param replacing character used in output
* @param replacing
* character used in output
* @return encoded * @return encoded
*/ */
public static String passwordify(String password, String replacing) public static String passwordify(String password, String replacing)
@ -108,8 +102,7 @@ public class StringUtils {
/** /**
* Get ordinal version of numbers (1 = 1st, 5 = 5th etc.) * Get ordinal version of numbers (1 = 1st, 5 = 5th etc.)
* *
* @param number * @param number number
* number
* @return ordinal, string * @return ordinal, string
*/ */
public static String numberToOrdinal(int number) public static String numberToOrdinal(int number)
@ -126,8 +119,7 @@ public class StringUtils {
/** /**
* Format number with thousands separated by a dot. * Format number with thousands separated by a dot.
* *
* @param number * @param number number
* number
* @return string 12.004.225 * @return string 12.004.225
*/ */
public static String formatInt(long number) public static String formatInt(long number)

@ -1,5 +1,6 @@
package mightypork.utils.string.validation; package mightypork.utils.string.validation;
public interface CharValidator { public interface CharValidator {
public boolean isValid(char c); public boolean isValid(char c);

@ -1,5 +1,6 @@
package mightypork.utils.string.validation; package mightypork.utils.string.validation;
public class CharValidatorRegex implements CharValidator { public class CharValidatorRegex implements CharValidator {
private String formula; private String formula;

@ -1,5 +1,6 @@
package mightypork.utils.string.validation; package mightypork.utils.string.validation;
public class CharValidatorWhitelist implements CharValidator { public class CharValidatorWhitelist implements CharValidator {
private String whitelist; private String whitelist;

@ -1,5 +1,6 @@
package mightypork.utils.string.validation; package mightypork.utils.string.validation;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
@ -18,8 +19,7 @@ public class FileSuffixFilter implements FileFilter {
/** /**
* Suffix filter * Suffix filter
* *
* @param suffixes * @param suffixes var-args allowed suffixes, case insensitive
* var-args allowed suffixes, case insensitive
*/ */
public FileSuffixFilter(String... suffixes) { public FileSuffixFilter(String... suffixes) {
this.suffixes = suffixes; this.suffixes = suffixes;

@ -1,5 +1,6 @@
package mightypork.utils.string.validation; package mightypork.utils.string.validation;
public class FilenameCharValidator extends CharValidatorRegex { public class FilenameCharValidator extends CharValidatorRegex {
public FilenameCharValidator() { public FilenameCharValidator() {

@ -1,5 +1,6 @@
package mightypork.utils.string.validation; package mightypork.utils.string.validation;
/** /**
* Utility interface for string filters (accepting filepaths and similar) * Utility interface for string filters (accepting filepaths and similar)
* *

@ -1,5 +1,6 @@
package mightypork.utils.time; package mightypork.utils.time;
/** /**
* Class for counting FPS in games.<br> * Class for counting FPS in games.<br>
* This class can be used also as a simple frequency meter - output is in Hz. * This class can be used also as a simple frequency meter - output is in Hz.
@ -43,8 +44,7 @@ public class FpsMeter {
/** /**
* Notification that some frames have been dropped * Notification that some frames have been dropped
* *
* @param dropped * @param dropped dropped frames
* dropped frames
*/ */
public void drop(int dropped) public void drop(int dropped)
{ {

@ -1,5 +1,6 @@
package mightypork.utils.time; package mightypork.utils.time;
public interface Pauseable { public interface Pauseable {
/** /**

@ -1,5 +1,6 @@
package mightypork.utils.time; package mightypork.utils.time;
/** /**
* Timer for delta timing * Timer for delta timing
* *

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save