From b57ae900e5f539ffdb546697144a38803861445a Mon Sep 17 00:00:00 2001
From: Andrea Cavalli
Date: Sat, 22 Sep 2018 11:17:30 +0200
Subject: [PATCH] Code cleanup
---
.../main/java/it/cavallium/warppi/Engine.java | 50 +-
.../java/it/cavallium/warppi/Platform.java | 203 ++-
.../java/it/cavallium/warppi/StaticVars.java | 7 +-
.../java/it/cavallium/warppi/TestDrivers.java | 14 +-
.../java/it/cavallium/warppi/boot/Boot.java | 12 +-
.../warppi/boot/StartupArguments.java | 32 +-
.../warppi/boot/StartupArgumentsImpl.java | 30 +-
.../it/cavallium/warppi/device/CacheFile.java | 14 +-
.../warppi/device/HardwareDevice.java | 6 +-
.../warppi/device/HardwareTouchDevice.java | 16 +-
.../cavallium/warppi/device/InputManager.java | 6 +-
.../it/cavallium/warppi/device/Keyboard.java | 696 ++++----
.../warppi/device/KeyboardJogampValues.java | 356 ++--
.../warppi/device/PIHardwareDisplay.java | 7 +-
.../warppi/device/PIHardwareTouchDevice.java | 56 +-
.../warppi/device/chip/ParallelToSerial.java | 2 +-
.../warppi/device/chip/SerialToParallel.java | 8 +-
.../warppi/device/graphicengine/RAWFont.java | 62 +-
.../it/cavallium/warppi/event/KeyEvent.java | 2 +-
.../warppi/event/KeyPressedEvent.java | 4 +-
.../warppi/event/KeyReleasedEvent.java | 4 +-
.../warppi/event/KeyboardEventListener.java | 4 +-
.../warppi/event/TouchCancelEvent.java | 10 +-
.../cavallium/warppi/event/TouchEndEvent.java | 10 +-
.../it/cavallium/warppi/event/TouchEvent.java | 4 +-
.../warppi/event/TouchEventListener.java | 8 +-
.../warppi/event/TouchMoveEvent.java | 10 +-
.../it/cavallium/warppi/event/TouchPoint.java | 8 +-
.../warppi/event/TouchStartEvent.java | 10 +-
.../warppi/extra/mario/MarioBlock.java | 4 +-
.../warppi/extra/mario/MarioEnemy.java | 2 +-
.../warppi/extra/mario/MarioEntity.java | 28 +-
.../warppi/extra/mario/MarioGame.java | 102 +-
.../warppi/extra/mario/MarioWorld.java | 14 +-
.../warppi/extra/mario/PlayerEntity.java | 58 +-
.../warppi/flow/BehaviorSubject.java | 30 +-
.../it/cavallium/warppi/flow/Consumer.java | 4 +-
.../it/cavallium/warppi/flow/Disposable.java | 4 +-
.../warppi/flow/IntervalsManager.java | 24 +-
.../it/cavallium/warppi/flow/Observable.java | 76 +-
.../flow/ObservableCombinedChanged.java | 40 +-
.../warppi/flow/ObservableCombinedLatest.java | 37 +-
.../warppi/flow/ObservableInterval.java | 22 +-
.../cavallium/warppi/flow/ObservableMap.java | 27 +-
.../warppi/flow/ObservableMerged.java | 42 +-
.../warppi/flow/ObservableSource.java | 2 +-
.../warppi/flow/ObservableZipped.java | 37 +-
.../it/cavallium/warppi/flow/Observer.java | 8 +-
.../cavallium/warppi/flow/SimpleSubject.java | 21 +-
.../it/cavallium/warppi/flow/Subject.java | 15 +-
.../it/cavallium/warppi/flow/Subscriber.java | 2 +-
.../it/cavallium/warppi/flow/TestFlow.java | 40 +-
.../cavallium/warppi/gui/CalculatorHUD.java | 46 +-
.../cavallium/warppi/gui/DisplayManager.java | 178 +-
.../cavallium/warppi/gui/GUIErrorMessage.java | 6 +-
.../it/cavallium/warppi/gui/GraphicUtils.java | 40 +-
.../warppi/gui/GraphicalElement.java | 14 +-
.../warppi/gui/GraphicalInterface.java | 12 +-
.../cavallium/warppi/gui/HardwareDisplay.java | 6 +-
.../warppi/gui/expression/Caret.java | 20 +-
.../warppi/gui/expression/ExtraMenu.java | 4 +-
.../warppi/gui/expression/InputContext.java | 2 +-
.../warppi/gui/expression/blocks/Block.java | 4 +-
.../gui/expression/blocks/BlockChar.java | 14 +-
.../gui/expression/blocks/BlockContainer.java | 155 +-
.../gui/expression/blocks/BlockDivision.java | 21 +-
.../blocks/BlockExponentialNotation.java | 2 +-
.../gui/expression/blocks/BlockLogarithm.java | 45 +-
.../expression/blocks/BlockNumericChar.java | 2 +-
.../expression/blocks/BlockParenthesis.java | 4 +-
.../blocks/BlockParenthesisAbstract.java | 28 +-
.../gui/expression/blocks/BlockPower.java | 18 +-
.../gui/expression/blocks/BlockPower2.java | 20 +-
.../gui/expression/blocks/BlockReference.java | 9 +-
.../gui/expression/blocks/BlockSine.java | 2 +-
.../expression/blocks/BlockSquareRoot.java | 20 +-
.../gui/expression/blocks/BlockUndefined.java | 12 +-
.../gui/expression/blocks/BlockVariable.java | 47 +-
.../containers/InlineInputContainer.java | 8 +-
.../expression/containers/InputContainer.java | 60 +-
.../containers/NormalInputContainer.java | 28 +-
.../containers/NormalOutputContainer.java | 4 +-
.../containers/OutputContainer.java | 41 +-
.../gui/expression/layouts/InputLayout.java | 2 +-
.../warppi/gui/graphicengine/BinaryFont.java | 6 +-
.../gui/graphicengine/GraphicEngine.java | 44 +-
.../warppi/gui/graphicengine/Renderer.java | 43 +-
.../gui/graphicengine/RenderingLoop.java | 2 +-
.../warppi/gui/graphicengine/Skin.java | 12 +-
.../graphicengine/impl/common/PngSkin.java | 15 +-
.../graphicengine/impl/common/RFTFont.java | 111 +-
.../graphicengine/impl/nogui/NoGuiEngine.java | 79 +-
.../screens/ChooseVariableValueScreen.java | 6 +-
.../warppi/gui/screens/EmptyScreen.java | 2 +-
.../gui/screens/KeyboardDebugScreen.java | 118 +-
.../warppi/gui/screens/LoadingScreen.java | 5 +-
.../warppi/gui/screens/MarioScreen.java | 81 +-
.../warppi/gui/screens/MathInputScreen.java | 211 +--
.../warppi/gui/screens/SolveForXScreen.java | 6 +-
.../it/cavallium/warppi/math/Function.java | 30 +-
.../warppi/math/FunctionDynamic.java | 44 +-
.../warppi/math/FunctionOperator.java | 58 +-
.../cavallium/warppi/math/FunctionSingle.java | 40 +-
.../it/cavallium/warppi/math/MathContext.java | 8 +-
.../warppi/math/MathematicalSymbols.java | 33 +-
.../warppi/math/functions/Division.java | 12 +-
.../warppi/math/functions/EmptyNumber.java | 12 +-
.../warppi/math/functions/Expression.java | 130 +-
.../cavallium/warppi/math/functions/Joke.java | 10 +-
.../warppi/math/functions/Logarithm.java | 12 +-
.../warppi/math/functions/Multiplication.java | 34 +-
.../warppi/math/functions/Negative.java | 15 +-
.../warppi/math/functions/Number.java | 96 +-
.../warppi/math/functions/Power.java | 9 +-
.../cavallium/warppi/math/functions/Root.java | 6 +-
.../warppi/math/functions/RootSquare.java | 11 +-
.../warppi/math/functions/Subtraction.java | 6 +-
.../cavallium/warppi/math/functions/Sum.java | 11 +-
.../warppi/math/functions/SumSubtraction.java | 6 +-
.../warppi/math/functions/Undefined.java | 12 +-
.../warppi/math/functions/Variable.java | 23 +-
.../math/functions/equations/Equation.java | 13 +-
.../functions/equations/EquationResult.java | 2 +-
.../functions/equations/EquationsSystem.java | 8 +-
.../equations/EquationsSystemPart.java | 6 +-
.../functions/trigonometry/ArcCosine.java | 6 +-
.../math/functions/trigonometry/ArcSine.java | 6 +-
.../functions/trigonometry/ArcTangent.java | 6 +-
.../math/functions/trigonometry/Cosine.java | 6 +-
.../math/functions/trigonometry/Sine.java | 12 +-
.../math/functions/trigonometry/Tangent.java | 6 +-
.../warppi/math/parser/MathParser.java | 121 +-
.../warppi/math/parser/MathParserStep.java | 10 +-
.../math/parser/features/FeatureChar.java | 4 +-
.../math/parser/features/FeatureDivision.java | 4 +-
.../parser/features/FeatureDoubleImpl.java | 6 +-
.../parser/features/FeatureLogarithm.java | 4 +-
.../features/FeatureMultiplication.java | 4 +-
.../math/parser/features/FeatureNumber.java | 20 +-
.../parser/features/FeatureParenthesis.java | 4 +-
.../math/parser/features/FeaturePower.java | 4 +-
.../parser/features/FeaturePowerChar.java | 4 +-
.../math/parser/features/FeatureSine.java | 4 +-
.../parser/features/FeatureSingleImpl.java | 4 +-
.../parser/features/FeatureSquareRoot.java | 4 +-
.../parser/features/FeatureSubtraction.java | 4 +-
.../math/parser/features/FeatureSum.java | 4 +-
.../features/FeatureSumSubtraction.java | 4 +-
.../math/parser/features/FeatureVariable.java | 4 +-
.../parser/features/interfaces/Feature.java | 2 +-
.../features/interfaces/FeatureDouble.java | 8 +-
.../features/interfaces/FeatureMultiple.java | 12 +-
.../features/interfaces/FeatureSingle.java | 4 +-
.../steps/AddImplicitMultiplications.java | 9 +-
.../steps/FixMultiplicationsAndDivisions.java | 17 +-
.../parser/steps/FixSingleFunctionArgs.java | 13 +-
.../parser/steps/FixSumsAndSubtractions.java | 17 +-
.../parser/steps/JoinNumberAndVariables.java | 9 +-
.../math/parser/steps/RemoveParentheses.java | 11 +-
.../it/cavallium/warppi/math/rules/Rule.java | 14 +-
.../warppi/math/rules/RulesManager.java | 107 +-
.../math/rules/methods/DivisionRule1.java | 34 +-
.../rules/methods/MultiplicationMethod1.java | 18 +-
.../warppi/math/rules/methods/SumMethod1.java | 29 +-
.../warppi/math/solver/MathSolver.java | 76 +-
.../warppi/math/solver/SolveMethod.java | 4 +-
.../it/cavallium/warppi/util/CacheUtils.java | 33 +-
.../java/it/cavallium/warppi/util/Error.java | 6 +-
.../it/cavallium/warppi/util/IntWrapper.java | 2 +-
.../it/cavallium/warppi/util/ScriptUtils.java | 5 +-
.../java/it/cavallium/warppi/util/Utils.java | 404 ++---
.../main/java/org/nevec/rjm/Bernoulli.java | 56 +-
.../main/java/org/nevec/rjm/BigComplex.java | 56 +-
.../java/org/nevec/rjm/BigDecimalMath.java | 1546 ++++++++---------
.../java/org/nevec/rjm/BigIntegerMath.java | 223 +--
.../java/org/nevec/rjm/BigIntegerPoly.java | 217 +--
core/src/main/java/org/nevec/rjm/BigSurd.java | 147 +-
.../main/java/org/nevec/rjm/BigSurdVec.java | 213 +--
core/src/main/java/org/nevec/rjm/Euler.java | 38 +-
.../src/main/java/org/nevec/rjm/EulerPhi.java | 22 +-
.../main/java/org/nevec/rjm/Factorial.java | 30 +-
.../src/main/java/org/nevec/rjm/Harmonic.java | 15 +-
core/src/main/java/org/nevec/rjm/Ifactor.java | 215 +--
.../main/java/org/nevec/rjm/PartitionsP.java | 51 +-
core/src/main/java/org/nevec/rjm/Prime.java | 157 +-
core/src/main/java/org/nevec/rjm/RatPoly.java | 274 ++-
.../src/main/java/org/nevec/rjm/Rational.java | 329 ++--
.../java/org/nevec/rjm/SafeMathContext.java | 2 +-
.../src/main/java/org/nevec/rjm/Wigner3j.java | 157 +-
.../main/java/org/nevec/rjm/Wigner3jGUI.java | 20 +-
.../java/it/cavallium/warppi/AppTest.java | 49 +-
.../cavallium/warppi/desktop/DesktopBoot.java | 2 +-
.../warppi/desktop/DesktopConsoleUtils.java | 64 +-
.../cavallium/warppi/desktop/DesktopGpio.java | 25 +-
.../warppi/desktop/DesktopPlatform.java | 54 +-
.../warppi/desktop/DesktopPngReader.java | 29 +-
.../warppi/desktop/DesktopPngUtils.java | 2 +-
.../warppi/desktop/DesktopSemaphore.java | 4 +-
.../warppi/desktop/DesktopSettings.java | 6 +-
.../warppi/desktop/DesktopStorageUtils.java | 82 +-
.../warppi/desktop/DesktopURLClassLoader.java | 2 +-
.../jansi24bitcolors/JAnsi24bitEngine.java | 102 +-
.../impl/jansi24bitcolors/JAnsi24bitFont.java | 8 +-
.../jansi24bitcolors/JAnsi24bitRenderer.java | 152 +-
.../impl/jansi24bitcolors/JAnsi24bitSkin.java | 21 +-
.../impl/jansi256colors/JAnsi256Engine.java | 74 +-
.../impl/jansi256colors/JAnsi256Font.java | 8 +-
.../impl/jansi256colors/JAnsi256Renderer.java | 168 +-
.../impl/jansi256colors/JAnsi256Skin.java | 23 +-
.../impl/jansi8colors/JAnsi8Engine.java | 74 +-
.../impl/jansi8colors/JAnsi8Font.java | 8 +-
.../impl/jansi8colors/JAnsi8Renderer.java | 193 +-
.../impl/jansi8colors/JAnsi8Skin.java | 20 +-
.../impl/swing/SwingAdvancedButton.java | 64 +-
.../graphicengine/impl/swing/SwingEngine.java | 41 +-
.../graphicengine/impl/swing/SwingFont.java | 9 +-
.../impl/swing/SwingRenderer.java | 182 +-
.../graphicengine/impl/swing/SwingSkin.java | 7 +-
.../graphicengine/impl/swing/SwingWindow.java | 175 +-
.../graphicengine/impl/jogl/JOGLEngine.java | 47 +-
.../gui/graphicengine/impl/jogl/JOGLFont.java | 87 +-
.../graphicengine/impl/jogl/JOGLRenderer.java | 205 +--
.../gui/graphicengine/impl/jogl/JOGLSkin.java | 14 +-
.../graphicengine/impl/jogl/NEWTWindow.java | 177 +-
.../main/java/cz/adamh/utils/NativeUtils.java | 37 +-
.../it/cavallium/warppi/MmapByteBuffer.java | 2 +-
.../impl/framebuffer/FBEngine.java | 46 +-
.../impl/framebuffer/FBFont.java | 12 +-
.../impl/framebuffer/FBRenderer.java | 40 +-
.../impl/framebuffer/FBSkin.java | 7 +-
.../warppi/hardware/HardwareBoot.java | 2 +-
.../warppi/hardware/HardwareConsoleUtils.java | 64 +-
.../warppi/hardware/HardwareGpio.java | 14 +-
.../warppi/hardware/HardwarePlatform.java | 45 +-
.../warppi/hardware/HardwarePngReader.java | 29 +-
.../warppi/hardware/HardwarePngUtils.java | 2 +-
.../warppi/hardware/HardwareSemaphore.java | 4 +-
.../warppi/hardware/HardwareSettings.java | 6 +-
.../warppi/hardware/HardwareStorageUtils.java | 82 +-
.../hardware/HardwareURLClassLoader.java | 2 +-
rules/src/main/java/rules/ExpandRule1.java | 84 +-
rules/src/main/java/rules/ExpandRule2.java | 25 +-
rules/src/main/java/rules/ExpandRule5.java | 33 +-
rules/src/main/java/rules/ExponentRule1.java | 19 +-
rules/src/main/java/rules/ExponentRule15.java | 30 +-
rules/src/main/java/rules/ExponentRule16.java | 43 +-
rules/src/main/java/rules/ExponentRule17.java | 26 +-
rules/src/main/java/rules/ExponentRule2.java | 18 +-
rules/src/main/java/rules/ExponentRule3.java | 16 +-
rules/src/main/java/rules/ExponentRule4.java | 34 +-
rules/src/main/java/rules/ExponentRule8.java | 21 +-
rules/src/main/java/rules/ExponentRule9.java | 24 +-
rules/src/main/java/rules/FractionsRule1.java | 28 +-
.../src/main/java/rules/FractionsRule10.java | 16 +-
.../src/main/java/rules/FractionsRule11.java | 26 +-
.../src/main/java/rules/FractionsRule12.java | 25 +-
.../src/main/java/rules/FractionsRule14.java | 43 +-
rules/src/main/java/rules/FractionsRule2.java | 20 +-
rules/src/main/java/rules/FractionsRule3.java | 16 +-
rules/src/main/java/rules/FractionsRule4.java | 26 +-
rules/src/main/java/rules/FractionsRule5.java | 40 +-
rules/src/main/java/rules/FractionsRule6.java | 22 +-
rules/src/main/java/rules/FractionsRule7.java | 19 +-
rules/src/main/java/rules/FractionsRule8.java | 13 +-
rules/src/main/java/rules/FractionsRule9.java | 10 +-
rules/src/main/java/rules/NumberRule1.java | 23 +-
rules/src/main/java/rules/NumberRule2.java | 31 +-
rules/src/main/java/rules/NumberRule3.java | 33 +-
rules/src/main/java/rules/NumberRule4.java | 16 +-
rules/src/main/java/rules/NumberRule5.java | 31 +-
rules/src/main/java/rules/NumberRule7.java | 16 +-
rules/src/main/java/rules/UndefinedRule1.java | 18 +-
rules/src/main/java/rules/UndefinedRule2.java | 20 +-
rules/src/main/java/rules/VariableRule1.java | 33 +-
rules/src/main/java/rules/VariableRule2.java | 33 +-
rules/src/main/java/rules/VariableRule3.java | 33 +-
.../java/rules/functions/DivisionRule.java | 19 +-
.../java/rules/functions/EmptyNumberRule.java | 4 +-
.../java/rules/functions/ExpressionRule.java | 6 +-
.../main/java/rules/functions/JokeRule.java | 4 +-
.../rules/functions/MultiplicationRule.java | 12 +-
.../java/rules/functions/NegativeRule.java | 19 +-
.../main/java/rules/functions/NumberRule.java | 17 +-
.../main/java/rules/functions/PowerRule.java | 18 +-
.../main/java/rules/functions/RootRule.java | 32 +-
.../java/rules/functions/SubtractionRule.java | 12 +-
.../main/java/rules/functions/SumRule.java | 14 +-
.../rules/functions/SumSubtractionRule.java | 12 +-
.../java/rules/functions/VariableRule.java | 13 +-
.../ar/com/hjg/pngj/BufferedStreamFeeder.java | 355 ++--
.../java/ar/com/hjg/pngj/ChunkReader.java | 391 +++--
.../ar/com/hjg/pngj/ChunkSeqBuffering.java | 36 +-
.../java/ar/com/hjg/pngj/ChunkSeqReader.java | 720 ++++----
.../ar/com/hjg/pngj/ChunkSeqReaderPng.java | 491 +++---
.../ar/com/hjg/pngj/ChunkSeqSkipping.java | 100 +-
.../ar/com/hjg/pngj/DeflatedChunkReader.java | 125 +-
.../ar/com/hjg/pngj/DeflatedChunksSet.java | 723 ++++----
.../java/ar/com/hjg/pngj/Deinterlacer.java | 342 ++--
.../main/java/ar/com/hjg/pngj/FilterType.java | 203 +--
.../java/ar/com/hjg/pngj/IBytesConsumer.java | 18 +-
.../java/ar/com/hjg/pngj/IChunkFactory.java | 15 +-
.../java/ar/com/hjg/pngj/IDatChunkWriter.java | 201 +--
.../main/java/ar/com/hjg/pngj/IImageLine.java | 63 +-
.../java/ar/com/hjg/pngj/IImageLineArray.java | 29 +-
.../ar/com/hjg/pngj/IImageLineFactory.java | 2 +-
.../java/ar/com/hjg/pngj/IImageLineSet.java | 79 +-
.../ar/com/hjg/pngj/IImageLineSetFactory.java | 40 +-
.../ar/com/hjg/pngj/IPngWriterFactory.java | 2 +-
.../main/java/ar/com/hjg/pngj/IdatSet.java | 412 ++---
.../main/java/ar/com/hjg/pngj/ImageInfo.java | 442 ++---
.../java/ar/com/hjg/pngj/ImageLineByte.java | 319 ++--
.../java/ar/com/hjg/pngj/ImageLineHelper.java | 835 +++++----
.../java/ar/com/hjg/pngj/ImageLineInt.java | 350 ++--
.../ar/com/hjg/pngj/ImageLineSetDefault.java | 260 +--
.../ar/com/hjg/pngj/PngHelperInternal.java | 541 +++---
.../ar/com/hjg/pngj/PngHelperInternal2.java | 44 +-
.../main/java/ar/com/hjg/pngj/PngReader.java | 1073 ++++++------
.../java/ar/com/hjg/pngj/PngReaderApng.java | 336 ++--
.../java/ar/com/hjg/pngj/PngReaderByte.java | 32 +-
.../java/ar/com/hjg/pngj/PngReaderFilter.java | 134 +-
.../java/ar/com/hjg/pngj/PngReaderInt.java | 44 +-
.../main/java/ar/com/hjg/pngj/PngWriter.java | 806 ++++-----
.../java/ar/com/hjg/pngj/PngWriterHc.java | 36 +-
.../ar/com/hjg/pngj/PngjBadCrcException.java | 20 +-
.../java/ar/com/hjg/pngj/PngjException.java | 20 +-
.../com/hjg/pngj/PngjExceptionInternal.java | 27 +-
.../ar/com/hjg/pngj/PngjInputException.java | 20 +-
.../ar/com/hjg/pngj/PngjOutputException.java | 20 +-
.../hjg/pngj/PngjUnsupportedException.java | 29 +-
.../main/java/ar/com/hjg/pngj/RowInfo.java | 90 +-
.../hjg/pngj/chunks/ChunkCopyBehaviour.java | 160 +-
.../ar/com/hjg/pngj/chunks/ChunkFactory.java | 181 +-
.../ar/com/hjg/pngj/chunks/ChunkHelper.java | 483 ++---
.../hjg/pngj/chunks/ChunkLoadBehaviour.java | 37 +-
.../com/hjg/pngj/chunks/ChunkPredicate.java | 14 +-
.../java/ar/com/hjg/pngj/chunks/ChunkRaw.java | 268 +--
.../ar/com/hjg/pngj/chunks/ChunksList.java | 265 ++-
.../hjg/pngj/chunks/ChunksListForWrite.java | 310 ++--
.../pngj/chunks/PngBadCharsetException.java | 20 +-
.../java/ar/com/hjg/pngj/chunks/PngChunk.java | 351 ++--
.../ar/com/hjg/pngj/chunks/PngChunkACTL.java | 74 +-
.../ar/com/hjg/pngj/chunks/PngChunkBKGD.java | 172 +-
.../ar/com/hjg/pngj/chunks/PngChunkCHRM.java | 108 +-
.../ar/com/hjg/pngj/chunks/PngChunkFCTL.java | 240 +--
.../ar/com/hjg/pngj/chunks/PngChunkFDAT.java | 94 +-
.../ar/com/hjg/pngj/chunks/PngChunkGAMA.java | 60 +-
.../ar/com/hjg/pngj/chunks/PngChunkHIST.java | 70 +-
.../ar/com/hjg/pngj/chunks/PngChunkICCP.java | 107 +-
.../ar/com/hjg/pngj/chunks/PngChunkIDAT.java | 35 +-
.../ar/com/hjg/pngj/chunks/PngChunkIEND.java | 38 +-
.../ar/com/hjg/pngj/chunks/PngChunkIHDR.java | 285 ++-
.../ar/com/hjg/pngj/chunks/PngChunkITXT.java | 169 +-
.../com/hjg/pngj/chunks/PngChunkMultiple.java | 29 +-
.../ar/com/hjg/pngj/chunks/PngChunkOFFS.java | 112 +-
.../ar/com/hjg/pngj/chunks/PngChunkPHYS.java | 154 +-
.../ar/com/hjg/pngj/chunks/PngChunkPLTE.java | 139 +-
.../ar/com/hjg/pngj/chunks/PngChunkSBIT.java | 174 +-
.../ar/com/hjg/pngj/chunks/PngChunkSPLT.java | 200 ++-
.../ar/com/hjg/pngj/chunks/PngChunkSRGB.java | 66 +-
.../ar/com/hjg/pngj/chunks/PngChunkSTER.java | 68 +-
.../com/hjg/pngj/chunks/PngChunkSingle.java | 62 +-
.../ar/com/hjg/pngj/chunks/PngChunkTEXT.java | 54 +-
.../ar/com/hjg/pngj/chunks/PngChunkTIME.java | 115 +-
.../ar/com/hjg/pngj/chunks/PngChunkTRNS.java | 235 +--
.../com/hjg/pngj/chunks/PngChunkTextVar.java | 84 +-
.../com/hjg/pngj/chunks/PngChunkUNKNOWN.java | 44 +-
.../ar/com/hjg/pngj/chunks/PngChunkZTXT.java | 85 +-
.../ar/com/hjg/pngj/chunks/PngMetadata.java | 383 ++--
.../com/hjg/pngj/pixels/CompressorStream.java | 260 +--
.../pngj/pixels/CompressorStreamDeflater.java | 163 +-
.../hjg/pngj/pixels/CompressorStreamLz4.java | 140 +-
.../hjg/pngj/pixels/DeflaterEstimatorHjg.java | 416 +++--
.../hjg/pngj/pixels/DeflaterEstimatorLz4.java | 433 +++--
.../hjg/pngj/pixels/FiltersPerformance.java | 351 ++--
.../ar/com/hjg/pngj/pixels/PixelsWriter.java | 431 ++---
.../hjg/pngj/pixels/PixelsWriterDefault.java | 258 +--
.../hjg/pngj/pixels/PixelsWriterMultiple.java | 409 +++--
.../gui/graphicengine/html/HtmlEngine.java | 171 +-
.../gui/graphicengine/html/HtmlFont.java | 40 +-
.../gui/graphicengine/html/HtmlRenderer.java | 173 +-
.../gui/graphicengine/html/HtmlSkin.java | 29 +-
.../it/cavallium/warppi/teavm/TeaVMBoot.java | 2 +-
.../warppi/teavm/TeaVMConsoleUtils.java | 66 +-
.../it/cavallium/warppi/teavm/TeaVMGpio.java | 20 +-
.../cavallium/warppi/teavm/TeaVMPlatform.java | 47 +-
.../warppi/teavm/TeaVMPngReader.java | 29 +-
.../cavallium/warppi/teavm/TeaVMPngUtils.java | 2 +-
.../warppi/teavm/TeaVMSemaphore.java | 26 +-
.../cavallium/warppi/teavm/TeaVMSettings.java | 6 +-
.../warppi/teavm/TeaVMStorageUtils.java | 216 ++-
.../warppi/teavm/TeaVMURLClassLoader.java | 8 +-
391 files changed, 15558 insertions(+), 16635 deletions(-)
diff --git a/core/src/main/java/it/cavallium/warppi/Engine.java b/core/src/main/java/it/cavallium/warppi/Engine.java
index df7b2e0b..7b9fa42d 100644
--- a/core/src/main/java/it/cavallium/warppi/Engine.java
+++ b/core/src/main/java/it/cavallium/warppi/Engine.java
@@ -21,15 +21,14 @@ public class Engine {
private static Platform platform;
private static boolean running = false;
private static BehaviorSubject loadPhase = BehaviorSubject.create();
- private BehaviorSubject loaded = BehaviorSubject.create(false);
+ private final BehaviorSubject loaded = BehaviorSubject.create(false);
private HardwareDevice hardwareDevice;
- private Engine() {
- }
+ private Engine() {}
/**
* Start an instance of the calculator.
- *
+ *
* @param platform
* Platform implementation
* @param screen
@@ -43,32 +42,34 @@ public class Engine {
* @throws InterruptedException
* @throws IOException
*/
- public static void start(Platform platform, Screen screen, HardwareDisplay disp, HardwareTouchDevice touchdevice, HUD hud,
- StartupArguments args) throws InterruptedException, IOException {
- if (running) {
+ public static void start(final Platform platform, final Screen screen, final HardwareDisplay disp,
+ final HardwareTouchDevice touchdevice, final HUD hud, final StartupArguments args)
+ throws InterruptedException, IOException {
+ if (Engine.running)
throw new RuntimeException("Already running!");
- } else {
- running = true;
- INSTANCE.startInstance(platform, screen, disp, touchdevice, hud, args);
+ else {
+ Engine.running = true;
+ Engine.INSTANCE.startInstance(platform, screen, disp, touchdevice, hud, args);
}
}
- private void startInstance(final Platform platform, Screen screen, HardwareDisplay disp, HardwareTouchDevice touchdevice, HUD hud,
- StartupArguments args) throws InterruptedException, IOException {
+ private void startInstance(final Platform platform, final Screen screen, final HardwareDisplay disp,
+ final HardwareTouchDevice touchdevice, final HUD hud, final StartupArguments args)
+ throws InterruptedException, IOException {
Engine.platform = platform;
platform.getConsoleUtils().out().println("WarpPI Calculator");
initializeEnvironment(args);
- Thread currentThread = Thread.currentThread();
+ final Thread currentThread = Thread.currentThread();
currentThread.setPriority(Thread.MAX_PRIORITY);
Engine.getPlatform().setThreadName(currentThread, "Main thread");
- DisplayManager dm = new DisplayManager(disp, hud, screen, "WarpPI Calculator by Andrea Cavalli (@Cavallium)");
- Keyboard k = new Keyboard();
- InputManager im = new InputManager(k, touchdevice);
+ final DisplayManager dm = new DisplayManager(disp, hud, screen, "WarpPI Calculator by Andrea Cavalli (@Cavallium)");
+ final Keyboard k = new Keyboard();
+ final InputManager im = new InputManager(k, touchdevice);
hardwareDevice = new HardwareDevice(dm, im);
-
- hardwareDevice.setup(() -> loadPhase.onNext(new LoadingStatus()));
+
+ hardwareDevice.setup(() -> Engine.loadPhase.onNext(new LoadingStatus()));
}
private void onShutdown() {
@@ -79,13 +80,12 @@ public class Engine {
Engine.getPlatform().exit(0);
}
- private void initializeEnvironment(StartupArguments args) throws IOException {
+ private void initializeEnvironment(final StartupArguments args) throws IOException {
ClassUtils.classLoader = this.getClass();
StaticVars.startupArguments = args;
StaticVars.debugWindow2x = args.isZoomed();
- if (args.isVerboseLoggingEnabled() || args.isDebugEnabled()) {
+ if (args.isVerboseLoggingEnabled() || args.isDebugEnabled())
StaticVars.outputLevel = ConsoleUtils.OUTPUTLEVEL_DEBUG_VERBOSE;
- }
Engine.platform.getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, args);
checkDeviceType();
if (Engine.getPlatform().isRunningOnRaspberry() && args.isRaspberryModeAllowed()) {
@@ -111,15 +111,15 @@ public class Engine {
}
public Observable getLoadPhase() {
- return loadPhase;
+ return Engine.loadPhase;
}
-
+
public HardwareDevice getHardwareDevice() {
return hardwareDevice;
}
-
+
public static Platform getPlatform() {
- return platform;
+ return Engine.platform;
}
public static class LoadingStatus {
diff --git a/core/src/main/java/it/cavallium/warppi/Platform.java b/core/src/main/java/it/cavallium/warppi/Platform.java
index 8bad5737..592579f9 100644
--- a/core/src/main/java/it/cavallium/warppi/Platform.java
+++ b/core/src/main/java/it/cavallium/warppi/Platform.java
@@ -14,166 +14,189 @@ import it.cavallium.warppi.util.Error;
public interface Platform {
- public ConsoleUtils getConsoleUtils();
- public Gpio getGpio();
- public StorageUtils getStorageUtils();
- public PngUtils getPngUtils();
- public Settings getSettings();
+ ConsoleUtils getConsoleUtils();
- public void setThreadName(Thread t, String name);
- public void setThreadDaemon(Thread t);
- public void setThreadDaemon(Thread t, boolean value);
+ Gpio getGpio();
- public void exit(int value);
- public void gc();
+ StorageUtils getStorageUtils();
- public boolean isJavascript();
- public boolean isRunningOnRaspberry();
-
- public String getOsName();
+ PngUtils getPngUtils();
- public void alphaChanged(boolean val);
- public void shiftChanged(boolean val);
+ Settings getSettings();
- public Semaphore newSemaphore();
- public Semaphore newSemaphore(int i);
-
- public URLClassLoader newURLClassLoader(URL[] urls);
+ void setThreadName(Thread t, String name);
- public Map getEnginesList();
- public GraphicEngine getEngine(String string) throws NullPointerException;
+ void setThreadDaemon(Thread t);
- public void throwNewExceptionInInitializerError(String text);
- public String[] stacktraceToString(Error e);
+ void setThreadDaemon(Thread t, boolean value);
- public void loadPlatformRules();
- public void zip(String targetPath, String destinationFilePath, String password);
- public void unzip(String targetZipFilePath, String destinationFolderPath, String password);
+ void exit(int value);
- public boolean compile(String[] command, PrintWriter printWriter, PrintWriter errors);
+ void gc();
+
+ boolean isJavascript();
+
+ boolean isRunningOnRaspberry();
+
+ String getOsName();
+
+ void alphaChanged(boolean val);
+
+ void shiftChanged(boolean val);
+
+ Semaphore newSemaphore();
+
+ Semaphore newSemaphore(int i);
+
+ URLClassLoader newURLClassLoader(URL[] urls);
+
+ Map getEnginesList();
+
+ GraphicEngine getEngine(String string) throws NullPointerException;
+
+ void throwNewExceptionInInitializerError(String text);
+
+ String[] stacktraceToString(Error e);
+
+ void loadPlatformRules();
+
+ void zip(String targetPath, String destinationFilePath, String password);
+
+ void unzip(String targetZipFilePath, String destinationFolderPath, String password);
+
+ boolean compile(String[] command, PrintWriter printWriter, PrintWriter errors);
public interface Gpio {
- public int valueOutput();
- public int valuePwmOutput();
- public int valueInput();
- public int valueHigh();
- public int valueLow();
- public Object valueUnknownBoardType();
+ int valueOutput();
- public void wiringPiSetupPhys();
+ int valuePwmOutput();
- public void pinMode(int i, int type);
+ int valueInput();
- public void digitalWrite(int pin, int val);
+ int valueHigh();
- public void digitalWrite(int pin, boolean val);
+ int valueLow();
- public void pwmWrite(int pin, int val);
-
- public void delayMicroseconds(int t);
+ Object valueUnknownBoardType();
- public int digitalRead(int pin);
+ void wiringPiSetupPhys();
- public Object getBoardType();
+ void pinMode(int i, int type);
+
+ void digitalWrite(int pin, int val);
+
+ void digitalWrite(int pin, boolean val);
+
+ void pwmWrite(int pin, int val);
+
+ void delayMicroseconds(int t);
+
+ int digitalRead(int pin);
+
+ Object getBoardType();
}
-
+
public interface ConsoleUtils {
- public static final int OUTPUTLEVEL_NODEBUG = 0;
- public static final int OUTPUTLEVEL_DEBUG_MIN = 1;
- public static final int OUTPUTLEVEL_DEBUG_VERBOSE = 4;
-
- public AdvancedOutputStream out();
-
- public int getOutputLevel();
-
+ int OUTPUTLEVEL_NODEBUG = 0;
+ int OUTPUTLEVEL_DEBUG_MIN = 1;
+ int OUTPUTLEVEL_DEBUG_VERBOSE = 4;
+
+ AdvancedOutputStream out();
+
+ int getOutputLevel();
+
public interface AdvancedOutputStream {
- public void println(Object str);
+ void println(Object str);
- public void println(int level);
+ void println(int level);
- public void println(int level, Object str);
+ void println(int level, Object str);
- public void print(int level, String str);
+ void print(int level, String str);
- public void println(int level, String prefix, String str);
+ void println(int level, String prefix, String str);
- public void println(int level, String... parts);
+ void println(int level, String... parts);
}
}
-
+
public interface StorageUtils {
int OpenOptionWrite = 0;
int OpenOptionCreate = 1;
- public boolean exists(File f);
+ boolean exists(File f);
- public File get(String path);
+ File get(String path);
- public File get(String... path);
+ File get(String... path);
@Deprecated()
- public File getResource(String string) throws IOException, URISyntaxException;
+ File getResource(String string) throws IOException, URISyntaxException;
- public InputStream getResourceStream(String string) throws IOException, URISyntaxException;
+ InputStream getResourceStream(String string) throws IOException, URISyntaxException;
- public List readAllLines(File file) throws IOException;
-
- public String read(InputStream input) throws IOException;
+ List readAllLines(File file) throws IOException;
- public List walk(File dir) throws IOException;
+ String read(InputStream input) throws IOException;
- public File relativize(File rulesPath, File f);
+ List walk(File dir) throws IOException;
- public File resolve(File file, String string);
-
- public File getParent(File f);
+ File relativize(File rulesPath, File f);
- public void createDirectories(File dir) throws IOException;
+ File resolve(File file, String string);
- public void write(File f, byte[] bytes, int... options) throws IOException;
+ File getParent(File f);
- public List readAllLines(InputStream input) throws IOException;
+ void createDirectories(File dir) throws IOException;
- public String getBasePath();
+ void write(File f, byte[] bytes, int... options) throws IOException;
+
+ List readAllLines(InputStream input) throws IOException;
+
+ String getBasePath();
}
-
+
public interface Semaphore {
void release();
+
void acquire() throws InterruptedException;
}
-
+
public interface URLClassLoader {
- public Class> loadClass(String name) throws ClassNotFoundException;
+ Class> loadClass(String name) throws ClassNotFoundException;
+
void close() throws IOException;
}
-
+
public interface PngUtils {
- public PngReader load(InputStream resourceStream);
-
+ PngReader load(InputStream resourceStream);
+
public interface PngReader {
int[] getImageMatrix();
int[] getSize();
-
+
}
-
+
}
-
+
public interface Settings {
- public boolean isDebugEnabled();
+ boolean isDebugEnabled();
- public void setDebugEnabled(boolean debugOn);
+ void setDebugEnabled(boolean debugOn);
- public default String getCalculatorName() {
+ default String getCalculatorName() {
return "WarpPI";
}
- public default String getCalculatorNameLowercase() {
+
+ default String getCalculatorNameLowercase() {
return "warppi";
}
- public default String getCalculatorNameUppercase() {
+
+ default String getCalculatorNameUppercase() {
return "WARPPI";
}
diff --git a/core/src/main/java/it/cavallium/warppi/StaticVars.java b/core/src/main/java/it/cavallium/warppi/StaticVars.java
index 2ac86784..0e8a1b4a 100644
--- a/core/src/main/java/it/cavallium/warppi/StaticVars.java
+++ b/core/src/main/java/it/cavallium/warppi/StaticVars.java
@@ -17,13 +17,12 @@ public class StaticVars {
public static boolean debugWindow2x = false;
public static BehaviorSubject windowZoom = BehaviorSubject.create(2F);
public static Function windowZoomFunction = (val) -> {
- if (StaticVars.debugWindow2x) {
+ if (StaticVars.debugWindow2x)
return val + 1;
- } else {
+ else
return val;
- }
};
- public static Observable windowZoom$ = windowZoom.map(windowZoomFunction);
+ public static Observable windowZoom$ = StaticVars.windowZoom.map(StaticVars.windowZoomFunction);
public static StartupArguments startupArguments;
private StaticVars() {
diff --git a/core/src/main/java/it/cavallium/warppi/TestDrivers.java b/core/src/main/java/it/cavallium/warppi/TestDrivers.java
index bc27a251..441dd2a2 100644
--- a/core/src/main/java/it/cavallium/warppi/TestDrivers.java
+++ b/core/src/main/java/it/cavallium/warppi/TestDrivers.java
@@ -1,25 +1,23 @@
package it.cavallium.warppi;
public class TestDrivers {
- public static void main(String[] args) {
+ public static void main(final String[] args) {
System.out.println("Test started.");
String className;
className = "jogamp.newt.driver.bcm.vc.iv.DisplayDriver";
- if (exists(className)) {
+ if (TestDrivers.exists(className))
System.out.println("[FOUND] " + className);
- } else {
+ else
System.out.println("[NOT FOUND] " + className);
- }
className = ".bcm.vc.iv.DisplayDriver";
- if (exists(className)) {
+ if (TestDrivers.exists(className))
System.out.println("[FOUND] " + className);
- } else {
+ else
System.out.println("[NOT FOUND] " + className);
- }
System.out.println("Test finished.");
}
- public static boolean exists(String className) {
+ public static boolean exists(final String className) {
try {
Class.forName(className);
return true;
diff --git a/core/src/main/java/it/cavallium/warppi/boot/Boot.java b/core/src/main/java/it/cavallium/warppi/boot/Boot.java
index d3ffaea2..329f1032 100644
--- a/core/src/main/java/it/cavallium/warppi/boot/Boot.java
+++ b/core/src/main/java/it/cavallium/warppi/boot/Boot.java
@@ -13,13 +13,13 @@ import it.cavallium.warppi.math.rules.RulesManager;
import it.cavallium.warppi.util.Error;
public class Boot {
-
- public static void boot(Platform platform, String[] args) throws Exception {
- Engine.start(platform, new LoadingScreen(), new PIHardwareDisplay(), new PIHardwareTouchDevice(false, false, false), new CalculatorHUD(), parseStartupArguments(args));
+
+ public static void boot(final Platform platform, final String[] args) throws Exception {
+ Engine.start(platform, new LoadingScreen(), new PIHardwareDisplay(), new PIHardwareTouchDevice(false, false, false), new CalculatorHUD(), Boot.parseStartupArguments(args));
Engine.INSTANCE.getLoadPhase().subscribe(Boot::loadCalculator);
}
- private static void loadCalculator(LoadingStatus loading) {
+ private static void loadCalculator(final LoadingStatus loading) {
try {
Engine.INSTANCE.getHardwareDevice().getDisplayManager().setBrightness(0.2f);
RulesManager.initialize();
@@ -33,12 +33,12 @@ public class Boot {
public static StartupArguments parseStartupArguments(final String[] a) {
final StartupArgumentsImpl args = new StartupArgumentsImpl();
- Arrays.asList(a).stream().parallel().map(String::toLowerCase).forEach(arg -> parseArgument(args, arg));
+ Arrays.asList(a).stream().parallel().map(String::toLowerCase).forEach(arg -> Boot.parseArgument(args, arg));
args.setHeadlessEngineForced(args.isHeadlessEngineForced() || args.isHeadless8EngineForced() || args.isHeadless256EngineForced() || args.isHeadless24bitEngineForced());
return args;
}
- public static void parseArgument(StartupArgumentsImpl args, String arg) {
+ public static void parseArgument(final StartupArgumentsImpl args, final String arg) {
switch (arg) {
case "-zoomed":
args.setZoomed(true);
diff --git a/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java b/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java
index 1f6928bc..9cbc7039 100644
--- a/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java
+++ b/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java
@@ -1,36 +1,36 @@
package it.cavallium.warppi.boot;
public interface StartupArguments {
- public boolean isRaspberryModeAllowed();
+ boolean isRaspberryModeAllowed();
- public boolean isZoomed();
+ boolean isZoomed();
- public boolean isHeadlessEngineForced();
+ boolean isHeadlessEngineForced();
- public boolean isHeadless8EngineForced();
+ boolean isHeadless8EngineForced();
- public boolean isHeadless256EngineForced();
+ boolean isHeadless256EngineForced();
- public boolean isHeadless24bitEngineForced();
+ boolean isHeadless24bitEngineForced();
- public boolean isCPUEngineForced();
+ boolean isCPUEngineForced();
- public boolean isGPUEngineForced();
+ boolean isGPUEngineForced();
- public boolean isFrameBufferEngineForced();
+ boolean isFrameBufferEngineForced();
- public boolean isNoGUIEngineForced();
+ boolean isNoGUIEngineForced();
- public boolean isHTMLEngineForced();
+ boolean isHTMLEngineForced();
- public boolean isMSDOSModeEnabled();
+ boolean isMSDOSModeEnabled();
- public boolean isVerboseLoggingEnabled();
+ boolean isVerboseLoggingEnabled();
- public boolean isDebugEnabled();
+ boolean isDebugEnabled();
- public boolean isUncached();
+ boolean isUncached();
- public boolean isEngineForced();
+ boolean isEngineForced();
}
diff --git a/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java b/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java
index 99f79928..f8feb508 100644
--- a/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java
+++ b/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java
@@ -102,63 +102,63 @@ public class StartupArgumentsImpl implements StartupArguments {
return isCPUEngineForced || isFrameBufferEngineForced || isGPUEngineForced || isHeadless24bitEngineForced || isHeadless256EngineForced || isHeadless8EngineForced || isHTMLEngineForced || isNoGUIEngineForced;
}
- void setRaspberryModeAllowed(boolean isRaspberryModeAllowed) {
+ void setRaspberryModeAllowed(final boolean isRaspberryModeAllowed) {
this.isRaspberryModeAllowed = isRaspberryModeAllowed;
}
- void setZoomed(boolean isZoomed) {
+ void setZoomed(final boolean isZoomed) {
this.isZoomed = isZoomed;
}
- void setHeadlessEngineForced(boolean isHeadlessEngineForced) {
+ void setHeadlessEngineForced(final boolean isHeadlessEngineForced) {
this.isHeadlessEngineForced = isHeadlessEngineForced;
}
- void setHeadless8EngineForced(boolean isHeadless8EngineForced) {
+ void setHeadless8EngineForced(final boolean isHeadless8EngineForced) {
this.isHeadless8EngineForced = isHeadless8EngineForced;
}
- void setHeadless256EngineForced(boolean isHeadless256EngineForced) {
+ void setHeadless256EngineForced(final boolean isHeadless256EngineForced) {
this.isHeadless256EngineForced = isHeadless256EngineForced;
}
- void setHeadless24bitEngineForced(boolean isHeadless24bitEngineForced) {
+ void setHeadless24bitEngineForced(final boolean isHeadless24bitEngineForced) {
this.isHeadless24bitEngineForced = isHeadless24bitEngineForced;
}
- void setCPUEngineForced(boolean isCPUEngineForced) {
+ void setCPUEngineForced(final boolean isCPUEngineForced) {
this.isCPUEngineForced = isCPUEngineForced;
}
- void setGPUEngineForced(boolean isGPUEngineForced) {
+ void setGPUEngineForced(final boolean isGPUEngineForced) {
this.isGPUEngineForced = isGPUEngineForced;
}
- void setFrameBufferEngineForced(boolean isFrameBufferEngineForced) {
+ void setFrameBufferEngineForced(final boolean isFrameBufferEngineForced) {
this.isFrameBufferEngineForced = isFrameBufferEngineForced;
}
- void setNoGUIEngineForced(boolean isNoGUIEngineForced) {
+ void setNoGUIEngineForced(final boolean isNoGUIEngineForced) {
this.isNoGUIEngineForced = isNoGUIEngineForced;
}
- void setHTMLEngineForced(boolean isHTMLEngineForced) {
+ void setHTMLEngineForced(final boolean isHTMLEngineForced) {
this.isHTMLEngineForced = isHTMLEngineForced;
}
- void setMSDOSModeEnabled(boolean isMSDOSModeEnabled) {
+ void setMSDOSModeEnabled(final boolean isMSDOSModeEnabled) {
this.isMSDOSModeEnabled = isMSDOSModeEnabled;
}
- void setVerboseLoggingEnabled(boolean isVerboseLoggingEnabled) {
+ void setVerboseLoggingEnabled(final boolean isVerboseLoggingEnabled) {
this.isVerboseLoggingEnabled = isVerboseLoggingEnabled;
}
- void setDebugEnabled(boolean isDebugEnabled) {
+ void setDebugEnabled(final boolean isDebugEnabled) {
this.isDebugEnabled = isDebugEnabled;
}
- void setUncached(boolean isUncached) {
+ void setUncached(final boolean isUncached) {
this.isUncached = isUncached;
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/CacheFile.java b/core/src/main/java/it/cavallium/warppi/device/CacheFile.java
index 48a5eb29..62c23b97 100644
--- a/core/src/main/java/it/cavallium/warppi/device/CacheFile.java
+++ b/core/src/main/java/it/cavallium/warppi/device/CacheFile.java
@@ -18,9 +18,9 @@ public class CacheFile {
private FileInputStream lastFIS;
public CacheFile() {
- do {
+ do
path = UUID.randomUUID().toString() + ".ser";
- } while (new File(path).exists());
+ while (new File(path).exists());
try {
File.createTempFile(Engine.getPlatform().getSettings().getCalculatorNameLowercase(), "");
} catch (final IOException e) {
@@ -29,28 +29,26 @@ public class CacheFile {
}
public ObjectOutputStream getObjectOutputStram() {
- if (lastOOS == null) {
+ if (lastOOS == null)
try {
return new ObjectOutputStream(new FileOutputStream(path));
} catch (final IOException e) {
e.printStackTrace();
return lastOOS;
}
- } else {
+ else
return lastOOS;
- }
}
public ObjectInputStream getObjectInputStram() {
- if (lastOIS == null) {
+ if (lastOIS == null)
try {
return new ObjectInputStream(new FileInputStream(path));
} catch (final IOException e) {
return lastOIS;
}
- } else {
+ else
return lastOIS;
- }
}
public void closeStreams() {
diff --git a/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java b/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java
index 299a5f00..402060d8 100644
--- a/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java
+++ b/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java
@@ -7,7 +7,7 @@ public class HardwareDevice {
private final DisplayManager displayManager;
private final InputManager inputManager;
- public HardwareDevice(DisplayManager m, InputManager im) {
+ public HardwareDevice(final DisplayManager m, final InputManager im) {
displayManager = m;
inputManager = im;
}
@@ -20,10 +20,10 @@ public class HardwareDevice {
return inputManager;
}
- public void setup(Runnable r) {
+ public void setup(final Runnable r) {
displayManager.initialize();
inputManager.getKeyboard().startKeyboard();
- Thread t = new Thread(r);
+ final Thread t = new Thread(r);
Engine.getPlatform().setThreadDaemon(t, false);
Engine.getPlatform().setThreadName(t, "Main thread (after setup)");
t.start();
diff --git a/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java b/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java
index ce37c52c..5bf36efb 100644
--- a/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java
+++ b/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java
@@ -4,18 +4,18 @@ import it.cavallium.warppi.event.TouchEventListener;
import it.cavallium.warppi.event.TouchPoint;
public interface HardwareTouchDevice extends TouchEventListener {
- public boolean getInvertedXY();
+ boolean getInvertedXY();
- public boolean getInvertedX();
+ boolean getInvertedX();
- public boolean getInvertedY();
+ boolean getInvertedY();
- public default void setInvertedXY() {}
+ default void setInvertedXY() {}
- public default void setInvertedX() {}
+ default void setInvertedX() {}
- public default void setInvertedY() {}
+ default void setInvertedY() {}
- public TouchPoint makePoint(long id, float x, float y, int maxX, int maxY, float radiusX, float radiusY,
- float force, float rotationAngle);
+ TouchPoint makePoint(long id, float x, float y, int maxX, int maxY, float radiusX, float radiusY, float force,
+ float rotationAngle);
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/InputManager.java b/core/src/main/java/it/cavallium/warppi/device/InputManager.java
index 41f9cc0e..22e93090 100644
--- a/core/src/main/java/it/cavallium/warppi/device/InputManager.java
+++ b/core/src/main/java/it/cavallium/warppi/device/InputManager.java
@@ -4,9 +4,9 @@ public class InputManager {
private final Keyboard keyboard;
private final HardwareTouchDevice touchDevice;
- public InputManager(Keyboard k, HardwareTouchDevice t) {
- this.keyboard = k;
- this.touchDevice = t;
+ public InputManager(final Keyboard k, final HardwareTouchDevice t) {
+ keyboard = k;
+ touchDevice = t;
}
public Keyboard getKeyboard() {
diff --git a/core/src/main/java/it/cavallium/warppi/device/Keyboard.java b/core/src/main/java/it/cavallium/warppi/device/Keyboard.java
index f6df9d0b..d9edafea 100644
--- a/core/src/main/java/it/cavallium/warppi/device/Keyboard.java
+++ b/core/src/main/java/it/cavallium/warppi/device/Keyboard.java
@@ -41,36 +41,36 @@ public class Keyboard {
public synchronized void startKeyboard() {
final Thread kt = new Thread(() -> {
- if (Engine.getPlatform().getSettings().isDebugEnabled()) {
+ if (Engine.getPlatform().getSettings().isDebugEnabled())
try {
while (true) {
- if (debugKeyCode != -1) {
- debugKeyPressed(debugKeyCode);
- debugKeyCode = -1;
+ if (Keyboard.debugKeyCode != -1) {
+ Keyboard.debugKeyPressed(Keyboard.debugKeyCode);
+ Keyboard.debugKeyCode = -1;
}
- if (debugKeyCodeRelease != -1) {
- debugKeyReleased(debugKeyCodeRelease);
- debugKeyCodeRelease = -1;
+ if (Keyboard.debugKeyCodeRelease != -1) {
+ Keyboard.debugKeyReleased(Keyboard.debugKeyCodeRelease);
+ Keyboard.debugKeyCodeRelease = -1;
}
Thread.sleep(50);
}
} catch (final InterruptedException e) {}
- } else {
- Engine.getPlatform().getGpio().pinMode(CLK_INH_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(RCK_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(SER_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(SH_LD_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(SCK_and_CLK_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(QH_pin, Engine.getPlatform().getGpio().valueInput());
+ else {
+ Engine.getPlatform().getGpio().pinMode(Keyboard.CLK_INH_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.RCK_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.SER_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.SH_LD_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.SCK_and_CLK_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.QH_pin, Engine.getPlatform().getGpio().valueInput());
- Engine.getPlatform().getGpio().digitalWrite(CLK_INH_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(RCK_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(SER_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(SH_LD_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(SCK_and_CLK_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(QH_pin, false);
- final SerialToParallel chip1 = new SerialToParallel(RCK_pin, SCK_and_CLK_pin /*SCK*/, SER_pin);
- final ParallelToSerial chip2 = new ParallelToSerial(SH_LD_pin, CLK_INH_pin, QH_pin, SCK_and_CLK_pin/*CLK*/);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.CLK_INH_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.RCK_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.SER_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.SH_LD_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.SCK_and_CLK_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.QH_pin, false);
+ final SerialToParallel chip1 = new SerialToParallel(Keyboard.RCK_pin, Keyboard.SCK_and_CLK_pin /*SCK*/, Keyboard.SER_pin);
+ final ParallelToSerial chip2 = new ParallelToSerial(Keyboard.SH_LD_pin, Keyboard.CLK_INH_pin, Keyboard.QH_pin, Keyboard.SCK_and_CLK_pin/*CLK*/);
KeyboardDebugScreen.log("Started keyboard system");
@@ -85,15 +85,14 @@ public class Keyboard {
// KeyboardDebugScreen.ks[col] = data;
for (int row = 0; row < 8; row++) {
- if (data[row] == true && precedentStates[row][col] == false) {
-// System.out.println("Pressed button at " + (row + 1) + ", " + (col + 1));
+ if (data[row] == true && Keyboard.precedentStates[row][col] == false)
+ // System.out.println("Pressed button at " + (row + 1) + ", " + (col + 1));
// KeyboardDebugScreen.log("Pressed button at " + (row + 1) + ", " + (col + 1));
- keyPressedRaw(row, col);
- } else if (data[row] == false && precedentStates[row][col] == true) {
- keyReleasedRaw(row, col);
+ Keyboard.keyPressedRaw(row, col);
+ else if (data[row] == false && Keyboard.precedentStates[row][col] == true)
+ Keyboard.keyReleasedRaw(row, col);
// KeyboardDebugScreen.log("Released button at " + (row + 1) + ", " + (col + 1));
- }
- precedentStates[row][col] = data[row];
+ Keyboard.precedentStates[row][col] = data[row];
}
}
}
@@ -105,259 +104,229 @@ public class Keyboard {
kt.start();
}
- public static void debugKeyPressed(int keyCode) {
+ public static void debugKeyPressed(final int keyCode) {
switch (keyCode) {
case KeyEvent.VK_ESCAPE:
Keyboard.keyPressed(Key.POWEROFF);
break;
case KeyEvent.VK_S:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.ARCSINE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_S);
- } else {
+ else
Keyboard.keyPressed(Key.SINE);
- }
break;
case KeyEvent.VK_C:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.ARCCOSINE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_C);
- } else {
+ else
Keyboard.keyPressed(Key.COSINE);
- }
break;
case KeyEvent.VK_T:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.ARCTANGENT);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_T);
- } else {
+ else
Keyboard.keyPressed(Key.TANGENT);
- }
break;
case KeyEvent.VK_D:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug_DEG);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_D);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_R:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug_RAD);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_R);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_G:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug_GRA);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_G);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_X:
- if (Keyboard.alpha) {
+ if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_X);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_P:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_P);
- } else {
+ else
Keyboard.keyPressed(Key.PI);
- }
break;
case KeyEvent.VK_E:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_E);
- } else {
+ else
Keyboard.keyPressed(Key.EULER_NUMBER);
- }
break;
case KeyEvent.VK_Y:
- if (Keyboard.alpha) {
+ if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_Y);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_B:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE_REVERSE);
- } else if (!Keyboard.shift && !Keyboard.alpha) {
+ else if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE);
- } else {
+ else
Keyboard.keyPressed(Key.LETTER_B);
- }
break;
case KeyEvent.VK_L:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.LOGARITHM);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_L);
- } else {
+ else
Keyboard.keyPressed(Key.LOGARITHM);
- }
break;
case KeyboardJogampValues.VK_ENTER:
case KeyEvent.VK_ENTER:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.STEP);
- } else if (!Keyboard.shift && !Keyboard.alpha) {
+ else if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.SIMPLIFY);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
int row = 2;
int col = 1;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
break;
case KeyEvent.VK_1:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM1);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_2:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM2);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_3:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM3);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_4:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM4);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_5:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM5);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_6:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM6);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_7:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM7);
- } else if (Keyboard.shift) {
- if (Engine.getPlatform().getSettings().isDebugEnabled()) {
+ else if (Keyboard.shift)
+ if (Engine.getPlatform().getSettings().isDebugEnabled())
Keyboard.keyPressed(Key.DIVIDE);
- }
- }
break;
case KeyEvent.VK_8:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM8);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.PARENTHESIS_OPEN);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_9:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM9);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.PARENTHESIS_CLOSE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_0:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM0);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.EQUAL);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_M:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.SURD_MODE);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.LETTER_M);
- }
break;
case KeyboardJogampValues.VK_ADD:
case KeyEvent.VK_ADD:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.PLUS);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.PLUS_MINUS);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_SUBTRACT:
case KeyEvent.VK_SUBTRACT:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.MINUS);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_MULTIPLY:
case KeyEvent.VK_MULTIPLY:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.MULTIPLY);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_DIVIDE:
case KeyEvent.VK_DIVIDE:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.DIVIDE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_BACK_SPACE:
Keyboard.keyPressed(Key.DELETE);
break;
case KeyboardJogampValues.VK_DELETE:
case KeyEvent.VK_DELETE:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.RESET);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_LEFT:
case KeyEvent.VK_LEFT:
@@ -365,11 +334,10 @@ public class Keyboard {
row = 2;
col = 3;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.LEFT);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_RIGHT:
case KeyEvent.VK_RIGHT:
@@ -377,11 +345,10 @@ public class Keyboard {
row = 2;
col = 5;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.RIGHT);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_UP:
case KeyEvent.VK_UP:
@@ -389,11 +356,10 @@ public class Keyboard {
row = 1;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.UP);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_DOWN:
case KeyEvent.VK_DOWN:
@@ -401,188 +367,170 @@ public class Keyboard {
row = 3;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.DOWN);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case (short) 12:
//DOWN
row = 2;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.OK);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_NUMPAD4:
case KeyEvent.VK_NUMPAD4:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.HISTORY_BACK);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_NUMPAD6:
case KeyEvent.VK_NUMPAD6:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.HISTORY_FORWARD);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_PERIOD:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.DOT);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_A:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_A);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_F:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_F);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_H:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_H);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_I:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_I);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_J:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_J);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_K:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_K);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_N:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_N);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_O:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_O);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_Q:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_Q);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_U:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_U);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_V:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_V);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_W:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_W);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_Z:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_Z);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.ZOOM_MODE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_SHIFT:
case KeyEvent.VK_SHIFT:
@@ -610,7 +558,7 @@ public class Keyboard {
}
}
- private synchronized static void debugKeyReleased(int keyCode) {
+ private synchronized static void debugKeyReleased(final int keyCode) {
switch (keyCode) {
case KeyEvent.VK_ENTER:
int row = 2;
@@ -655,15 +603,14 @@ public class Keyboard {
}
}
- public static boolean isKeyDown(int row, int col) {
- if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
- return precedentStates[row - 1][col - 1];
- } else {
- return debugKeysDown[row - 1][col - 1];
- }
+ public static boolean isKeyDown(final int row, final int col) {
+ if (Engine.getPlatform().getSettings().isDebugEnabled() == false)
+ return Keyboard.precedentStates[row - 1][col - 1];
+ else
+ return Keyboard.debugKeysDown[row - 1][col - 1];
}
- public synchronized static void keyReleasedRaw(int row, int col) {
+ public synchronized static void keyReleasedRaw(final int row, final int col) {
// KeyboardDebugScreen.keyX = row;
// KeyboardDebugScreen.keyY = col;
if (row == 1 && col == 1) {
@@ -672,80 +619,80 @@ public class Keyboard {
}
static final String[][][] KeyLabelsMap = /* [ROW, COLUMN, (0:normal 1:shift 2:alpha)] */
- { { /* ROW 0 */
- { "⇪", "⇪", null }, /* 0,0 */
- { "A", null, "A" }, /* 0,1 */
- {"", null, null }, /* 0,2 */
- { "⇧", null, null }, /* 0,3 */
- {"", null, null }, /* 0,4 */
- {"", null, null }, /* 0,5 */
- { "☼", "☼", null }, /* 0,6 */
- {"↩", null, null } /* 0,7 */
- }, { /* ROW 1 */
- {"", null, null }, /* 1,0 */
- {"", null, null }, /* 1,1 */
- {"⇦", null, null }, /* 1,2 */
- {"OK", null, null }, /* 1,3 */
- {"⇨", null, null }, /* 1,4 */
- {"↤", null, null }, /* 1,5 */
- {"↦", null, null }, /* 1,6 */
- {"", null, null } /* 1,7 */
- }, { /* ROW 2 */
- {"", null, null }, /* 2,0 */
- {"√", null, null }, /* 2,1 */
- {"", null, null }, /* 2,2 */
- {"⇩", null, null }, /* 2,3 */
- {"↶", null, null }, /* 2,4 */
- {"", null, null }, /* 2,5 */
- {"", null, null }, /* 2,6 */
- {"", null, null } /* 2,7 */
- }, { /* ROW 3 */
- {"", null, null }, /* 3,0 */
- {"", null, null }, /* 3,1 */
- {"^x", null, null }, /* 3,2 */
- {"^2", null, null }, /* 3,3 */
- {"", null, null }, /* 3,4 */
- {"", null, null }, /* 3,5 */
- {"", null, null }, /* 3,6 */
- {".", null, "y" } /* 3,7 */
- }, { /* ROW 4 */
- {"", null, null }, /* 4,0 */
- {"", null, null }, /* 4,1 */
- {"(", null, null }, /* 4,2 */
- {")", null, null }, /* 4,3 */
- {"", null, null }, /* 4,4 */
- {"S⇔D", null, null }, /* 4,5 */
- {"", null, null }, /* 4,6 */
- {"0", null, "x" } /* 4,7 */
- }, { /* ROW 5 */
- {"7", null, null }, /* 5,0 */
- {"8", null, null }, /* 5,1 */
- {"9", null, null }, /* 5,2 */
- {"⌫", null, null }, /* 5,3 */
- {"RESET", null, null }, /* 5,4 */
- {"", null, null }, /* 5,5 */
- {"", null, null }, /* 5,6 */
- {"", null, null } /* 5,7 */
- }, { /* ROW 6 */
- {"4", null, null }, /* 6,0 */
- {"5", null, null }, /* 6,1 */
- {"6", null, null }, /* 6,2 */
- {"*", null, null }, /* 6,3 */
- {"/", null, null }, /* 6,4 */
- {"", null, null }, /* 6,5 */
- {"", null, null }, /* 6,6 */
- {"", null, null } /* 6,7 */
- }, { /* ROW 7 */
- {"1", null, null }, /* 7,0 */
- {"2", null, null }, /* 7,1 */
- {"3", null, null }, /* 7,2 */
- {"+", null, null }, /* 7,3 */
- {"-", null, null }, /* 7,4 */
- {"", null, null }, /* 7,5 */
- {"", null, null }, /* 7,6 */
- {"", null, null } /* 7,7 */
- } };
-
+ { { /* ROW 0 */
+ { "⇪", "⇪", null }, /* 0,0 */
+ { "A", null, "A" }, /* 0,1 */
+ { "", null, null }, /* 0,2 */
+ { "⇧", null, null }, /* 0,3 */
+ { "", null, null }, /* 0,4 */
+ { "", null, null }, /* 0,5 */
+ { "☼", "☼", null }, /* 0,6 */
+ { "↩", null, null } /* 0,7 */
+ }, { /* ROW 1 */
+ { "", null, null }, /* 1,0 */
+ { "", null, null }, /* 1,1 */
+ { "⇦", null, null }, /* 1,2 */
+ { "OK", null, null }, /* 1,3 */
+ { "⇨", null, null }, /* 1,4 */
+ { "↤", null, null }, /* 1,5 */
+ { "↦", null, null }, /* 1,6 */
+ { "", null, null } /* 1,7 */
+ }, { /* ROW 2 */
+ { "", null, null }, /* 2,0 */
+ { "√", null, null }, /* 2,1 */
+ { "", null, null }, /* 2,2 */
+ { "⇩", null, null }, /* 2,3 */
+ { "↶", null, null }, /* 2,4 */
+ { "", null, null }, /* 2,5 */
+ { "", null, null }, /* 2,6 */
+ { "", null, null } /* 2,7 */
+ }, { /* ROW 3 */
+ { "", null, null }, /* 3,0 */
+ { "", null, null }, /* 3,1 */
+ { "^x", null, null }, /* 3,2 */
+ { "^2", null, null }, /* 3,3 */
+ { "", null, null }, /* 3,4 */
+ { "", null, null }, /* 3,5 */
+ { "", null, null }, /* 3,6 */
+ { ".", null, "y" } /* 3,7 */
+ }, { /* ROW 4 */
+ { "", null, null }, /* 4,0 */
+ { "", null, null }, /* 4,1 */
+ { "(", null, null }, /* 4,2 */
+ { ")", null, null }, /* 4,3 */
+ { "", null, null }, /* 4,4 */
+ { "S⇔D", null, null }, /* 4,5 */
+ { "", null, null }, /* 4,6 */
+ { "0", null, "x" } /* 4,7 */
+ }, { /* ROW 5 */
+ { "7", null, null }, /* 5,0 */
+ { "8", null, null }, /* 5,1 */
+ { "9", null, null }, /* 5,2 */
+ { "⌫", null, null }, /* 5,3 */
+ { "RESET", null, null }, /* 5,4 */
+ { "", null, null }, /* 5,5 */
+ { "", null, null }, /* 5,6 */
+ { "", null, null } /* 5,7 */
+ }, { /* ROW 6 */
+ { "4", null, null }, /* 6,0 */
+ { "5", null, null }, /* 6,1 */
+ { "6", null, null }, /* 6,2 */
+ { "*", null, null }, /* 6,3 */
+ { "/", null, null }, /* 6,4 */
+ { "", null, null }, /* 6,5 */
+ { "", null, null }, /* 6,6 */
+ { "", null, null } /* 6,7 */
+ }, { /* ROW 7 */
+ { "1", null, null }, /* 7,0 */
+ { "2", null, null }, /* 7,1 */
+ { "3", null, null }, /* 7,2 */
+ { "+", null, null }, /* 7,3 */
+ { "-", null, null }, /* 7,4 */
+ { "", null, null }, /* 7,5 */
+ { "", null, null }, /* 7,6 */
+ { "", null, null } /* 7,7 */
+ } };
+
static final Key[][][] keyMap = /* [ROW, COLUMN, (0:normal 1:shift 2:alpha)] */
{ { /* ROW 0 */
{ Key.SHIFT, Key.SHIFT, Key.SHIFT }, /* 0,0 */
@@ -820,45 +767,40 @@ public class Keyboard {
{ Key.NONE, Key.NONE, Key.NONE }, /* 7,6 */
{ Key.NONE, Key.NONE, Key.NONE } /* 7,7 */
} };
-
- public static String getKeyName(int row, int col) {
- return getKeyName(row, col, shift, alpha);
+
+ public static String getKeyName(final int row, final int col) {
+ return Keyboard.getKeyName(row, col, Keyboard.shift, Keyboard.alpha);
}
-
- public static String getKeyName(int row, int col, boolean shift, boolean alpha) {
- String[] keyValues = KeyLabelsMap[row][col];
+
+ public static String getKeyName(final int row, final int col, final boolean shift, final boolean alpha) {
+ final String[] keyValues = Keyboard.KeyLabelsMap[row][col];
if (shift) {
- if (keyValues[1] != null) {
+ if (keyValues[1] != null)
return keyValues[1];
- }
- } else if (alpha) {
- if (keyValues[2] != null) {
+ } else if (alpha)
+ if (keyValues[2] != null)
return keyValues[2];
- }
- }
return keyValues[0];
}
- public static boolean hasKeyName(int row, int col) {
- String[] keyValues = KeyLabelsMap[row][col];
- if (shift) {
+ public static boolean hasKeyName(final int row, final int col) {
+ final String[] keyValues = Keyboard.KeyLabelsMap[row][col];
+ if (Keyboard.shift)
return keyValues[1] != null;
- } else if (alpha) {
+ else if (Keyboard.alpha)
return keyValues[2] != null;
- } else {
+ else
return true;
- }
}
- public static synchronized void keyPressedRaw(int row, int col) {
+ public static synchronized void keyPressedRaw(final int row, final int col) {
// KeyboardDebugScreen.keyX = row;
// KeyboardDebugScreen.keyY = col;
- final Key k = keyMap[row][col][shift ? 1 : alpha ? 2 : 0];
- if (k != null) {
- keyPressed(k);
- } else {
- keyPressed(Key.NONE);
- }
+ final Key k = Keyboard.keyMap[row][col][Keyboard.shift ? 1 : Keyboard.alpha ? 2 : 0];
+ if (k != null)
+ Keyboard.keyPressed(k);
+ else
+ Keyboard.keyPressed(Key.NONE);
}
public static void stopKeyboard() {
@@ -872,15 +814,14 @@ public class Keyboard {
}
}
- public synchronized static void keyPressed(Key k) {
+ public synchronized static void keyPressed(final Key k) {
boolean done = false;
- if (additionalListener != null) {
+ if (Keyboard.additionalListener != null)
try {
- done = additionalListener.onKeyPressed(new KeyPressedEvent(k));
+ done = Keyboard.additionalListener.onKeyPressed(new KeyPressedEvent(k));
} catch (final Exception ex) {
new GUIErrorMessage(ex);
}
- }
if (Engine.INSTANCE.getHardwareDevice().getDisplayManager() != null) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
@@ -890,9 +831,9 @@ public class Keyboard {
} catch (final Exception ex) {
new GUIErrorMessage(ex);
}
- if (scr != null && scr.initialized && scrdone) {
+ if (scr != null && scr.initialized && scrdone)
refresh = true;
- } else {
+ else
switch (k) {
case POWEROFF:
Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.destroy();
@@ -909,7 +850,7 @@ public class Keyboard {
refresh = true;
break;
case ZOOM_MODE:
- float newZoom = (StaticVars.windowZoom.getLastValue() % 3) + 1;
+ final float newZoom = StaticVars.windowZoom.getLastValue() % 3 + 1;
StaticVars.windowZoom.onNext(newZoom);
Engine.getPlatform().getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, "Keyboard", "Zoom: " + newZoom);
// StaticVars.windowZoom = ((StaticVars.windowZoom - 0.5f) % 2f) + 1f;
@@ -925,7 +866,6 @@ public class Keyboard {
default:
break;
}
- }
switch (k) {
case SHIFT:
if (Keyboard.alpha)
@@ -948,47 +888,41 @@ public class Keyboard {
}
break;
}
- if (refresh) {
- refreshRequest = true;
- }
- } else if (!done) {
+ if (refresh)
+ Keyboard.refreshRequest = true;
+ } else if (!done)
Engine.getPlatform().getConsoleUtils().out().println(1, "Key " + k.toString() + " ignored.");
- }
}
- public synchronized static void keyReleased(Key k) {
+ public synchronized static void keyReleased(final Key k) {
boolean done = false;
- if (additionalListener != null) {
- done = additionalListener.onKeyReleased(new KeyReleasedEvent(k));
- }
+ if (Keyboard.additionalListener != null)
+ done = Keyboard.additionalListener.onKeyReleased(new KeyReleasedEvent(k));
boolean refresh = false;
if (Engine.INSTANCE.getHardwareDevice().getDisplayManager() != null) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
- if (scr != null && scr.initialized && scr.onKeyReleased(new KeyReleasedEvent(k))) {
+ if (scr != null && scr.initialized && scr.onKeyReleased(new KeyReleasedEvent(k)))
refresh = true;
- } else {
+ else
switch (k) {
case NONE:
break;
default:
break;
}
- }
- if (refresh) {
- refreshRequest = true;
- }
- } else if (!done) {
+ if (refresh)
+ Keyboard.refreshRequest = true;
+ } else if (!done)
Engine.getPlatform().getConsoleUtils().out().println(1, "Key " + k.toString() + " ignored.");
- }
}
- public void setAdditionalKeyboardListener(KeyboardEventListener l) {
- additionalListener = l;
+ public void setAdditionalKeyboardListener(final KeyboardEventListener l) {
+ Keyboard.additionalListener = l;
}
public static boolean popRefreshRequest() {
- if (refreshRequest) {
- refreshRequest = false;
+ if (Keyboard.refreshRequest) {
+ Keyboard.refreshRequest = false;
return true;
}
return false;
@@ -1007,7 +941,7 @@ Keyboard:
| SHIFT STATE |
| ALPHA STATE |
|--------------|
-
+
Physical keyboard:
|0,0-----|0,1-----|########|0,3-----|########|0,5-----|0,6-----|
| SHIFT | ALPHA |########| ^ |########|SETTINGS|+BRIGHT |
@@ -1050,28 +984,28 @@ Keyboard:
SCREEN F_n:
MathInputScreen:
Default:
- [F_1] Normal: Solve for X Shift: Solve for _ Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Variables & constants Shift: Alpha:
- [F_4] Normal: Functions f(x) Shift: Alpha:
+ [F_1] Normal: Solve for X Shift: Solve for _ Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Variables & constants Shift: Alpha:
+ [F_4] Normal: Functions f(x) Shift: Alpha:
Variable popup:
- [F_1] Normal(if constant):Set value Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal(if constant):Set value Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
MarioScreen
- [F_1] Normal: Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal: Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
ChooseVariableValueScreen
- [F_1] Normal: Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal: Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
SolveForXScreen
- [F_1] Normal: Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal: Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
*/
\ No newline at end of file
diff --git a/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java b/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java
index 7a59f6f7..1cfe22e3 100644
--- a/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java
+++ b/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java
@@ -9,108 +9,108 @@ public interface KeyboardJogampValues {
/**
* This value, {@value}, is used to indicate that the keyCode is unknown.
*/
- public static final short VK_UNDEFINED = (short) 0x0;
+ short VK_UNDEFINED = (short) 0x0;
- static final short VK_FREE01 = (short) 0x01;
+ short VK_FREE01 = (short) 0x01;
/** Constant for the HOME function key. ASCII: Start Of Text. */
- public static final short VK_HOME = (short) 0x02;
+ short VK_HOME = (short) 0x02;
/** Constant for the END function key. ASCII: End Of Text. */
- public static final short VK_END = (short) 0x03;
+ short VK_END = (short) 0x03;
/** Constant for the END function key. ASCII: End Of Transmission. */
- public static final short VK_FINAL = (short) 0x04;
+ short VK_FINAL = (short) 0x04;
/** Constant for the PRINT function key. ASCII: Enquiry. */
- public static final short VK_PRINTSCREEN = (short) 0x05;
+ short VK_PRINTSCREEN = (short) 0x05;
- static final short VK_FREE06 = (short) 0x06;
- static final short VK_FREE07 = (short) 0x07;
+ short VK_FREE06 = (short) 0x06;
+ short VK_FREE07 = (short) 0x07;
/** Constant for the BACK SPACE key "\b", matching ASCII. Printable! */
- public static final short VK_BACK_SPACE = (short) 0x08;
+ short VK_BACK_SPACE = (short) 0x08;
/** Constant for the HORIZ TAB key "\t", matching ASCII. Printable! */
- public static final short VK_TAB = (short) 0x09;
+ short VK_TAB = (short) 0x09;
/** LINE_FEED "\n", matching ASCII, n/a on keyboard. */
- static final short VK_FREE0A = (short) 0x0A;
+ short VK_FREE0A = (short) 0x0A;
/** Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation. */
- public static final short VK_PAGE_DOWN = (short) 0x0B;
+ short VK_PAGE_DOWN = (short) 0x0B;
/** Constant for the CLEAR key, i.e. FORM FEED, matching ASCII. */
- public static final short VK_CLEAR = (short) 0x0C;
+ short VK_CLEAR = (short) 0x0C;
/**
* Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII.
* Printable!
*/
- public static final short VK_ENTER = (short) 0x0D;
+ short VK_ENTER = (short) 0x0D;
- static final short VK_FREE0E = (short) 0x0E;
+ short VK_FREE0E = (short) 0x0E;
/** Constant for the CTRL function key. ASCII: shift-in. */
- public static final short VK_SHIFT = (short) 0x0F;
+ short VK_SHIFT = (short) 0x0F;
/** Constant for the PAGE UP function key. ASCII: Data Link Escape. */
- public static final short VK_PAGE_UP = (short) 0x10;
+ short VK_PAGE_UP = (short) 0x10;
/** Constant for the CTRL function key. ASCII: device-ctrl-one. */
- public static final short VK_CONTROL = (short) 0x11;
+ short VK_CONTROL = (short) 0x11;
/** Constant for the left ALT function key. ASCII: device-ctrl-two. */
- public static final short VK_ALT = (short) 0x12;
+ short VK_ALT = (short) 0x12;
/**
* Constant for the ALT_GRAPH function key, i.e. right ALT key. ASCII:
* device-ctrl-three.
*/
- public static final short VK_ALT_GRAPH = (short) 0x13;
+ short VK_ALT_GRAPH = (short) 0x13;
/** Constant for the CAPS LOCK function key. ASCII: device-ctrl-four. */
- public static final short VK_CAPS_LOCK = (short) 0x14;
+ short VK_CAPS_LOCK = (short) 0x14;
- static final short VK_FREE15 = (short) 0x15;
+ short VK_FREE15 = (short) 0x15;
/** Constant for the PAUSE function key. ASCII: sync-idle. */
- public static final short VK_PAUSE = (short) 0x16;
+ short VK_PAUSE = (short) 0x16;
/** scroll lock key. ASCII: End Of Transmission Block. */
- public static final short VK_SCROLL_LOCK = (short) 0x17;
+ short VK_SCROLL_LOCK = (short) 0x17;
/** Constant for the CANCEL function key. ASCII: Cancel. */
- public static final short VK_CANCEL = (short) 0x18;
+ short VK_CANCEL = (short) 0x18;
- static final short VK_FREE19 = (short) 0x19;
+ short VK_FREE19 = (short) 0x19;
/** Constant for the INSERT function key. ASCII: Substitute. */
- public static final short VK_INSERT = (short) 0x1A;
+ short VK_INSERT = (short) 0x1A;
/** Constant for the ESCAPE function key. ASCII: Escape. */
- public static final short VK_ESCAPE = (short) 0x1B;
+ short VK_ESCAPE = (short) 0x1B;
/**
* Constant for the Convert function key, Japanese "henkan". ASCII: File
* Separator.
*/
- public static final short VK_CONVERT = (short) 0x1C;
+ short VK_CONVERT = (short) 0x1C;
/**
* Constant for the Don't Convert function key, Japanese "muhenkan". ASCII:
* Group Separator.
*/
- public static final short VK_NONCONVERT = (short) 0x1D;
+ short VK_NONCONVERT = (short) 0x1D;
/**
* Constant for the Accept or Commit function key, Japanese "kakutei".
* ASCII: Record Separator.
*/
- public static final short VK_ACCEPT = (short) 0x1E;
+ short VK_ACCEPT = (short) 0x1E;
/** Constant for the Mode Change (?). ASCII: Unit Separator. */
- public static final short VK_MODECHANGE = (short) 0x1F;
+ short VK_MODECHANGE = (short) 0x1F;
//
// Unicode: Printable [0x20 - 0x7E]
@@ -118,168 +118,168 @@ public interface KeyboardJogampValues {
//
/** Constant for the SPACE function key. ASCII: SPACE. */
- public static final short VK_SPACE = (short) 0x20;
+ short VK_SPACE = (short) 0x20;
/** Constant for the "!" key. */
- public static final short VK_EXCLAMATION_MARK = (short) 0x21;
+ short VK_EXCLAMATION_MARK = (short) 0x21;
/** Constant for the """ key. */
- public static final short VK_QUOTEDBL = (short) 0x22;
+ short VK_QUOTEDBL = (short) 0x22;
/** Constant for the "#" key. */
- public static final short VK_NUMBER_SIGN = (short) 0x23;
+ short VK_NUMBER_SIGN = (short) 0x23;
/** Constant for the "$" key. */
- public static final short VK_DOLLAR = (short) 0x24;
+ short VK_DOLLAR = (short) 0x24;
/** Constant for the "%" key. */
- public static final short VK_PERCENT = (short) 0x25;
+ short VK_PERCENT = (short) 0x25;
/** Constant for the "&" key. */
- public static final short VK_AMPERSAND = (short) 0x26;
+ short VK_AMPERSAND = (short) 0x26;
/** Constant for the "'" key. */
- public static final short VK_QUOTE = (short) 0x27;
+ short VK_QUOTE = (short) 0x27;
/** Constant for the "(" key. */
- public static final short VK_LEFT_PARENTHESIS = (short) 0x28;
+ short VK_LEFT_PARENTHESIS = (short) 0x28;
/** Constant for the ")" key. */
- public static final short VK_RIGHT_PARENTHESIS = (short) 0x29;
+ short VK_RIGHT_PARENTHESIS = (short) 0x29;
/** Constant for the "*" key */
- public static final short VK_ASTERISK = (short) 0x2A;
+ short VK_ASTERISK = (short) 0x2A;
/** Constant for the "+" key. */
- public static final short VK_PLUS = (short) 0x2B;
+ short VK_PLUS = (short) 0x2B;
/** Constant for the comma key, "," */
- public static final short VK_COMMA = (short) 0x2C;
+ short VK_COMMA = (short) 0x2C;
/** Constant for the minus key, "-" */
- public static final short VK_MINUS = (short) 0x2D;
+ short VK_MINUS = (short) 0x2D;
/** Constant for the period key, "." */
- public static final short VK_PERIOD = (short) 0x2E;
+ short VK_PERIOD = (short) 0x2E;
/** Constant for the forward slash key, "/" */
- public static final short VK_SLASH = (short) 0x2F;
+ short VK_SLASH = (short) 0x2F;
/** VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39] */
- public static final short VK_0 = (short) 0x30;
+ short VK_0 = (short) 0x30;
/** See {@link #VK_0}. */
- public static final short VK_1 = (short) 0x31;
+ short VK_1 = (short) 0x31;
/** See {@link #VK_0}. */
- public static final short VK_2 = (short) 0x32;
+ short VK_2 = (short) 0x32;
/** See {@link #VK_0}. */
- public static final short VK_3 = (short) 0x33;
+ short VK_3 = (short) 0x33;
/** See {@link #VK_0}. */
- public static final short VK_4 = (short) 0x34;
+ short VK_4 = (short) 0x34;
/** See {@link #VK_0}. */
- public static final short VK_5 = (short) 0x35;
+ short VK_5 = (short) 0x35;
/** See {@link #VK_0}. */
- public static final short VK_6 = (short) 0x36;
+ short VK_6 = (short) 0x36;
/** See {@link #VK_0}. */
- public static final short VK_7 = (short) 0x37;
+ short VK_7 = (short) 0x37;
/** See {@link #VK_0}. */
- public static final short VK_8 = (short) 0x38;
+ short VK_8 = (short) 0x38;
/** See {@link #VK_0}. */
- public static final short VK_9 = (short) 0x39;
+ short VK_9 = (short) 0x39;
/** Constant for the ":" key. */
- public static final short VK_COLON = (short) 0x3A;
+ short VK_COLON = (short) 0x3A;
/** Constant for the semicolon key, ";" */
- public static final short VK_SEMICOLON = (short) 0x3B;
+ short VK_SEMICOLON = (short) 0x3B;
/** Constant for the equals key, "<" */
- public static final short VK_LESS = (short) 0x3C;
+ short VK_LESS = (short) 0x3C;
/** Constant for the equals key, "=" */
- public static final short VK_EQUALS = (short) 0x3D;
+ short VK_EQUALS = (short) 0x3D;
/** Constant for the equals key, ">" */
- public static final short VK_GREATER = (short) 0x3E;
+ short VK_GREATER = (short) 0x3E;
/** Constant for the equals key, "?" */
- public static final short VK_QUESTIONMARK = (short) 0x3F;
+ short VK_QUESTIONMARK = (short) 0x3F;
/** Constant for the equals key, "@" */
- public static final short VK_AT = (short) 0x40;
+ short VK_AT = (short) 0x40;
/**
* VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 -
* 0x5A)
*/
- public static final short VK_A = (short) 0x41;
+ short VK_A = (short) 0x41;
/** See {@link #VK_A}. */
- public static final short VK_B = (short) 0x42;
+ short VK_B = (short) 0x42;
/** See {@link #VK_A}. */
- public static final short VK_C = (short) 0x43;
+ short VK_C = (short) 0x43;
/** See {@link #VK_A}. */
- public static final short VK_D = (short) 0x44;
+ short VK_D = (short) 0x44;
/** See {@link #VK_A}. */
- public static final short VK_E = (short) 0x45;
+ short VK_E = (short) 0x45;
/** See {@link #VK_A}. */
- public static final short VK_F = (short) 0x46;
+ short VK_F = (short) 0x46;
/** See {@link #VK_A}. */
- public static final short VK_G = (short) 0x47;
+ short VK_G = (short) 0x47;
/** See {@link #VK_A}. */
- public static final short VK_H = (short) 0x48;
+ short VK_H = (short) 0x48;
/** See {@link #VK_A}. */
- public static final short VK_I = (short) 0x49;
+ short VK_I = (short) 0x49;
/** See {@link #VK_A}. */
- public static final short VK_J = (short) 0x4A;
+ short VK_J = (short) 0x4A;
/** See {@link #VK_A}. */
- public static final short VK_K = (short) 0x4B;
+ short VK_K = (short) 0x4B;
/** See {@link #VK_A}. */
- public static final short VK_L = (short) 0x4C;
+ short VK_L = (short) 0x4C;
/** See {@link #VK_A}. */
- public static final short VK_M = (short) 0x4D;
+ short VK_M = (short) 0x4D;
/** See {@link #VK_A}. */
- public static final short VK_N = (short) 0x4E;
+ short VK_N = (short) 0x4E;
/** See {@link #VK_A}. */
- public static final short VK_O = (short) 0x4F;
+ short VK_O = (short) 0x4F;
/** See {@link #VK_A}. */
- public static final short VK_P = (short) 0x50;
+ short VK_P = (short) 0x50;
/** See {@link #VK_A}. */
- public static final short VK_Q = (short) 0x51;
+ short VK_Q = (short) 0x51;
/** See {@link #VK_A}. */
- public static final short VK_R = (short) 0x52;
+ short VK_R = (short) 0x52;
/** See {@link #VK_A}. */
- public static final short VK_S = (short) 0x53;
+ short VK_S = (short) 0x53;
/** See {@link #VK_A}. */
- public static final short VK_T = (short) 0x54;
+ short VK_T = (short) 0x54;
/** See {@link #VK_A}. */
- public static final short VK_U = (short) 0x55;
+ short VK_U = (short) 0x55;
/** See {@link #VK_A}. */
- public static final short VK_V = (short) 0x56;
+ short VK_V = (short) 0x56;
/** See {@link #VK_A}. */
- public static final short VK_W = (short) 0x57;
+ short VK_W = (short) 0x57;
/** See {@link #VK_A}. */
- public static final short VK_X = (short) 0x58;
+ short VK_X = (short) 0x58;
/** See {@link #VK_A}. */
- public static final short VK_Y = (short) 0x59;
+ short VK_Y = (short) 0x59;
/** See {@link #VK_A}. */
- public static final short VK_Z = (short) 0x5A;
+ short VK_Z = (short) 0x5A;
/** Constant for the open bracket key, "[" */
- public static final short VK_OPEN_BRACKET = (short) 0x5B;
+ short VK_OPEN_BRACKET = (short) 0x5B;
/** Constant for the back slash key, "\" */
- public static final short VK_BACK_SLASH = (short) 0x5C;
+ short VK_BACK_SLASH = (short) 0x5C;
/** Constant for the close bracket key, "]" */
- public static final short VK_CLOSE_BRACKET = (short) 0x5D;
+ short VK_CLOSE_BRACKET = (short) 0x5D;
/** Constant for the "^" key. */
- public static final short VK_CIRCUMFLEX = (short) 0x5E;
+ short VK_CIRCUMFLEX = (short) 0x5E;
/** Constant for the "_" key */
- public static final short VK_UNDERSCORE = (short) 0x5F;
+ short VK_UNDERSCORE = (short) 0x5F;
/** Constant for the "`" key */
- public static final short VK_BACK_QUOTE = (short) 0x60;
+ short VK_BACK_QUOTE = (short) 0x60;
/**
* Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode /
@@ -298,86 +298,86 @@ public interface KeyboardJogampValues {
* See Unicode Collision for details.
*
*/
- public static final short VK_F1 = (short) (0x60 + 1);
+ short VK_F1 = (short) (0x60 + 1);
/** Constant for the F2 function key. See {@link #VK_F1}. */
- public static final short VK_F2 = (short) (0x60 + 2);
+ short VK_F2 = (short) (0x60 + 2);
/** Constant for the F3 function key. See {@link #VK_F1}. */
- public static final short VK_F3 = (short) (0x60 + 3);
+ short VK_F3 = (short) (0x60 + 3);
/** Constant for the F4 function key. See {@link #VK_F1}. */
- public static final short VK_F4 = (short) (0x60 + 4);
+ short VK_F4 = (short) (0x60 + 4);
/** Constant for the F5 function key. See {@link #VK_F1}. */
- public static final short VK_F5 = (short) (0x60 + 5);
+ short VK_F5 = (short) (0x60 + 5);
/** Constant for the F6 function key. See {@link #VK_F1}. */
- public static final short VK_F6 = (short) (0x60 + 6);
+ short VK_F6 = (short) (0x60 + 6);
/** Constant for the F7 function key. See {@link #VK_F1}. */
- public static final short VK_F7 = (short) (0x60 + 7);
+ short VK_F7 = (short) (0x60 + 7);
/** Constant for the F8 function key. See {@link #VK_F1}. */
- public static final short VK_F8 = (short) (0x60 + 8);
+ short VK_F8 = (short) (0x60 + 8);
/** Constant for the F9 function key. See {@link #VK_F1}. */
- public static final short VK_F9 = (short) (0x60 + 9);
+ short VK_F9 = (short) (0x60 + 9);
/** Constant for the F11 function key. See {@link #VK_F1}. */
- public static final short VK_F10 = (short) (0x60 + 10);
+ short VK_F10 = (short) (0x60 + 10);
/** Constant for the F11 function key. See {@link #VK_F1}. */
- public static final short VK_F11 = (short) (0x60 + 11);
+ short VK_F11 = (short) (0x60 + 11);
/** Constant for the F12 function key. See {@link #VK_F1}. */
- public static final short VK_F12 = (short) (0x60 + 12);
+ short VK_F12 = (short) (0x60 + 12);
/** Constant for the F13 function key. See {@link #VK_F1}. */
- public static final short VK_F13 = (short) (0x60 + 13);
+ short VK_F13 = (short) (0x60 + 13);
/** Constant for the F14 function key. See {@link #VK_F1}. */
- public static final short VK_F14 = (short) (0x60 + 14);
+ short VK_F14 = (short) (0x60 + 14);
/** Constant for the F15 function key. See {@link #VK_F1}. */
- public static final short VK_F15 = (short) (0x60 + 15);
+ short VK_F15 = (short) (0x60 + 15);
/** Constant for the F16 function key. See {@link #VK_F1}. */
- public static final short VK_F16 = (short) (0x60 + 16);
+ short VK_F16 = (short) (0x60 + 16);
/** Constant for the F17 function key. See {@link #VK_F1}. */
- public static final short VK_F17 = (short) (0x60 + 17);
+ short VK_F17 = (short) (0x60 + 17);
/** Constant for the F18 function key. See {@link #VK_F1}. */
- public static final short VK_F18 = (short) (0x60 + 18);
+ short VK_F18 = (short) (0x60 + 18);
/** Constant for the F19 function key. See {@link #VK_F1}. */
- public static final short VK_F19 = (short) (0x60 + 19);
+ short VK_F19 = (short) (0x60 + 19);
/** Constant for the F20 function key. See {@link #VK_F1}. */
- public static final short VK_F20 = (short) (0x60 + 20);
+ short VK_F20 = (short) (0x60 + 20);
/** Constant for the F21 function key. See {@link #VK_F1}. */
- public static final short VK_F21 = (short) (0x60 + 21);
+ short VK_F21 = (short) (0x60 + 21);
/** Constant for the F22 function key. See {@link #VK_F1}. */
- public static final short VK_F22 = (short) (0x60 + 22);
+ short VK_F22 = (short) (0x60 + 22);
/** Constant for the F23 function key. See {@link #VK_F1}. */
- public static final short VK_F23 = (short) (0x60 + 23);
+ short VK_F23 = (short) (0x60 + 23);
/** Constant for the F24 function key. See {@link #VK_F1}. */
- public static final short VK_F24 = (short) (0x60 + 24);
+ short VK_F24 = (short) (0x60 + 24);
/** Constant for the "{" key */
- public static final short VK_LEFT_BRACE = (short) 0x7B;
+ short VK_LEFT_BRACE = (short) 0x7B;
/** Constant for the "|" key */
- public static final short VK_PIPE = (short) 0x7C;
+ short VK_PIPE = (short) 0x7C;
/** Constant for the "}" key */
- public static final short VK_RIGHT_BRACE = (short) 0x7D;
+ short VK_RIGHT_BRACE = (short) 0x7D;
/** Constant for the "~" key, matching ASCII */
- public static final short VK_TILDE = (short) 0x7E;
+ short VK_TILDE = (short) 0x7E;
//
// Unicode: Non printable controls: [0x7F - 0x9F]
@@ -388,125 +388,125 @@ public interface KeyboardJogampValues {
/**
* Numeric keypad decimal separator key. Non printable UTF control.
*/
- public static final short VK_SEPARATOR = (short) 0x7F;
+ short VK_SEPARATOR = (short) 0x7F;
/**
* Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80
* - 0x89). Non printable UTF control.
*/
- public static final short VK_NUMPAD0 = (short) 0x80;
+ short VK_NUMPAD0 = (short) 0x80;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD1 = (short) 0x81;
+ short VK_NUMPAD1 = (short) 0x81;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD2 = (short) 0x82;
+ short VK_NUMPAD2 = (short) 0x82;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD3 = (short) 0x83;
+ short VK_NUMPAD3 = (short) 0x83;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD4 = (short) 0x84;
+ short VK_NUMPAD4 = (short) 0x84;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD5 = (short) 0x85;
+ short VK_NUMPAD5 = (short) 0x85;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD6 = (short) 0x86;
+ short VK_NUMPAD6 = (short) 0x86;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD7 = (short) 0x87;
+ short VK_NUMPAD7 = (short) 0x87;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD8 = (short) 0x88;
+ short VK_NUMPAD8 = (short) 0x88;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD9 = (short) 0x89;
+ short VK_NUMPAD9 = (short) 0x89;
/**
* Numeric keypad decimal separator key. Non printable UTF control.
*/
- public static final short VK_DECIMAL = (short) 0x8A;
+ short VK_DECIMAL = (short) 0x8A;
/** Numeric keypad add key. Non printable UTF control. */
- public static final short VK_ADD = (short) 0x8B;
+ short VK_ADD = (short) 0x8B;
/** Numeric keypad subtract key. Non printable UTF control. */
- public static final short VK_SUBTRACT = (short) 0x8C;
+ short VK_SUBTRACT = (short) 0x8C;
/** Numeric keypad multiply key. Non printable UTF control. */
- public static final short VK_MULTIPLY = (short) 0x8D;
+ short VK_MULTIPLY = (short) 0x8D;
/** Numeric keypad divide key. Non printable UTF control. */
- public static final short VK_DIVIDE = (short) 0x8E;
+ short VK_DIVIDE = (short) 0x8E;
/** Constant for the DEL key, matching ASCII. Non printable UTF control. */
- public static final short VK_DELETE = (short) 0x93;
+ short VK_DELETE = (short) 0x93;
/** Numeric keypad num lock key. Non printable UTF control. */
- public static final short VK_NUM_LOCK = (short) 0x94;
+ short VK_NUM_LOCK = (short) 0x94;
/**
* Constant for the cursor- or numerical-pad left arrow key. Non
* printable UTF control.
*/
- public static final short VK_LEFT = (short) 0x95;
+ short VK_LEFT = (short) 0x95;
/**
* Constant for the cursor- or numerical-pad up arrow key. Non
* printable UTF control.
*/
- public static final short VK_UP = (short) 0x96;
+ short VK_UP = (short) 0x96;
/**
* Constant for the cursor- or numerical-pad right arrow key. Non
* printable UTF control.
*/
- public static final short VK_RIGHT = (short) 0x97;
+ short VK_RIGHT = (short) 0x97;
/**
* Constant for the cursor- or numerical pad down arrow key. Non
* printable UTF control.
*/
- public static final short VK_DOWN = (short) 0x98;
+ short VK_DOWN = (short) 0x98;
/** Constant for the Context Menu key. Non printable UTF control. */
- public static final short VK_CONTEXT_MENU = (short) 0x99;
+ short VK_CONTEXT_MENU = (short) 0x99;
/**
* Constant for the MS "Windows" function key.
* It is used for both the left and right version of the key.
*/
- public static final short VK_WINDOWS = (short) 0x9A;
+ short VK_WINDOWS = (short) 0x9A;
/** Constant for the Meta function key. */
- public static final short VK_META = (short) 0x9B;
+ short VK_META = (short) 0x9B;
/** Constant for the Help function key. */
- public static final short VK_HELP = (short) 0x9C;
+ short VK_HELP = (short) 0x9C;
/** Constant for the Compose function key. */
- public static final short VK_COMPOSE = (short) 0x9D;
+ short VK_COMPOSE = (short) 0x9D;
/** Constant for the Begin function key. */
- public static final short VK_BEGIN = (short) 0x9E;
+ short VK_BEGIN = (short) 0x9E;
/** Constant for the Stop function key. */
- public static final short VK_STOP = (short) 0x9F;
+ short VK_STOP = (short) 0x9F;
//
// Unicode: Printable [0x00A0 - 0xDFFF]
//
/** Constant for the inverted exclamation mark key. */
- public static final short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1;
+ short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1;
/** Constant for the Euro currency sign key. */
- public static final short VK_EURO_SIGN = (short) 0x20AC;
+ short VK_EURO_SIGN = (short) 0x20AC;
//
// Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
//
/* for Sun keyboards */
- public static final short VK_CUT = (short) 0xF879;
- public static final short VK_COPY = (short) 0xF87A;
- public static final short VK_PASTE = (short) 0xF87B;
- public static final short VK_UNDO = (short) 0xF87C;
- public static final short VK_AGAIN = (short) 0xF87D;
- public static final short VK_FIND = (short) 0xF87E;
- public static final short VK_PROPS = (short) 0xF87F;
+ short VK_CUT = (short) 0xF879;
+ short VK_COPY = (short) 0xF87A;
+ short VK_PASTE = (short) 0xF87B;
+ short VK_UNDO = (short) 0xF87C;
+ short VK_AGAIN = (short) 0xF87D;
+ short VK_FIND = (short) 0xF87E;
+ short VK_PROPS = (short) 0xF87F;
/* for input method support on Asian Keyboards */
@@ -514,61 +514,61 @@ public interface KeyboardJogampValues {
* Constant for the input method on/off key.
*/
/* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
- public static final short VK_INPUT_METHOD_ON_OFF = (short) 0xF890;
+ short VK_INPUT_METHOD_ON_OFF = (short) 0xF890;
/**
* Constant for the Code Input function key.
*/
/* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */
- public static final short VK_CODE_INPUT = (short) 0xF891;
+ short VK_CODE_INPUT = (short) 0xF891;
/**
* Constant for the Roman Characters function key.
*/
/* Japanese PC 106 keyboard: roumaji */
- public static final short VK_ROMAN_CHARACTERS = (short) 0xF892;
+ short VK_ROMAN_CHARACTERS = (short) 0xF892;
/**
* Constant for the All Candidates function key.
*/
/* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */
- public static final short VK_ALL_CANDIDATES = (short) 0xF893;
+ short VK_ALL_CANDIDATES = (short) 0xF893;
/**
* Constant for the Previous Candidate function key.
*/
/* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */
- public static final short VK_PREVIOUS_CANDIDATE = (short) 0xF894;
+ short VK_PREVIOUS_CANDIDATE = (short) 0xF894;
/**
* Constant for the Alphanumeric function key.
*/
/* Japanese PC 106 keyboard: eisuu */
- public static final short VK_ALPHANUMERIC = (short) 0xF895;
+ short VK_ALPHANUMERIC = (short) 0xF895;
/**
* Constant for the Katakana function key.
*/
/* Japanese PC 106 keyboard: katakana */
- public static final short VK_KATAKANA = (short) 0xF896;
+ short VK_KATAKANA = (short) 0xF896;
/**
* Constant for the Hiragana function key.
*/
/* Japanese PC 106 keyboard: hiragana */
- public static final short VK_HIRAGANA = (short) 0xF897;
+ short VK_HIRAGANA = (short) 0xF897;
/**
* Constant for the Full-Width Characters function key.
*/
/* Japanese PC 106 keyboard: zenkaku */
- public static final short VK_FULL_WIDTH = (short) 0xF898;
+ short VK_FULL_WIDTH = (short) 0xF898;
/**
* Constant for the Half-Width Characters function key.
*/
/* Japanese PC 106 keyboard: hankaku */
- public static final short VK_HALF_WIDTH = (short) 0xF89A;
+ short VK_HALF_WIDTH = (short) 0xF89A;
/**
* Constant for the Japanese-Katakana function key.
@@ -576,7 +576,7 @@ public interface KeyboardJogampValues {
* input mode.
*/
/* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
- public static final short VK_JAPANESE_KATAKANA = (short) 0xF89B;
+ short VK_JAPANESE_KATAKANA = (short) 0xF89B;
/**
* Constant for the Japanese-Hiragana function key.
@@ -584,7 +584,7 @@ public interface KeyboardJogampValues {
* input mode.
*/
/* Japanese Macintosh keyboard */
- public static final short VK_JAPANESE_HIRAGANA = (short) 0xF89C;
+ short VK_JAPANESE_HIRAGANA = (short) 0xF89C;
/**
* Constant for the Japanese-Roman function key.
@@ -592,19 +592,19 @@ public interface KeyboardJogampValues {
* input mode.
*/
/* Japanese Macintosh keyboard */
- public static final short VK_JAPANESE_ROMAN = (short) 0xF89D;
+ short VK_JAPANESE_ROMAN = (short) 0xF89D;
/**
* Constant for the locking Kana function key.
* This key locks the keyboard into a Kana layout.
*/
/* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */
- public static final short VK_KANA_LOCK = (short) 0xF89F;
+ short VK_KANA_LOCK = (short) 0xF89F;
/**
* Constant for Keyboard became invisible, e.g. Android's soft keyboard Back
* button hit while keyboard is visible.
*/
- public static final short VK_KEYBOARD_INVISIBLE = (short) 0xF8FF;
+ short VK_KEYBOARD_INVISIBLE = (short) 0xF8FF;
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java b/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java
index b29326b9..ab052483 100644
--- a/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java
+++ b/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java
@@ -12,13 +12,12 @@ public class PIHardwareDisplay implements HardwareDisplay {
public void shutdown() {}
@Override
- public void setBrightness(double value) {
- if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
+ public void setBrightness(final double value) {
+ if (Engine.getPlatform().getSettings().isDebugEnabled() == false)
Engine.getPlatform().getGpio().pwmWrite(12, (int) Math.ceil(value * 1024f));
// SoftPwm.softPwmWrite(12, (int)(Math.ceil(brightness*10)));
- } else {
+ else
Engine.getPlatform().getConsoleUtils().out().println(1, "Brightness: " + value);
- }
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java b/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java
index 0acde74a..f91aad95 100644
--- a/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java
+++ b/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java
@@ -12,69 +12,65 @@ public class PIHardwareTouchDevice implements HardwareTouchDevice {
private final boolean invertXY, invertX, invertY;
- public PIHardwareTouchDevice(boolean invertXY, boolean invertX, boolean invertY) {
+ public PIHardwareTouchDevice(final boolean invertXY, final boolean invertX, final boolean invertY) {
this.invertXY = invertXY;
this.invertX = invertX;
this.invertY = invertY;
}
@Override
- public boolean onTouchStart(TouchStartEvent e) {
+ public boolean onTouchStart(final TouchStartEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchStart(e)) {
+ if (scr != null && scr.initialized && scr.onTouchStart(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@Override
- public boolean onTouchEnd(TouchEndEvent e) {
+ public boolean onTouchEnd(final TouchEndEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchEnd(e)) {
+ if (scr != null && scr.initialized && scr.onTouchEnd(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@Override
- public boolean onTouchCancel(TouchCancelEvent e) {
+ public boolean onTouchCancel(final TouchCancelEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchCancel(e)) {
+ if (scr != null && scr.initialized && scr.onTouchCancel(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@Override
- public boolean onTouchMove(TouchMoveEvent e) {
+ public boolean onTouchMove(final TouchMoveEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchMove(e)) {
+ if (scr != null && scr.initialized && scr.onTouchMove(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@@ -94,20 +90,18 @@ public class PIHardwareTouchDevice implements HardwareTouchDevice {
}
@Override
- public TouchPoint makePoint(long id, float x, float y, int screenWidth, int screenHeight, float radiusX,
- float radiusY, float force, float rotationAngle) {
+ public TouchPoint makePoint(final long id, float x, float y, final int screenWidth, final int screenHeight,
+ final float radiusX, final float radiusY, final float force, final float rotationAngle) {
if (getInvertedXY()) {
- double oldX = x;
- double oldY = y;
- x = (float) (oldY * ((double) screenWidth) / ((double) screenHeight));
- y = (float) (oldX * ((double) screenHeight) / ((double) screenWidth));
+ final double oldX = x;
+ final double oldY = y;
+ x = (float) (oldY * screenWidth / screenHeight);
+ y = (float) (oldX * screenHeight / screenWidth);
}
- if (getInvertedX()) {
+ if (getInvertedX())
x = screenWidth - x;
- }
- if (getInvertedY()) {
+ if (getInvertedY())
y = screenHeight - y;
- }
return new TouchPoint(id, x, y, radiusX, radiusY, force, rotationAngle);
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java b/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java
index 51f815c9..dfc74e6d 100644
--- a/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java
+++ b/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java
@@ -9,7 +9,7 @@ public class ParallelToSerial {
private final int QH;
private final int CLK;
- public ParallelToSerial(int SH_LD_pin, int CLK_INH_pin, int QH_pin, int CLK_pin) {
+ public ParallelToSerial(final int SH_LD_pin, final int CLK_INH_pin, final int QH_pin, final int CLK_pin) {
SH_LD = SH_LD_pin;
CLK_INH = CLK_INH_pin;
QH = QH_pin;
diff --git a/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java b/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java
index 56e53027..f5563280 100644
--- a/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java
+++ b/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java
@@ -7,16 +7,16 @@ public class SerialToParallel {
private final int SCK; //Shift register clock pin
private final int SER; //Serial data input
- public SerialToParallel(int RCK_pin, int SCK_pin, int SER_pin) {
+ public SerialToParallel(final int RCK_pin, final int SCK_pin, final int SER_pin) {
RCK = RCK_pin;
SCK = SCK_pin;
SER = SER_pin;
}
- public void write(boolean[] data) {
- if (data.length != 8) {
+ public void write(final boolean[] data) {
+ if (data.length != 8)
return;
- } else {
+ else {
Engine.getPlatform().getGpio().digitalWrite(RCK, Engine.getPlatform().getGpio().valueLow());
for (int i = 7; i >= 0; i--) {
diff --git a/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java b/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java
index 0b69f52f..fd7ca8de 100644
--- a/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java
+++ b/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java
@@ -31,7 +31,7 @@ public class RAWFont {
public int charIntCount;
public static final int intBits = 31;
- public void create(String name) {
+ public void create(final String name) {
try {
loadFont("/font_" + name + ".rft");
} catch (final IOException e) {
@@ -45,7 +45,7 @@ public class RAWFont {
int currentInt = 0;
int currentBit = 0;
for (int i = 0; i < charS; i++) {
- if (currentInt * intBits + currentBit >= (currentInt + 1) * intBits) {
+ if (currentInt * RAWFont.intBits + currentBit >= (currentInt + 1) * RAWFont.intBits) {
currentInt += 1;
currentBit = 0;
}
@@ -56,11 +56,11 @@ public class RAWFont {
int currentInt = 0;
int currentBit = 0;
for (int i = 0; i < charS; i++) {
- if (currentBit >= intBits) {
+ if (currentBit >= RAWFont.intBits) {
currentInt += 1;
currentBit = 0;
}
- chars32[charIndex * charIntCount + currentInt] = (chars32[charIndex * charIntCount + currentInt]) | ((currentChar[i] ? 1 : 0) << currentBit);
+ chars32[charIndex * charIntCount + currentInt] = chars32[charIndex * charIntCount + currentInt] | (currentChar[i] ? 1 : 0) << currentBit;
currentBit++;
}
}
@@ -69,12 +69,11 @@ public class RAWFont {
Object obj = new Object();
final WeakReference ref = new WeakReference<>(obj);
obj = null;
- while (ref.get() != null) {
+ while (ref.get() != null)
System.gc();
- }
}
- private void loadFont(String string) throws IOException {
+ private void loadFont(final String string) throws IOException {
final URL res = ClassUtils.classLoader.getClass().getResource(string);
final int[] file = Utils.realBytes(Utils.convertStreamToByteArray(res.openStream(), res.getFile().length()));
final int filelength = file.length;
@@ -83,32 +82,28 @@ public class RAWFont {
charW = file[0x4] << 8 | file[0x5];
charH = file[0x6] << 8 | file[0x7];
charS = charW * charH;
- charIntCount = (int) Math.ceil(((double) charS) / ((double) intBits));
+ charIntCount = (int) Math.ceil((double) charS / (double) RAWFont.intBits);
minBound = file[0x9] << 24 | file[0xA] << 16 | file[0xB] << 8 | file[0xC];
maxBound = file[0xE] << 24 | file[0xF] << 16 | file[0x10] << 8 | file[0x11];
- if (maxBound <= minBound) {
+ if (maxBound <= minBound)
maxBound = 10000; //TODO remove it: temp fix
- }
rawchars = new boolean[maxBound - minBound][];
int index = 0x12;
- while (index < filelength) {
+ while (index < filelength)
try {
final int charIndex = file[index] << 8 | file[index + 1];
final boolean[] rawchar = new boolean[charS];
int charbytescount = 0;
- while (charbytescount * 8 < charS) {
+ while (charbytescount * 8 < charS)
charbytescount += 1;
- }
int currentBit = 0;
- for (int i = 0; i <= charbytescount; i++) {
+ for (int i = 0; i <= charbytescount; i++)
for (int bit = 0; bit < 8; bit++) {
- if (currentBit >= charS) {
+ if (currentBit >= charS)
break;
- }
- rawchar[currentBit] = (((file[index + 2 + i] >> (8 - 1 - bit)) & 0x1) == 1) ? true : false;
+ rawchar[currentBit] = (file[index + 2 + i] >> 8 - 1 - bit & 0x1) == 1 ? true : false;
currentBit++;
}
- }
rawchars[charIndex - minBound] = rawchar;
index += 2 + charbytescount;
} catch (final Exception ex) {
@@ -116,27 +111,23 @@ public class RAWFont {
System.out.println(string);
Engine.getPlatform().exit(-1);
}
- }
- } else {
+ } else
throw new IOException();
- }
- } else {
+ } else
throw new IOException();
- }
}
- public int[] getCharIndexes(String txt) {
+ public int[] getCharIndexes(final String txt) {
final int l = txt.length();
final int[] indexes = new int[l];
final char[] chars = txt.toCharArray();
- for (int i = 0; i < l; i++) {
+ for (int i = 0; i < l; i++)
indexes[i] = (chars[i] & 0xFFFF) - minBound;
- }
return indexes;
}
@SuppressWarnings("unused")
- private void saveArray(int[] screen, String coutputpng) {
+ private void saveArray(final int[] screen, final String coutputpng) {
final BufferedImage bi = new BufferedImage(300, 200, BufferedImage.TYPE_INT_RGB);
final int[] a = ((DataBufferInt) bi.getRaster().getDataBuffer()).getData();
System.arraycopy(screen, 0, a, 0, screen.length);
@@ -147,7 +138,8 @@ public class RAWFont {
}
}
- public void drawText(int[] screen, int[] screenSize, int x, int y, int[] text, int color) {
+ public void drawText(final int[] screen, final int[] screenSize, final int x, final int y, final int[] text,
+ final int color) {
final int screenLength = screen.length;
int screenPos = 0;
@@ -158,23 +150,21 @@ public class RAWFont {
int j;
final int l = text.length;
for (int i = 0; i < l; i++) {
- cpos = (i * (charW + 1));
+ cpos = i * (charW + 1);
final int charIndex = text[i];
- for (int dy = 0; dy < charH; dy++) {
+ for (int dy = 0; dy < charH; dy++)
for (int dx = 0; dx < charW; dx++) {
j = x + cpos + dx;
if (j > 0 & j < screenSize[0]) {
final int bit = dx + dy * charW;
- currentInt = (int) (Math.floor(bit) / (intBits));
- currentIntBitPosition = bit - (currentInt * intBits);
- bitData = (chars32[charIndex * charIntCount + currentInt] >> currentIntBitPosition) & 1;
+ currentInt = (int) (Math.floor(bit) / RAWFont.intBits);
+ currentIntBitPosition = bit - currentInt * RAWFont.intBits;
+ bitData = chars32[charIndex * charIntCount + currentInt] >> currentIntBitPosition & 1;
screenPos = x + cpos + dx + (y + dy) * screenSize[0];
- if (bitData == 1 & screenLength > screenPos) {
+ if (bitData == 1 & screenLength > screenPos)
screen[screenPos] = color;
- }
}
}
- }
}
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/KeyEvent.java b/core/src/main/java/it/cavallium/warppi/event/KeyEvent.java
index f5dd53fb..df12c188 100644
--- a/core/src/main/java/it/cavallium/warppi/event/KeyEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/KeyEvent.java
@@ -1,5 +1,5 @@
package it.cavallium.warppi.event;
public interface KeyEvent extends Event {
- public Key getKey();
+ Key getKey();
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/KeyPressedEvent.java b/core/src/main/java/it/cavallium/warppi/event/KeyPressedEvent.java
index 8c43ab81..2d262704 100644
--- a/core/src/main/java/it/cavallium/warppi/event/KeyPressedEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/KeyPressedEvent.java
@@ -2,9 +2,9 @@ package it.cavallium.warppi.event;
public class KeyPressedEvent implements KeyEvent {
- private Key k;
+ private final Key k;
- public KeyPressedEvent(Key k) {
+ public KeyPressedEvent(final Key k) {
this.k = k;
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/KeyReleasedEvent.java b/core/src/main/java/it/cavallium/warppi/event/KeyReleasedEvent.java
index b1e0daf1..da0c77d5 100644
--- a/core/src/main/java/it/cavallium/warppi/event/KeyReleasedEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/KeyReleasedEvent.java
@@ -2,9 +2,9 @@ package it.cavallium.warppi.event;
public class KeyReleasedEvent implements KeyEvent {
- private Key k;
+ private final Key k;
- public KeyReleasedEvent(Key k) {
+ public KeyReleasedEvent(final Key k) {
this.k = k;
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/KeyboardEventListener.java b/core/src/main/java/it/cavallium/warppi/event/KeyboardEventListener.java
index 6101459b..027c1b08 100644
--- a/core/src/main/java/it/cavallium/warppi/event/KeyboardEventListener.java
+++ b/core/src/main/java/it/cavallium/warppi/event/KeyboardEventListener.java
@@ -1,11 +1,11 @@
package it.cavallium.warppi.event;
public interface KeyboardEventListener {
- public default boolean onKeyPressed(KeyPressedEvent k) {
+ default boolean onKeyPressed(final KeyPressedEvent k) {
return false;
}
- public default boolean onKeyReleased(KeyReleasedEvent k) {
+ default boolean onKeyReleased(final KeyReleasedEvent k) {
return false;
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchCancelEvent.java b/core/src/main/java/it/cavallium/warppi/event/TouchCancelEvent.java
index 3618ac3e..7d19b364 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchCancelEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchCancelEvent.java
@@ -7,7 +7,7 @@ public class TouchCancelEvent implements TouchEvent {
private final List changedTouches;
private final List touches;
- public TouchCancelEvent(List changedTouches, List touches) {
+ public TouchCancelEvent(final List changedTouches, final List touches) {
super();
this.changedTouches = changedTouches;
this.touches = touches;
@@ -27,20 +27,20 @@ public class TouchCancelEvent implements TouchEvent {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((changedTouches == null) ? 0 : changedTouches.hashCode());
- result = prime * result + ((touches == null) ? 0 : touches.hashCode());
+ result = prime * result + (changedTouches == null ? 0 : changedTouches.hashCode());
+ result = prime * result + (touches == null ? 0 : touches.hashCode());
return result;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- TouchCancelEvent other = (TouchCancelEvent) obj;
+ final TouchCancelEvent other = (TouchCancelEvent) obj;
if (changedTouches == null) {
if (other.changedTouches != null)
return false;
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchEndEvent.java b/core/src/main/java/it/cavallium/warppi/event/TouchEndEvent.java
index 27f98186..baa8a31c 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchEndEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchEndEvent.java
@@ -7,7 +7,7 @@ public class TouchEndEvent implements TouchEvent {
private final List changedTouches;
private final List touches;
- public TouchEndEvent(List changedTouches, List touches) {
+ public TouchEndEvent(final List changedTouches, final List touches) {
super();
this.changedTouches = changedTouches;
this.touches = touches;
@@ -27,20 +27,20 @@ public class TouchEndEvent implements TouchEvent {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((changedTouches == null) ? 0 : changedTouches.hashCode());
- result = prime * result + ((touches == null) ? 0 : touches.hashCode());
+ result = prime * result + (changedTouches == null ? 0 : changedTouches.hashCode());
+ result = prime * result + (touches == null ? 0 : touches.hashCode());
return result;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- TouchEndEvent other = (TouchEndEvent) obj;
+ final TouchEndEvent other = (TouchEndEvent) obj;
if (changedTouches == null) {
if (other.changedTouches != null)
return false;
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchEvent.java b/core/src/main/java/it/cavallium/warppi/event/TouchEvent.java
index 66aa6265..565fbed0 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchEvent.java
@@ -3,7 +3,7 @@ package it.cavallium.warppi.event;
import java.util.List;
public interface TouchEvent extends Event {
- public List getChangedTouches();
+ List getChangedTouches();
- public List getTouches();
+ List getTouches();
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchEventListener.java b/core/src/main/java/it/cavallium/warppi/event/TouchEventListener.java
index 596fa62a..9dda969b 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchEventListener.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchEventListener.java
@@ -1,19 +1,19 @@
package it.cavallium.warppi.event;
public interface TouchEventListener {
- public default boolean onTouchStart(TouchStartEvent k) {
+ default boolean onTouchStart(final TouchStartEvent k) {
return false;
}
- public default boolean onTouchEnd(TouchEndEvent k) {
+ default boolean onTouchEnd(final TouchEndEvent k) {
return false;
}
- public default boolean onTouchCancel(TouchCancelEvent k) {
+ default boolean onTouchCancel(final TouchCancelEvent k) {
return false;
}
- public default boolean onTouchMove(TouchMoveEvent k) {
+ default boolean onTouchMove(final TouchMoveEvent k) {
return false;
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchMoveEvent.java b/core/src/main/java/it/cavallium/warppi/event/TouchMoveEvent.java
index 424226b3..cbba6118 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchMoveEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchMoveEvent.java
@@ -7,7 +7,7 @@ public class TouchMoveEvent implements TouchEvent {
private final List changedTouches;
private final List touches;
- public TouchMoveEvent(List changedTouches, List touches) {
+ public TouchMoveEvent(final List changedTouches, final List touches) {
super();
this.changedTouches = changedTouches;
this.touches = touches;
@@ -27,20 +27,20 @@ public class TouchMoveEvent implements TouchEvent {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((changedTouches == null) ? 0 : changedTouches.hashCode());
- result = prime * result + ((touches == null) ? 0 : touches.hashCode());
+ result = prime * result + (changedTouches == null ? 0 : changedTouches.hashCode());
+ result = prime * result + (touches == null ? 0 : touches.hashCode());
return result;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- TouchMoveEvent other = (TouchMoveEvent) obj;
+ final TouchMoveEvent other = (TouchMoveEvent) obj;
if (changedTouches == null) {
if (other.changedTouches != null)
return false;
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchPoint.java b/core/src/main/java/it/cavallium/warppi/event/TouchPoint.java
index dc46e1cf..9e05fc56 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchPoint.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchPoint.java
@@ -9,7 +9,7 @@ public class TouchPoint {
private final float y;
private final long id;
- public TouchPoint(long id, float x, float y, float radiusX, float radiusY, float force, float rotationAngle) {
+ public TouchPoint(final long id, final float x, final float y, final float radiusX, final float radiusY, final float force, final float rotationAngle) {
super();
this.id = id;
this.radiusX = radiusX;
@@ -53,7 +53,7 @@ public class TouchPoint {
final int prime = 31;
int result = 1;
result = prime * result + Float.floatToIntBits(force);
- result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + (int) (id ^ id >>> 32);
result = prime * result + Float.floatToIntBits(radiusX);
result = prime * result + Float.floatToIntBits(radiusY);
result = prime * result + Float.floatToIntBits(rotationAngle);
@@ -63,14 +63,14 @@ public class TouchPoint {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- TouchPoint other = (TouchPoint) obj;
+ final TouchPoint other = (TouchPoint) obj;
if (Float.floatToIntBits(force) != Float.floatToIntBits(other.force))
return false;
if (id != other.id)
diff --git a/core/src/main/java/it/cavallium/warppi/event/TouchStartEvent.java b/core/src/main/java/it/cavallium/warppi/event/TouchStartEvent.java
index 97c032fc..feb621d6 100644
--- a/core/src/main/java/it/cavallium/warppi/event/TouchStartEvent.java
+++ b/core/src/main/java/it/cavallium/warppi/event/TouchStartEvent.java
@@ -7,7 +7,7 @@ public class TouchStartEvent implements TouchEvent {
private final List changedTouches;
private final List touches;
- public TouchStartEvent(List changedTouches, List touches) {
+ public TouchStartEvent(final List changedTouches, final List touches) {
super();
this.changedTouches = changedTouches;
this.touches = touches;
@@ -27,20 +27,20 @@ public class TouchStartEvent implements TouchEvent {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((changedTouches == null) ? 0 : changedTouches.hashCode());
- result = prime * result + ((touches == null) ? 0 : touches.hashCode());
+ result = prime * result + (changedTouches == null ? 0 : changedTouches.hashCode());
+ result = prime * result + (touches == null ? 0 : touches.hashCode());
return result;
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
- TouchStartEvent other = (TouchStartEvent) obj;
+ final TouchStartEvent other = (TouchStartEvent) obj;
if (changedTouches == null) {
if (other.changedTouches != null)
return false;
diff --git a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioBlock.java b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioBlock.java
index 6f9f7147..68a3f6a5 100644
--- a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioBlock.java
+++ b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioBlock.java
@@ -5,7 +5,7 @@ public class MarioBlock {
private final int y;
private final byte id;
- public MarioBlock(int x, int y, byte b) {
+ public MarioBlock(final int x, final int y, final byte b) {
this.x = x;
this.y = y;
id = b;
@@ -27,7 +27,7 @@ public class MarioBlock {
return y;
}
- public static boolean isSolid(byte id) {
+ public static boolean isSolid(final byte id) {
return id != 0b0;
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEnemy.java b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEnemy.java
index 50199268..cc9710a3 100644
--- a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEnemy.java
+++ b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEnemy.java
@@ -2,7 +2,7 @@ package it.cavallium.warppi.extra.mario;
public class MarioEnemy extends MarioEntity {
- public MarioEnemy(double x, double y, double forceX, double forceY, boolean onGround, boolean subjectToGravity) {
+ public MarioEnemy(final double x, final double y, final double forceX, final double forceY, final boolean onGround, final boolean subjectToGravity) {
super(x, y, forceX, forceY, onGround, subjectToGravity);
}
diff --git a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEntity.java b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEntity.java
index 1facaf96..11cc7ded 100644
--- a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEntity.java
+++ b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioEntity.java
@@ -11,7 +11,7 @@ public class MarioEntity {
public boolean collisionRight;
public boolean subjectToGravity;
- public MarioEntity(double x, double y, double forceX, double forceY, boolean onGround, boolean subjectToGravity) {
+ public MarioEntity(final double x, final double y, final double forceX, final double forceY, final boolean onGround, final boolean subjectToGravity) {
this.x = x;
this.y = y;
this.forceX = forceX;
@@ -20,12 +20,12 @@ public class MarioEntity {
this.subjectToGravity = subjectToGravity;
}
- public void setPosition(double x, double y) {
+ public void setPosition(final double x, final double y) {
this.x = x;
this.y = y;
}
- public void setPosition(double x, double y, boolean onGround) {
+ public void setPosition(final double x, final double y, final boolean onGround) {
this.x = x;
this.y = y;
collisionDown = onGround;
@@ -43,43 +43,41 @@ public class MarioEntity {
return collisionDown;
}
- public void setOnGround(boolean onGround) {
+ public void setOnGround(final boolean onGround) {
collisionDown = onGround;
}
- public void gameTick(double dt) {
+ public void gameTick(final double dt) {
x = computeFutureDX(dt);
y = computeFutureDY(dt);
forceX = computeFutureForceDX(dt);
forceY = computeFutureForceDY(dt);
}
- public double computeFutureDX(double dt) {
- return (x + dt * forceX) - x;
+ public double computeFutureDX(final double dt) {
+ return x + dt * forceX - x;
}
- public double computeFutureDY(double dt) {
+ public double computeFutureDY(final double dt) {
final double forceY = this.forceY;
double y = this.y;
- if (!collisionDown) {
+ if (!collisionDown)
y += dt * forceY;
- }
return y - this.y;
}
- public double computeFutureForceDX(double dt) {
+ public double computeFutureForceDX(final double dt) {
double forceX = this.forceX;
forceX *= 0.75;
return forceX - this.forceX;
}
- public double computeFutureForceDY(double dt) {
+ public double computeFutureForceDY(final double dt) {
double forceY = this.forceY;
- if (subjectToGravity && !collisionDown) {
+ if (subjectToGravity && !collisionDown)
forceY -= dt * 1569.6 / 16f;
- } else {
+ else
forceY *= 0.75;
- }
return forceY - this.forceY;
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioGame.java b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioGame.java
index f799669f..056868fd 100644
--- a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioGame.java
+++ b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioGame.java
@@ -26,15 +26,15 @@ public class MarioGame {
canMove = true;
}
- public MarioBlock getBlockAt(int x, int y) {
+ public MarioBlock getBlockAt(final int x, final int y) {
return worlds[currentWorld].getBlockAt(x, y);
}
- public MarioBlock getBlockAt(double x, double y) {
+ public MarioBlock getBlockAt(final double x, final double y) {
return getBlockAt((int) x, (int) y);
}
- public void move(float dt, double deltaX, double deltaY) {
+ public void move(final float dt, final double deltaX, final double deltaY) {
final double curX = player.getX();
final double curY = player.getY();
final double futureX = curX + deltaX;
@@ -50,15 +50,14 @@ public class MarioGame {
return worlds[currentWorld];
}
- public void gameTick(float dt, boolean upPressed, boolean downPressed, boolean leftPressed, boolean rightPressed,
- boolean jumpPressed, boolean runPressed) {
+ public void gameTick(final float dt, final boolean upPressed, final boolean downPressed, final boolean leftPressed,
+ final boolean rightPressed, final boolean jumpPressed, final boolean runPressed) {
checkOnGround(getPlayer(), dt);
checkCollisionTop(getPlayer(), dt);
checkCollisionLeft(getPlayer(), dt);
checkCollisionRight(getPlayer(), dt);
- if (canMove) {
+ if (canMove)
move(dt, (rightPressed ? 1 : 0) - (leftPressed ? 1 : 0), jumpPressed ? 1 : 0);
- }
getPlayer().gameTick(dt);
final MarioWorld w = getCurrentWorld();
@@ -72,25 +71,24 @@ public class MarioGame {
}
@SuppressWarnings("unused")
- private int nearest(double val, int a, int b) {
+ private int nearest(final double val, final int a, final int b) {
final double aa = Math.abs(val - a);
final double ab = Math.abs(val - b);
- if (aa < ab) {
+ if (aa < ab)
return (int) aa;
- } else {
+ else
return (int) ab;
- }
}
- private void checkOnGround(MarioEntity e, float dt) {
+ private void checkOnGround(final MarioEntity e, final float dt) {
if (e.subjectToGravity) {
final int xA = (int) Math.floor(e.getX());
final int xB = (int) Math.ceil(e.getX());
final int y0 = (int) Math.ceil(e.getY());
final int y1 = (int) Math.ceil(e.getY() + e.computeFutureDY(dt));
boolean onGround = false;
- if (y1 < y0) {
- for (int y = y0; y >= y1; y--) {
+ if (y1 < y0)
+ for (int y = y0; y >= y1; y--)
for (int x = xA; x <= xB; x++) {
final byte b = getCurrentWorld().getBlockIdAt(x, y - 1);
if (MarioBlock.isSolid(b)) {
@@ -103,8 +101,7 @@ public class MarioGame {
break;
}
}
- }
- } else {
+ else
for (int x = xA; x <= xB; x++) {
final byte b = getCurrentWorld().getBlockIdAt(x, y0 - 1);
if (MarioBlock.isSolid(b)) {
@@ -116,22 +113,20 @@ public class MarioGame {
}
}
}
- }
- if (!onGround) {
+ if (!onGround)
e.setOnGround(false);
- }
}
}
- private void checkCollisionTop(MarioEntity e, float dt) {
+ private void checkCollisionTop(final MarioEntity e, final float dt) {
if (e.subjectToGravity) {
final int xA = (int) Math.floor(e.getX());
final int xB = (int) Math.ceil(e.getX());
final int y0 = (int) Math.ceil(e.getY());
final int y1 = (int) Math.ceil(e.getY() + e.computeFutureDY(dt));
boolean collisionUp = false;
- if (y1 > y0) {
- for (int y = y0; y <= y1; y++) {
+ if (y1 > y0)
+ for (int y = y0; y <= y1; y++)
for (int x = xA; x <= xB; x++) {
final byte b = getCurrentWorld().getBlockIdAt(x, y + 1);
if (MarioBlock.isSolid(b)) {
@@ -144,8 +139,7 @@ public class MarioGame {
break;
}
}
- }
- } else {
+ else
for (int x = xA; x <= xB; x++) {
final byte b = getCurrentWorld().getBlockIdAt(x, y0 + 1);
if (MarioBlock.isSolid(b)) {
@@ -157,14 +151,12 @@ public class MarioGame {
}
}
}
- }
- if (!collisionUp) {
+ if (!collisionUp)
e.collisionUp = false;
- }
}
}
- private void checkCollisionRight(MarioEntity e, float dt) {
+ private void checkCollisionRight(final MarioEntity e, final float dt) {
if (e.subjectToGravity) {
final int yA = (int) Math.floor(e.getY());
final int yB = (int) Math.ceil(e.getY());
@@ -172,8 +164,8 @@ public class MarioGame {
final double x1double = e.getX() + e.computeFutureDX(dt);
final int x1 = (int) Math.floor(x1double);
boolean collisionRight = false;
- if (x1 > x0) {
- for (int x = x0; x <= x1; x++) {
+ if (x1 > x0)
+ for (int x = x0; x <= x1; x++)
for (int y = yA; y <= yB; y++) {
final byte b = getCurrentWorld().getBlockIdAt(x + 1, y);
if (MarioBlock.isSolid(b)) {
@@ -186,8 +178,7 @@ public class MarioGame {
break;
}
}
- }
- } else {
+ else
for (int y = yA; y <= yB; y++) {
final byte b = getCurrentWorld().getBlockIdAt(x0 + 1, y);
if (MarioBlock.isSolid(b)) {
@@ -199,14 +190,12 @@ public class MarioGame {
}
}
}
- }
- if (!collisionRight) {
+ if (!collisionRight)
e.collisionRight = false;
- }
}
}
- private void checkCollisionLeft(MarioEntity e, float dt) {
+ private void checkCollisionLeft(final MarioEntity e, final float dt) {
if (e.subjectToGravity) {
final int yA = (int) Math.floor(e.getY());
final int yB = (int) Math.ceil(e.getY());
@@ -220,39 +209,34 @@ public class MarioGame {
e.setPosition(0, e.getY());
}
e.collisionLeft = true;
- } else {
- if (x1 < x0) {
- for (int x = x0; x >= x1; x--) {
- for (int y = yA; y <= yB; y++) {
- final byte b = getCurrentWorld().getBlockIdAt(x - 1, y);
- if (MarioBlock.isSolid(b)) {
- collisionLeft = true;
- if (e.forceX < 0 && x1double <= x) {
- e.forceX = 0;
- e.setPosition(x, e.getY());
- e.collisionLeft = true;
- }
- break;
- }
- }
- }
- } else {
+ } else if (x1 < x0)
+ for (int x = x0; x >= x1; x--)
for (int y = yA; y <= yB; y++) {
- final byte b = getCurrentWorld().getBlockIdAt(x0 - 1, y);
+ final byte b = getCurrentWorld().getBlockIdAt(x - 1, y);
if (MarioBlock.isSolid(b)) {
collisionLeft = true;
- if (e.forceX < 0 && x1double <= x0) {
+ if (e.forceX < 0 && x1double <= x) {
e.forceX = 0;
- e.setPosition(x0, e.getY());
+ e.setPosition(x, e.getY());
e.collisionLeft = true;
}
+ break;
+ }
+ }
+ else
+ for (int y = yA; y <= yB; y++) {
+ final byte b = getCurrentWorld().getBlockIdAt(x0 - 1, y);
+ if (MarioBlock.isSolid(b)) {
+ collisionLeft = true;
+ if (e.forceX < 0 && x1double <= x0) {
+ e.forceX = 0;
+ e.setPosition(x0, e.getY());
+ e.collisionLeft = true;
}
}
}
- }
- if (!collisionLeft) {
+ if (!collisionLeft)
e.collisionLeft = false;
- }
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioWorld.java b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioWorld.java
index e6cae610..1146233c 100644
--- a/core/src/main/java/it/cavallium/warppi/extra/mario/MarioWorld.java
+++ b/core/src/main/java/it/cavallium/warppi/extra/mario/MarioWorld.java
@@ -17,7 +17,7 @@ public class MarioWorld {
* @param events
* @param marioEnemies
*/
- public MarioWorld(int[] spawnPoint, int width, int height, byte[][] data, MarioEvent[] events, MarioEntity[] entities) {
+ public MarioWorld(final int[] spawnPoint, final int width, final int height, final byte[][] data, final MarioEvent[] events, final MarioEntity[] entities) {
this.spawnPoint = spawnPoint;
this.width = width;
this.height = height;
@@ -26,19 +26,17 @@ public class MarioWorld {
this.entities = entities;
}
- public byte getBlockIdAt(int x, int y) {
- final int idy = (height - 1 - y);
- if (idy < 0 || idy >= data.length) {
+ public byte getBlockIdAt(final int x, final int y) {
+ final int idy = height - 1 - y;
+ if (idy < 0 || idy >= data.length)
return 0b0;
- }
final int idx = x;
- if (idx < 0 || idx >= data[0].length) {
+ if (idx < 0 || idx >= data[0].length)
return 0b0;
- }
return data[idy][idx];
}
- public MarioBlock getBlockAt(int x, int y) {
+ public MarioBlock getBlockAt(final int x, final int y) {
return new MarioBlock(x, y, getBlockIdAt(x, y));
}
diff --git a/core/src/main/java/it/cavallium/warppi/extra/mario/PlayerEntity.java b/core/src/main/java/it/cavallium/warppi/extra/mario/PlayerEntity.java
index 1056952c..e07cb327 100644
--- a/core/src/main/java/it/cavallium/warppi/extra/mario/PlayerEntity.java
+++ b/core/src/main/java/it/cavallium/warppi/extra/mario/PlayerEntity.java
@@ -14,13 +14,13 @@ public class PlayerEntity extends MarioEntity {
private double controllerDX;
private double controllerDY;
- public PlayerEntity(double x, double y, int life) {
+ public PlayerEntity(final double x, final double y, final int life) {
super(x, y, 0, 0, true, true);
this.life = life;
}
@Override
- public void gameTick(double dt) {
+ public void gameTick(final double dt) {
walkAnimation += dt;
x += computeFutureDX(dt);
y += computeFutureDY(dt);
@@ -48,87 +48,79 @@ public class PlayerEntity extends MarioEntity {
if (jumptime <= 0.5f && !jumping && collisionDown) {
jumping = true;
collisionDown = false;
- } else if (jumptime <= 0.5f) {} else {
+ } else if (jumptime <= 0.5f) {} else
jumping = false;
- }
} else {
jumping = false;
- if (collisionDown) {
+ if (collisionDown)
jumptime = 0;
- } else {
+ else
jumptime = Float.MAX_VALUE;
- }
}
if (!walking & !running & !jumping) {
marioSkinPos[0] = 0;
marioSkinPos[1] = 0;
- } else if (collisionDown & walking & !running & !jumping && walkAnimation >= 0.08) {
+ } else if (collisionDown & walking & !running & !jumping && walkAnimation >= 0.08)
while (walkAnimation > 0.08) {
walkAnimation -= 0.08;
- if (marioSkinPos[0] == 1 & marioSkinPos[1] == 0) {
+ if (marioSkinPos[0] == 1 & marioSkinPos[1] == 0)
marioSkinPos[0] += 2;
- } else if (marioSkinPos[0] == 3 & marioSkinPos[1] == 0) {
+ else if (marioSkinPos[0] == 3 & marioSkinPos[1] == 0)
marioSkinPos[0] -= 1;
- } else if (marioSkinPos[0] == 2 & marioSkinPos[1] == 0) {
+ else if (marioSkinPos[0] == 2 & marioSkinPos[1] == 0)
marioSkinPos[0] -= 1;
- } else {
+ else {
marioSkinPos[0] = 1;
marioSkinPos[1] = 0;
}
}
- } else if (jumping) {
+ else if (jumping) {
marioSkinPos[0] = 5;
marioSkinPos[1] = 1;
}
}
@Override
- public double computeFutureDX(double dt) {
+ public double computeFutureDX(final double dt) {
return super.computeFutureDX(dt);
}
- public double computeFuturedDY(double dt) {
+ public double computeFuturedDY(final double dt) {
return super.computeFutureDY(dt);
}
@Override
- public double computeFutureForceDX(double dt) {
+ public double computeFutureForceDX(final double dt) {
double forceX = this.forceX;
if (controllerDX == 0) {} else {
- if (controllerDX > 0) { //RIGHT
- if (forceX < 500f / 16f) {
+ if (controllerDX > 0)
+ if (forceX < 500f / 16f)
forceX += dt * 500f / 16f;
- }
- }
- if (controllerDX < 0) { //LEFT
- if (forceX > -500f / 16f) {
+ if (controllerDX < 0)
+ if (forceX > -500f / 16f)
forceX -= dt * 500f / 16f;
- }
- }
}
- return (forceX + super.computeFutureForceDX(dt)) - this.forceX;
+ return forceX + super.computeFutureForceDX(dt) - this.forceX;
}
@Override
- public double computeFutureForceDY(double dt) {
+ public double computeFutureForceDY(final double dt) {
float jumptime = this.jumptime;
double forceY = this.forceY;
if (controllerDY > 0) { //JUMP
- if (collisionUp) {
+ if (collisionUp)
jumptime = Float.MAX_VALUE;
- }
jumptime += dt;
- if (jumptime <= 0.5f && !jumping && collisionDown) {
+ if (jumptime <= 0.5f && !jumping && collisionDown)
forceY = dt * (4 * 1569.6f) / 16f;
- } else if (jumptime <= 0.5f) {
+ else if (jumptime <= 0.5f)
forceY = dt * (4 * 1569.6f) / 16f;
- }
}
- return (forceY + super.computeFutureForceDY(dt)) - this.forceY;
+ return forceY + super.computeFutureForceDY(dt) - this.forceY;
}
- public void move(float dt, double dX, double dY) {
+ public void move(final float dt, final double dX, final double dY) {
walkAnimation += dt;
controllerDX = dX;
diff --git a/core/src/main/java/it/cavallium/warppi/flow/BehaviorSubject.java b/core/src/main/java/it/cavallium/warppi/flow/BehaviorSubject.java
index 029cf057..92817723 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/BehaviorSubject.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/BehaviorSubject.java
@@ -11,7 +11,7 @@ public class BehaviorSubject extends Subject {
lastValueSet = false;
}
- protected BehaviorSubject(T initialValue) {
+ protected BehaviorSubject(final T initialValue) {
super();
lastValue = initialValue;
lastValueSet = true;
@@ -21,31 +21,28 @@ public class BehaviorSubject extends Subject {
return new BehaviorSubject<>();
}
- public final static BehaviorSubject create(T initialValue) {
- return new BehaviorSubject(initialValue);
+ public final static BehaviorSubject create(final T initialValue) {
+ return new BehaviorSubject<>(initialValue);
}
@Override
public void onComplete() {
- for (Subscriber super T> sub : this.subscribers) {
+ for (final Subscriber super T> sub : subscribers)
sub.onComplete();
- }
}
@Override
- public void onError(Throwable e) {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ public void onError(final Throwable e) {
+ for (final Subscriber super T> sub : subscribers)
+ sub.onError(e);;
}
@Override
- public void onNext(T t) {
+ public void onNext(final T t) {
lastValue = t;
lastValueSet = true;
- for (Subscriber super T> sub : this.subscribers) {
+ for (final Subscriber super T> sub : subscribers)
sub.onNext(t);
- }
}
@Override
@@ -79,13 +76,12 @@ public class BehaviorSubject extends Subject {
}
@Override
- public void onSubscribe(Disposable d) {
+ public void onSubscribe(final Disposable d) {
@SuppressWarnings("unchecked")
- DisposableOfSubscriber ds = (DisposableOfSubscriber) d;
- Subscriber super T> s = ds.getSubscriber();
- if (lastValueSet) {
+ final DisposableOfSubscriber ds = (DisposableOfSubscriber) d;
+ final Subscriber super T> s = ds.getSubscriber();
+ if (lastValueSet)
s.onNext(lastValue);
- }
}
public T getLastValue() {
diff --git a/core/src/main/java/it/cavallium/warppi/flow/Consumer.java b/core/src/main/java/it/cavallium/warppi/flow/Consumer.java
index addbb885..3eedfd1d 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/Consumer.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/Consumer.java
@@ -26,9 +26,9 @@ public interface Consumer {
* @throws NullPointerException
* if {@code after} is null
*/
- default Consumer andThen(Consumer super T> after) {
+ default Consumer andThen(final Consumer super T> after) {
Objects.requireNonNull(after);
- return (T t) -> {
+ return (final T t) -> {
accept(t);
after.accept(t);
};
diff --git a/core/src/main/java/it/cavallium/warppi/flow/Disposable.java b/core/src/main/java/it/cavallium/warppi/flow/Disposable.java
index 6e3fd6c2..5839c67c 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/Disposable.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/Disposable.java
@@ -1,7 +1,7 @@
package it.cavallium.warppi.flow;
public interface Disposable {
- public void dispose();
+ void dispose();
- public boolean isDisposed();
+ boolean isDisposed();
}
diff --git a/core/src/main/java/it/cavallium/warppi/flow/IntervalsManager.java b/core/src/main/java/it/cavallium/warppi/flow/IntervalsManager.java
index ae58b3f8..322ed66f 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/IntervalsManager.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/IntervalsManager.java
@@ -9,35 +9,31 @@ public class IntervalsManager {
private static List intervals = new LinkedList<>();
static {
- startChecker();
+ IntervalsManager.startChecker();
}
private IntervalsManager() {
}
- public static void register(ObservableInterval t) {
- synchronized (intervals) {
- if (!intervals.contains(t)) {
- intervals.add(t);
- }
+ public static void register(final ObservableInterval t) {
+ synchronized (IntervalsManager.intervals) {
+ if (!IntervalsManager.intervals.contains(t))
+ IntervalsManager.intervals.add(t);
}
}
private static void startChecker() {
- Thread t = new Thread(() -> {
+ final Thread t = new Thread(() -> {
try {
while (true) {
Thread.sleep(1000);
- for (ObservableInterval interval : intervals) {
- if (interval.running) {
- if (interval.subscribers.size() <= 0) {
+ for (final ObservableInterval interval : IntervalsManager.intervals)
+ if (interval.running)
+ if (interval.subscribers.size() <= 0)
interval.stopInterval();
- }
- }
- }
}
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
});
diff --git a/core/src/main/java/it/cavallium/warppi/flow/Observable.java b/core/src/main/java/it/cavallium/warppi/flow/Observable.java
index 0146dd18..f383e320 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/Observable.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/Observable.java
@@ -14,69 +14,75 @@ public abstract class Observable implements ObservableSource {
return null;
}
- public Disposable subscribe(Action1 super T> onNext) {
+ public Disposable subscribe(final Action1 super T> onNext) {
return subscribe(createSubscriber(onNext));
}
- protected Observable.DisposableOfSubscriber createDisposable(Subscriber super T> sub) {
+ protected Observable.DisposableOfSubscriber createDisposable(final Subscriber super T> sub) {
return new DisposableOfSubscriber(sub);
}
- public Disposable subscribe(Action1 super T> onNext, Action1 onError) {
+ public Disposable subscribe(final Action1 super T> onNext, final Action1 onError) {
return subscribe(createSubscriber(onNext, onError));
}
- public Disposable subscribe(Action1 super T> onNext, Action1 onError, Action0 onCompleted) {
+ public Disposable subscribe(final Action1 super T> onNext, final Action1 onError,
+ final Action0 onCompleted) {
return subscribe(createSubscriber(onNext, onError, onCompleted));
}
- public void subscribe(Observer super T> obs) {
+ @Override
+ public void subscribe(final Observer super T> obs) {
subscribe(createSubscriber(obs));
}
- public Disposable subscribe(Subscriber super T> sub) {
+ public Disposable subscribe(final Subscriber super T> sub) {
subscribers.add(sub);
return createDisposable(sub);
}
- protected Subscriber createSubscriber(Action1 super T> onNext) {
+ protected Subscriber createSubscriber(final Action1 super T> onNext) {
return new Subscriber() {
@Override
- public void onSubscribe(Subscription s) {}
+ public void onSubscribe(final Subscription s) {}
- public void onNext(T t) {
+ @Override
+ public void onNext(final T t) {
onNext.call(t);
}
};
}
- protected Subscriber createSubscriber(Action1 super T> onNext, Action1 onError) {
+ protected Subscriber createSubscriber(final Action1 super T> onNext, final Action1 onError) {
return new Subscriber() {
@Override
- public void onSubscribe(Subscription s) {}
+ public void onSubscribe(final Subscription s) {}
- public void onNext(T t) {
+ @Override
+ public void onNext(final T t) {
onNext.call(t);
}
@Override
- public void onError(Throwable t) {
+ public void onError(final Throwable t) {
onError.call(t);
}
};
}
- protected Subscriber createSubscriber(Action1 super T> onNext, Action1 onError, Action0 onCompl) {
+ protected Subscriber createSubscriber(final Action1 super T> onNext, final Action1 onError,
+ final Action0 onCompl) {
return new Subscriber() {
@Override
- public void onSubscribe(Subscription s) {}
+ public void onSubscribe(final Subscription s) {}
- public void onNext(T t) {
+ @Override
+ public void onNext(final T t) {
onNext.call(t);
}
@Override
- public void onError(Throwable t) {
+ public void onError(final Throwable t) {
onError.call(t);
}
@@ -87,17 +93,18 @@ public abstract class Observable implements ObservableSource {
};
}
- protected Subscriber createSubscriber(Observer super T> obs) {
+ protected Subscriber createSubscriber(final Observer super T> obs) {
return new Subscriber() {
@Override
- public void onSubscribe(Subscription s) {}
+ public void onSubscribe(final Subscription s) {}
- public void onNext(T t) {
+ @Override
+ public void onNext(final T t) {
obs.onNext(t);
}
@Override
- public void onError(Throwable t) {
+ public void onError(final Throwable t) {
obs.onError(t);
}
@@ -108,32 +115,32 @@ public abstract class Observable implements ObservableSource {
};
}
- public static final Observable merge(Observable a, Observable b) {
+ public static final Observable merge(final Observable a, final Observable b) {
return new ObservableMerged<>(a, b);
}
@Deprecated
- public static final Observable of(Observable a) {
+ public static final Observable of(final Observable a) {
return null;
}
- public final Observable map(Function f) {
- return new ObservableMap(this, f);
+ public final Observable map(final Function f) {
+ return new ObservableMap<>(this, f);
}
- public static final Observable> combineLatest(Observable a, Observable b) {
+ public static final Observable> combineLatest(final Observable a, final Observable b) {
return new ObservableCombinedLatest<>(a, b);
}
- public static final Observable> combineChanged(Observable a, Observable b) {
+ public static final Observable> combineChanged(final Observable a, final Observable b) {
return new ObservableCombinedChanged<>(a, b);
}
- public static final Observable> zip(Observable a, Observable b) {
+ public static final Observable> zip(final Observable a, final Observable b) {
return new ObservableZipped<>(a, b);
}
- public static final Observable interval(long interval) {
+ public static final Observable interval(final long interval) {
return new ObservableInterval(interval);
}
@@ -141,7 +148,7 @@ public abstract class Observable implements ObservableSource {
private final Subscriber super T> sub;
- public DisposableOfSubscriber(Subscriber super T> sub) {
+ public DisposableOfSubscriber(final Subscriber super T> sub) {
this.sub = sub;
}
@@ -155,9 +162,8 @@ public abstract class Observable implements ObservableSource {
@Override
public void dispose() {
- if (isDisposed()) {
+ if (isDisposed())
throw new RuntimeException("Already disposed!");
- }
subscribers.remove(sub);
Observable.this.onDisposed(sub);
}
@@ -169,8 +175,8 @@ public abstract class Observable implements ObservableSource {
}
- public Observable doOnNext(Action1 onNext) {
- Subject onNextSubject = BehaviorSubject.create();
+ public Observable doOnNext(final Action1 onNext) {
+ final Subject onNextSubject = BehaviorSubject.create();
this.subscribe((val) -> {
onNext.call(val);
onNextSubject.onNext(val);
@@ -178,7 +184,7 @@ public abstract class Observable implements ObservableSource {
return onNextSubject;
}
- public void onDisposed(Subscriber super T> sub) {
+ public void onDisposed(final Subscriber super T> sub) {
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedChanged.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedChanged.java
index 6718388a..3536870f 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedChanged.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedChanged.java
@@ -4,12 +4,12 @@ import org.apache.commons.lang3.tuple.Pair;
public class ObservableCombinedChanged extends Observable> {
private volatile boolean initialized = false;
- private Observable a;
- private Observable b;
+ private final Observable a;
+ private final Observable b;
private Disposable disposableA;
private Disposable disposableB;
- public ObservableCombinedChanged(Observable a, Observable b) {
+ public ObservableCombinedChanged(final Observable a, final Observable b) {
super();
this.a = a;
this.b = b;
@@ -17,30 +17,24 @@ public class ObservableCombinedChanged extends Observable> {
private void initialize() {
this.disposableA = a.subscribe((t) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
+ for (final Subscriber super Pair> sub : subscribers)
sub.onNext(Pair.of(t, null));
- }
}, (e) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onComplete();;
});
this.disposableB = b.subscribe((t) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onNext(Pair.of(null, t));
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onNext(Pair.of(null, t));;
}, (e) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onComplete();;
});
}
@@ -52,14 +46,14 @@ public class ObservableCombinedChanged extends Observable> {
}
@Override
- public Disposable subscribe(Subscriber super Pair> sub) {
- Disposable disp = super.subscribe(sub);
+ public Disposable subscribe(final Subscriber super Pair> sub) {
+ final Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;
}
@Override
- public void onDisposed(Subscriber super Pair> sub) {
+ public void onDisposed(final Subscriber super Pair> sub) {
super.onDisposed(sub);
this.disposableA.dispose();
this.disposableB.dispose();
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedLatest.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedLatest.java
index cc15770c..991354a4 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedLatest.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableCombinedLatest.java
@@ -4,8 +4,8 @@ import org.apache.commons.lang3.tuple.Pair;
public class ObservableCombinedLatest extends Observable> {
private volatile boolean initialized = false;
- private Observable a;
- private Observable b;
+ private final Observable a;
+ private final Observable b;
private Disposable disposableA;
private Disposable disposableB;
private volatile T lastA;
@@ -13,7 +13,7 @@ public class ObservableCombinedLatest extends Observable> {
private volatile boolean didAOneTime;
private volatile boolean didBOneTime;
- public ObservableCombinedLatest(Observable a, Observable b) {
+ public ObservableCombinedLatest(final Observable a, final Observable b) {
super();
this.a = a;
this.b = b;
@@ -25,35 +25,30 @@ public class ObservableCombinedLatest extends Observable> {
didAOneTime = true;
receivedNext();
}, (e) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onComplete();;
});
this.disposableB = b.subscribe((t) -> {
lastB = t;
didBOneTime = true;
receivedNext();
}, (e) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onComplete();;
});
}
private void receivedNext() {
- if (didAOneTime && didBOneTime) {
- this.subscribers.forEach(sub -> {
+ if (didAOneTime && didBOneTime)
+ subscribers.forEach(sub -> {
sub.onNext(Pair.of(lastA, lastB));
});
- }
}
private void chechInitialized() {
@@ -64,14 +59,14 @@ public class ObservableCombinedLatest extends Observable> {
}
@Override
- public Disposable subscribe(Subscriber super Pair> sub) {
- Disposable disp = super.subscribe(sub);
+ public Disposable subscribe(final Subscriber super Pair> sub) {
+ final Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;
}
@Override
- public void onDisposed(Subscriber super Pair> sub) {
+ public void onDisposed(final Subscriber super Pair> sub) {
super.onDisposed(sub);
this.disposableA.dispose();
this.disposableB.dispose();
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableInterval.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableInterval.java
index 9530ca5e..9c07a6a0 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableInterval.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableInterval.java
@@ -7,12 +7,12 @@ public class ObservableInterval extends Observable {
volatile boolean running;
volatile Thread timeThread;
- protected ObservableInterval(long interval) {
+ protected ObservableInterval(final long interval) {
super();
this.interval = interval;
try {
startInterval();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
@@ -20,15 +20,15 @@ public class ObservableInterval extends Observable {
void stopInterval() {
if (running) {
running = false;
- this.timeThread.interrupt();
+ timeThread.interrupt();
}
}
@Override
- public Disposable subscribe(Subscriber super Long> sub) {
+ public Disposable subscribe(final Subscriber super Long> sub) {
try {
startInterval();
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
return super.subscribe(sub);
@@ -36,18 +36,16 @@ public class ObservableInterval extends Observable {
void startInterval() throws InterruptedException {
if (running == false) {
- while (timeThread != null) {
+ while (timeThread != null)
Thread.sleep(100);
- }
timeThread = new Thread(() -> {
try {
while (!Thread.interrupted()) {
- for (Subscriber super Long> sub : this.subscribers) {
+ for (final Subscriber super Long> sub : subscribers)
sub.onNext(System.currentTimeMillis());
- }
Thread.sleep(interval);
}
- } catch (InterruptedException e) {}
+ } catch (final InterruptedException e) {}
timeThread = null;
});
Engine.getPlatform().setThreadName(timeThread, "ObservableTimer");
@@ -56,12 +54,12 @@ public class ObservableInterval extends Observable {
}
}
- public static ObservableInterval create(long l) {
+ public static ObservableInterval create(final long l) {
return new ObservableInterval(l);
}
@Override
- public void onDisposed(Subscriber super Long> sub) {
+ public void onDisposed(final Subscriber super Long> sub) {
super.onDisposed(sub);
stopInterval();
}
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableMap.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableMap.java
index 70875e74..435020f9 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableMap.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableMap.java
@@ -3,12 +3,12 @@ package it.cavallium.warppi.flow;
import java.util.function.Function;
public class ObservableMap extends Observable {
- private Observable originalObservable;
- private Function mapAction;
+ private final Observable originalObservable;
+ private final Function mapAction;
private volatile boolean initialized = false;
private Disposable mapDisposable;
- public ObservableMap(Observable originalObservable, Function mapAction) {
+ public ObservableMap(final Observable originalObservable, final Function mapAction) {
super();
this.originalObservable = originalObservable;
this.mapAction = mapAction;
@@ -16,17 +16,14 @@ public class ObservableMap extends Observable {
private void initialize() {
this.mapDisposable = originalObservable.subscribe((t) -> {
- for (Subscriber super U> sub : this.subscribers) {
- sub.onNext(mapAction.apply(t));
- } ;
+ for (final Subscriber super U> sub : subscribers)
+ sub.onNext(mapAction.apply(t));;
}, (e) -> {
- for (Subscriber super U> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super U> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super U> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super U> sub : subscribers)
+ sub.onComplete();;
});
}
@@ -38,14 +35,14 @@ public class ObservableMap extends Observable {
}
@Override
- public Disposable subscribe(Subscriber super U> sub) {
- Disposable disp = super.subscribe(sub);
+ public Disposable subscribe(final Subscriber super U> sub) {
+ final Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;
}
@Override
- public void onDisposed(Subscriber super U> sub) {
+ public void onDisposed(final Subscriber super U> sub) {
super.onDisposed(sub);
mapDisposable.dispose();
}
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableMerged.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableMerged.java
index 6dc60c72..b3a1a539 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableMerged.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableMerged.java
@@ -1,13 +1,13 @@
package it.cavallium.warppi.flow;
public class ObservableMerged extends Observable {
- private Observable originalObservableA;
- private Observable originalObservableB;
+ private final Observable originalObservableA;
+ private final Observable originalObservableB;
private volatile boolean initialized = false;
private Disposable mapDisposableA;
private Disposable mapDisposableB;
- public ObservableMerged(Observable originalObservableA, Observable originalObservableB) {
+ public ObservableMerged(final Observable originalObservableA, final Observable originalObservableB) {
super();
this.originalObservableA = originalObservableA;
this.originalObservableB = originalObservableB;
@@ -15,30 +15,24 @@ public class ObservableMerged extends Observable {
private void initialize() {
this.mapDisposableA = originalObservableA.subscribe((t) -> {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onNext(t);
- } ;
+ for (final Subscriber super T> sub : subscribers)
+ sub.onNext(t);;
}, (e) -> {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super T> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super T> sub : subscribers)
+ sub.onComplete();;
});
this.mapDisposableB = originalObservableB.subscribe((t) -> {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onNext(t);
- } ;
+ for (final Subscriber super T> sub : subscribers)
+ sub.onNext(t);;
}, (e) -> {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super T> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super T> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super T> sub : subscribers)
+ sub.onComplete();;
});
}
@@ -50,14 +44,14 @@ public class ObservableMerged extends Observable {
}
@Override
- public Disposable subscribe(Subscriber super T> sub) {
- Disposable disp = super.subscribe(sub);
+ public Disposable subscribe(final Subscriber super T> sub) {
+ final Disposable disp = super.subscribe(sub);
chechInitialized();
return disp;
}
@Override
- public void onDisposed(Subscriber super T> sub) {
+ public void onDisposed(final Subscriber super T> sub) {
super.onDisposed(sub);
this.mapDisposableA.dispose();
this.mapDisposableB.dispose();
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableSource.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableSource.java
index 8e3a604e..b47d6f3f 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableSource.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableSource.java
@@ -1,5 +1,5 @@
package it.cavallium.warppi.flow;
public interface ObservableSource {
- public void subscribe(Observer super T> observer);
+ void subscribe(Observer super T> observer);
}
diff --git a/core/src/main/java/it/cavallium/warppi/flow/ObservableZipped.java b/core/src/main/java/it/cavallium/warppi/flow/ObservableZipped.java
index 0ff45821..b6b9ede4 100644
--- a/core/src/main/java/it/cavallium/warppi/flow/ObservableZipped.java
+++ b/core/src/main/java/it/cavallium/warppi/flow/ObservableZipped.java
@@ -4,8 +4,8 @@ import org.apache.commons.lang3.tuple.Pair;
public class ObservableZipped extends Observable> {
private volatile boolean initialized = false;
- private Observable a;
- private Observable b;
+ private final Observable a;
+ private final Observable b;
private Disposable disposableA;
private Disposable disposableB;
private volatile T lastA;
@@ -13,7 +13,7 @@ public class ObservableZipped extends Observable> {
private volatile boolean didA;
private volatile boolean didB;
- public ObservableZipped(Observable a, Observable b) {
+ public ObservableZipped(final Observable a, final Observable b) {
super();
this.a = a;
this.b = b;
@@ -25,26 +25,22 @@ public class ObservableZipped extends Observable> {
didA = true;
receivedNext();
}, (e) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onComplete();;
});
this.disposableB = b.subscribe((t) -> {
lastB = t;
didB = true;
receivedNext();
}, (e) -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onError(e);
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onError(e);;
}, () -> {
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onComplete();
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onComplete();;
});
}
@@ -52,9 +48,8 @@ public class ObservableZipped extends Observable> {
if (didA && didB) {
didA = false;
didB = false;
- for (Subscriber super Pair> sub : this.subscribers) {
- sub.onNext(Pair.of(lastA, lastB));
- } ;
+ for (final Subscriber super Pair> sub : subscribers)
+ sub.onNext(Pair.of(lastA, lastB));;
}
}
@@ -66,14 +61,14 @@ public class ObservableZipped extends Observable> {
}
@Override
- public Disposable subscribe(Subscriber super Pair> sub) {
- Disposable disp = super.subscribe(sub);
+ public Disposable subscribe(final Subscriber super Pair