aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Gouesse <gouessej@orange.fr>2016-06-30 22:36:24 +0200
committerJulien Gouesse <gouessej@orange.fr>2016-06-30 22:36:24 +0200
commitced8e5e5a3439630b51a5aef53ef5dfbde69eb95 (patch)
treed09e41e49f4ad4a172a2cb4760d373aead49d4eb
parent1257dbbf93986d1c2f21c0b1758efd8ffd110cf5 (diff)
Switches from Java 1.6 to Java 1.7 and fixes numerous warnings
-rw-r--r--ardor3d-animation/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java10
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java10
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java6
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java8
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java4
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java2
-rw-r--r--ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java2
-rw-r--r--ardor3d-awt/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java2
-rw-r--r--ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java2
-rw-r--r--ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java8
-rw-r--r--ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java2
-rw-r--r--ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java4
-rw-r--r--ardor3d-collada/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java28
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java10
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java4
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java2
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java8
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java4
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java2
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java8
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java40
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java2
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java6
-rw-r--r--ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java2
-rw-r--r--ardor3d-core/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java29
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java30
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java15
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java84
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/Image.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java11
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java53
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java20
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java30
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java14
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java11
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java20
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java32
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java42
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java32
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java10
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java28
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java16
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java23
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java28
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java25
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java53
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java47
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java9
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java11
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java13
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java9
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java4
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java14
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java20
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java126
-rw-r--r--ardor3d-effects/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java2
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java4
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java4
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java4
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java4
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java2
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java4
-rw-r--r--ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java4
-rw-r--r--ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java9
-rw-r--r--ardor3d-examples/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java4
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java14
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java28
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java96
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java17
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java2
-rw-r--r--ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java2
-rw-r--r--ardor3d-extras/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java10
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java17
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java8
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java2
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java8
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java6
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java14
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java4
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java6
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java4
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java2
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java8
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java355
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java8
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java52
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java12
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java6
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java4
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java10
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java64
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java12
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java2
-rw-r--r--ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java6
-rw-r--r--ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java2
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java2
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java2
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java2
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java4
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java4
-rw-r--r--ardor3d-math/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java115
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java18
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java32
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java136
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java221
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java2
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Plane.java39
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java156
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java23
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java37
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Ring.java50
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Transform.java88
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java40
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java103
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java104
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java120
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java14
-rw-r--r--ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java2
-rw-r--r--ardor3d-savable/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java80
-rw-r--r--ardor3d-swt/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java2
-rw-r--r--ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java2
-rw-r--r--ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java4
-rw-r--r--ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java8
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java6
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java32
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java8
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java46
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java15
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java6
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java2
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java11
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java6
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java2
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java10
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java8
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java6
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java2
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java2
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java2
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java21
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java4
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java14
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java6
-rw-r--r--ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java8
-rw-r--r--ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java5
-rw-r--r--ardor3d-ui/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java20
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java2
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java12
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java8
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java6
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java17
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java4
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java18
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java2
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java4
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java4
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java4
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java2
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java12
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java10
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java2
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java6
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java6
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java6
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java2
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java13
-rw-r--r--ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java18
-rw-r--r--ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java12
-rw-r--r--pom.xml10
283 files changed, 1919 insertions, 2204 deletions
diff --git a/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs b/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs
index 6fe5961..65ceabb 100644
--- a/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-animation/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java
index 0caa7eb..6c5289b 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/AnimationManager.java
@@ -55,19 +55,19 @@ public class AnimationManager {
protected final Spatial _sceneRoot;
/** Local instance information for any clips referenced by the layers/blend trees in this manager. */
- protected final Map<AnimationClip, AnimationClipInstance> _clipInstances = new WeakHashMap<AnimationClip, AnimationClipInstance>();
+ protected final Map<AnimationClip, AnimationClipInstance> _clipInstances = new WeakHashMap<>();
/** A logic object responsible for taking animation data and applying it to skeleton poses. */
protected AnimationApplier _applier;
/** Our animation layers. */
- protected final List<AnimationLayer> _layers = new ArrayList<AnimationLayer>();
+ protected final List<AnimationLayer> _layers = new ArrayList<>();
/**
* A map of key / Double values, allowing control over elements under this manager without needing precise knowledge
* of the layout of those layers, blend trees, etc. Missing keys will return 0.0 and log a warning.
*/
- protected final LoggingMap<String, Double> _valuesStore = new LoggingMap<String, Double>();
+ protected final LoggingMap<String, Double> _valuesStore = new LoggingMap<>();
/**
* The throttle rate of animation. Default is 60fps (1/60.0). Set to 0 to disable throttling.
@@ -97,7 +97,7 @@ public class AnimationManager {
/**
* Listeners for changes to this manager's AnimationUpdateState.
*/
- protected final List<AnimationUpdateStateListener> _updateStateListeners = new ArrayList<AnimationUpdateStateListener>();
+ protected final List<AnimationUpdateStateListener> _updateStateListeners = new ArrayList<>();
/**
* Construct a new AnimationManager.
@@ -130,7 +130,7 @@ public class AnimationManager {
layer.setManager(this);
_layers.add(layer);
- _applyToPoses = new ArrayList<SkeletonPose>();
+ _applyToPoses = new ArrayList<>();
if (pose != null) {
_applyToPoses.add(pose);
}
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java
index 6a06fce..8ba92ca 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkeletonPose.java
@@ -48,7 +48,7 @@ public class SkeletonPose implements Savable {
/**
* The list of elements interested in notification when this SkeletonPose updates. Not saved to savable.
*/
- private transient final List<PoseListener> _poseListeners = new ArrayList<PoseListener>(1);
+ private transient final List<PoseListener> _poseListeners = new ArrayList<>(1);
/**
* Construct a new SkeletonPose using the given Skeleton.
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java
index 1ad1ac0..31ac962 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/SkinnedMesh.java
@@ -12,6 +12,7 @@ package com.ardor3d.extension.animation.skeletal;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.Objects;
import java.util.TreeSet;
import com.ardor3d.bounding.CollisionTreeManager;
@@ -625,7 +626,7 @@ public class SkinnedMesh extends Mesh implements PoseListener {
final short[] joints = new short[vcount * maxCount];
final float[] weights = new float[vcount * maxCount];
- final TreeSet<JointWeight> weightSort = new TreeSet<JointWeight>();
+ final TreeSet<JointWeight> weightSort = new TreeSet<>();
// Walk through old data vertex by vertex
int index;
for (int i = 0; i < vcount; i++) {
@@ -723,12 +724,7 @@ public class SkinnedMesh extends Mesh implements PoseListener {
@Override
public int hashCode() {
- int result = 17;
-
- // only care about joint
- result += 31 * result + joint;
-
- return result;
+ return Objects.hashCode(Short.valueOf(joint));
}
@Override
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java
index 7f2cb9f..6fc7124 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/BinaryLERPSource.java
@@ -115,7 +115,7 @@ public class BinaryLERPSource extends AbstractTwoPartSource {
Map<String, Object> rVal = store;
if (rVal == null) {
- rVal = new HashMap<String, Object>();
+ rVal = new HashMap<>();
}
for (final Entry<String, ? extends Object> entryAData : sourceAData.entrySet()) {
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java
index c75a943..e278f8c 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ExclusiveClipSource.java
@@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableList;
public class ExclusiveClipSource extends ClipSource {
/** Our List of channels to exclude by name. */
- private final List<String> _disabledChannels = new ArrayList<String>();
+ private final List<String> _disabledChannels = new ArrayList<>();
/**
* Construct a new source. Clip and Manager must be set separately before use.
@@ -91,7 +91,7 @@ public class ExclusiveClipSource extends ClipSource {
final Map<String, ? extends Object> orig = super.getSourceData(manager);
// make a copy, removing specific channels
- final Map<String, Object> data = new HashMap<String, Object>(orig);
+ final Map<String, Object> data = new HashMap<>(orig);
if (_disabledChannels != null) {
for (final String key : _disabledChannels) {
data.remove(key);
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java
index 55ff54f..4d74952 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/InclusiveClipSource.java
@@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList;
public class InclusiveClipSource extends ClipSource {
/** Our List of channels to include by name. */
- private final List<String> _enabledChannels = new ArrayList<String>();
+ private final List<String> _enabledChannels = new ArrayList<>();
/**
* Construct a new source. Clip and Manager must be set separately before use.
@@ -92,7 +92,7 @@ public class InclusiveClipSource extends ClipSource {
final Map<String, ? extends Object> orig = super.getSourceData(manager);
// make a copy, only bringing across specific channels
- final Map<String, Object> data = new HashMap<String, Object>();
+ final Map<String, Object> data = new HashMap<>();
if (_enabledChannels != null) {
for (final String key : _enabledChannels) {
if (orig.containsKey(key)) {
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java
index 3b7e9ff..daf55ab 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/ManagedTransformSource.java
@@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableMap;
public class ManagedTransformSource implements BlendTreeSource {
/** Our local source data. */
- private final Map<String, JointData> data = new HashMap<String, JointData>();
+ private final Map<String, JointData> data = new HashMap<>();
/** optional: name of source we were initialized from, if given. */
private String sourceName;
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java
index 4d050ad..f671ca9 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/blendtree/SimpleAnimationApplier.java
@@ -32,7 +32,7 @@ public class SimpleAnimationApplier implements AnimationApplier {
private final Multimap<String, TriggerCallback> _triggerCallbacks = ArrayListMultimap.create(0, 0);
- private final Map<String, Spatial> _spatialCache = new WeakHashMap<String, Spatial>();
+ private final Map<String, Spatial> _spatialCache = new WeakHashMap<>();
@Override
public void apply(final Spatial root, final AnimationManager manager) {
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java
index c3292fe..70532c0 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClip.java
@@ -44,7 +44,7 @@ public class AnimationClip implements Savable {
*/
public AnimationClip(final String name) {
_name = name;
- _channels = new ArrayList<AbstractAnimationChannel>();
+ _channels = new ArrayList<>();
}
/**
@@ -58,7 +58,7 @@ public class AnimationClip implements Savable {
*/
public AnimationClip(final String name, final List<AbstractAnimationChannel> channels) {
_name = name;
- _channels = new ArrayList<AbstractAnimationChannel>(channels);
+ _channels = new ArrayList<>(channels);
updateMaxTimeIndex();
}
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java
index dac8681..28b9673 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/AnimationClipInstance.java
@@ -40,7 +40,7 @@ public class AnimationClipInstance {
private double _startTime = 0.0;
/** Map of channel name to state tracking objects. */
- private final Map<String, Object> _clipStateObjects = new HashMap<String, Object>();
+ private final Map<String, Object> _clipStateObjects = new HashMap<>();
/** List of callbacks for animation events. */
private List<AnimationListener> animationListeners = null;
@@ -53,7 +53,7 @@ public class AnimationClipInstance {
*/
public void addAnimationListener(final AnimationListener animationListener) {
if (animationListeners == null) {
- animationListeners = new ArrayList<AnimationListener>();
+ animationListeners = new ArrayList<>();
}
animationListeners.add(animationListener);
}
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java
index c76aeba..2063ae1 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/GuaranteedTriggerChannel.java
@@ -49,7 +49,7 @@ public class GuaranteedTriggerChannel extends TriggerChannel {
if (oldIndex == newIndex) {
triggerData.arm(newIndex, _keys[newIndex]);
} else {
- final List<String> triggers = new ArrayList<String>();
+ final List<String> triggers = new ArrayList<>();
for (int i = oldIndex + 1; i <= newIndex; i++) {
if (_keys[i] != null) {
triggers.add(_keys[i]);
@@ -85,8 +85,8 @@ public class GuaranteedTriggerChannel extends TriggerChannel {
if (startTime > endTime) {
throw new IllegalArgumentException("startTime > endTime");
}
- final List<Float> times = new ArrayList<Float>();
- final List<String> keys = new ArrayList<String>();
+ final List<Float> times = new ArrayList<>();
+ final List<String> keys = new ArrayList<>();
final TriggerData tData = new TriggerData();
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java
index 9e0d19a..9292e9c 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedDoubleChannel.java
@@ -92,8 +92,8 @@ public class InterpolatedDoubleChannel extends AbstractAnimationChannel {
if (startTime > endTime) {
throw new IllegalArgumentException("startTime > endTime");
}
- final List<Float> times = new ArrayList<Float>();
- final List<Double> keys = new ArrayList<Double>();
+ final List<Float> times = new ArrayList<>();
+ final List<Double> keys = new ArrayList<>();
final double[] data = new double[1];
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java
index 71f0c40..c33d4f4 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/InterpolatedFloatChannel.java
@@ -90,8 +90,8 @@ public class InterpolatedFloatChannel extends AbstractAnimationChannel {
if (startTime > endTime) {
throw new IllegalArgumentException("startTime > endTime");
}
- final List<Float> times = new ArrayList<Float>();
- final List<Float> keys = new ArrayList<Float>();
+ final List<Float> times = new ArrayList<>();
+ final List<Float> keys = new ArrayList<>();
final float[] data = new float[1];
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java
index 2af0042..f3cb027 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TransformChannel.java
@@ -200,10 +200,10 @@ public class TransformChannel extends AbstractAnimationChannel {
if (startTime > endTime) {
throw new IllegalArgumentException("startTime > endTime");
}
- final List<Float> times = new ArrayList<Float>();
- final List<ReadOnlyQuaternion> rotations = new ArrayList<ReadOnlyQuaternion>();
- final List<ReadOnlyVector3> translations = new ArrayList<ReadOnlyVector3>();
- final List<ReadOnlyVector3> scales = new ArrayList<ReadOnlyVector3>();
+ final List<Float> times = new ArrayList<>();
+ final List<ReadOnlyQuaternion> rotations = new ArrayList<>();
+ final List<ReadOnlyVector3> translations = new ArrayList<>();
+ final List<ReadOnlyVector3> scales = new ArrayList<>();
final TransformData tData = new TransformData();
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java
index 0a48964..4f9ff63 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerChannel.java
@@ -94,8 +94,8 @@ public class TriggerChannel extends AbstractAnimationChannel {
if (startTime > endTime) {
throw new IllegalArgumentException("startTime > endTime");
}
- final List<Float> times = new ArrayList<Float>();
- final List<String> keys = new ArrayList<String>();
+ final List<Float> times = new ArrayList<>();
+ final List<String> keys = new ArrayList<>();
final TriggerData tData = new TriggerData();
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java
index c741cd0..61ea3b4 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/clip/TriggerData.java
@@ -19,7 +19,7 @@ import java.util.List;
public class TriggerData {
/** The current trigger name. */
- private final List<String> _currentTriggers = new ArrayList<String>();
+ private final List<String> _currentTriggers = new ArrayList<>();
/**
* The current channel sample index. We keep this to make sure we don't miss two channels in a row with the same
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java
index 242d1f8..3f27041 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/layer/AnimationLayer.java
@@ -36,7 +36,7 @@ public class AnimationLayer implements StateOwner {
private static final Logger logger = Logger.getLogger(AnimationLayer.class.getName());
/** Our animation states */
- private final Map<String, SteadyState> _steadyStates = new HashMap<String, SteadyState>();
+ private final Map<String, SteadyState> _steadyStates = new HashMap<>();
/** Our current animation state */
private AbstractFiniteState _currentState;
@@ -51,7 +51,7 @@ public class AnimationLayer implements StateOwner {
private final String _name;
/** A map of general transitions for moving from the current state to another. */
- private final Map<String, AbstractTransitionState> _transitions = new HashMap<String, AbstractTransitionState>();
+ private final Map<String, AbstractTransitionState> _transitions = new HashMap<>();
/**
* Construct a new AnimationLayer.
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java
index fccb91f..3028afd 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/AbstractTwoStateLerpTransition.java
@@ -195,7 +195,7 @@ public abstract class AbstractTwoStateLerpTransition extends AbstractTransitionS
// too many new transform data objects. This assumes that a
// same state always returns the same transform data objects.
if (_sourceData == null) {
- _sourceData = new HashMap<String, Object>();
+ _sourceData = new HashMap<>();
}
return BinaryLERPSource.combineSourceData(sourceAData, sourceBData, getPercent(), _sourceData);
}
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java
index 3145509..6b3358c 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/ImmediateTransitionState.java
@@ -49,7 +49,7 @@ public class ImmediateTransitionState extends AbstractTransitionState {
*/
@Override
public Map<String, ? extends Object> getCurrentSourceData(final AnimationManager manager) {
- return new HashMap<String, Object>();
+ return new HashMap<>();
}
/**
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java
index 325fb4a..a8db4c5 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/SteadyState.java
@@ -28,7 +28,7 @@ public class SteadyState extends AbstractFiniteState {
private final String _name;
/** A map of possible transitions for moving from this state to another. */
- private final Map<String, AbstractTransitionState> _transitions = new HashMap<String, AbstractTransitionState>();
+ private final Map<String, AbstractTransitionState> _transitions = new HashMap<>();
/** A transition to use if we reach the end of this state. May be null. */
private AbstractTransitionState _endTransition;
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java
index 8a0e34f..91b7ea1 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/state/loader/OutputStore.java
@@ -21,7 +21,7 @@ import com.ardor3d.extension.animation.skeletal.AttachmentPoint;
public class OutputStore {
/** List of attachment points created during layer import. */
- private final List<AttachmentPoint> _attachments = new ArrayList<AttachmentPoint>();
+ private final List<AttachmentPoint> _attachments = new ArrayList<>();
/** List of animation clip sources encountered during layer import. */
private final OutputClipSourceMap _usedClipSources = new OutputClipSourceMap();
diff --git a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java
index a7e78d9..9e6052e 100644
--- a/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java
+++ b/ardor3d-animation/src/main/java/com/ardor3d/extension/animation/skeletal/util/LoggingMap.java
@@ -28,7 +28,7 @@ public class LoggingMap<KEY, VALUE> {
private static final Logger logger = Logger.getLogger(LoggingMap.class.getName());
/** Our map of values. */
- protected final Map<KEY, VALUE> _wrappedMap = new HashMap<KEY, VALUE>();
+ protected final Map<KEY, VALUE> _wrappedMap = new HashMap<>();
/** If not null, this callback is asked to load the missing value using the key. */
private MissingCallback<KEY, VALUE> _missCallback = null;
diff --git a/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs b/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs
index 19eadb6..941c850 100644
--- a/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-awt/.settings/org.eclipse.jdt.core.prefs
@@ -8,16 +8,16 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java
index 34f0991..22728ac 100644
--- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java
+++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageLoader.java
@@ -49,7 +49,7 @@ public class AWTImageLoader implements ImageLoader {
public static void registerLoader() {
if (supportedFormats == null) {
- final List<String> formats = new ArrayList<String>();
+ final List<String> formats = new ArrayList<>();
for (String format : ImageIO.getReaderFormatNames()) {
format = "." + format.toUpperCase();
if (!formats.contains(format)) {
diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java
index 076def2..6bfac79 100644
--- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java
+++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTImageUtil.java
@@ -63,7 +63,7 @@ public abstract class AWTImageUtil {
final int width = input.getWidth(), height = input.getHeight();
// create our return list
- final List<BufferedImage> rVal = new ArrayList<BufferedImage>();
+ final List<BufferedImage> rVal = new ArrayList<>();
// Calculate our modulation or "tint" values per channel
final double tRed = tint != null ? tint.getRed() / 255. : 1.0;
diff --git a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java
index 76f1447..2edc166 100644
--- a/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java
+++ b/ardor3d-awt/src/main/java/com/ardor3d/image/util/awt/AWTTextureUtil.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -22,7 +22,7 @@ public abstract class AWTTextureUtil {
/**
* Convenience Utility for loading a BufferedImage as an Ardor3D Texture.
- *
+ *
* @param image
* our buffered image
* @param minFilter
@@ -36,8 +36,8 @@ public abstract class AWTTextureUtil {
public static final Texture loadTexture(final BufferedImage image, final Texture.MinificationFilter minFilter,
final TextureStoreFormat storeFormat, final boolean flipVertically) {
final Image imageData = AWTImageLoader.makeArdor3dImage(image, flipVertically);
- final String fileType = (image != null) ? "" + image.hashCode() : null;
- final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, fileType, minFilter);
+ final String imageId = (image != null) ? "" + image.hashCode() : null;
+ final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, imageId, minFilter);
return TextureManager.loadFromKey(tkey, imageData, null);
}
}
diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java
index 1b58724..964be26 100644
--- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java
+++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtKeyboardWrapper.java
@@ -31,7 +31,7 @@ import com.google.common.collect.PeekingIterator;
*/
public class AwtKeyboardWrapper implements KeyboardWrapper, KeyListener {
@GuardedBy("this")
- protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<KeyEvent>();
+ protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<>();
@GuardedBy("this")
protected AwtKeyboardIterator _currentIterator = null;
diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java
index c158cca..d722999 100644
--- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java
+++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseWrapper.java
@@ -40,7 +40,7 @@ import com.google.common.collect.PeekingIterator;
*/
public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelListener, MouseMotionListener {
@GuardedBy("this")
- protected final LinkedList<MouseState> _upcomingEvents = new LinkedList<MouseState>();
+ protected final LinkedList<MouseState> _upcomingEvents = new LinkedList<>();
@GuardedBy("this")
protected AwtMouseIterator _currentIterator = null;
@@ -55,7 +55,7 @@ public class AwtMouseWrapper implements MouseWrapper, MouseListener, MouseWheelL
protected final MouseManager _manager;
protected final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class);
- protected final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<MouseButton, Long>(MouseButton.class);
+ protected final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<>(MouseButton.class);
protected final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class);
protected int _ignoreX = Integer.MAX_VALUE;
diff --git a/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs b/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs
index 19eadb6..941c850 100644
--- a/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-collada/.settings/org.eclipse.jdt.core.prefs
@@ -8,16 +8,16 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java
index e3f39fd..c5eafad 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java
@@ -195,7 +195,7 @@ public class ColladaAnimUtils {
final Node meshNode = _colladaMeshUtils.buildMesh(geometry);
if (meshNode != null) {
// Look for skeleton entries in the original <instance_controller> element
- final List<Element> skeletonRoots = new ArrayList<Element>();
+ final List<Element> skeletonRoots = new ArrayList<>();
for (final Element sk : instanceController.getChildren("skeleton")) {
final Element skroot = _colladaDOMUtil.findTargetWithId(sk.getText());
if (skroot != null) {
@@ -214,9 +214,9 @@ public class ColladaAnimUtils {
}
// Pull out our joint names and bind matrices
- final List<String> jointNames = new ArrayList<String>();
- final List<Transform> bindMatrices = new ArrayList<Transform>();
- final List<ColladaInputPipe.ParamType> paramTypes = new ArrayList<ColladaInputPipe.ParamType>();
+ final List<String> jointNames = new ArrayList<>();
+ final List<Transform> bindMatrices = new ArrayList<>();
+ final List<ColladaInputPipe.ParamType> paramTypes = new ArrayList<>();
for (final Element inputEL : jointsEL.getChildren("input")) {
final ColladaInputPipe pipe = new ColladaInputPipe(_colladaDOMUtil, inputEL);
@@ -323,8 +323,8 @@ public class ColladaAnimUtils {
}
// Pull out our per vertex joint indices and weights
- final List<Short> jointIndices = new ArrayList<Short>();
- final List<Float> jointWeights = new ArrayList<Float>();
+ final List<Short> jointIndices = new ArrayList<>();
+ final List<Float> jointWeights = new ArrayList<>();
int indOff = 0, weightOff = 0;
int maxOffset = 0;
@@ -646,7 +646,7 @@ public class ColladaAnimUtils {
*/
private void buildAnimations(final Element parentElement, final Collection<TargetChannel> targetList) {
- final List<Element> elementTransforms = new ArrayList<Element>();
+ final List<Element> elementTransforms = new ArrayList<>();
for (final Element child : parentElement.getChildren()) {
if (_dataCache.getTransformTypes().contains(child.getName())) {
elementTransforms.add(child);
@@ -669,7 +669,7 @@ public class ColladaAnimUtils {
+ targetNode.getName() + "(" + targetIndex + ")");
}
- final EnumMap<Type, ColladaInputPipe> pipes = new EnumMap<Type, ColladaInputPipe>(Type.class);
+ final EnumMap<Type, ColladaInputPipe> pipes = new EnumMap<>(Type.class);
final Element samplerElement = _colladaDOMUtil.findTargetWithId(source);
for (final Element inputElement : samplerElement.getChildren("input")) {
@@ -708,9 +708,9 @@ public class ColladaAnimUtils {
targetChannel.currentPos = 0;
}
- final List<Float> finalTimeList = new ArrayList<Float>();
- final List<Transform> finalTransformList = new ArrayList<Transform>();
- final List<TargetChannel> workingChannels = new ArrayList<TargetChannel>();
+ final List<Float> finalTimeList = new ArrayList<>();
+ final List<Transform> finalTransformList = new ArrayList<>();
+ final List<TargetChannel> workingChannels = new ArrayList<>();
for (;;) {
float lowestTime = Float.MAX_VALUE;
boolean found = false;
@@ -925,7 +925,7 @@ public class ColladaAnimUtils {
return currentElement;
}
- private static final Map<String, Integer> symbolMap = new HashMap<String, Integer>();
+ private static final Map<String, Integer> symbolMap = new HashMap<>();
static {
symbolMap.put("ANGLE", 3);
symbolMap.put("TIME", 0);
@@ -1023,7 +1023,7 @@ public class ColladaAnimUtils {
* @return
*/
private List<TransformElement> getNodeTransformList(final List<Element> transforms) {
- final List<TransformElement> transformList = new ArrayList<TransformElement>();
+ final List<TransformElement> transformList = new ArrayList<>();
for (final Element transform : transforms) {
final double[] array = _colladaDOMUtil.parseDoubleArray(transform);
@@ -1172,7 +1172,7 @@ public class ColladaAnimUtils {
private static class Target {
public String id;
- public List<String> sids = new ArrayList<String>();
+ public List<String> sids = new ArrayList<>();
public AccessorType accessorType = AccessorType.None;
public int accessorIndexX = -1, accessorIndexY = -1;
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java
index b4a61fd..67fa7f9 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java
@@ -142,7 +142,7 @@ public class ColladaDOMUtil {
final String content = node.getText();
- final List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<>();
final StringTokenizer tokenizer = new StringTokenizer(content, " ");
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
@@ -172,7 +172,7 @@ public class ColladaDOMUtil {
final String content = node.getText();
- final List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<>();
final StringTokenizer tokenizer = new StringTokenizer(content, " ");
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
@@ -202,7 +202,7 @@ public class ColladaDOMUtil {
final String content = node.getText();
- final List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<>();
final StringTokenizer tokenizer = new StringTokenizer(content, " ");
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
@@ -232,7 +232,7 @@ public class ColladaDOMUtil {
final String content = node.getText();
- final List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<>();
final StringTokenizer tokenizer = new StringTokenizer(content, " ");
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
@@ -262,7 +262,7 @@ public class ColladaDOMUtil {
final String content = node.getText();
- final List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<>();
final StringTokenizer tokenizer = new StringTokenizer(content, " ");
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java
index cf0e4b5..198d976 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaImporter.java
@@ -71,7 +71,7 @@ public class ColladaImporter {
private final EnumSet<MatchCondition> _optimizeSettings = EnumSet.of(MatchCondition.UVs, MatchCondition.Normal,
MatchCondition.Color);
private Map<String, Joint> _externalJointMapping;
- private final List<ColladaExtraPlugin> _extraPlugins = new ArrayList<ColladaExtraPlugin>();
+ private final List<ColladaExtraPlugin> _extraPlugins = new ArrayList<>();
public boolean isLoadTextures() {
return _loadTextures;
@@ -361,7 +361,7 @@ public class ColladaImporter {
private Element currentElement;
private BufferType bufferType = BufferType.None;
private int count = 0;
- private final List<String> list = new ArrayList<String>();
+ private final List<String> list = new ArrayList<>();
ArdorFactory(final DataCache dataCache) {
this.dataCache = dataCache;
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java
index 2f1edce..7af6558 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java
@@ -103,7 +103,7 @@ public class ColladaMaterialUtils {
* temp cache for textures, we do not want to add textures twice (for example, transparant map might point
* to diffuse texture)
*/
- final HashMap<String, Texture> loadedTextures = new HashMap<String, Texture>();
+ final HashMap<String, Texture> loadedTextures = new HashMap<>();
final Element effect = effectNode;
// XXX: For now, just grab the common technique:
final Element common = effect.getChild("profile_COMMON");
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java
index 4c40b0a..6dc8ddf 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMeshUtils.java
@@ -241,7 +241,7 @@ public class ColladaMeshUtils {
// Build and set RenderStates for our material
_colladaMaterialUtils.applyMaterial(polys.getAttributeValue("material"), polyMesh);
- final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>();
+ final LinkedList<ColladaInputPipe> pipes = new LinkedList<>();
final int maxOffset = extractPipes(polys, pipes);
final int interval = maxOffset + 1;
@@ -336,7 +336,7 @@ public class ColladaMeshUtils {
// Build and set RenderStates for our material
_colladaMaterialUtils.applyMaterial(polys.getAttributeValue("material"), polyMesh);
- final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>();
+ final LinkedList<ColladaInputPipe> pipes = new LinkedList<>();
final int maxOffset = extractPipes(polys, pipes);
final int interval = maxOffset + 1;
@@ -428,7 +428,7 @@ public class ColladaMeshUtils {
// Build and set RenderStates for our material
_colladaMaterialUtils.applyMaterial(tris.getAttributeValue("material"), triMesh);
- final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>();
+ final LinkedList<ColladaInputPipe> pipes = new LinkedList<>();
final int maxOffset = extractPipes(tris, pipes);
final int interval = maxOffset + 1;
@@ -479,7 +479,7 @@ public class ColladaMeshUtils {
// Build and set RenderStates for our material
_colladaMaterialUtils.applyMaterial(lines.getAttributeValue("material"), lineMesh);
- final LinkedList<ColladaInputPipe> pipes = new LinkedList<ColladaInputPipe>();
+ final LinkedList<ColladaInputPipe> pipes = new LinkedList<>();
final int maxOffset = extractPipes(lines, pipes);
final int interval = maxOffset + 1;
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java
index d67347f..a5bb526 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java
@@ -96,7 +96,7 @@ public class ColladaNodeUtils {
// build a list of joints - one list per skeleton - and build a skeleton for each joint list.
for (final JointNode jointChildNode : _dataCache.getRootJointNode().getChildren()) {
- final List<Joint> jointList = new ArrayList<Joint>();
+ final List<Joint> jointList = new ArrayList<>();
buildJointLists(jointChildNode, jointList);
final Joint[] joints = jointList.toArray(new Joint[jointList.size()]);
final Skeleton skeleton = new Skeleton(joints[0].getName() + "_skeleton", joints);
@@ -266,7 +266,7 @@ public class ColladaNodeUtils {
}
final Node node = new Node(nodeName);
- final List<Element> transforms = new ArrayList<Element>();
+ final List<Element> transforms = new ArrayList<>();
for (final Element child : dNode.getChildren()) {
if (_dataCache.getTransformTypes().contains(child.getName())) {
transforms.add(child);
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java
index 2829e0e..803c055 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/AnimationItem.java
@@ -24,7 +24,7 @@ import com.ardor3d.util.export.Savable;
@SavableFactory(factoryMethod = "initSavable")
public class AnimationItem implements Savable {
private final String _name;
- private final List<AnimationItem> _children = new ArrayList<AnimationItem>();
+ private final List<AnimationItem> _children = new ArrayList<>();
private AnimationClip _animationClip;
public AnimationItem(final String name) {
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java
index 2d430b6..769f8a3 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/ColladaStorage.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -34,10 +34,10 @@ import com.google.common.collect.Multimap;
public class ColladaStorage implements Savable {
private Node _scene;
- private final List<SkinData> _skins = new ArrayList<SkinData>();
+ private final List<SkinData> _skins = new ArrayList<>();
private AssetData _assetData;
- private final List<AbstractAnimationChannel> _transformChannels = new ArrayList<AbstractAnimationChannel>();
+ private final List<AbstractAnimationChannel> _transformChannels = new ArrayList<>();
private AnimationItem _animationItemRoot;
// List of parsed color buffers, useful if collada includes multiple color channels per meshdata object
@@ -92,7 +92,7 @@ public class ColladaStorage implements Savable {
/**
* Extract all animation channels in the Collada file as a single, unified AnimationClip.
- *
+ *
* @param name
* the name to give our new clip.
* @return the new AnimationClip.
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java
index 46d7d96..1651df5 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/DataCache.java
@@ -70,35 +70,35 @@ public class DataCache {
private final Multimap<Joint, AttachmentPoint> _attachmentPoints = ArrayListMultimap.create();
public DataCache() {
- _boundMaterials = new HashMap<String, Element>();
- _textures = new HashMap<String, Texture>();
- _idCache = new HashMap<String, Element>();
- _sidCache = new HashMap<String, Element>();
- _xPathExpressions = new HashMap<String, XPathExpression<?>>();
+ _boundMaterials = new HashMap<>();
+ _textures = new HashMap<>();
+ _idCache = new HashMap<>();
+ _sidCache = new HashMap<>();
+ _xPathExpressions = new HashMap<>();
_pattern = Pattern.compile("\\s");
_transformTypes = Collections.unmodifiableList(Arrays.asList(new String[] { "lookat", "matrix", "rotate",
"scale", "scew", "translate" }));
- _floatArrays = new HashMap<Element, float[]>();
- _doubleArrays = new HashMap<Element, double[]>();
- _booleanArrays = new HashMap<Element, boolean[]>();
- _intArrays = new HashMap<Element, int[]>();
- _stringArrays = new HashMap<Element, String[]>();
+ _floatArrays = new HashMap<>();
+ _doubleArrays = new HashMap<>();
+ _booleanArrays = new HashMap<>();
+ _intArrays = new HashMap<>();
+ _stringArrays = new HashMap<>();
_vertMappings = ArrayListMultimap.create();
- _meshVertMap = new IdentityHashMap<Mesh, VertMap>();
+ _meshVertMap = new IdentityHashMap<>();
_parsedVertexColors = ArrayListMultimap.create();
- _materialInfoMap = new HashMap<String, MaterialInfo>();
- _meshMaterialMap = new IdentityHashMap<Mesh, String>();
+ _materialInfoMap = new HashMap<>();
+ _meshMaterialMap = new IdentityHashMap<>();
- _elementSpatialMapping = new HashMap<Element, Spatial>();
+ _elementSpatialMapping = new HashMap<>();
- _elementJointMapping = new HashMap<Element, Joint>();
- _externalJointMapping = new HashMap<String, Joint>();
- _skeletons = new ArrayList<Skeleton>();
- _jointSkeletonMapping = new HashMap<Joint, Skeleton>();
- _skeletonPoseMapping = new HashMap<Skeleton, SkeletonPose>();
- _controllers = new ArrayList<ControllerStore>();
+ _elementJointMapping = new HashMap<>();
+ _externalJointMapping = new HashMap<>();
+ _skeletons = new ArrayList<>();
+ _jointSkeletonMapping = new HashMap<>();
+ _skeletonPoseMapping = new HashMap<>();
+ _controllers = new ArrayList<>();
}
public void bindMaterial(final String ref, final Element material) {
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java
index 892f206..0face15 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/JointNode.java
@@ -18,7 +18,7 @@ import com.ardor3d.scenegraph.Node;
public class JointNode {
private JointNode parent;
- private final List<JointNode> children = new ArrayList<JointNode>();
+ private final List<JointNode> children = new ArrayList<>();
private final Joint joint;
/** Scene node associated with the Joint. */
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java
index 05c29ba..798e537 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/MaterialInfo.java
@@ -21,9 +21,9 @@ public class MaterialInfo {
private String _materialName;
private String _profile;
private String _technique;
- private final Map<String, String> _textureReferences = new HashMap<String, String>();
- private final Map<String, Texture> _textures = new HashMap<String, Texture>();
- private final Map<String, String> _textureFileNames = new HashMap<String, String>();
+ private final Map<String, String> _textureReferences = new HashMap<>();
+ private final Map<String, Texture> _textures = new HashMap<>();
+ private final Map<String, String> _textureFileNames = new HashMap<>();
private boolean _useTransparency;
private float _transparency = 1.0f;
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java
index c583e96..b2cfb56 100644
--- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java
+++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/data/SkinData.java
@@ -31,7 +31,7 @@ public class SkinData implements Savable {
private SkeletonPose _pose;
private Node _skinBaseNode;
- private final List<SkinnedMesh> _skins = new ArrayList<SkinnedMesh>();
+ private final List<SkinnedMesh> _skins = new ArrayList<>();
private final String _name;
/**
diff --git a/ardor3d-core/.settings/org.eclipse.jdt.core.prefs b/ardor3d-core/.settings/org.eclipse.jdt.core.prefs
index b861883..cf92767 100644
--- a/ardor3d-core/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-core/.settings/org.eclipse.jdt.core.prefs
@@ -10,16 +10,16 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java
index 35d4245..14c2d80 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java
@@ -12,6 +12,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.MathUtils;
@@ -66,16 +67,8 @@ public class BoundingBox extends BoundingVolume {
@Override
public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- long temp;
- temp = Double.doubleToLongBits(_xExtent);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(_yExtent);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- temp = Double.doubleToLongBits(_zExtent);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- return result;
+ return Objects.hash(Integer.valueOf(super.hashCode()), Double.valueOf(getXExtent()),
+ Double.valueOf(getYExtent()), Double.valueOf(getZExtent()));
}
@Override
@@ -259,10 +252,10 @@ public class BoundingBox extends BoundingVolume {
return;
}
- final Vector3 min = _compVect1
- .set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
- final Vector3 max = _compVect2
- .set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
+ final Vector3 min = _compVect1.set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
+ Double.POSITIVE_INFINITY);
+ final Vector3 max = _compVect2.set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY,
+ Double.NEGATIVE_INFINITY);
final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount();
Vector3[] store = new Vector3[vertsPerPrimitive];
@@ -397,8 +390,8 @@ public class BoundingBox extends BoundingVolume {
switch (volume.getType()) {
case AABB: {
final BoundingBox vBox = (BoundingBox) volume;
- return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(), new BoundingBox(
- new Vector3(0, 0, 0), 0, 0, 0));
+ return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(),
+ new BoundingBox(new Vector3(0, 0, 0), 0, 0, 0));
}
case Sphere: {
@@ -768,8 +761,8 @@ public class BoundingBox extends BoundingVolume {
}
final double[] distances = new double[] { t[0] };
- final Vector3[] points = new Vector3[] { new Vector3(ray.getDirection()).multiplyLocal(distances[0])
- .addLocal(ray.getOrigin()), };
+ final Vector3[] points = new Vector3[] {
+ new Vector3(ray.getDirection()).multiplyLocal(distances[0]).addLocal(ray.getOrigin()), };
return new IntersectionRecord(distances, points);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java
index ca6c0f9..b6ffb5d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java
@@ -12,6 +12,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -68,12 +69,7 @@ public class BoundingSphere extends BoundingVolume {
@Override
public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- long temp;
- temp = Double.doubleToLongBits(_radius);
- result = prime * result + (int) (temp ^ (temp >>> 32));
- return result;
+ return Objects.hash(Integer.valueOf(super.hashCode()), Double.valueOf(getRadius()));
}
@Override
@@ -294,8 +290,9 @@ public class BoundingSphere extends BoundingVolume {
final Vector3 b = B.subtract(O, null);
final Vector3 c = C.subtract(O, null);
- final double Denominator = 2.0 * (a.getX() * (b.getY() * c.getZ() - c.getY() * b.getZ()) - b.getX()
- * (a.getY() * c.getZ() - c.getY() * a.getZ()) + c.getX() * (a.getY() * b.getZ() - b.getY() * a.getZ()));
+ final double Denominator = 2.0 * (a.getX() * (b.getY() * c.getZ() - c.getY() * b.getZ())
+ - b.getX() * (a.getY() * c.getZ() - c.getY() * a.getZ())
+ + c.getX() * (a.getY() * b.getZ() - b.getY() * a.getZ()));
if (Denominator == 0) {
_center.set(0, 0, 0);
setRadius(0);
@@ -349,9 +346,9 @@ public class BoundingSphere extends BoundingVolume {
* @see #calcWelzl(java.nio.FloatBuffer)
*/
private void setSphere(final Vector3 O, final Vector3 A) {
- setRadius(Math.sqrt(((A.getX() - O.getX()) * (A.getX() - O.getX()) + (A.getY() - O.getY())
- * (A.getY() - O.getY()) + (A.getZ() - O.getZ()) * (A.getZ() - O.getZ())) / 4f)
- + radiusEpsilon - 1);
+ setRadius(
+ Math.sqrt(((A.getX() - O.getX()) * (A.getX() - O.getX()) + (A.getY() - O.getY()) * (A.getY() - O.getY())
+ + (A.getZ() - O.getZ()) * (A.getZ() - O.getZ())) / 4f) + radiusEpsilon - 1);
Vector3.lerp(O, A, .5, _center);
}
@@ -542,7 +539,8 @@ public class BoundingSphere extends BoundingVolume {
return this;
}
- private BoundingVolume merge(final double otherRadius, final ReadOnlyVector3 otherCenter, final BoundingSphere store) {
+ private BoundingVolume merge(final double otherRadius, final ReadOnlyVector3 otherCenter,
+ final BoundingSphere store) {
// check for infinite bounds... is so, return infinite bounds with center at origin
if (Double.isInfinite(otherRadius) || Double.isInfinite(getRadius())) {
store.setCenter(Vector3.ZERO);
@@ -720,8 +718,8 @@ public class BoundingSphere extends BoundingVolume {
discr = (a1 * a1) - a;
root = Math.sqrt(discr);
final double[] distances = new double[] { root - a1 };
- final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3())
- .addLocal(ray.getOrigin()) };
+ final Vector3[] points = new Vector3[] {
+ ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()) };
return new IntersectionRecord(distances, points);
}
@@ -745,8 +743,8 @@ public class BoundingSphere extends BoundingVolume {
}
final double[] distances = new double[] { -a1 };
- final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3())
- .addLocal(ray.getOrigin()) };
+ final Vector3[] points = new Vector3[] {
+ ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()) };
return new IntersectionRecord(distances, points);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java
index d2f4d81..37609c1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java
@@ -13,6 +13,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.io.Serializable;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.Vector3;
@@ -47,10 +48,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((_center == null) ? 0 : _center.hashCode());
- return result;
+ return Objects.hashCode(getCenter());
}
@Override
@@ -65,14 +63,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
return false;
}
final BoundingVolume other = (BoundingVolume) obj;
- if (_center == null) {
- if (other._center != null) {
- return false;
- }
- } else if (!_center.equals(other._center)) {
- return false;
- }
- return true;
+ return Objects.equals(_center, other._center);
}
/**
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java
index df3f7ef..23396b9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java
@@ -449,7 +449,7 @@ public class CollisionTree implements Serializable {
public List<PrimitiveKey> intersect(final Ray3 ray, final List<PrimitiveKey> store) {
List<PrimitiveKey> result = store;
if (result == null) {
- result = new ArrayList<PrimitiveKey>();
+ result = new ArrayList<>();
}
// if our ray doesn't hit the bounds, then it must not hit a primitive.
@@ -594,6 +594,6 @@ public class CollisionTree implements Serializable {
* @return a new reference to the given mesh.
*/
private WeakReference<Mesh> makeRef(final Mesh mesh) {
- return new WeakReference<Mesh>(mesh);
+ return new WeakReference<>(mesh);
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java
index cbdfcca..ff7d64c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java
@@ -80,7 +80,7 @@ public enum CollisionTreeManager {
* private constructor for the Singleton. Initializes the cache.
*/
private CollisionTreeManager() {
- _cache = new WeakHashMap<Mesh, CollisionTree>();
+ _cache = new WeakHashMap<>();
_protectedList = Collections.synchronizedList(new ArrayList<Mesh>(1));
setCollisionTreeController(new UsageTreeController());
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java
index c053ab6..24d14c1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java
@@ -13,6 +13,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
import java.util.Arrays;
+import java.util.Objects;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.Matrix3;
@@ -63,15 +64,8 @@ public class OrientedBoundingBox extends BoundingVolume {
@Override
public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((_extent == null) ? 0 : _extent.hashCode());
- result = prime * result + Arrays.hashCode(_vectorStore);
- result = prime * result + ((_xAxis == null) ? 0 : _xAxis.hashCode());
- result = prime * result + ((_yAxis == null) ? 0 : _yAxis.hashCode());
- result = prime * result + ((_zAxis == null) ? 0 : _zAxis.hashCode());
- result = prime * result + (correctCorners ? 1231 : 1237);
- return result;
+ return Objects.hash(Integer.valueOf(super.hashCode()), getExtent(),
+ Integer.valueOf(Arrays.hashCode(_vectorStore)), getXAxis(), getYAxis(), getZAxis());
}
@Override
@@ -302,29 +296,29 @@ public class OrientedBoundingBox extends BoundingVolume {
mergeBuf.put((float) _vectorStore[i].getZ());
}
mergeBuf.put((float) (mergeSphere._center.getX() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() + mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() + mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() + mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
mergeBuf.put((float) (mergeSphere._center.getX() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
- .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
+ .put((float) (mergeSphere._center.getY() - mergeSphere.getRadius()))
+ .put((float) (mergeSphere._center.getZ() - mergeSphere.getRadius()));
containAABB(mergeBuf);
correctCorners = false;
return this;
@@ -353,29 +347,29 @@ public class OrientedBoundingBox extends BoundingVolume {
mergeBuf.put((float) _vectorStore[i].getZ());
}
mergeBuf.put((float) (mergeBox._center.getX() + mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() - mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() + mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() + mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() - mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() + mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() - mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() + mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() + mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
mergeBuf.put((float) (mergeBox._center.getX() - mergeBox.getXExtent()))
- .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
- .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
+ .put((float) (mergeBox._center.getY() - mergeBox.getYExtent()))
+ .put((float) (mergeBox._center.getZ() - mergeBox.getZExtent()));
containAABB(mergeBuf);
correctCorners = false;
return this;
@@ -600,10 +594,10 @@ public class OrientedBoundingBox extends BoundingVolume {
final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount();
Vector3[] store = new Vector3[vertsPerPrimitive];
- final Vector3 min = _compVect1
- .set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
- final Vector3 max = _compVect2
- .set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
+ final Vector3 min = _compVect1.set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
+ Double.POSITIVE_INFINITY);
+ final Vector3 max = _compVect2.set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY,
+ Double.NEGATIVE_INFINITY);
Vector3 point;
for (int i = start; i < end; i++) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java b/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java
index c5465cf..869b332 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java
@@ -48,8 +48,8 @@ public final class FrameHandler {
public FrameHandler(final Timer timer) {
_timer = timer;
- _updaters = new CopyOnWriteArrayList<Updater>();
- _canvases = new CopyOnWriteArrayList<Canvas>();
+ _updaters = new CopyOnWriteArrayList<>();
+ _canvases = new CopyOnWriteArrayList<>();
}
@MainThread
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Image.java b/ardor3d-core/src/main/java/com/ardor3d/image/Image.java
index b6b07ca..c81334d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/Image.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/Image.java
@@ -42,7 +42,7 @@ public class Image implements Serializable, Savable {
* Constructor instantiates a new <code>Image</code> object. All values are undefined.
*/
public Image() {
- _data = new ArrayList<ByteBuffer>(1);
+ _data = new ArrayList<>(1);
}
/**
@@ -97,7 +97,7 @@ public class Image implements Serializable, Savable {
*/
public Image(final ImageDataFormat format, final PixelDataType type, final int width, final int height,
final ByteBuffer data, final int[] mipMapSizes) {
- this(format, type, width, height, new ArrayList<ByteBuffer>(Arrays.asList(data)), mipMapSizes);
+ this(format, type, width, height, new ArrayList<>(Arrays.asList(data)), mipMapSizes);
}
/**
@@ -122,7 +122,7 @@ public class Image implements Serializable, Savable {
* the data that contains the image information.
*/
public void setData(final ByteBuffer data) {
- _data = new ArrayList<ByteBuffer>(Arrays.asList(data));
+ _data = new ArrayList<>(Arrays.asList(data));
}
/**
@@ -133,7 +133,7 @@ public class Image implements Serializable, Savable {
*/
public void addData(final ByteBuffer data) {
if (_data == null) {
- _data = new ArrayList<ByteBuffer>(1);
+ _data = new ArrayList<>(1);
}
_data.add(data);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java
index 6316b57..6fa46a0 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java
@@ -144,7 +144,7 @@ public abstract class GeneratedImageFactory {
double val;
final double rangeDiv = 1.0 / (rangeEnd - rangeStart);
// prepare list of image slices.
- final List<ByteBuffer> dataList = new ArrayList<ByteBuffer>(depth);
+ final List<ByteBuffer> dataList = new ArrayList<>(depth);
final byte[] data = new byte[width * height];
for (double z = 0; z < depth; z++) {
@@ -199,7 +199,7 @@ public abstract class GeneratedImageFactory {
final ReadOnlyColorRGBA... colorTable) {
assert (colorTable.length == 256) : "color table must be size 256.";
- final List<ByteBuffer> dataList = new ArrayList<ByteBuffer>(lumImage.getDepth());
+ final List<ByteBuffer> dataList = new ArrayList<>(lumImage.getDepth());
ReadOnlyColorRGBA c;
for (int i = 0; i < lumImage.getDepth(); i++) {
final ByteBuffer src = lumImage.getData(i);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java
index bd404fa..4e80df7 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java
@@ -47,21 +47,12 @@ public abstract class ImageLoaderUtil {
return TextureState.getDefaultTextureImage();
}
- InputStream is = null;
- try {
- is = src.openStream();
+ try (final InputStream is = src.openStream()) {
logger.log(Level.FINER, "loadImage(ResourceSource, boolean) opened stream: {0}", src);
return loadImage(type, is, flipped);
} catch (final IOException e) {
logger.log(Level.WARNING, "loadImage(ResourceSource, boolean): defaultTexture used", e);
return TextureState.getDefaultTextureImage();
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (final IOException ioe) {
- } // ignore
- }
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java
index 3c28364..d44f44b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -58,39 +58,40 @@ public class DdsLoader implements ImageLoader {
@Override
public Image load(final InputStream is, final boolean flipVertically) throws IOException {
- final LittleEndianDataInput in = new LittleEndianDataInput(is);
+ try (final LittleEndianDataInput in = new LittleEndianDataInput(is)) {
- // Read and check magic word...
- final int dwMagic = in.readInt();
- if (dwMagic != getInt("DDS ")) {
- throw new Error("Not a dds file.");
- }
- logger.finest("Reading DDS file.");
+ // Read and check magic word...
+ final int dwMagic = in.readInt();
+ if (dwMagic != getInt("DDS ")) {
+ throw new Error("Not a dds file.");
+ }
+ logger.finest("Reading DDS file.");
- // Create our data store;
- final DdsImageInfo info = new DdsImageInfo();
+ // Create our data store;
+ final DdsImageInfo info = new DdsImageInfo();
- info.flipVertically = flipVertically;
+ info.flipVertically = flipVertically;
- // Read standard dds header
- info.header = DdsHeader.read(in);
+ // Read standard dds header
+ info.header = DdsHeader.read(in);
- // if applicable, read DX10 header
- info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null;
+ // if applicable, read DX10 header
+ info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null;
- // Create our new image
- final Image image = new Image();
- image.setWidth(info.header.dwWidth);
- image.setHeight(info.header.dwHeight);
+ // Create our new image
+ final Image image = new Image();
+ image.setWidth(info.header.dwWidth);
+ image.setHeight(info.header.dwHeight);
- // update depth based on flags / header
- updateDepth(image, info);
+ // update depth based on flags / header
+ updateDepth(image, info);
- // add our format and image data.
- populateImage(image, info, in);
+ // add our format and image data.
+ populateImage(image, info, in);
- // return the loaded image
- return image;
+ // return the loaded image
+ return image;
+ }
}
private static final void updateDepth(final Image image, final DdsImageInfo info) {
@@ -254,7 +255,7 @@ public class DdsLoader implements ImageLoader {
}
// Go through and load in image data
- final List<ByteBuffer> imageData = new ArrayList<ByteBuffer>();
+ final List<ByteBuffer> imageData = new ArrayList<>();
for (int i = 0; i < image.getDepth(); i++) {
// read in compressed data
if (compressedFormat) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java
index e9175bf..649c356 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java
@@ -21,8 +21,8 @@ public class ControllerInfo {
public ControllerInfo(final String controllerName, final List<String> axisNames, final List<String> buttonNames) {
_controllerName = controllerName;
- _axisNames = new ArrayList<String>(axisNames);
- _buttonNames = new ArrayList<String>(buttonNames);
+ _axisNames = new ArrayList<>(axisNames);
+ _buttonNames = new ArrayList<>(buttonNames);
}
public String getControllerName() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java
index bd3ed45..c0570bd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -17,6 +17,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import com.ardor3d.annotation.Immutable;
@@ -25,8 +26,8 @@ public class ControllerState {
public static final ControllerState NOTHING = new ControllerState(0);
- protected final Map<String, Map<String, Float>> _controllerStates = new LinkedHashMap<String, Map<String, Float>>();
- protected final List<ControllerEvent> _eventsSinceLastState = new ArrayList<ControllerEvent>();
+ protected final Map<String, Map<String, Float>> _controllerStates = new LinkedHashMap<>();
+ protected final List<ControllerEvent> _eventsSinceLastState = new ArrayList<>();
protected ControllerState(final int ignore) {}
@@ -50,7 +51,7 @@ public class ControllerState {
if (_controllerStates.containsKey(controllerName)) {
controllerState = _controllerStates.get(controllerName);
} else {
- controllerState = new LinkedHashMap<String, Float>();
+ controllerState = new LinkedHashMap<>();
_controllerStates.put(controllerName, controllerState);
}
@@ -68,6 +69,11 @@ public class ControllerState {
}
@Override
+ public int hashCode() {
+ return Objects.hashCode(_controllerStates);
+ }
+
+ @Override
public String toString() {
final StringBuilder stateString = new StringBuilder("ControllerState: ");
@@ -94,7 +100,7 @@ public class ControllerState {
private void duplicateStates(final Map<String, Map<String, Float>> store) {
store.clear();
for (final Entry<String, Map<String, Float>> entry : _controllerStates.entrySet()) {
- store.put(entry.getKey(), new LinkedHashMap<String, Float>(entry.getValue()));
+ store.put(entry.getKey(), new LinkedHashMap<>(entry.getValue()));
}
}
@@ -119,11 +125,11 @@ public class ControllerState {
}
public List<String> getControllerNames() {
- return new ArrayList<String>(_controllerStates.keySet());
+ return new ArrayList<>(_controllerStates.keySet());
}
public List<String> getControllerComponentNames(final String controller) {
- return new ArrayList<String>(_controllerStates.get(controller).keySet());
+ return new ArrayList<>(_controllerStates.get(controller).keySet());
}
public Map<String, Float> getControllerComponentValues(final String controller) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java
index 49e4d69..f356853 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java
@@ -51,7 +51,7 @@ public enum MouseButton {
if (nine == null) {
throw new NullPointerException("nine");
}
- final EnumMap<MouseButton, ButtonState> map = new EnumMap<MouseButton, ButtonState>(MouseButton.class);
+ final EnumMap<MouseButton, ButtonState> map = new EnumMap<>(MouseButton.class);
map.put(LEFT, left);
map.put(RIGHT, right);
map.put(MIDDLE, middle);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java
index e24e4ce..62ec847 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java
@@ -12,6 +12,8 @@ package com.ardor3d.input;
import static com.google.common.base.Preconditions.checkArgument;
+import java.util.Objects;
+
import com.ardor3d.annotation.Immutable;
import com.ardor3d.image.Image;
import com.ardor3d.image.ImageDataFormat;
@@ -21,7 +23,7 @@ import com.ardor3d.util.geom.BufferUtils;
/**
* An immutable representation of a mouse cursor. A mouse cursor consists of an image and a hotspot where clicking is
* done.
- *
+ *
*/
@Immutable
public class MouseCursor {
@@ -29,8 +31,9 @@ public class MouseCursor {
* This constant is used to identify that the native operating system's default cursor should be used. It is not a
* valid mouse cursor in itself.
*/
- public static final MouseCursor SYSTEM_DEFAULT = new MouseCursor("system default", new Image(ImageDataFormat.RGBA,
- PixelDataType.UnsignedByte, 1, 1, BufferUtils.createByteBuffer(4), null), 0, 0);
+ public static final MouseCursor SYSTEM_DEFAULT = new MouseCursor("system default",
+ new Image(ImageDataFormat.RGBA, PixelDataType.UnsignedByte, 1, 1, BufferUtils.createByteBuffer(4), null), 0,
+ 0);
private final String _name;
private final Image _image;
@@ -39,7 +42,7 @@ public class MouseCursor {
/**
* Instantiates a MouseCursor.
- *
+ *
* @param name
* the name of this cursor, for debugging purposes.
* @param image
@@ -55,10 +58,10 @@ public class MouseCursor {
_hotspotX = hotspotX;
_hotspotY = hotspotY;
- checkArgument(hotspotX >= 0 && hotspotX < image.getWidth(), "hotspot X is out of bounds: 0 <= %s < "
- + image.getWidth(), hotspotX);
- checkArgument(hotspotY >= 0 && hotspotY < image.getHeight(), "hotspot Y is out of bounds: 0 <= %s < "
- + image.getHeight(), hotspotY);
+ checkArgument(hotspotX >= 0 && hotspotX < image.getWidth(),
+ "hotspot X is out of bounds: 0 <= %s < " + image.getWidth(), hotspotX);
+ checkArgument(hotspotY >= 0 && hotspotY < image.getHeight(),
+ "hotspot Y is out of bounds: 0 <= %s < " + image.getHeight(), hotspotY);
}
public String getName() {
@@ -102,11 +105,10 @@ public class MouseCursor {
if (_hotspotY != that._hotspotY) {
return false;
}
- if (_image != null ? !_image.equals(that._image) : that._image != null) {
+ if (!Objects.equals(_image, that._image)) {
return false;
}
- // noinspection RedundantIfStatement
- if (_name != null ? !_name.equals(that._name) : that._name != null) {
+ if (!Objects.equals(_name, that._name)) {
return false;
}
@@ -115,10 +117,6 @@ public class MouseCursor {
@Override
public int hashCode() {
- int result = _name != null ? _name.hashCode() : 0;
- result = 31 * result + (_image != null ? _image.hashCode() : 0);
- result = 31 * result + _hotspotX;
- result = 31 * result + _hotspotY;
- return result;
+ return Objects.hash(getName(), getImage(), Integer.valueOf(getHotspotX()), Integer.valueOf(getHotspotY()));
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java
index b1f4faa..d86a4a3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java
@@ -138,7 +138,7 @@ public class MouseState {
public EnumMap<MouseButton, ButtonState> getButtonStates(final EnumMap<MouseButton, ButtonState> store) {
EnumMap<MouseButton, ButtonState> rVal = store;
if (store == null) {
- rVal = new EnumMap<MouseButton, ButtonState>(MouseButton.class);
+ rVal = new EnumMap<>(MouseButton.class);
}
rVal.clear();
rVal.putAll(_buttonStates);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java b/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java
index 5948094..0a5a438 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java
@@ -67,7 +67,7 @@ public class PhysicalLayer {
_mouseWrapper = mouseWrapper;
_focusWrapper = focusWrapper;
_controllerWrapper = controllerWrapper;
- _stateQueue = new LinkedBlockingQueue<InputState>();
+ _stateQueue = new LinkedBlockingQueue<>();
_currentKeyboardState = KeyboardState.NOTHING;
_currentMouseState = MouseState.NOTHING;
@@ -189,7 +189,7 @@ public class PhysicalLayer {
return EMPTY_LIST;
}
- final LinkedList<InputState> result = new LinkedList<InputState>();
+ final LinkedList<InputState> result = new LinkedList<>();
_stateQueue.drainTo(result);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java
index ed57f8c..1e15458 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java
@@ -27,8 +27,8 @@ import com.ardor3d.input.PhysicalLayer;
*/
@ThreadSafe
public final class LogicalLayer {
- private final Set<InputSource> _inputs = new CopyOnWriteArraySet<InputSource>();
- private final Set<InputTrigger> _triggers = new CopyOnWriteArraySet<InputTrigger>();
+ private final Set<InputSource> _inputs = new CopyOnWriteArraySet<>();
+ private final Set<InputTrigger> _triggers = new CopyOnWriteArraySet<>();
private LogicalTriggersApplier _applier = new BasicTriggersApplier();
public LogicalLayer() {}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java
index 58c283f..e4c3639 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java
@@ -23,7 +23,7 @@ import com.google.common.base.Predicate;
*/
@Immutable
public final class MouseButtonCondition implements Predicate<TwoInputStates> {
- private final EnumMap<MouseButton, ButtonState> _states = new EnumMap<MouseButton, ButtonState>(MouseButton.class);
+ private final EnumMap<MouseButton, ButtonState> _states = new EnumMap<>(MouseButton.class);
public MouseButtonCondition(final EnumMap<MouseButton, ButtonState> states) {
_states.putAll(states);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java
index 2ce1a58..f98d005 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java
@@ -49,7 +49,7 @@ public final class TriggerConditions {
};
private static MouseButtonCondition makeCondition(final MouseButton button, final ButtonState state) {
- final EnumMap<MouseButton, ButtonState> map = new EnumMap<MouseButton, ButtonState>(MouseButton.class);
+ final EnumMap<MouseButton, ButtonState> map = new EnumMap<>(MouseButton.class);
for (final MouseButton b : MouseButton.values()) {
map.put(b, button != b ? ButtonState.UNDEFINED : state);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java
index 2e058e1..e770389 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -12,6 +12,8 @@ package com.ardor3d.input.logical;
import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Objects;
+
import com.ardor3d.annotation.Immutable;
import com.ardor3d.input.InputState;
@@ -27,12 +29,12 @@ public final class TwoInputStates {
/**
* Instantiates a new TwoInputStates. It is safe for both parameters to point to the same instance, but they cannot
* be null.
- *
+ *
* @param previous
* the previous input state
* @param current
* the current input state
- *
+ *
* @throws NullPointerException
* if either parameter is null
*/
@@ -51,9 +53,7 @@ public final class TwoInputStates {
@Override
public int hashCode() {
- // we don't expect this to be used in a map.
- assert false : "hashCode not designed";
- return 42;
+ return Objects.hash(getPrevious(), getCurrent());
}
@Override
@@ -65,6 +65,6 @@ public final class TwoInputStates {
return false;
}
final TwoInputStates comp = (TwoInputStates) o;
- return _previous == comp._previous && _current == comp._current;
+ return Objects.equals(_previous, comp._previous) && Objects.equals(_current, comp._current);
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java
index 0d4d693..a7a5981 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java
@@ -26,7 +26,7 @@ public abstract class CollisionResults {
* Constructor instantiates a new <code>PickResults</code> object.
*/
public CollisionResults() {
- _nodeList = new ArrayList<CollisionData>();
+ _nodeList = new ArrayList<>();
}
/**
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java
index 283dc27..11f8e8e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java
@@ -32,7 +32,7 @@ public abstract class PickResults {
* Constructor instantiates a new <code>PickResults</code> object.
*/
public PickResults() {
- _nodeList = new ArrayList<PickData>();
+ _nodeList = new ArrayList<>();
}
/**
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java
index 133312d..3328e91 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java
@@ -34,8 +34,8 @@ public class PrimitiveCollisionResults extends CollisionResults {
public void addCollision(final Mesh s, final Mesh t) {
// find the triangle that is being hit.
// add this node and the triangle to the CollisionResults list.
- final List<PrimitiveKey> a = new ArrayList<PrimitiveKey>();
- final List<PrimitiveKey> b = new ArrayList<PrimitiveKey>();
+ final List<PrimitiveKey> a = new ArrayList<>();
+ final List<PrimitiveKey> b = new ArrayList<>();
PickingUtil.findPrimitiveCollision(s, t, a, b);
final CollisionData data = new CollisionData(s, t, a, b);
addCollisionData(data);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java
index c23d085..9f03d36 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java
@@ -3,13 +3,15 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.intersection;
+import java.util.Objects;
+
public class PrimitiveKey {
private final int _primitiveIndex;
private final int _section;
@@ -35,12 +37,7 @@ public class PrimitiveKey {
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _primitiveIndex;
- result += 31 * result + _section;
-
- return result;
+ return Objects.hash(Integer.valueOf(getPrimitiveIndex()), Integer.valueOf(getSection()));
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java
index 0bf54fb..5e7f6d9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java
@@ -30,7 +30,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
private static final Logger logger = Logger.getLogger(AbstractFBOTextureRenderer.class.getName());
/** List of states that override any set states on a spatial if not null. */
- protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>(
RenderState.StateType.class);
protected final Camera _camera = new Camera(1, 1);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java
index 565f531..16afb05 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java
@@ -28,7 +28,7 @@ public abstract class AbstractPbufferTextureRenderer implements TextureRenderer
private static final Logger logger = Logger.getLogger(AbstractPbufferTextureRenderer.class.getName());
/** List of states that override any set states on a spatial if not null. */
- protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>(
RenderState.StateType.class);
protected final Camera _camera = new Camera(1, 1);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java
index c3b04fd..8a6dcdf 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java
@@ -47,7 +47,7 @@ public abstract class AbstractRenderer implements Renderer {
protected RenderLogic renderLogic;
/** List of default rendering states for this specific renderer type */
- protected final EnumMap<RenderState.StateType, RenderState> defaultStateList = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> defaultStateList = new EnumMap<>(
RenderState.StateType.class);
public AbstractRenderer() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java
index ed46ec9..1a87c80 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java
@@ -19,9 +19,9 @@ public class ContextManager {
protected static RenderContext currentContext = null;
- private static List<ContextCleanListener> _cleanListeners = new ArrayList<ContextCleanListener>();
+ private static List<ContextCleanListener> _cleanListeners = new ArrayList<>();
- protected static final Map<Object, RenderContext> contextStore = new WeakHashMap<Object, RenderContext>();
+ protected static final Map<Object, RenderContext> contextStore = new WeakHashMap<>();
/**
* @return a RenderContext object representing the current OpenGL context.
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java
index eaaeb57..d8feb7e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -26,18 +26,18 @@ import com.ardor3d.renderer.state.record.StateRecord;
public class RenderContext {
/** List of states that override any set states on a spatial if not null. */
- protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>(
RenderState.StateType.class);
- protected final Stack<EnumMap<StateType, RenderState>> _enforcedBackStack = new Stack<EnumMap<StateType, RenderState>>();
+ protected final Stack<EnumMap<StateType, RenderState>> _enforcedBackStack = new Stack<>();
- protected final Stack<AbstractFBOTextureRenderer> _textureRenderers = new Stack<AbstractFBOTextureRenderer>();
+ protected final Stack<AbstractFBOTextureRenderer> _textureRenderers = new Stack<>();
/** RenderStates a Spatial contains during rendering. */
- protected final EnumMap<RenderState.StateType, RenderState> _currentStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _currentStates = new EnumMap<>(
RenderState.StateType.class);
- protected final EnumMap<RenderState.StateType, StateRecord> _stateRecords = new EnumMap<RenderState.StateType, StateRecord>(
+ protected final EnumMap<RenderState.StateType, StateRecord> _stateRecords = new EnumMap<>(
RenderState.StateType.class);
protected final LineRecord _lineRecord = new LineRecord();
@@ -105,7 +105,7 @@ public class RenderContext {
* Enforce a particular state. In other words, the given state will override any state of the same type set on a
* scene object. Remember to clear the state when done enforcing. Very useful for multipass techniques where
* multiple sets of states need to be applied to a scenegraph drawn multiple times.
- *
+ *
* @param state
* state to enforce
*/
@@ -122,7 +122,7 @@ public class RenderContext {
/**
* Clears an enforced render state index by setting it to null. This allows object specific states to be used.
- *
+ *
* @param type
* The type of RenderState to clear enforcement on.
*/
@@ -188,12 +188,12 @@ public class RenderContext {
* Saves the currently set states to a stack. Does not changes the currently enforced states.
*/
public void pushEnforcedStates() {
- _enforcedBackStack.push(new EnumMap<StateType, RenderState>(_enforcedStates));
+ _enforcedBackStack.push(new EnumMap<>(_enforcedStates));
}
/**
* Restores the enforced states from the stack. Any states enforced or cleared since the last push are reverted.
- *
+ *
* @throws EmptyStackException
* if this method is called without first calling {@link #pushEnforcedStates()}
*/
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java
index bc40f1d..a0cbb69 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java
@@ -33,8 +33,8 @@ import com.ardor3d.util.geom.BufferUtils;
public class EffectManager {
protected final DisplaySettings _canvasSettings;
- protected final List<RenderEffect> _effects = new ArrayList<RenderEffect>();
- protected final Map<String, RenderTarget> _renderTargetMap = new HashMap<String, RenderTarget>();
+ protected final List<RenderEffect> _effects = new ArrayList<>();
+ protected final Map<String, RenderTarget> _renderTargetMap = new HashMap<>();
protected Renderer _currentRenderer = null;
protected RenderTarget _currentRenderTarget = null;
protected Camera _fsqCamera, _sceneCamera;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java
index 588b95a..76a0219 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java
@@ -20,9 +20,9 @@ import com.ardor3d.renderer.state.TextureState;
public class EffectStep_RenderScreenOverlay implements EffectStep {
- private final EnumMap<StateType, RenderState> _states = new EnumMap<StateType, RenderState>(StateType.class);
+ private final EnumMap<StateType, RenderState> _states = new EnumMap<>(StateType.class);
private final TextureState _texState = new TextureState();
- private final Map<String, Integer> _targetMap = new HashMap<String, Integer>();
+ private final Map<String, Integer> _targetMap = new HashMap<>();
public EffectStep_RenderScreenOverlay() {
_states.put(StateType.Texture, _texState);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java
index a07df8b..c1af85c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java
@@ -20,8 +20,8 @@ import com.ardor3d.renderer.state.RenderState.StateType;
import com.ardor3d.scenegraph.Spatial;
public class EffectStep_RenderSpatials implements EffectStep {
- private final EnumMap<StateType, RenderState> _states = new EnumMap<StateType, RenderState>(StateType.class);
- private final List<Spatial> _spatials = new ArrayList<Spatial>();
+ private final EnumMap<StateType, RenderState> _states = new EnumMap<>(StateType.class);
+ private final List<Spatial> _spatials = new ArrayList<>();
private final Camera _trackedCamera;
public EffectStep_RenderSpatials(final Camera trackedCamera) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java
index 409e443..b3b4162 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java
@@ -20,7 +20,7 @@ import java.util.List;
public abstract class RenderEffect {
/** A list of logical steps that comprise our effect. */
- protected final List<EffectStep> _steps = new ArrayList<EffectStep>();
+ protected final List<EffectStep> _steps = new ArrayList<>();
/** Is this render effect active? */
protected boolean _enabled = true;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java
index 82af301..bab4d39 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java
@@ -22,7 +22,7 @@ import com.ardor3d.renderer.TextureRendererFactory;
public enum TextureRendererPool {
INSTANCE;
- private final List<TextureRenderer> renderers = new LinkedList<TextureRenderer>();
+ private final List<TextureRenderer> renderers = new LinkedList<>();
public static TextureRenderer fetch(final int width, final int height, final Renderer renderer) {
for (final Iterator<TextureRenderer> it = INSTANCE.renderers.iterator(); it.hasNext();) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java
index 6597e59..f60b54f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java
@@ -22,7 +22,7 @@ import com.ardor3d.renderer.TextureRenderer;
*/
public class BasicPassManager {
- protected List<Pass> _passes = new ArrayList<Pass>();
+ protected List<Pass> _passes = new ArrayList<>();
public void add(final Pass toAdd) {
if (toAdd != null) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java
index 12fadf3..ab0bdd6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java
@@ -38,7 +38,7 @@ public abstract class Pass implements Serializable {
private static final long serialVersionUID = 1L;
/** list of Spatial objects registered with this pass. */
- protected List<Spatial> _spatials = new ArrayList<Spatial>();
+ protected List<Spatial> _spatials = new ArrayList<>();
/** if false, pass will not be updated or rendered. */
protected boolean _enabled = true;
@@ -47,7 +47,7 @@ public abstract class Pass implements Serializable {
* RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set
* during rendering.
*/
- protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<>(
RenderState.StateType.class);
protected RenderContext _context = null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java
index 89f21c8..10dbf54 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java
@@ -28,9 +28,9 @@ public class AbstractRenderBucket implements RenderBucket {
protected Spatial[] _currentList, _tempList;
protected int _currentListSize;
- protected Stack<Spatial[]> _listStack = new Stack<Spatial[]>();
- protected Stack<Spatial[]> _listStackPool = new Stack<Spatial[]>();
- protected Stack<Integer> _listSizeStack = new Stack<Integer>();
+ protected Stack<Spatial[]> _listStack = new Stack<>();
+ protected Stack<Spatial[]> _listStackPool = new Stack<>();
+ protected Stack<Integer> _listSizeStack = new Stack<>();
public AbstractRenderBucket() {
_currentList = new Spatial[32];
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java
index d5f881d..103f9e7 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java
@@ -28,7 +28,7 @@ public final class RenderBucketType {
return bucketType;
}
- private static final Map<String, RenderBucketType> bucketTypeMap = new HashMap<String, RenderBucketType>();
+ private static final Map<String, RenderBucketType> bucketTypeMap = new HashMap<>();
private final String name;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java
index 34a28ba..65bdf35 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java
@@ -22,7 +22,7 @@ import com.ardor3d.util.Constants;
public class RenderQueue {
- private final Map<RenderBucketType, RenderBucket> renderBuckets = new LinkedHashMap<RenderBucketType, RenderBucket>();
+ private final Map<RenderBucketType, RenderBucket> renderBuckets = new LinkedHashMap<>();
public RenderQueue() {
setupDefaultBuckets();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
index 13b6f6d..8ae5b6e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -39,7 +39,7 @@ public class FragmentProgramState extends RenderState {
/**
* <code>setEnvParameter</code> sets an environmental fragment program parameter that is accessable by all fragment
* programs in memory.
- *
+ *
* @param param
* four-element array of floating point numbers
* @param paramID
@@ -50,7 +50,7 @@ public class FragmentProgramState extends RenderState {
* public static void setEnvParameter(float[] param, int paramID){ if (paramID < 0 || paramID > 95) throw new
* IllegalArgumentException("Invalid parameter ID"); if (param != null && param.length != 4) throw new
* IllegalArgumentException("Vertex program parameters must be of type float[4]");
- *
+ *
* envparameters[paramID] = param; }
*/
@@ -60,7 +60,7 @@ public class FragmentProgramState extends RenderState {
/**
* <code>setParameter</code> sets a parameter for this fragment program.
- *
+ *
* @param paramID
* identity number of the parameter, ranging from 0 to 23
* @param param
@@ -86,14 +86,12 @@ public class FragmentProgramState extends RenderState {
/**
* Loads the fragment program into a byte array.
- *
+ *
* @see com.ardor3d.renderer.state.FragmentProgramState#load(java.net.URL)
*/
public void load(final java.net.URL file) {
- InputStream inputStream = null;
- try {
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
- inputStream = new BufferedInputStream(file.openStream());
+ try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
+ final InputStream inputStream = new BufferedInputStream(file.openStream())) {
final byte[] buffer = new byte[1024];
int byteCount = -1;
@@ -107,7 +105,6 @@ public class FragmentProgramState extends RenderState {
// Release resources
inputStream.close();
- outputStream.close();
program = BufferUtils.createByteBuffer(data.length);
program.put(data);
@@ -117,21 +114,12 @@ public class FragmentProgramState extends RenderState {
} catch (final Exception e) {
logger.severe("Could not load fragment program: " + e);
logger.logp(Level.SEVERE, getClass().getName(), "load(URL)", "Exception", e);
- } finally {
- // Ensure that the stream is closed, even if there is an exception.
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (final IOException closeFailure) {
- logger.log(Level.WARNING, "Failed to close the fragment program", closeFailure);
- }
- }
}
}
/**
* Loads the fragment program into a byte array.
- *
+ *
* @see com.ardor3d.renderer.state.FragmentProgramState#load(java.net.URL)
*/
public void load(final String programContents) {
@@ -170,7 +158,7 @@ public class FragmentProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @see java.io.Serializable
@@ -190,7 +178,7 @@ public class FragmentProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @throws ClassNotFoundException
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
index ccedbce..47c4504 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
@@ -70,9 +70,9 @@ public class GLSLShaderObjectsState extends RenderState {
private static final Logger logger = Logger.getLogger(GLSLShaderObjectsState.class.getName());
/** Storage for shader uniform values */
- protected List<ShaderVariable> _shaderUniforms = new ArrayList<ShaderVariable>();
+ protected List<ShaderVariable> _shaderUniforms = new ArrayList<>();
/** Storage for shader attribute values */
- protected List<ShaderVariable> _shaderAttributes = new ArrayList<ShaderVariable>();
+ protected List<ShaderVariable> _shaderAttributes = new ArrayList<>();
protected ByteBuffer _vertShader, _fragShader, _geomShader, _tessControlShader, _tessEvalShader, _compShader;
@@ -240,28 +240,14 @@ public class GLSLShaderObjectsState extends RenderState {
}
protected ByteBuffer load(final InputStream in) throws IOException {
- DataInputStream dataStream = null;
- try {
- final BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
- dataStream = new DataInputStream(bufferedInputStream);
+ try (final BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
+ final DataInputStream dataStream = new DataInputStream(bufferedInputStream)) {
final byte shaderCode[] = new byte[bufferedInputStream.available()];
dataStream.readFully(shaderCode);
- bufferedInputStream.close();
- dataStream.close();
final ByteBuffer shaderByteBuffer = BufferUtils.createByteBuffer(shaderCode.length);
shaderByteBuffer.put(shaderCode);
shaderByteBuffer.rewind();
-
return shaderByteBuffer;
- } finally {
- // Ensure that the stream is closed, even if there is an exception.
- if (dataStream != null) {
- try {
- dataStream.close();
- } catch (final IOException closeFailure) {
- logger.log(Level.WARNING, "Failed to close the shader object", closeFailure);
- }
- }
}
}
@@ -1190,8 +1176,8 @@ public class GLSLShaderObjectsState extends RenderState {
* @param data
* The actual data to use as attribute pointer
*/
- public void setAttributePointer(final String name, final int size, final boolean normalized,
- final boolean unsigned, final int stride, final ByteBufferData data) {
+ public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned,
+ final int stride, final ByteBufferData data) {
final ShaderVariablePointerByte shaderUniform = getShaderAttribute(name, ShaderVariablePointerByte.class);
shaderUniform.size = size;
shaderUniform.normalized = normalized;
@@ -1221,8 +1207,8 @@ public class GLSLShaderObjectsState extends RenderState {
* @param data
* The actual data to use as attribute pointer
*/
- public void setAttributePointer(final String name, final int size, final boolean normalized,
- final boolean unsigned, final int stride, final IntBufferData data) {
+ public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned,
+ final int stride, final IntBufferData data) {
final ShaderVariablePointerInt shaderUniform = getShaderAttribute(name, ShaderVariablePointerInt.class);
shaderUniform.size = size;
shaderUniform.normalized = normalized;
@@ -1252,8 +1238,8 @@ public class GLSLShaderObjectsState extends RenderState {
* @param data
* The actual data to use as attribute pointer
*/
- public void setAttributePointer(final String name, final int size, final boolean normalized,
- final boolean unsigned, final int stride, final ShortBufferData data) {
+ public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned,
+ final int stride, final ShortBufferData data) {
final ShaderVariablePointerShort shaderUniform = getShaderAttribute(name, ShaderVariablePointerShort.class);
shaderUniform.size = size;
shaderUniform.normalized = normalized;
@@ -1332,11 +1318,11 @@ public class GLSLShaderObjectsState extends RenderState {
return shaderUniform;
} catch (final InstantiationException e) {
- logger.logp(Level.SEVERE, this.getClass().toString(),
- "getShaderVariable(name, classz, shaderVariableList)", "Exception", e);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)",
+ "Exception", e);
} catch (final IllegalAccessException e) {
- logger.logp(Level.SEVERE, this.getClass().toString(),
- "getShaderVariable(name, classz, shaderVariableList)", "Exception", e);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)",
+ "Exception", e);
}
return null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java
index a5ce713..e8b86eb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java
@@ -95,7 +95,7 @@ public class LightState extends RenderState {
* Constructor instantiates a new <code>LightState</code> object. Initially there are no lights set.
*/
public LightState() {
- lightList = new ArrayList<Light>();
+ lightList = new ArrayList<>();
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java
index bbe1b64..ad80e9e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java
@@ -95,7 +95,7 @@ public abstract class RenderState implements Savable {
static public class StateStack implements Poolable {
- private final EnumMap<RenderState.StateType, Stack<RenderState>> stacks = new EnumMap<StateType, Stack<RenderState>>(
+ private final EnumMap<RenderState.StateType, Stack<RenderState>> stacks = new EnumMap<>(
RenderState.StateType.class);
public StateStack() {}
@@ -122,7 +122,7 @@ public abstract class RenderState implements Savable {
public void push(final RenderState state) {
Stack<RenderState> stack = stacks.get(state.getType());
if (stack == null) {
- stack = new Stack<RenderState>();
+ stack = new Stack<>();
stacks.put(state.getType(), stack);
}
stack.push(state);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java
index 9b8d4ea..b9f5e71 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java
@@ -62,7 +62,7 @@ public class TextureState extends RenderState {
}
/** The texture(s). */
- protected List<Texture> _texture = new ArrayList<Texture>(1);
+ protected List<Texture> _texture = new ArrayList<>(1);
/**
* Perspective correction to use for the object rendered with this texture state. Default is
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java
index 44e49b4..6c107f4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -46,7 +46,7 @@ public class VertexProgramState extends RenderState {
/**
* <code>setEnvParameter</code> sets an environmental vertex program parameter that is accessible by all vertex
* programs in memory.
- *
+ *
* @param param
* four-element array of floating point numbers
* @param paramID
@@ -72,7 +72,7 @@ public class VertexProgramState extends RenderState {
/**
* <code>setParameter</code> sets a parameter for this vertex program.
- *
+ *
* @param paramID
* identity number of the parameter, ranging from 0 to 95
* @param param
@@ -97,10 +97,8 @@ public class VertexProgramState extends RenderState {
}
public void load(final java.net.URL file) {
- InputStream inputStream = null;
- try {
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
- inputStream = new BufferedInputStream(file.openStream());
+ try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
+ final InputStream inputStream = new BufferedInputStream(file.openStream())) {
final byte[] buffer = new byte[1024];
int byteCount = -1;
@@ -112,10 +110,6 @@ public class VertexProgramState extends RenderState {
// Set data with byte content from stream
final byte[] data = outputStream.toByteArray();
- // Release resources
- inputStream.close();
- outputStream.close();
-
_program = BufferUtils.createByteBuffer(data.length);
_program.put(data);
_program.rewind();
@@ -125,22 +119,12 @@ public class VertexProgramState extends RenderState {
} catch (final Exception e) {
logger.severe("Could not load vertex program: " + e);
logger.logp(Level.SEVERE, getClass().getName(), "load(URL)", "Exception", e);
- } finally {
- // Ensure that the stream is closed, even if there is an exception.
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (final IOException closeFailure) {
- logger.log(Level.WARNING, "Failed to close the vertex program", closeFailure);
- }
- }
-
}
}
/**
* Loads the vertex program into a byte array.
- *
+ *
* @see com.ardor3d.renderer.state.VertexProgramState#load(java.net.URL)
*/
public void load(final String programContents) {
@@ -184,7 +168,7 @@ public class VertexProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @see java.io.Serializable
@@ -204,7 +188,7 @@ public class VertexProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @throws ClassNotFoundException
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java
index 3a04e45..2a8be1c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java
@@ -18,7 +18,7 @@ import com.ardor3d.math.ColorRGBA;
import com.ardor3d.util.geom.BufferUtils;
public class LightStateRecord extends StateRecord {
- private final List<LightRecord> lightList = new ArrayList<LightRecord>();
+ private final List<LightRecord> lightList = new ArrayList<>();
private int lightMask;
private int backLightMask;
private boolean twoSidedOn;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java
index 9f51cbc..d5edbaf 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java
@@ -26,7 +26,7 @@ public class RendererRecord extends StateRecord {
private boolean _clippingTestEnabled;
private transient final ColorRGBA _tempColor = new ColorRGBA();
private DrawBufferTarget _drawBufferTarget = null;
- private final Stack<ReadOnlyRectangle2> _clips = new Stack<ReadOnlyRectangle2>();
+ private final Stack<ReadOnlyRectangle2> _clips = new Stack<>();
private int _normalMode = -1; // signifies disabled
private int _enabledTextures = 0;
private boolean _texturesValid = false;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java
index 2fa77e4..a3e77ae 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java
@@ -22,7 +22,7 @@ public class ShaderObjectsStateRecord extends StateRecord {
// XXX checking system.
GLSLShaderObjectsState reference = null;
- public List<ShaderVariable> enabledAttributes = new ArrayList<ShaderVariable>();
+ public List<ShaderVariable> enabledAttributes = new ArrayList<>();
public int shaderId = -1;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java
index 3e63a6b..286ccb7 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java
@@ -46,7 +46,7 @@ public class TextureStateRecord extends StateRecord {
public final DoubleBuffer tmp_matrixBuffer = BufferUtils.createDoubleBuffer(16);
public TextureStateRecord() {
- textures = new HashMap<Integer, TextureRecord>();
+ textures = new HashMap<>();
units = new TextureUnitRecord[TextureState.MAX_TEXTURES];
for (int i = 0; i < units.length; i++) {
units[i] = new TextureUnitRecord();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java
index 2581a89..b49e1c1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java
@@ -32,10 +32,10 @@ import com.google.common.collect.Multimap;
public abstract class AbstractBufferData<T extends Buffer> {
- private static Map<AbstractBufferData<?>, Object> _identityCache = new WeakHashMap<AbstractBufferData<?>, Object>();
+ private static Map<AbstractBufferData<?>, Object> _identityCache = new WeakHashMap<>();
private static final Object STATIC_REF = new Object();
- private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<AbstractBufferData<?>>();
+ private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<>();
static {
ContextManager.addContextCleanListener(new ContextCleanListener() {
@@ -165,7 +165,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
}
if (_vboIdCache == null) {
- _vboIdCache = new ContextIdReference<AbstractBufferData<T>>(this, _vboRefQueue);
+ _vboIdCache = new ContextIdReference<>(this, _vboRefQueue);
}
_vboIdCache.put(glContextRep, vboId);
}
@@ -300,8 +300,8 @@ public abstract class AbstractBufferData<T extends Buffer> {
}
// Otherwise, add a delete request to that context's render task queue.
else {
- GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render(
- new RendererCallable<Void>() {
+ GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref))
+ .render(new RendererCallable<Void>() {
@Override
public Void call() throws Exception {
getRenderer().deleteVBOs(idMap.get(glref));
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java
index 320e4e4..f7e4c88 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java
@@ -26,7 +26,7 @@ import com.ardor3d.util.geom.BufferUtils;
public class InstancingManager {
private int _maxBatchSize = 30;
- private final List<Mesh> _visibleMeshes = new ArrayList<Mesh>(_maxBatchSize);
+ private final List<Mesh> _visibleMeshes = new ArrayList<>(_maxBatchSize);
private FloatBuffer _transformBuffer;
private int _primCount;
private int _meshesToDraw = 0;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java
index bc3882d..f483e83 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java
@@ -66,7 +66,7 @@ public class Mesh extends Spatial implements Renderable, Pickable {
* The compiled list of renderstates for this mesh, taking into account ancestors states - updated with
* updateRenderStates()
*/
- protected final EnumMap<RenderState.StateType, RenderState> _states = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _states = new EnumMap<>(
RenderState.StateType.class);
/** The compiled lightState for this mesh */
@@ -559,7 +559,7 @@ public class Mesh extends Spatial implements Renderable, Pickable {
@Override
public IntersectionRecord intersectsPrimitivesWhere(final Ray3 ray) {
- final List<PrimitiveKey> primitives = new ArrayList<PrimitiveKey>();
+ final List<PrimitiveKey> primitives = new ArrayList<>();
// What about Lines and Points?
final CollisionTree ct = CollisionTreeManager.getInstance().getCollisionTree(this);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java
index 911e69d..590c582 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java
@@ -57,7 +57,7 @@ public class MeshData implements Savable {
protected FloatBufferData _colorCoords;
protected FloatBufferData _fogCoords;
protected FloatBufferData _tangentCoords;
- protected List<FloatBufferData> _textureCoords = new ArrayList<FloatBufferData>(1);
+ protected List<FloatBufferData> _textureCoords = new ArrayList<>(1);
/** Interleaved data (for VBO id use). */
protected FloatBufferData _interleaved;
@@ -1204,7 +1204,7 @@ public class MeshData implements Savable {
}
if (_vboIdCache == null) {
- _vboIdCache = new WeakHashMap<Object, Integer>(1);
+ _vboIdCache = new WeakHashMap<>(1);
}
_vboIdCache.put(glContext, vboId);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java
index f03c447..079e63a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java
@@ -494,7 +494,7 @@ public class Node extends Spatial {
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
- capsule.writeSavableList(new ArrayList<Spatial>(_children), "children", null);
+ capsule.writeSavableList(new ArrayList<>(_children), "children", null);
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
index c657032..b7fe057 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
@@ -79,7 +79,7 @@ public abstract class Spatial implements Savable, Hintable {
protected List<SpatialController<?>> _controllers;
/** The render states of this spatial. */
- protected EnumMap<RenderState.StateType, RenderState> _renderStateList = new EnumMap<RenderState.StateType, RenderState>(
+ protected EnumMap<RenderState.StateType, RenderState> _renderStateList = new EnumMap<>(
RenderState.StateType.class);
/** Listener for dirty events. */
@@ -165,7 +165,7 @@ public abstract class Spatial implements Savable, Hintable {
if (delegate == null) {
return;
} else {
- _delegateMap = new WeakHashMap<Object, RenderDelegate>();
+ _delegateMap = new WeakHashMap<>();
}
}
if (delegate != null) {
@@ -1102,7 +1102,7 @@ public abstract class Spatial implements Savable, Hintable {
*/
public void addController(final SpatialController<?> controller) {
if (_controllers == null) {
- _controllers = new ArrayList<SpatialController<?>>(1);
+ _controllers = new ArrayList<>(1);
}
_controllers.add(controller);
}
@@ -1158,7 +1158,7 @@ public abstract class Spatial implements Savable, Hintable {
*/
public SpatialController<?> getController(final int i) {
if (_controllers == null) {
- _controllers = new ArrayList<SpatialController<?>>(1);
+ _controllers = new ArrayList<>(1);
}
return _controllers.get(i);
}
@@ -1170,7 +1170,7 @@ public abstract class Spatial implements Savable, Hintable {
*/
public List<SpatialController<?>> getControllers() {
if (_controllers == null) {
- _controllers = new ArrayList<SpatialController<?>>(1);
+ _controllers = new ArrayList<>(1);
}
return _controllers;
}
@@ -1416,7 +1416,7 @@ public abstract class Spatial implements Savable, Hintable {
}
if (_controllers != null) {
- final List<Savable> list = new ArrayList<Savable>();
+ final List<Savable> list = new ArrayList<>();
for (final SpatialController<?> sc : _controllers) {
if (sc instanceof Savable) {
list.add((Savable) sc);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java
index 0baf1d5..9762e77 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -23,7 +23,7 @@ import com.ardor3d.scenegraph.controller.ComplexSpatialController;
* Implementation note: This class is comprised of quite a few protected methods, this is mainly to allow maximum
* flexibility for overriding classes.
* </p>
- *
+ *
* @param <C>
* The control 'points' being interpolated, for example Vectors or Quaternions.
* @param <T>
@@ -54,7 +54,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* This method is automatically called by {@link #update(double, Spatial)} from this controller.
- *
+ *
* @param from
* The control to interpolate from.
* @param to
@@ -73,7 +73,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
* It will only update the given object if this controller is {@link #isActive() active}, caller isn't
* <code>null</code> and it's {@link #getSpeed() speed} is greater than zero.
* </p>
- *
+ *
* @param time
* The passed since this controller was last called.
* @param caller
@@ -92,7 +92,8 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
clampIndex();
- assert (getIndex() < getControls().size()) : "_index was greater than the number of controls, clampIndex() has probably been overriden incorrectly";
+ assert (getIndex() < getControls()
+ .size()) : "_index was greater than the number of controls, clampIndex() has probably been overriden incorrectly";
assert (getIndex() >= 0) : "_index was negative, clampIndex() has probably been overriden incorrectly";
interpolate(getControlFrom(), getControlTo(), getDelta(), caller);
@@ -139,7 +140,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
* The new values to set, can not be <code>null</code> or size 0.
* @see #getControls()
*/
- public void setControls(final C... controlArray) {
+ public void setControls(@SuppressWarnings("unchecked") final C... controlArray) {
if (null == controlArray) {
throw new IllegalArgumentException("controlArray can not be null!");
}
@@ -153,14 +154,15 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
*/
public List<C> getControls() {
assert (null != _controls) : "_controls was null, it must be set before use!";
- assert (!_controls.isEmpty()) : "_controls was empty, it must contain at least 1 element for this class to work!";
+ assert (!_controls
+ .isEmpty()) : "_controls was empty, it must contain at least 1 element for this class to work!";
return _controls;
}
/**
* Updates the {@link #getDelta() delta} and {@link #getIndex() index}.
- *
+ *
* @param time
* The raw time since this was last called.
*/
@@ -224,7 +226,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly.
- *
+ *
* @return The control to interpolate from, will not be <code>null</code>.
* @see #getControlTo()
*/
@@ -254,7 +256,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly.
- *
+ *
* @return The control to interpolate to, will not be <code>null</code>.
* @see #getControlFrom()
*/
@@ -288,7 +290,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* Increments the index by 1.
- *
+ *
* @return The new index value as a convenience.
*/
protected int incrementIndex() {
@@ -297,7 +299,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* Decrements the index by 1.
- *
+ *
* @return The new index value as a convenience.
*/
protected int decrementIndex() {
@@ -386,7 +388,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* Also {@link #reset() resets} this controller for safety, because changing the repeat type part way through an
* interpolation can cause problems.
- *
+ *
* @param repeatType
* The new repeat type to use.
*/
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java
index ba65860..4d8c900 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java
@@ -24,7 +24,7 @@ public class SceneGraphManager implements DirtyEventListener {
private final List<DirtyEventListener> _listeners;
private SceneGraphManager() {
- _listeners = new ArrayList<DirtyEventListener>();
+ _listeners = new ArrayList<>();
}
public static SceneGraphManager getSceneGraphManager() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java
index 8d2377d..1b4c45d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java
@@ -24,7 +24,7 @@ import com.ardor3d.util.export.OutputCapsule;
public class PassNode extends Node {
- private List<PassNodeState> _passNodeStates = new ArrayList<PassNodeState>();
+ private List<PassNodeState> _passNodeStates = new ArrayList<>();
public PassNode(final String name) {
super(name);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java
index abbc917..661a263 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java
@@ -33,7 +33,7 @@ public class PassNodeState implements Savable, Serializable {
* RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set
* during rendering.
*/
- protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<>(
RenderState.StateType.class);
/**
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java
index 6fb83ae..f8ce590 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java
@@ -266,7 +266,7 @@ public class Extrusion extends Mesh {
final double d[][] = new double[3][np]; // Newton form coefficients
final double x[] = new double[np]; // x-coordinates of nodes
- final List<ReadOnlyVector3> path = new ArrayList<ReadOnlyVector3>();
+ final List<ReadOnlyVector3> path = new ArrayList<>();
for (int i = 0; i < np; i++) {
ReadOnlyVector3 p;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java b/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java
index df2fc6c..7ab7562 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java
@@ -172,7 +172,7 @@ public class ArcLengthTable {
throw new IllegalArgumentException("step must be > 0! step=" + step);
}
- _lookupTable = new HashMap<Integer, List<ArcLengthEntry>>();
+ _lookupTable = new HashMap<>();
final Vector3 target = Vector3.fetchTempInstance();
final Vector3 previous = Vector3.fetchTempInstance();
@@ -187,7 +187,7 @@ public class ArcLengthTable {
previous.set(_curve.getControlPoints().get(i));
- final ArrayList<ArcLengthEntry> entries = new ArrayList<ArcLengthEntry>();
+ final ArrayList<ArcLengthEntry> entries = new ArrayList<>();
entries.add(new ArcLengthEntry(0f, 0));
final int endIndex = reverse ? startIndex - 1 : startIndex + 1;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java
index 657f56d..a51b171 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java
@@ -55,11 +55,11 @@ import com.ardor3d.util.resource.ResourceSource;
public class BMFont implements Savable {
private static Logger logger = Logger.getLogger(BMFont.class.getName());
- private final Map<Integer, Char> _charMap = new HashMap<Integer, Char>();
- private final Map<Integer, Map<Integer, Integer>> _kernMap = new HashMap<Integer, Map<Integer, Integer>>();
+ private final Map<Integer, Char> _charMap = new HashMap<>();
+ private final Map<Integer, Map<Integer, Integer>> _kernMap = new HashMap<>();
private String _styleName; // e.g. "Courier-12-bold"
- private final ArrayList<Page> _pages = new ArrayList<Page>();
+ private final ArrayList<Page> _pages = new ArrayList<>();
private Texture _pageTexture;
private RenderStateSetter _blendStateSetter = null;
private RenderStateSetter _alphaStateSetter = null;
@@ -424,7 +424,7 @@ public class BMFont implements Savable {
}
public List<Integer> getMappedChars() {
- return new ArrayList<Integer>(_charMap.keySet());
+ return new ArrayList<>(_charMap.keySet());
}
public Map<Integer, Integer> getKerningsForCharacter(final int val) {
@@ -556,7 +556,7 @@ public class BMFont implements Savable {
Map<Integer, Integer> amtHash;
amtHash = _kernMap.get(first);
if (amtHash == null) {
- amtHash = new HashMap<Integer, Integer>();
+ amtHash = new HashMap<>();
_kernMap.put(first, amtHash);
}
amtHash.put(second, amount);
@@ -884,10 +884,10 @@ public class BMFont implements Savable {
// Pages
capsule.writeSavableList(_pages, "pages", _pages);
// Chars
- capsule.writeSavableList(new ArrayList<Char>(_charMap.values()), "charMap", null);
+ capsule.writeSavableList(new ArrayList<>(_charMap.values()), "charMap", null);
// Kernings
- final List<Kerning> kernings = new ArrayList<Kerning>();
+ final List<Kerning> kernings = new ArrayList<>();
for (final Iterator<Integer> iterator = _kernMap.keySet().iterator(); iterator.hasNext();) {
final Integer first = iterator.next();
final Map<Integer, Integer> amtHash = _kernMap.get(first);
@@ -938,7 +938,7 @@ public class BMFont implements Savable {
Map<Integer, Integer> amtHash;
amtHash = _kernMap.get(k.first);
if (amtHash == null) {
- amtHash = new HashMap<Integer, Integer>();
+ amtHash = new HashMap<>();
_kernMap.put(k.first, amtHash);
}
amtHash.put(k.second, k.amount);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java
index 7ae05a6..069c0fd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java
@@ -23,7 +23,7 @@ public class ContextIdReference<T> extends PhantomReference<T> {
/**
* Keep a strong reference to these objects until their reference is cleared.
*/
- private static final List<ContextIdReference<?>> REFS = new LinkedList<ContextIdReference<?>>();
+ private static final List<ContextIdReference<?>> REFS = new LinkedList<>();
private final Map<Object, Integer> _idCache;
private Integer _singleContextId;
@@ -31,7 +31,7 @@ public class ContextIdReference<T> extends PhantomReference<T> {
public ContextIdReference(final T reference, final ReferenceQueue<? super T> queue) {
super(reference, queue);
if (Constants.useMultipleContexts) {
- _idCache = new WeakHashMap<Object, Integer>(2);
+ _idCache = new WeakHashMap<>(2);
} else {
_idCache = null;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java
index 2a0e17c..357a96b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java
@@ -38,13 +38,13 @@ public class GameTaskQueue {
public static final String RENDER = "render";
public static final String UPDATE = "update";
- private final ConcurrentLinkedQueue<GameTask<?>> _queue = new ConcurrentLinkedQueue<GameTask<?>>();
+ private final ConcurrentLinkedQueue<GameTask<?>> _queue = new ConcurrentLinkedQueue<>();
private final AtomicBoolean _executeMultiple = new AtomicBoolean();
// Default execution time is 0, which means only 1 task will be executed at a time.
private long _executionTime = 0;
- private final List<ExecutionExceptionListener> _executionExceptionListeners = new LinkedList<ExecutionExceptionListener>();
+ private final List<ExecutionExceptionListener> _executionExceptionListeners = new LinkedList<>();
public void addExecutionExceptionListener(final ExecutionExceptionListener l) {
_executionExceptionListeners.add(l);
@@ -111,7 +111,7 @@ public class GameTaskQueue {
* @return
*/
public <V> Future<V> enqueue(final Callable<V> callable) {
- final GameTask<V> task = new GameTask<V>(callable);
+ final GameTask<V> task = new GameTask<>(callable);
_queue.add(task);
return task;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java
index 4f57874..26f9d16 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java
@@ -25,7 +25,7 @@ public final class GameTaskQueueManager {
private static final Object MAP_LOCK = new Object();
private static final ConcurrentMap<Object, GameTaskQueueManager> _managers = new MapMaker().weakKeys().makeMap();
- private final ConcurrentMap<String, GameTaskQueue> _managedQueues = new ConcurrentHashMap<String, GameTaskQueue>(2);
+ private final ConcurrentMap<String, GameTaskQueue> _managedQueues = new ConcurrentHashMap<>(2);
public static GameTaskQueueManager getManager(final Object key) {
synchronized (MAP_LOCK) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java
index 914364e..2241206 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -20,7 +20,7 @@ import java.io.InputStream;
* LittleEndianDataInput is a class to read little-endian stored data via a InputStream. All functions work as defined
* in DataInput, but assume they come from a LittleEndian input stream.
*/
-public class LittleEndianDataInput implements DataInput {
+public class LittleEndianDataInput implements DataInput, AutoCloseable {
private final BufferedInputStream _stream;
@@ -33,7 +33,7 @@ public class LittleEndianDataInput implements DataInput {
/**
* Creates a new LittleEndian reader from the given input stream. The stream is wrapped in a BufferedInputStream
* automatically.
- *
+ *
* @param in
* The input stream to read from.
*/
@@ -50,8 +50,8 @@ public class LittleEndianDataInput implements DataInput {
* read an unsigned int as a long
*/
public final long readUnsignedInt() throws IOException {
- return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) | (((long) (_stream
- .read() & 0xff)) << 24));
+ return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16)
+ | (((long) (_stream.read() & 0xff)) << 24));
}
@Override
@@ -81,16 +81,16 @@ public class LittleEndianDataInput implements DataInput {
@Override
public final int readInt() throws IOException {
- return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) | ((_stream
- .read() & 0xff) << 24));
+ return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16)
+ | ((_stream.read() & 0xff) << 24));
}
@Override
public final long readLong() throws IOException {
- return ((_stream.read() & 0xff) | ((long) (_stream.read() & 0xff) << 8)
- | ((long) (_stream.read() & 0xff) << 16) | ((long) (_stream.read() & 0xff) << 24)
- | ((long) (_stream.read() & 0xff) << 32) | ((long) (_stream.read() & 0xff) << 40)
- | ((long) (_stream.read() & 0xff) << 48) | ((long) (_stream.read() & 0xff) << 56));
+ return ((_stream.read() & 0xff) | ((long) (_stream.read() & 0xff) << 8) | ((long) (_stream.read() & 0xff) << 16)
+ | ((long) (_stream.read() & 0xff) << 24) | ((long) (_stream.read() & 0xff) << 32)
+ | ((long) (_stream.read() & 0xff) << 40) | ((long) (_stream.read() & 0xff) << 48)
+ | ((long) (_stream.read() & 0xff) << 56));
}
@Override
@@ -141,6 +141,7 @@ public class LittleEndianDataInput implements DataInput {
throw new IOException("Unsupported operation");
}
+ @Override
public final void close() throws IOException {
_stream.close();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java
index 21ff6e3..91ac624 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java
@@ -20,7 +20,7 @@ public class SimpleContextIdReference<T> extends PhantomReference<T> {
/**
* Keep a string reference to these objects until their reference is cleared.
*/
- private static final List<SimpleContextIdReference<?>> REFS = new LinkedList<SimpleContextIdReference<?>>();
+ private static final List<SimpleContextIdReference<?>> REFS = new LinkedList<>();
private final int _id;
private final Object _glContext;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java b/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java
index b0d83ce..4202fcb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -67,14 +68,14 @@ final public class TextureKey implements Savable {
private boolean _dirty;
/** cache of OpenGL context specific texture ids for the associated texture. */
- protected final transient ContextIdReference<TextureKey> _idCache = new ContextIdReference<TextureKey>(this,
+ protected final transient ContextIdReference<TextureKey> _idCache = new ContextIdReference<>(this,
TextureManager.getRefQueue());
/** cached hashcode value. */
protected transient int _code = Integer.MAX_VALUE;
/** cache of texturekey objects allowing us to find an existing texture key. */
- protected static final List<WeakReference<TextureKey>> _keyCache = new LinkedList<WeakReference<TextureKey>>();
+ protected static final List<WeakReference<TextureKey>> _keyCache = new LinkedList<>();
private static final Integer ZERO = new Integer(0);
@@ -84,7 +85,7 @@ final public class TextureKey implements Savable {
/** DO NOT USE. FOR INTERNAL USE ONLY */
protected TextureKey() {
if (Constants.useMultipleContexts) {
- _dirtyContexts = new ArrayList<WeakReference<Object>>();
+ _dirtyContexts = new ArrayList<>();
} else {
_dirtyContexts = null;
}
@@ -101,7 +102,7 @@ final public class TextureKey implements Savable {
_dirtyContexts.clear();
// grab all contexts we currently have ids for and add them all as dirty
for (final Object context : _idCache.getContextObjects()) {
- final WeakReference<Object> ref = new WeakReference<Object>(context);
+ final WeakReference<Object> ref = new WeakReference<>(context);
_dirtyContexts.add(ref);
}
}
@@ -166,7 +167,7 @@ final public class TextureKey implements Savable {
/**
* Get a new unique TextureKey. This is meant for use by RTT and other situations where we know we are making a
* unique texture.
- *
+ *
* @param minFilter
* our minification filter value.
* @return the new TextureKey
@@ -216,7 +217,7 @@ final public class TextureKey implements Savable {
}
// not found
- _keyCache.add(new WeakReference<TextureKey>(key));
+ _keyCache.add(new WeakReference<>(key));
return key;
}
@@ -264,7 +265,7 @@ final public class TextureKey implements Savable {
* Note: This does not remove the texture from the card and is provided for use by code that does remove textures
* from the card.
* </p>
- *
+ *
* @param glContext
* the object representing the OpenGL context this texture belongs to. See
* {@link RenderContext#getGlContextRep()}
@@ -288,7 +289,7 @@ final public class TextureKey implements Savable {
/**
* Sets the id for a texture in regards to the given OpenGL context.
- *
+ *
* @param glContext
* the object representing the OpenGL context a texture belongs to. See
* {@link RenderContext#getGlContextRep()}
@@ -347,13 +348,8 @@ final public class TextureKey implements Savable {
@Override
public int hashCode() {
if (_code == Integer.MAX_VALUE) {
- _code = 17;
-
- _code += 31 * _code + (_source != null ? _source.hashCode() : 0);
- _code += 31 * _code + (_id != null ? _id.hashCode() : 0);
- _code += 31 * _code + _minFilter.hashCode();
- _code += 31 * _code + _format.hashCode();
- _code += 31 * _code + (_flipped ? 1 : 0);
+ _code = Objects.hash(getSource(), getId(), getMinificationFilter(), getFormat(),
+ Boolean.valueOf(isFlipped()));
}
return _code;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java b/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java
index b584647..8118104 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java
@@ -46,7 +46,7 @@ final public class TextureManager {
private static Map<TextureKey, Texture> _tCache = new MapMaker().weakKeys().weakValues().makeMap();
- private static ReferenceQueue<TextureKey> _textureRefQueue = new ReferenceQueue<TextureKey>();
+ private static ReferenceQueue<TextureKey> _textureRefQueue = new ReferenceQueue<>();
static {
ContextManager.addContextCleanListener(new ContextCleanListener() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java
index 61090b2..55414de 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -123,14 +123,14 @@ public class BinaryExporter implements Ardor3dExporter {
protected int _aliasCount = 1;
protected int _idCount = 1;
- protected final Map<Savable, BinaryIdContentPair> _contentTable = new IdentityHashMap<Savable, BinaryIdContentPair>();
+ protected final Map<Savable, BinaryIdContentPair> _contentTable = new IdentityHashMap<>();
- protected final Map<Integer, Integer> _locationTable = new HashMap<Integer, Integer>();
+ protected final Map<Integer, Integer> _locationTable = new HashMap<>();
// key - class name, value = bco
- protected final Map<String, BinaryClassObject> _classes = new HashMap<String, BinaryClassObject>();
+ protected final Map<String, BinaryClassObject> _classes = new HashMap<>();
- protected final List<Savable> _contentKeys = new ArrayList<Savable>();
+ protected final List<Savable> _contentKeys = new ArrayList<>();
public BinaryExporter() {
this(DEFAULT_COMPRESSION);
@@ -138,7 +138,7 @@ public class BinaryExporter implements Ardor3dExporter {
/**
* Construct a new exporter, specifying some options.
- *
+ *
* @param compression
* the compression type to use. One of the constants from {@link java.util.zip.Deflater}
*/
@@ -196,8 +196,7 @@ public class BinaryExporter implements Ardor3dExporter {
// write out data to a seperate stream
int location = 0;
// keep track of location for each piece
- final HashMap<String, List<BinaryIdContentPair>> alreadySaved = new HashMap<String, List<BinaryIdContentPair>>(
- _contentTable.size());
+ final HashMap<String, List<BinaryIdContentPair>> alreadySaved = new HashMap<>(_contentTable.size());
for (final Savable savable : _contentKeys) {
// look back at previous written data for matches
final String savableName = savable.getClassTag().getName();
@@ -211,7 +210,7 @@ public class BinaryExporter implements Ardor3dExporter {
_locationTable.put(pair.getId(), location);
if (bucket == null) {
- bucket = new ArrayList<BinaryIdContentPair>();
+ bucket = new ArrayList<>();
alreadySaved.put(savableName + getChunk(pair), bucket);
}
bucket.add(pair);
@@ -304,9 +303,9 @@ public class BinaryExporter implements Ardor3dExporter {
parentDirectory.mkdirs();
}
- final FileOutputStream fos = new FileOutputStream(file);
- save(object, fos);
- fos.close();
+ try (final FileOutputStream fos = new FileOutputStream(file)) {
+ save(object, fos);
+ }
}
public int processBinarySavable(final Savable object) throws IOException {
@@ -318,7 +317,7 @@ public class BinaryExporter implements Ardor3dExporter {
if (bco == null) {
bco = new BinaryClassObject();
bco._alias = generateTag();
- bco._nameFields = new HashMap<String, BinaryClassField>();
+ bco._nameFields = new HashMap<>();
_classes.put(object.getClassTag().getName(), bco);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
index c9944a2..e048fbf 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -37,13 +37,13 @@ public class BinaryImporter implements Ardor3dImporter {
private static final Logger logger = Logger.getLogger(BinaryImporter.class.getName());
// Key - alias, object - bco
- protected final Map<String, BinaryClassObject> _classes = new HashMap<String, BinaryClassObject>();
+ protected final Map<String, BinaryClassObject> _classes = new HashMap<>();
// Key - id, object - the savable
- protected final Map<Integer, Savable> _contentTable = new HashMap<Integer, Savable>();
+ protected final Map<Integer, Savable> _contentTable = new HashMap<>();
// Key - savable, object - capsule
- protected final Map<Savable, BinaryInputCapsule> _capsuleTable = new IdentityHashMap<Savable, BinaryInputCapsule>();
+ protected final Map<Savable, BinaryInputCapsule> _capsuleTable = new IdentityHashMap<>();
// Key - id, opject - location in the file
- protected final Map<Integer, Integer> _locationTable = new HashMap<Integer, Integer>();
+ protected final Map<Integer, Integer> _locationTable = new HashMap<>();
protected byte[] _dataArray = null;
protected int _aliasWidth = 0;
@@ -79,8 +79,8 @@ public class BinaryImporter implements Ardor3dImporter {
final int fields = ByteUtils.readInt(bis);
bytes += (8 + _aliasWidth + classLength);
- bco._nameFields = new HashMap<String, BinaryClassField>(fields);
- bco._aliasFields = new HashMap<Byte, BinaryClassField>(fields);
+ bco._nameFields = new HashMap<>(fields);
+ bco._aliasFields = new HashMap<>(fields);
for (int x = 0; x < fields; x++) {
final byte fieldAlias = (byte) bis.read();
final byte fieldType = (byte) bis.read();
@@ -162,10 +162,10 @@ public class BinaryImporter implements Ardor3dImporter {
}
public Savable load(final URL url, final ReadListener listener) throws IOException {
- final InputStream is = url.openStream();
- final Savable rVal = load(is, listener);
- is.close();
- return rVal;
+ try (final InputStream is = url.openStream()) {
+ final Savable rVal = load(is, listener);
+ return rVal;
+ }
}
@Override
@@ -174,18 +174,18 @@ public class BinaryImporter implements Ardor3dImporter {
}
public Savable load(final File file, final ReadListener listener) throws IOException {
- final FileInputStream fis = new FileInputStream(file);
- final Savable rVal = load(fis, listener);
- fis.close();
- return rVal;
+ try (final FileInputStream fis = new FileInputStream(file)) {
+ final Savable rVal = load(fis, listener);
+ return rVal;
+ }
}
@Override
public Savable load(final byte[] data) throws IOException {
- final ByteArrayInputStream bais = new ByteArrayInputStream(data);
- final Savable rVal = load(bais);
- bais.close();
- return rVal;
+ try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
+ final Savable rVal = load(bais);
+ return rVal;
+ }
}
protected String readString(final InputStream is, final int length) throws IOException {
@@ -218,8 +218,8 @@ public class BinaryImporter implements Ardor3dImporter {
final BinaryClassObject bco = _classes.get(alias);
if (bco == null) {
- logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int id)", "NULL class object: "
- + alias);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int id)",
+ "NULL class object: " + alias);
return null;
}
@@ -244,15 +244,12 @@ public class BinaryImporter implements Ardor3dImporter {
} catch (final InstantiationException e) {
logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)",
"Could not access constructor of class '" + bco._className + "'! \n"
- + "Some types may require the annotation SavableFactory. Please double check.", e);
+ + "Some types may require the annotation SavableFactory. Please double check.",
+ e);
throw new Ardor3dException(e);
} catch (final NoSuchMethodException e) {
- logger.logp(
- Level.SEVERE,
- this.getClass().toString(),
- "readObject(int)",
- e.getMessage()
- + " \n"
+ logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)",
+ e.getMessage() + " \n"
+ "Method specified in annotation does not appear to exist or has an invalid method signature.",
e);
throw new Ardor3dException(e);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java
index 3d99d16..f3fb207 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java
@@ -46,7 +46,7 @@ public class BinaryInputCapsule implements InputCapsule {
}
public void setContent(final byte[] content, final int start, final int limit) {
- _fieldData = new HashMap<Byte, Object>();
+ _fieldData = new HashMap<>();
for (_index = start; _index < limit;) {
final byte alias = content[_index];
@@ -543,7 +543,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (savables == null) {
return null;
}
- final List<Savable> list = new ArrayList<Savable>(savables.length);
+ final List<Savable> list = new ArrayList<>(savables.length);
for (int x = 0; x < savables.length; x++) {
list.add(savables[x]);
}
@@ -555,7 +555,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (savables == null) {
return null;
}
- final Map<Savable, Savable> map = new HashMap<Savable, Savable>(savables.length);
+ final Map<Savable, Savable> map = new HashMap<>(savables.length);
for (int x = 0; x < savables.length; x++) {
map.put(savables[x][0], savables[x][1]);
}
@@ -567,7 +567,7 @@ public class BinaryInputCapsule implements InputCapsule {
return null;
}
- final Map<String, Savable> map = new HashMap<String, Savable>(keys.length);
+ final Map<String, Savable> map = new HashMap<>(keys.length);
for (int x = 0; x < keys.length; x++) {
map.put(keys[x], values[x]);
}
@@ -1239,7 +1239,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (length == BinaryOutputCapsule.NULL_OBJECT) {
return null;
}
- final List<FloatBuffer> rVal = new ArrayList<FloatBuffer>(length);
+ final List<FloatBuffer> rVal = new ArrayList<>(length);
for (int x = 0; x < length; x++) {
rVal.add(readFloatBuffer(content));
}
@@ -1253,7 +1253,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (length == BinaryOutputCapsule.NULL_OBJECT) {
return null;
}
- final List<ByteBuffer> rVal = new ArrayList<ByteBuffer>(length);
+ final List<ByteBuffer> rVal = new ArrayList<>(length);
for (int x = 0; x < length; x++) {
rVal.add(readByteBuffer(content));
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java
index 996cbd7..a3987d5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -441,6 +441,11 @@ public class BinaryOutputCapsule implements OutputCapsule {
return Arrays.equals(_bytes, other);
}
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(_bytes);
+ }
+
public void finish() {
// renamed to finish as 'finalize' in java.lang.Object should not be
// overridden like this
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
index 54de7e4..6b29554 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
@@ -48,7 +48,7 @@ public class DOMInputCapsule implements InputCapsule {
private final Document _doc;
private Element _currentElem;
private boolean _isAtRoot = true;
- private final Map<String, Savable> _referencedSavables = new HashMap<String, Savable>();
+ private final Map<String, Savable> _referencedSavables = new HashMap<>();
public DOMInputCapsule(final Document doc) {
_doc = doc;
@@ -882,7 +882,7 @@ public class DOMInputCapsule implements InputCapsule {
private Savable[] readRenderStateList(final Element fromElement, final Savable[] defVal) {
Savable[] ret = defVal;
try {
- final List<RenderState> tmp = new ArrayList<RenderState>();
+ final List<RenderState> tmp = new ArrayList<>();
_currentElem = findFirstChildElement(fromElement);
while (_currentElem != null) {
final Element el = _currentElem;
@@ -1074,7 +1074,7 @@ public class DOMInputCapsule implements InputCapsule {
}
final int size = Integer.parseInt(tmpEl.getAttribute("size"));
- final List<FloatBuffer> tmp = new ArrayList<FloatBuffer>(size);
+ final List<FloatBuffer> tmp = new ArrayList<>(size);
_currentElem = findFirstChildElement(tmpEl);
for (int i = 0; i < size; i++) {
tmp.add(readFloatBuffer(null, null));
@@ -1105,7 +1105,7 @@ public class DOMInputCapsule implements InputCapsule {
} else {
tempEl = _currentElem;
}
- ret = new HashMap<K, V>();
+ ret = new HashMap<>();
final NodeList nodes = tempEl.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
@@ -1135,7 +1135,7 @@ public class DOMInputCapsule implements InputCapsule {
tempEl = _currentElem;
}
if (tempEl != null) {
- ret = new HashMap<String, V>();
+ ret = new HashMap<>();
final NodeList nodes = tempEl.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
@@ -1280,7 +1280,7 @@ public class DOMInputCapsule implements InputCapsule {
}
final int size = Integer.parseInt(tmpEl.getAttribute("size"));
- final List<ByteBuffer> tmp = new ArrayList<ByteBuffer>(size);
+ final List<ByteBuffer> tmp = new ArrayList<>(size);
_currentElem = findFirstChildElement(tmpEl);
for (int i = 0; i < size; i++) {
tmp.add(readByteBuffer(null, null));
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java
index bf781a1..0033fd4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java
@@ -37,7 +37,7 @@ public class DOMOutputCapsule implements OutputCapsule {
private static final String _dataAttributeName = "data";
private final Document _doc;
private Element _currentElement;
- private final Map<Savable, Element> _writtenSavables = new IdentityHashMap<Savable, Element>();
+ private final Map<Savable, Element> _writtenSavables = new IdentityHashMap<>();
public DOMOutputCapsule(final Document doc) {
_doc = doc;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java
index 34000f0..21d9d35 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -26,7 +26,7 @@ import org.w3c.dom.NodeList;
/**
* The DOMSerializer was based primarily off the DOMSerializer.java class from the "Java and XML" 3rd Edition book by
* Brett McLaughlin, and Justin Edelson. Some modifications were made to support formatting of elements and attributes.
- *
+ *
*/
public class DOMSerializer {
@@ -51,7 +51,7 @@ public class DOMSerializer {
}
public void setIndent(final int numSpaces) {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
for (int i = 0; i < numSpaces; i++) {
buffer.append('\t');
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java
index e96c951..9e18e0e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java
@@ -45,7 +45,7 @@ import com.ardor3d.util.Constants;
public final class BufferUtils {
// // -- TRACKER HASH -- ////
- private static final Map<Buffer, Object> trackingHash = new WeakHashMap<Buffer, Object>();
+ private static final Map<Buffer, Object> trackingHash = new WeakHashMap<>();
private static final Object ref = new Object();
// // -- COLORRGBA METHODS -- ////
@@ -1782,7 +1782,7 @@ public final class BufferUtils {
public static void printCurrentDirectMemory(StringBuilder store) {
long totalHeld = 0;
// make a new set to hold the keys to prevent concurrency issues.
- final List<Buffer> bufs = new ArrayList<Buffer>(trackingHash.keySet());
+ final List<Buffer> bufs = new ArrayList<>(trackingHash.keySet());
int fBufs = 0, bBufs = 0, iBufs = 0, sBufs = 0, dBufs = 0;
int fBufsM = 0, bBufsM = 0, iBufsM = 0, sBufsM = 0, dBufsM = 0;
for (final Buffer b : bufs) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java
index 90b9110..3bb8cfd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java
@@ -126,8 +126,8 @@ public class GeometryTool {
}
}
- final Map<VertKey, Integer> store = new HashMap<VertKey, Integer>();
- final Map<Integer, Integer> indexRemap = new HashMap<Integer, Integer>();
+ final Map<VertKey, Integer> store = new HashMap<>();
+ final Map<Integer, Integer> indexRemap = new HashMap<>();
int good = 0;
long group;
for (int x = 0, max = verts.length; x < max; x++) {
@@ -350,7 +350,7 @@ public class GeometryTool {
final int numberOfUnits = meshData.getNumberOfUnits();
if (numberOfUnits > 0) {
final List<FloatBufferData> previousTextureCoordsList = meshData.getTextureCoords();
- final List<FloatBufferData> nextTextureCoordsList = new ArrayList<FloatBufferData>();
+ final List<FloatBufferData> nextTextureCoordsList = new ArrayList<>();
for (int unitIndex = 0; unitIndex < numberOfUnits; unitIndex++) {
final FloatBufferData previousTextureCoords = previousTextureCoordsList.get(unitIndex);
if (previousTextureCoords == null) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java
index 369afb6..8377762 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java
@@ -63,7 +63,7 @@ public class MeshCombiner {
}
public final static Mesh combine(final Spatial source, final MeshCombineLogic logic) {
- final List<Mesh> sources = new ArrayList<Mesh>();
+ final List<Mesh> sources = new ArrayList<>();
source.acceptVisitor(new Visitor() {
@Override
public void visit(final Spatial spatial) {
@@ -86,7 +86,7 @@ public class MeshCombiner {
* @return the combined Mesh.
*/
public final static Mesh combine(final Mesh... sources) {
- return combine(new ArrayList<Mesh>(Arrays.asList(sources)));
+ return combine(new ArrayList<>(Arrays.asList(sources)));
}
/**
@@ -129,7 +129,7 @@ public class MeshCombiner {
protected EnumMap<StateType, RenderState> states = null;
protected MeshData data = new MeshData();
protected BoundingVolume volumeType = null;
- protected List<Mesh> sources = new ArrayList<Mesh>();
+ protected List<Mesh> sources = new ArrayList<>();
private FloatBufferData vertices;
private FloatBufferData colors;
private FloatBufferData normals;
@@ -237,7 +237,7 @@ public class MeshCombiner {
normals = useNormals ? new FloatBufferData(totalVertices * 3, 3) : null;
data.setNormalCoords(normals);
- texCoordsList = new ArrayList<FloatBufferData>(maxTextures);
+ texCoordsList = new ArrayList<>(maxTextures);
for (int i = 0; i < maxTextures; i++) {
texCoordsList.add(new FloatBufferData(totalVertices * texCoords, texCoords));
}
@@ -359,8 +359,8 @@ class IndexCombiner {
}
public void saveTo(final MeshData data) {
- final List<IntBuffer> sections = new ArrayList<IntBuffer>();
- final List<IndexMode> modes = new ArrayList<IndexMode>();
+ final List<IntBuffer> sections = new ArrayList<>();
+ final List<IndexMode> modes = new ArrayList<>();
int max = 0;
// walk through index modes and combine those we can.
for (final IndexMode mode : sectionMap.keySet()) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java
index 2d9b019..6f53629 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -80,7 +80,7 @@ public class NormalGenerator {
/**
* Generates the normals for one Mesh, using the specified crease angle.
- *
+ *
* @param mesh
* The Mesh to generate the normals for
* @param creaseAngle
@@ -97,7 +97,7 @@ public class NormalGenerator {
/**
* Generates the normals for one Mesh, using the crease angle stored in the field <code>creaseAngle</code>
- *
+ *
* @param mesh
* The Mesh to generate the normals for
*/
@@ -252,12 +252,12 @@ public class NormalGenerator {
*/
private void initialize() {
// Copy the source vertices as a base for the normal generation
- _destVerts = new ArrayList<Vector3>(_sourceVerts.length);
+ _destVerts = new ArrayList<>(_sourceVerts.length);
for (int i = 0; i < _sourceVerts.length; i++) {
_destVerts.add(_sourceVerts[i]);
}
if (_sourceColors != null) {
- _destColors = new ArrayList<ColorRGBA>(_sourceColors.length);
+ _destColors = new ArrayList<>(_sourceColors.length);
for (int i = 0; i < _sourceColors.length; i++) {
_destColors.add(_sourceColors[i]);
}
@@ -265,7 +265,7 @@ public class NormalGenerator {
_destColors = null;
}
if (_sourceTexCoords != null) {
- _destTexCoords = new ArrayList<Vector2>(_sourceTexCoords.length);
+ _destTexCoords = new ArrayList<>(_sourceTexCoords.length);
for (int i = 0; i < _sourceTexCoords.length; i++) {
_destTexCoords.add(_sourceTexCoords[i]);
}
@@ -274,7 +274,7 @@ public class NormalGenerator {
}
// Set up the base triangles of the mesh and their face normals
- _triangles = new LinkedList<Triangle>();
+ _triangles = new LinkedList<>();
for (int i = 0; i * 3 < _sourceInds.length; i++) {
final Triangle tri = new Triangle(_sourceInds[i * 3 + 0], _sourceInds[i * 3 + 1], _sourceInds[i * 3 + 2]);
tri.computeNormal(_sourceVerts);
@@ -283,12 +283,12 @@ public class NormalGenerator {
// Set up the lists to store the created mesh split data
if (_splitMeshes == null) {
- _splitMeshes = new LinkedList<LinkedList<Triangle>>();
+ _splitMeshes = new LinkedList<>();
} else {
_splitMeshes.clear();
}
if (_splitMeshBorders == null) {
- _splitMeshBorders = new LinkedList<LinkedList<Edge>>();
+ _splitMeshBorders = new LinkedList<>();
} else {
_splitMeshBorders.clear();
}
@@ -300,8 +300,8 @@ public class NormalGenerator {
* border of the split mesh in splitMeshBorders.
*/
private void createMeshSplit() {
- _destTris = new LinkedList<Triangle>();
- _edges = new LinkedList<Edge>();
+ _destTris = new LinkedList<>();
+ _edges = new LinkedList<>();
final Triangle tri = _triangles.removeFirst();
_destTris.addLast(tri);
_edges.addLast(tri.edges[0]);
@@ -321,9 +321,10 @@ public class NormalGenerator {
* Finds one triangle connected to the split mesh currently being assembled over an edge whose angle does not exceed
* the creaseAngle. The Triangle is inserted into destTris and the list edges is updated with the edges of the
* triangle accordingly.
- *
+ *
* @return The triangle, if one was found, or <code>null</code> otherwise
*/
+ @SuppressWarnings("null")
private Triangle insertTriangle() {
final ListIterator<Triangle> triIt = _triangles.listIterator();
ListIterator<Edge> edgeIt = null;
@@ -386,7 +387,7 @@ public class NormalGenerator {
* Connects the remaining edges of the given triangle to the split mesh currently being assembled, if possible. The
* respective edges are removed from the border, and if the crease angle at this additional connection is exceeded,
* the vertices at this link are duplicated.
- *
+ *
* @param triangle
* The triangle being connected to the split mesh
* @param i
@@ -431,7 +432,7 @@ public class NormalGenerator {
/**
* Checks if the transition between the tqo given triangles should be smooth, according to the creaseAngle.
- *
+ *
* @param tri1
* The first triangle
* @param tri2
@@ -446,7 +447,7 @@ public class NormalGenerator {
/**
* Copies the vertex, color and texCoord at the given index in each of the source lists (if not null) and adds it to
* the end of the list.
- *
+ *
* @param index
* The index to copy the value in each list from
*/
@@ -542,7 +543,7 @@ public class NormalGenerator {
/**
* If the triangle contains the given index, it is replaced with the replacement index, unless it is already
* overridden with a newIndex (newI0, newI1).
- *
+ *
* @param tri
* The triangle
* @param index
@@ -661,7 +662,7 @@ public class NormalGenerator {
/**
* A helper class for the normal generator. Stores one triangle, consisting of 3 edges, and the normal for the
* triangle.
- *
+ *
* @author M. Sattler
*/
private class Triangle {
@@ -674,7 +675,7 @@ public class NormalGenerator {
/**
* Creates the triangle.
- *
+ *
* @param i0
* The index of vertex 0 in the triangle
* @param i1
@@ -690,7 +691,7 @@ public class NormalGenerator {
/**
* Computes the normal from the three vertices in the given array that are indexed by the edges.
- *
+ *
* @param verts
* The array containing the vertices
*/
@@ -708,6 +709,7 @@ public class NormalGenerator {
* An Edge to get the index of
* @return The index of the edge in the triangle, or -1, if it is not contained in the triangle
*/
+ @SuppressWarnings("unused")
public int indexOf(final Edge edge) {
for (int i = 0; i < 3; i++) {
if (edges[i] == edge) {
@@ -743,7 +745,7 @@ public class NormalGenerator {
/**
* Another helper class for the normal generator. Stores one edge in the mesh, consisting of two vertex indices, the
* triangle the edge belongs to, and, if applicable, another triangle the edge is connected to.
- *
+ *
* @author M. Sattler
*/
private class Edge {
@@ -760,13 +762,14 @@ public class NormalGenerator {
public Triangle parent;
// A Triangle this Edge is connected to, or null, if it is not connected
+ @SuppressWarnings("unused")
public Triangle connected;
// public Edge() {}
/**
* Creates this edge.
- *
+ *
* @param parent
* The Triangle containing this Edge
* @param i0
@@ -782,7 +785,7 @@ public class NormalGenerator {
/**
* Checks if this edge is connected to another one.
- *
+ *
* @param other
* The other edge
* @return <code>true</code>, if the indices in this edge and the other one are identical, but in inverse order
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java
index 429fece..caacbaa 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java
@@ -20,7 +20,7 @@ public class VertGroupData {
public static final int DEFAULT_GROUP = 0;
- private final Map<Long, EnumSet<MatchCondition>> _groupConditions = new HashMap<Long, EnumSet<MatchCondition>>();
+ private final Map<Long, EnumSet<MatchCondition>> _groupConditions = new HashMap<>();
private long[] _vertGroups = null;
public VertGroupData() {}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java
index 47f2f58..29510a2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -20,7 +20,7 @@ public class RelativeResourceLocator implements ResourceLocator {
/**
* Construct a new RelativeResourceLocator using the given source as our base.
- *
+ *
* @param resource
* our base source.
*/
@@ -54,4 +54,9 @@ public class RelativeResourceLocator implements ResourceLocator {
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ return _baseSource.hashCode();
+ }
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java
index 353c45a..f00b20d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java
@@ -37,7 +37,7 @@ public class ResourceLocatorTool {
public static final String TYPE_AUDIO = "audio";
public static final String TYPE_SHADER = "shader";
- private static final Map<String, List<ResourceLocator>> _locatorMap = new HashMap<String, List<ResourceLocator>>();
+ private static final Map<String, List<ResourceLocator>> _locatorMap = new HashMap<>();
public static ResourceSource locateResource(final String resourceType, String resourceName) {
if (resourceName == null) {
@@ -84,7 +84,7 @@ public class ResourceLocatorTool {
synchronized (_locatorMap) {
List<ResourceLocator> bases = _locatorMap.get(resourceType);
if (bases == null) {
- bases = new ArrayList<ResourceLocator>();
+ bases = new ArrayList<>();
_locatorMap.put(resourceType, bases);
}
@@ -162,7 +162,7 @@ public class ResourceLocatorTool {
* @return a set containing the located URLs of the named resource.
*/
public static Set<URL> getClassPathResources(final Class<?> clazz, final String name) {
- final Set<URL> results = new HashSet<URL>();
+ final Set<URL> results = new HashSet<>();
Enumeration<URL> urls = null;
try {
urls = Thread.currentThread().getContextClassLoader().getResources(name);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java
index bb6734d..62b9470 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -27,7 +27,7 @@ public class SimpleResourceLocator implements ResourceLocator {
/**
* Construct a new SimpleResourceLocator using the given URI as our context.
- *
+ *
* @param baseDir
* our base context. This is meant to be a "directory" wherein we will search for resources. Therefore,
* if it does not end in /, a / will be added to ensure we are talking about children of the given
@@ -52,7 +52,7 @@ public class SimpleResourceLocator implements ResourceLocator {
/**
* Construct a new SimpleResourceLocator using the given URL as our context.
- *
+ *
* @param baseDir
* our base context. This is converted to a URI. This is meant to be a "directory" wherein we will search
* for resources. Therefore, if it does not end in /, a / will be added to ensure we are talking about
@@ -136,4 +136,9 @@ public class SimpleResourceLocator implements ResourceLocator {
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ return _baseDir.hashCode();
+ }
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java
index a2769a2..79c820e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -15,6 +15,7 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
+import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,7 +39,7 @@ public class URLResourceSource implements ResourceSource {
/**
* Construct a new URLResourceSource from a specific URL.
- *
+ *
* @param sourceUrl
* The url to load the resource from. Must not be null. If the URL has a valid URL filename (see
* {@link URL#getFile()}) and an extension (eg. http://url/myFile.png) then the extension (.png in this
@@ -62,7 +63,7 @@ public class URLResourceSource implements ResourceSource {
/**
* Construct a new URLResourceSource from a specific URL and type.
- *
+ *
* @param sourceUrl
* The url to load the resource from. Must not be null.
* @param type
@@ -136,11 +137,7 @@ public class URLResourceSource implements ResourceSource {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((_type == null) ? 0 : _type.hashCode());
- result = prime * result + ((_urlToString == null) ? 0 : _urlToString.hashCode());
- return result;
+ return Objects.hash(getType(), getName());
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java
index 57471ff..16cd314 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java
@@ -27,10 +27,10 @@ import com.google.common.collect.Multimap;
public class DisplayListDelegate implements RenderDelegate {
- private static Map<DisplayListDelegate, Object> _identityCache = new WeakHashMap<DisplayListDelegate, Object>();
+ private static Map<DisplayListDelegate, Object> _identityCache = new WeakHashMap<>();
private static final Object STATIC_REF = new Object();
- private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<DisplayListDelegate>();
+ private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<>();
static {
ContextManager.addContextCleanListener(new ContextCleanListener() {
@@ -44,7 +44,7 @@ public class DisplayListDelegate implements RenderDelegate {
private final SimpleContextIdReference<DisplayListDelegate> _id;
public DisplayListDelegate(final int id, final Object glContext) {
- _id = new SimpleContextIdReference<DisplayListDelegate>(this, _refQueue, id, glContext);
+ _id = new SimpleContextIdReference<>(this, _refQueue, id, glContext);
_identityCache.put(this, STATIC_REF);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java
index 13f97af..2c211b5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -11,6 +11,7 @@
package com.ardor3d.util.shader;
import java.io.IOException;
+import java.util.Objects;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
@@ -41,11 +42,7 @@ public class ShaderVariable implements Savable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + variableID;
- return result;
+ return Objects.hash(name, Integer.valueOf(variableID));
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java
index 0b85ad2..e2f8d99 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java
@@ -14,7 +14,7 @@ import java.util.HashMap;
import java.util.Set;
public class MultiStatSample {
- private final HashMap<StatType, StatValue> _values = new HashMap<StatType, StatValue>();
+ private final HashMap<StatType, StatValue> _values = new HashMap<>();
private double _elapsedTime = 0.0;
public static MultiStatSample createNew(final HashMap<StatType, StatValue> current) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java
index 0c54a43..b8fc49e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java
@@ -38,7 +38,7 @@ public abstract class StatCollector {
* Our map of current stat values. Current means values that have been collected within the current time sample. For
* example, if sampleRate = 1.0, then current will hold values collected since the last 1 second ping.
*/
- protected static HashMap<StatType, StatValue> current = new HashMap<StatType, StatValue>();
+ protected static HashMap<StatType, StatValue> current = new HashMap<>();
protected static List<MultiStatSample> historical = Collections.synchronizedList(new LinkedList<MultiStatSample>());
@@ -51,14 +51,14 @@ public abstract class StatCollector {
protected static double lastTimeCheckMS = 0;
- protected static List<StatListener> listeners = new ArrayList<StatListener>();
+ protected static List<StatListener> listeners = new ArrayList<>();
protected static double startOffset = 0;
protected static boolean ignoreStats = false;
- protected static Stack<StatType> timeStatStack = new Stack<StatType>();
- protected static HashSet<StatType> timedStats = new HashSet<StatType>();
+ protected static Stack<StatType> timeStatStack = new Stack<>();
+ protected static HashSet<StatType> timedStats = new HashSet<>();
protected static Timer timer = new Timer();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java
index 42bfee6..6cdfbab 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java
@@ -3,13 +3,15 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.util.stat;
+import java.util.Objects;
+
public class StatType implements Comparable<StatType> {
public static final StatType STAT_FRAMES = new StatType("_frames");
@@ -56,8 +58,7 @@ public class StatType implements Comparable<StatType> {
@Override
public int hashCode() {
- final int hash = _statName.hashCode();
- return hash;
+ return Objects.hashCode(getStatName());
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java
index 9b9d3d6..a81c19f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java
@@ -31,7 +31,7 @@ public abstract class AbstractStatGrapher implements StatListener {
protected Texture2D _texture;
protected int _gWidth, _gHeight;
- protected TreeMap<StatType, HashMap<String, Object>> _config = new TreeMap<StatType, HashMap<String, Object>>();
+ protected TreeMap<StatType, HashMap<String, Object>> _config = new TreeMap<>();
protected boolean _enabled = true;
@@ -92,7 +92,7 @@ public abstract class AbstractStatGrapher implements StatListener {
public void addConfig(final StatType type, final String key, final Object value) {
HashMap<String, Object> vals = _config.get(type);
if (vals == null) {
- vals = new HashMap<String, Object>();
+ vals = new HashMap<>();
_config.put(type, vals);
}
vals.put(key, value);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java
index 6e84991..4ccc49b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java
@@ -53,7 +53,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable {
private static final int majorHBar = 20;
private static final int majorVBar = 10;
- private final HashMap<StatType, LineEntry> _entries = new HashMap<StatType, LineEntry>();
+ private final HashMap<StatType, LineEntry> _entries = new HashMap<>();
private BlendState _defBlendState = null;
@@ -267,7 +267,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable {
}
class LineEntry {
- public List<Vector3> verts = new ArrayList<Vector3>();
+ public List<Vector3> verts = new ArrayList<>();
public int maxSamples;
public double min = 0;
public double max = 10;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java
index 316a77e..a81af4f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java
@@ -48,7 +48,7 @@ public class TabledLabelGrapher extends AbstractStatGrapher {
protected BlendState _defBlendState = null;
- private final HashMap<StatType, LabelEntry> _entries = new HashMap<StatType, LabelEntry>();
+ private final HashMap<StatType, LabelEntry> _entries = new HashMap<>();
private boolean _minimalBackground;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java
index 9f650ea..e423e04 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java
@@ -53,7 +53,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab
private static final int majorHBar = 20;
private static final int majorVBar = 10;
- private final HashMap<StatType, AreaEntry> _entries = new HashMap<StatType, AreaEntry>();
+ private final HashMap<StatType, AreaEntry> _entries = new HashMap<>();
private BlendState _defBlendState = null;
@@ -263,7 +263,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab
}
class AreaEntry {
- public List<Vector3> verts = new ArrayList<Vector3>();
+ public List<Vector3> verts = new ArrayList<>();
public int maxSamples;
public boolean visited;
public Mesh area;
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java b/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java
index cc0dbb8..d25da23 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java
@@ -38,15 +38,15 @@ public class TestPhysicalLayer {
Object[] mocks;
- List<KeyEvent> noKeys = new LinkedList<KeyEvent>();
- List<KeyEvent> Adown = new LinkedList<KeyEvent>();
- List<KeyEvent> AdownBdown = new LinkedList<KeyEvent>();
- List<KeyEvent> AdownAup = new LinkedList<KeyEvent>();
+ List<KeyEvent> noKeys = new LinkedList<>();
+ List<KeyEvent> Adown = new LinkedList<>();
+ List<KeyEvent> AdownBdown = new LinkedList<>();
+ List<KeyEvent> AdownAup = new LinkedList<>();
- List<ControllerEvent> nothing = new LinkedList<ControllerEvent>();
+ List<ControllerEvent> nothing = new LinkedList<>();
- List<MouseState> buttonDown = new LinkedList<MouseState>();
- List<MouseState> noMice = new LinkedList<MouseState>();
+ List<MouseState> buttonDown = new LinkedList<>();
+ List<MouseState> noMice = new LinkedList<>();
List<InputState> inputStates;
InputState is;
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java
index dc13728..82a00a9 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java
@@ -91,8 +91,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(state2);
@@ -120,8 +120,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(state2);
@@ -154,8 +154,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(state2);
@@ -188,8 +188,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
@@ -223,8 +223,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(InputState.LOST_FOCUS);
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java
index 2fde296..9a62193 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java
@@ -3,19 +3,17 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.input.logical;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
import java.util.EnumMap;
import java.util.EnumSet;
+import org.junit.Assert;
import org.junit.Test;
import com.ardor3d.input.ButtonState;
@@ -29,8 +27,8 @@ import com.ardor3d.input.MouseState;
public class TestStandardConditions {
final KeyboardState ks = new KeyboardState(EnumSet.noneOf(Key.class), KeyEvent.NOTHING);
- final MouseState ms = new MouseState(0, 0, 0, 0, 0, MouseButton.makeMap(ButtonState.UP, ButtonState.UP,
- ButtonState.UP), null);
+ final MouseState ms = new MouseState(0, 0, 0, 0, 0,
+ MouseButton.makeMap(ButtonState.UP, ButtonState.UP, ButtonState.UP), null);
final ControllerState cs = new ControllerState();
InputState is1, is2, is3, is4, is5;
@@ -40,8 +38,8 @@ public class TestStandardConditions {
EnumMap<MouseButton, ButtonState> bothUp = MouseButton.makeMap(ButtonState.UP, ButtonState.UP, ButtonState.UP);
EnumMap<MouseButton, ButtonState> upDown = MouseButton.makeMap(ButtonState.UP, ButtonState.DOWN, ButtonState.UP);
EnumMap<MouseButton, ButtonState> downUp = MouseButton.makeMap(ButtonState.DOWN, ButtonState.UP, ButtonState.UP);
- EnumMap<MouseButton, ButtonState> bothDown = MouseButton
- .makeMap(ButtonState.DOWN, ButtonState.DOWN, ButtonState.UP);
+ EnumMap<MouseButton, ButtonState> bothDown = MouseButton.makeMap(ButtonState.DOWN, ButtonState.DOWN,
+ ButtonState.UP);
@Test
public void testKeyHeld1() throws Exception {
@@ -51,16 +49,16 @@ public class TestStandardConditions {
is2 = new InputState(aDown, ms, cs);
is3 = new InputState(bDown, ms, cs);
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
- assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
- assertTrue("not down", kh.apply(new TwoInputStates(is2, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
+ Assert.assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
+ Assert.assertTrue("not down", kh.apply(new TwoInputStates(is2, is2)));
- assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test(expected = NullPointerException.class)
@@ -76,16 +74,16 @@ public class TestStandardConditions {
is2 = new InputState(aDown, ms, cs);
is3 = new InputState(bDown, ms, cs);
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
- assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
+ Assert.assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
- assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test(expected = NullPointerException.class)
@@ -101,16 +99,16 @@ public class TestStandardConditions {
is2 = new InputState(aDown, ms, cs);
is3 = new InputState(bDown, ms, cs);
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is2)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
- assertTrue("not down", kh.apply(new TwoInputStates(is2, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
+ Assert.assertTrue("not down", kh.apply(new TwoInputStates(is2, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
- assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertFalse("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertFalse("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test(expected = NullPointerException.class)
@@ -133,17 +131,17 @@ public class TestStandardConditions {
is4 = new InputState(ks, ms4, cs);
is5 = new InputState(ks, ms5, cs);
- assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
- assertTrue("mm2", mm.apply(new TwoInputStates(is1, is2)));
- assertFalse("mm3", mm.apply(new TwoInputStates(is2, is3)));
- assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
- assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
- assertFalse("mm6", mm.apply(new TwoInputStates(is2, is2)));
-
- assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
+ Assert.assertTrue("mm2", mm.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("mm3", mm.apply(new TwoInputStates(is2, is3)));
+ Assert.assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
+ Assert.assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
+ Assert.assertFalse("mm6", mm.apply(new TwoInputStates(is2, is2)));
+
+ Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test
@@ -161,16 +159,16 @@ public class TestStandardConditions {
is4 = new InputState(ks, ms4, cs);
is5 = new InputState(ks, ms5, cs);
- assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
- assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
- assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
- assertFalse("mm4", mm.apply(new TwoInputStates(is3, is4)));
- assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
+ Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
+ Assert.assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
+ Assert.assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
+ Assert.assertFalse("mm4", mm.apply(new TwoInputStates(is3, is4)));
+ Assert.assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
- assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
+ Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
}
@Test
@@ -188,15 +186,15 @@ public class TestStandardConditions {
is4 = new InputState(ks, ms4, cs);
is5 = new InputState(ks, ms5, cs);
- assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
- assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
- assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
- assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
- assertFalse("mm5", mm.apply(new TwoInputStates(is4, is5)));
+ Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
+ Assert.assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
+ Assert.assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
+ Assert.assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
+ Assert.assertFalse("mm5", mm.apply(new TwoInputStates(is4, is5)));
- assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
+ Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
}
}
diff --git a/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs b/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs
index 19eadb6..941c850 100644
--- a/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-effects/.settings/org.eclipse.jdt.core.prefs
@@ -8,16 +8,16 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java
index c71b14f..0c034e2 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/SimpleBloomEffect.java
@@ -32,7 +32,7 @@ public class SimpleBloomEffect extends RenderEffect {
protected static final String RT_SECONDARY = "LDRBloomEffect.SECONDARY";
protected String shaderDirectory = "com/ardor3d/extension/effect/";
- protected final List<Spatial> _bloomItems = new ArrayList<Spatial>();
+ protected final List<Spatial> _bloomItems = new ArrayList<>();
protected float _downsampleRatio = .33f;
private final GLSLShaderObjectsState _extractionShader, _blurHorizShader, _blurVertShader;
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java
index 4d121cf..37fbe8e 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleAppearanceRamp.java
@@ -23,7 +23,7 @@ import com.ardor3d.util.export.Savable;
public class ParticleAppearanceRamp implements Savable {
- protected List<RampEntry> _entries = new ArrayList<RampEntry>();
+ protected List<RampEntry> _entries = new ArrayList<>();
public void addEntry(final RampEntry entry) {
_entries.add(entry);
@@ -163,7 +163,7 @@ public class ParticleAppearanceRamp implements Savable {
public void read(final InputCapsule capsule) throws IOException {
_entries = capsule.readSavableList("entries", null);
if (_entries == null) {
- _entries = new ArrayList<RampEntry>();
+ _entries = new ArrayList<>();
}
}
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java
index aaa5e6d..46f5a6b 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/ParticleController.java
@@ -387,7 +387,7 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem>
*/
public void addInfluence(final ParticleInfluence influence) {
if (influences == null) {
- influences = new ArrayList<ParticleInfluence>(1);
+ influences = new ArrayList<>(1);
}
influences.add(influence);
}
@@ -429,7 +429,7 @@ public class ParticleController extends ComplexSpatialController<ParticleSystem>
*/
public void addListener(final ParticleControllerListener listener) {
if (listeners == null) {
- listeners = new ArrayList<ParticleControllerListener>();
+ listeners = new ArrayList<>();
}
listeners.add(listener);
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java
index bfcc10a..52bf2a1 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/TexAnimation.java
@@ -21,7 +21,7 @@ import com.ardor3d.util.export.Savable;
public class TexAnimation implements Savable {
- protected List<AnimationEntry> _entries = new ArrayList<AnimationEntry>();
+ protected List<AnimationEntry> _entries = new ArrayList<>();
public void addEntry(final AnimationEntry entry) {
_entries.add(entry);
@@ -82,7 +82,7 @@ public class TexAnimation implements Savable {
public void read(final InputCapsule capsule) throws IOException {
_entries = capsule.readSavableList("entries", null);
if (_entries == null) {
- _entries = new ArrayList<AnimationEntry>();
+ _entries = new ArrayList<>();
}
}
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java
index 5a0481a..67d5df7 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/particle/WanderInfluence.java
@@ -28,13 +28,13 @@ public class WanderInfluence extends ParticleInfluence {
private double _wanderDistance = DEFAULT_DISTANCE;
private double _wanderJitter = DEFAULT_JITTER;
- private ArrayList<Vector3> _wanderTargets = new ArrayList<Vector3>(1);
+ private ArrayList<Vector3> _wanderTargets = new ArrayList<>(1);
private final Vector3 _workVect = new Vector3();
@Override
public void prepare(final ParticleSystem system) {
if (_wanderTargets.size() != system.getNumParticles()) {
- _wanderTargets = new ArrayList<Vector3>(system.getNumParticles());
+ _wanderTargets = new ArrayList<>(system.getNumParticles());
for (int x = system.getNumParticles(); --x >= 0;) {
_wanderTargets.add(new Vector3(system.getEmissionDirection()).normalizeLocal());
}
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java
index 98e9ba8..d758609 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/ProjectedGrid.java
@@ -84,7 +84,7 @@ public class ProjectedGrid extends Mesh {
private int nrUpdateThreads = 1;
private final ExecutorService executorService = Executors.newCachedThreadPool(new DeamonThreadFactory());
- private final Stack<Future<?>> futureStack = new Stack<Future<?>>();
+ private final Stack<Future<?>> futureStack = new Stack<>();
private final int connections[] = { 0, 1, 2, 3, 0, 4, 1, 5, 2, 6, 3, 7, 4, 5, 6, 7, };
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java
index 3605f0c..3f67f80 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/effect/water/WaterNode.java
@@ -70,8 +70,8 @@ public class WaterNode extends Node {
protected Texture2D textureRefract;
protected Texture2D textureDepth;
- protected List<Spatial> renderList = new ArrayList<Spatial>();
- protected List<Texture> texArray = new ArrayList<Texture>();
+ protected List<Spatial> renderList = new ArrayList<>();
+ protected List<Texture> texArray = new ArrayList<>();
protected Node skyBox;
protected GLSLShaderObjectsState waterShader;
diff --git a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java
index 7674ced..ad10ecb 100644
--- a/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java
+++ b/ardor3d-effects/src/main/java/com/ardor3d/extension/shadow/map/ParallelSplitShadowMapPass.java
@@ -99,10 +99,10 @@ public class ParallelSplitShadowMapPass extends Pass {
private Texture2D _shadowMapTexture[];
/** The list of occluding nodes. */
- private final List<Spatial> _occluderNodes = new ArrayList<Spatial>();
+ private final List<Spatial> _occluderNodes = new ArrayList<>();
/** Extra bounds receivers, when rendering shadows other ways than through overlay */
- private final List<Spatial> _boundsReceiver = new ArrayList<Spatial>();
+ private final List<Spatial> _boundsReceiver = new ArrayList<>();
// Various optimizations for rendering shadow maps...
/** Culling front faces when rendering shadow maps. */
diff --git a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java
index de74a4f..dfae9c5 100644
--- a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java
+++ b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java
@@ -3,15 +3,14 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.shadow.map;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
import com.ardor3d.bounding.BoundingBox;
@@ -53,7 +52,7 @@ public class TestPSSMCamera {
Assert.assertEquals(new Vector3(2, 2, 2), camera.getExtents());
- Assert.assertEquals(boxNear1, boxNear2);
- Assert.assertEquals(boxFar1, boxFar2);
+ Assert.assertEquals(boxNear1, boxNear2, 0.0);
+ Assert.assertEquals(boxFar1, boxFar2, 0.0);
}
}
diff --git a/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs b/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs
index 19eadb6..941c850 100644
--- a/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-examples/.settings/org.eclipse.jdt.core.prefs
@@ -8,16 +8,16 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java
index 83618d9..3f3076a 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleBase.java
@@ -417,8 +417,8 @@ public abstract class ExampleBase implements Runnable, Updater, Scene {
}
final URL dialogImageRef = dialogImage;
- final AtomicReference<PropertiesDialog> dialogRef = new AtomicReference<PropertiesDialog>();
- final Stack<Runnable> mainThreadTasks = new Stack<Runnable>();
+ final AtomicReference<PropertiesDialog> dialogRef = new AtomicReference<>();
+ final Stack<Runnable> mainThreadTasks = new Stack<>();
try {
if (EventQueue.isDispatchThread()) {
dialogRef.set(new PropertiesDialog(settings, dialogImageRef, mainThreadTasks));
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java
index ad65b8b..e55846a 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ExampleRunner.java
@@ -449,7 +449,7 @@ public class ExampleRunner extends JFrame {
final Class<?> clazz = (Class<?>) selected;
final boolean isWindows = System.getProperty("os.name").contains("Windows");
- final List<String> args = new ArrayList<String>();
+ final List<String> args = new ArrayList<>();
args.add(isWindows ? "javaw" : "java");
args.add("-Xmx" + maxHeapMemory + "M");
args.add("-cp");
@@ -509,10 +509,10 @@ public class ExampleRunner extends JFrame {
class ClassTreeModel implements TreeModel, SearchFilter {
private final EventListenerList listeners = new EventListenerList();
- private final LinkedHashMap<Package, Vector<Class<?>>> classes = new LinkedHashMap<Package, Vector<Class<?>>>();
+ private final LinkedHashMap<Package, Vector<Class<?>>> classes = new LinkedHashMap<>();
// the next two maps are for caching the status for the search filter
- private final HashMap<Class<?>, Boolean> classMatches = new HashMap<Class<?>, Boolean>();
- private final HashMap<Package, Boolean> packageMatches = new HashMap<Package, Boolean>();
+ private final HashMap<Class<?>, Boolean> classMatches = new HashMap<>();
+ private final HashMap<Package, Boolean> packageMatches = new HashMap<>();
private String root = "all examples";
private FileFilter classFileFilter;
private int size;
@@ -526,7 +526,7 @@ public class ExampleRunner extends JFrame {
@Override
public Object getChild(final Object parent, final int index) {
if (root.equals(parent)) {
- final Vector<Package> vec = new Vector<Package>(classes.keySet());
+ final Vector<Package> vec = new Vector<>(classes.keySet());
return vec.get(index);
}
final Vector<Class<?>> cl = classes.get(parent);
@@ -545,7 +545,7 @@ public class ExampleRunner extends JFrame {
@Override
public int getIndexOfChild(final Object parent, final Object child) {
if (root.equals(parent)) {
- final Vector<Package> vec = new Vector<Package>(classes.keySet());
+ final Vector<Package> vec = new Vector<>(classes.keySet());
return vec.indexOf(child);
}
final Vector<Class<?>> cl = classes.get(parent);
@@ -566,7 +566,7 @@ public class ExampleRunner extends JFrame {
classMatches.put(clazz, false);
Vector<Class<?>> cl = classes.get(clazz.getPackage());
if (cl == null) {
- cl = new Vector<Class<?>>();
+ cl = new Vector<>();
classes.put(clazz.getPackage(), cl);
}
size++;
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java
index 5124b44..a12274a 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java
@@ -266,9 +266,9 @@ public final class PropertiesDialog extends JDialog {
displayResCombo.addKeyListener(aListener);
samplesCombo = setUpSamplesChooser();
samplesCombo.addKeyListener(aListener);
- colorDepthCombo = new JComboBox<String>();
+ colorDepthCombo = new JComboBox<>();
colorDepthCombo.addKeyListener(aListener);
- displayFreqCombo = new JComboBox<String>();
+ displayFreqCombo = new JComboBox<>();
displayFreqCombo.addKeyListener(aListener);
fullscreenBox = new JCheckBox("Fullscreen?");
fullscreenBox.setSelected(source.isFullscreen());
@@ -413,7 +413,7 @@ public final class PropertiesDialog extends JDialog {
*/
private JComboBox<String> setUpResolutionChooser() {
final String[] res = getResolutions(modes);
- final JComboBox<String> resolutionBox = new JComboBox<String>(res);
+ final JComboBox<String> resolutionBox = new JComboBox<>(res);
resolutionBox.setSelectedItem(source.getWidth() + " x " + source.getHeight());
resolutionBox.addActionListener(new ActionListener() {
@@ -433,7 +433,7 @@ public final class PropertiesDialog extends JDialog {
* @return the list of renderers.
*/
private JComboBox<String> setUpRendererChooser() {
- final JComboBox<String> nameBox = new JComboBox<String>(new String[] { "JOGL 2" });
+ final JComboBox<String> nameBox = new JComboBox<>(new String[] { "JOGL 2" });
// final String old = source.getRenderer();
/*
* if (old != null) { if (old.startsWith("JOGL")) {
@@ -446,7 +446,7 @@ public final class PropertiesDialog extends JDialog {
}
private JComboBox<String> setUpSamplesChooser() {
- final JComboBox<String> nameBox = new JComboBox<String>(samples);
+ final JComboBox<String> nameBox = new JComboBox<>(samples);
nameBox.setSelectedItem(source.getRenderer());
return nameBox;
}
@@ -472,11 +472,11 @@ public final class PropertiesDialog extends JDialog {
// grab available depths
final String[] depths = getDepths(resolution, modes);
- colorDepthCombo.setModel(new DefaultComboBoxModel<String>(depths));
+ colorDepthCombo.setModel(new DefaultComboBoxModel<>(depths));
colorDepthCombo.setSelectedItem(colorDepth);
// grab available frequencies
final String[] freqs = getFrequencies(resolution, modes);
- displayFreqCombo.setModel(new DefaultComboBoxModel<String>(freqs));
+ displayFreqCombo.setModel(new DefaultComboBoxModel<>(freqs));
// Try to reset freq
displayFreqCombo.setSelectedItem(displayFreq);
}
@@ -488,12 +488,12 @@ public final class PropertiesDialog extends JDialog {
*/
private void updateResolutionChoices() {
if (!fullscreenBox.isSelected()) {
- displayResCombo.setModel(new DefaultComboBoxModel<String>(windowedResolutions));
- colorDepthCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "24 bpp", "16 bpp" }));
- displayFreqCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "n/a" }));
+ displayResCombo.setModel(new DefaultComboBoxModel<>(windowedResolutions));
+ colorDepthCombo.setModel(new DefaultComboBoxModel<>(new String[] { "24 bpp", "16 bpp" }));
+ displayFreqCombo.setModel(new DefaultComboBoxModel<>(new String[] { "n/a" }));
displayFreqCombo.setEnabled(false);
} else {
- displayResCombo.setModel(new DefaultComboBoxModel<String>(getResolutions(modes)));
+ displayResCombo.setModel(new DefaultComboBoxModel<>(getResolutions(modes)));
displayFreqCombo.setEnabled(true);
updateDisplayChoices();
}
@@ -526,7 +526,7 @@ public final class PropertiesDialog extends JDialog {
* Returns every unique resolution from an array of <code>DisplayMode</code>s.
*/
private static String[] getResolutions(final DisplayMode[] modes) {
- final List<String> resolutions = new ArrayList<String>(modes.length);
+ final List<String> resolutions = new ArrayList<>(modes.length);
for (int i = 0; i < modes.length; i++) {
final String res = modes[i].getWidth() + " x " + modes[i].getHeight();
if (!resolutions.contains(res)) {
@@ -543,7 +543,7 @@ public final class PropertiesDialog extends JDialog {
* Returns every possible bit depth for the given resolution.
*/
private static String[] getDepths(final String resolution, final DisplayMode[] modes) {
- final Set<String> depths = new TreeSet<String>(new Comparator<String>() {
+ final Set<String> depths = new TreeSet<>(new Comparator<String>() {
@Override
public int compare(final String o1, final String o2) {
// reverse order
@@ -573,7 +573,7 @@ public final class PropertiesDialog extends JDialog {
* Returns every possible refresh rate for the given resolution.
*/
private static String[] getFrequencies(final String resolution, final DisplayMode[] modes) {
- final List<String> freqs = new ArrayList<String>(4);
+ final List<String> freqs = new ArrayList<>(4);
for (int i = 0; i < modes.length; i++) {
final String res = modes[i].getWidth() + " x " + modes[i].getHeight();
final String freq = modes[i].getRefreshRate() + " Hz";
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java
index dbac6e3..b93c085 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesGameSettings.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -12,7 +12,6 @@ package com.ardor3d.example;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -26,7 +25,7 @@ import com.ardor3d.util.resource.ResourceLocatorTool;
/**
* <code>PropertiesGameSettings</code> handles loading and saving a properties file that defines the display settings. A
* property file is identified during creation of the object. The properties file should have the following format:
- *
+ *
* <PRE>
* &lt;CODE&gt;
* FREQ=60
@@ -106,7 +105,7 @@ public class PropertiesGameSettings {
/**
* Constructor creates the <code>PropertiesGameSettings</code> object for use.
- *
+ *
* @param personalFilename
* the properties file to use, read from filesystem. Must not be null.
* @param dfltsFilename
@@ -138,7 +137,7 @@ public class PropertiesGameSettings {
/**
* <code>get</code> takes an arbitrary string as a key and returns any value associated with it, null if none.
- *
+ *
* @param key
* the key to use for data retrieval.
* @return the string associated with the key, null if none.
@@ -154,7 +153,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -183,7 +182,7 @@ public class PropertiesGameSettings {
/**
* <code>getDepth</code> returns the depth as read from the properties file. If the properties file does not contain
* depth or was not read properly, the default depth is returned.
- *
+ *
* @return the depth determined by the properties file, or the default.
*/
public int getDepth() {
@@ -197,7 +196,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -218,7 +217,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -230,7 +229,7 @@ public class PropertiesGameSettings {
/**
* <code>getFrequency</code> returns the frequency of the monitor as read from the properties file. If the
* properties file does not contain frequency or was not read properly the default frequency is returned.
- *
+ *
* @return the frequency determined by the properties file, or the default.
*/
public int getFrequency() {
@@ -244,7 +243,7 @@ public class PropertiesGameSettings {
/**
* Legacy method.
- *
+ *
* @deprecated Use method isFullscreen instead.
* @see #isFullscreen()
*/
@@ -256,7 +255,7 @@ public class PropertiesGameSettings {
/**
* <code>getHeight</code> returns the height as read from the properties file. If the properties file does not
* contain height or was not read properly, the default height is returned.
- *
+ *
* @return the height determined by the properties file, or the default.
*/
public int getHeight() {
@@ -284,9 +283,9 @@ public class PropertiesGameSettings {
}
/**
- *
+ *
* <code>getRenderer</code> returns the requested rendering API, or the default.
- *
+ *
* @return the rendering API or the default.
*/
public String getRenderer() {
@@ -300,7 +299,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -311,7 +310,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -323,7 +322,7 @@ public class PropertiesGameSettings {
/**
* <code>getWidth</code> returns the width as read from the properties file. If the properties file does not contain
* width or was not read properly, the default width is returned.
- *
+ *
* @return the width determined by the properties file, or the default.
*/
public int getWidth() {
@@ -338,7 +337,7 @@ public class PropertiesGameSettings {
/**
* <code>isFullscreen</code> returns the fullscreen flag as read from the properties file. If the properties file
* does not contain the fullscreen flag or was not read properly, the default value is returned.
- *
+ *
* @return the fullscreen flag determined by the properties file, or the default.
*/
public boolean isFullscreen() {
@@ -352,7 +351,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -367,7 +366,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -378,7 +377,7 @@ public class PropertiesGameSettings {
/**
* If the properties file does not contain the setting or was not read properly, the default value is returned.
- *
+ *
* @throws InternalError
* in all cases
*/
@@ -390,35 +389,26 @@ public class PropertiesGameSettings {
/**
* <code>load</code> attempts to load the properties file defined during instantiation and put all properties in the
* table. If there is a problem loading or reading the file, false is returned. If all goes well, true is returned.
- *
+ *
* @return the success of the load, true indicated success and false indicates failure.
*/
public boolean load() {
- FileInputStream fin = null;
- try {
- fin = new FileInputStream(filename);
- } catch (final FileNotFoundException e) {
- logger.warning("Could not load properties. Creating a new one.");
- return false;
- }
-
- try {
+ try (final FileInputStream fin = new FileInputStream(filename)) {
prop.load(fin);
- fin.close();
+
+ // confirm that the properties file has all the data we need.
+ if (null == prop.getProperty("WIDTH") || null == prop.getProperty("HEIGHT")
+ || null == prop.getProperty("DEPTH") || null == prop.getProperty("FULLSCREEN")) {
+ logger.warning("Properties file not complete.");
+ return false;
+ }
+
+ logger.finer("Read properties");
+ return true;
} catch (final IOException e) {
logger.warning("Could not load properties. Creating a new one.");
return false;
}
-
- // confirm that the properties file has all the data we need.
- if (null == prop.getProperty("WIDTH") || null == prop.getProperty("HEIGHT")
- || null == prop.getProperty("DEPTH") || null == prop.getProperty("FULLSCREEN")) {
- logger.warning("Properties file not complete.");
- return false;
- }
-
- logger.finer("Read properties");
- return true;
}
/**
@@ -430,21 +420,20 @@ public class PropertiesGameSettings {
/**
* Persists current property mappings to designated file, overwriting if file already present.
- *
+ *
* @throws IOException
* for I/O failures
*/
public void save() throws IOException {
- final FileOutputStream fout = new FileOutputStream(filename);
- prop.store(fout, "Game Settings written by " + getClass().getName() + " at " + new java.util.Date());
-
- fout.close();
+ try (final FileOutputStream fout = new FileOutputStream(filename)) {
+ prop.store(fout, "Game Settings written by " + getClass().getName() + " at " + new java.util.Date());
+ }
logger.finer("Saved properties");
}
/**
* <code>save(int, int, int, int, boolean, String)</code> overwrites the properties file with the given parameters.
- *
+ *
* @param width
* the width of the resolution.
* @param height
@@ -595,7 +584,7 @@ public class PropertiesGameSettings {
/**
* Not implemented. Properties can not store an arbitrary Object in human-readable format. Use set(String, String)
* instead.
- *
+ *
* @see #set(String, String)
* @throws InternalError
* in all cases
@@ -648,7 +637,7 @@ public class PropertiesGameSettings {
/**
* save() method which throws only a RuntimeExceptin.
- *
+ *
* @throws RuntimeSetting
* for IO failure
* @see #save()
@@ -675,7 +664,7 @@ public class PropertiesGameSettings {
* AbstractGameSettings.assignDefaults(propfilename).
* <P/>
* Property file paths are relative to CLASSPATH element roots.
- *
+ *
* @param propFileName
* Properties file read as CLASSPATH resource. If you give null, no properties file will be loaded.
*/
@@ -745,8 +734,9 @@ public class PropertiesGameSettings {
try {
p.load(istream);
} catch (final IOException ioe) {
- logger.log(Level.WARNING, "Failed to load customizations from '" + propFileName
- + "'. Continuing without customizations.", ioe);
+ logger.log(Level.WARNING,
+ "Failed to load customizations from '" + propFileName + "'. Continuing without customizations.",
+ ioe);
return;
}
Integer i;
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java
index a4fcfa8..e45cddb 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/LineExample.java
@@ -107,7 +107,7 @@ public class LineExample extends ExampleBase {
private Line makeLine(final Grapher grapher, final double min, final double max, final double step) {
// This is just one way to make a line... You can also generate the FloatBuffer directly.
// Make an array to hold the Vector3 points that will make up our Line.
- final ArrayList<Vector3> vertexList = new ArrayList<Vector3>();
+ final ArrayList<Vector3> vertexList = new ArrayList<>();
// Step through our range [min, max] by our step amount.
for (double x = min; x <= max; x += step) {
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java
index 5bf947d..6934943 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/basic/MatrixLookAtExample.java
@@ -39,7 +39,7 @@ maxHeapMemory = 64)
public class MatrixLookAtExample extends ExampleBase {
private Mesh targetMesh;
- private final List<Mesh> boxes = new ArrayList<Mesh>();
+ private final List<Mesh> boxes = new ArrayList<>();
private double time = 0.0;
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java
index 5cad0b3..d14d43b 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtDesktopExample.java
@@ -61,7 +61,7 @@ public class JoglAwtDesktopExample {
static MouseCursor _cursor1;
static MouseCursor _cursor2;
- static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>();
+ static Map<Canvas, Boolean> _showCursor1 = new HashMap<>();
public static void main(final String[] args) throws Exception {
System.setProperty("ardor3d.useMultipleContexts", "true");
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java
index 287e0f9..ca3d78c 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglAwtExample.java
@@ -58,7 +58,7 @@ public class JoglAwtExample {
static MouseCursor _cursor1;
static MouseCursor _cursor2;
- static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>();
+ static Map<Canvas, Boolean> _showCursor1 = new HashMap<>();
public static void main(final String[] args) throws Exception {
System.setProperty("ardor3d.useMultipleContexts", "true");
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java
index dbd6ab4..c44fde3 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtAwtExample.java
@@ -61,7 +61,7 @@ public class JoglNewtAwtExample {
static MouseCursor _cursor1;
static MouseCursor _cursor2;
- static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>();
+ static Map<Canvas, Boolean> _showCursor1 = new HashMap<>();
public static void main(final String[] args) throws Exception {
System.setProperty("ardor3d.useMultipleContexts", "true");
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java
index 0aea9e5..ad3d9f6 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglNewtSwtExample.java
@@ -73,7 +73,7 @@ public class JoglNewtSwtExample {
static MouseCursor _cursor1;
static MouseCursor _cursor2;
- static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>();
+ static Map<Canvas, Boolean> _showCursor1 = new HashMap<>();
private static final Logger logger = Logger.getLogger(JoglNewtSwtExample.class.toString());
private static int i = 0;
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java
index b19d581..daab345 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwingExample.java
@@ -59,7 +59,7 @@ public class JoglSwingExample {
static MouseCursor _cursor1;
static MouseCursor _cursor2;
- static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>();
+ static Map<Canvas, Boolean> _showCursor1 = new HashMap<>();
public static void main(final String[] args) throws Exception {
System.setProperty("ardor3d.useMultipleContexts", "true");
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java
index ec7d852..7fb0519 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/canvas/JoglSwtExample.java
@@ -73,7 +73,7 @@ public class JoglSwtExample {
static MouseCursor _cursor1;
static MouseCursor _cursor2;
- static Map<Canvas, Boolean> _showCursor1 = new HashMap<Canvas, Boolean>();
+ static Map<Canvas, Boolean> _showCursor1 = new HashMap<>();
private static final Logger logger = Logger.getLogger(JoglSwtExample.class.toString());
private static int i = 0;
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java
index 05ab024..a7fa7ad 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/effect/ExtrusionExample.java
@@ -42,7 +42,7 @@ public class ExtrusionExample extends ExampleBase {
_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 0, 80));
_canvas.getCanvasRenderer().getCamera().lookAt(new Vector3(), Vector3.UNIT_Y);
- final List<ReadOnlyVector3> path = new ArrayList<ReadOnlyVector3>();
+ final List<ReadOnlyVector3> path = new ArrayList<>();
path.add(new Vector3(0, 0, 0));
path.add(new Vector3(0, 0, 4));
path.add(new Vector3(1, 0, 8));
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java
index 0912b12..24c8eba 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationDemoExample.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -59,17 +59,17 @@ import com.ardor3d.util.resource.URLResourceSource;
* Illustrates loading several animations from Collada and arranging them in an animation state machine.
*/
@Purpose(htmlDescriptionKey = "com.ardor3d.example.pipeline.AnimationDemoExample", //
-thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_AnimationDemoExample.jpg", //
-maxHeapMemory = 64)
+ thumbnailPath = "com/ardor3d/example/media/thumbnails/pipeline_AnimationDemoExample.jpg", //
+ maxHeapMemory = 64)
public class AnimationDemoExample extends ExampleBase {
private static final long MIN_STATE_TIME = 5000;
static AnimationDemoExample instance;
- private final List<AnimationManager> managers = new ArrayList<AnimationManager>();
- private final List<AnimationInfo> animInfo = new ArrayList<AnimationInfo>();
- private final Map<SkeletonPose, SkinnedMesh> poseToMesh = new IdentityHashMap<SkeletonPose, SkinnedMesh>();
+ private final List<AnimationManager> managers = new ArrayList<>();
+ private final List<AnimationInfo> animInfo = new ArrayList<>();
+ private final Map<SkeletonPose, SkinnedMesh> poseToMesh = new IdentityHashMap<>();
public static void main(final String[] args) {
ExampleBase.start(AnimationDemoExample.class);
@@ -148,8 +148,7 @@ public class AnimationDemoExample extends ExampleBase {
try {
gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationDemoExample.class,
"com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert"));
- gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(
- AnimationDemoExample.class,
+ gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationDemoExample.class,
"com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag"));
gpuShader.setUniform("texture", 0);
@@ -197,7 +196,7 @@ public class AnimationDemoExample extends ExampleBase {
return skeleton;
}
- private final Map<String, AnimationClip> animationStore = new HashMap<String, AnimationClip>();
+ private final Map<String, AnimationClip> animationStore = new HashMap<>();
private AnimationManager createAnimationManager(final SkeletonPose pose) {
// Make our manager
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java
index 960e9a3..7658797 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/ColladaExample.java
@@ -359,7 +359,7 @@ public class ColladaExample extends ExampleBase {
private List<File> findFiles(final File rootDir, final String name, List<File> fileList) {
if (fileList == null) {
- fileList = new ArrayList<File>();
+ fileList = new ArrayList<>();
}
final File[] files = rootDir.listFiles();
for (int i = 0; i < files.length; i++) {
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java
index 8a7ce03..0c82d57 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/Texture3DExample.java
@@ -78,7 +78,7 @@ public class Texture3DExample extends ExampleBase {
img.setHeight(32);
img.setDepth(32);
- final List<ByteBuffer> data = new ArrayList<ByteBuffer>();
+ final List<ByteBuffer> data = new ArrayList<>();
for (int i = 0; i < 32; i++) {
final Image colorImage = GeneratedImageFactory
.createSolidColorImage(ColorRGBA.randomColor(null), false, 32);
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java
index cc3353c..962771a 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExample.java
@@ -158,7 +158,7 @@ public class AtlasExample extends ExampleBase {
private void packIntoAtlas(final Spatial spatial) {
// Gather up all meshes to do the atlas operation on
- final List<Mesh> meshes = new ArrayList<Mesh>();
+ final List<Mesh> meshes = new ArrayList<>();
final Visitor visitor = new Visitor() {
@Override
public void visit(final Spatial spatial) {
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java
index 8e3ee11..831fc05 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/renderer/utils/atlas/AtlasExampleMultiTextured.java
@@ -159,7 +159,7 @@ public class AtlasExampleMultiTextured extends ExampleBase {
private void packIntoAtlas(final Spatial spatial) {
// Gather up all meshes to do the atlas operation on
- final List<Mesh> meshes = new ArrayList<Mesh>();
+ final List<Mesh> meshes = new ArrayList<>();
final Visitor visitor = new Visitor() {
@Override
public void visit(final Spatial spatial) {
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java
index 3f339fc..89ba8fd 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/terrain/ShadowedTerrainExample.java
@@ -1 +1 @@
-/** * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.example.terrain; import java.util.Random; import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; import com.ardor3d.bounding.BoundingBox; import com.ardor3d.example.ExampleBase; import com.ardor3d.example.Purpose; import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass; import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass.Filter; import com.ardor3d.extension.terrain.client.Terrain; import com.ardor3d.extension.terrain.client.TerrainBuilder; import com.ardor3d.extension.terrain.client.TerrainDataProvider; import com.ardor3d.extension.terrain.client.UrlInputSupplier; import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator; import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.input.Key; import com.ardor3d.input.logical.InputTrigger; import com.ardor3d.input.logical.KeyPressedCondition; import com.ardor3d.input.logical.TriggerAction; import com.ardor3d.input.logical.TwoInputStates; import com.ardor3d.intersection.PickingUtil; import com.ardor3d.intersection.PrimitivePickResults; import com.ardor3d.light.DirectionalLight; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Ray3; import com.ardor3d.math.Vector3; import com.ardor3d.renderer.Camera; import com.ardor3d.renderer.RenderContext; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.queue.RenderBucketType; import com.ardor3d.renderer.state.CullState; import com.ardor3d.renderer.state.FogState; import com.ardor3d.renderer.state.FogState.DensityFunction; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.hint.CullHint; import com.ardor3d.scenegraph.hint.LightCombineMode; import com.ardor3d.scenegraph.shape.Box; import com.ardor3d.scenegraph.shape.Sphere; import com.ardor3d.ui.text.BasicText; import com.ardor3d.util.GameTaskQueue; import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.resource.ResourceLocatorTool; /** * Example showing the Geometry Clipmap Terrain system combined with PSSM. (a bit experimental) Requires GLSL support. */ @Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ShadowedTerrainExample", // thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ShadowedTerrainExample.jpg", // maxHeapMemory = 128) public class ShadowedTerrainExample extends ExampleBase { /** The Constant logger. */ private static final Logger logger = Logger.getLogger(ShadowedTerrainExample.class.getName()); private boolean updateTerrain = true; private final float farPlane = 2500.0f; private Terrain terrain; private final Sphere sphere = new Sphere("sp", 16, 16, 1); private final Ray3 pickRay = new Ray3(); private boolean groundCamera = false; private Camera terrainCamera; /** Pssm shadow map pass. */ private ParallelSplitShadowMapPass _pssmPass; private DirectionalLight light; /** Temp vec for updating light pos. */ private final Vector3 lightPosition = new Vector3(10000, 10000, 10000); /** Text fields used to present info about the example. */ private final BasicText _exampleInfo[] = new BasicText[5]; public static void main(final String[] args) { ExampleBase.start(ShadowedTerrainExample.class); } @Override protected void updateExample(final ReadOnlyTimer timer) { final Camera camera = _canvas.getCanvasRenderer().getCamera(); // Make sure camera is above terrain final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ()); if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) { camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ())); } if (updateTerrain) { terrainCamera.set(camera); } // if we're picking... if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) { // Set up our pick ray pickRay.setOrigin(camera.getLocation()); pickRay.setDirection(camera.getDirection()); // do pick and move the sphere final PrimitivePickResults pickResults = new PrimitivePickResults(); pickResults.setCheckDistance(true); PickingUtil.findPick(_root, pickRay, pickResults); if (pickResults.getNumber() != 0) { final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord() .getIntersectionPoint(0); sphere.setTranslation(intersectionPoint); // XXX: maybe change the color of the ball for valid vs. invalid? } } } @Override protected void renderExample(final Renderer renderer) { // Lazy init since it needs the renderer... if (!_pssmPass.isInitialised()) { _pssmPass.init(renderer); _pssmPass.setPssmShader(terrain.getGeometryClipmapShader()); for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) { terrain.getClipTextureState().setTexture(_pssmPass.getShadowMapTexture(i), i + 1); } for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) { terrain.getGeometryClipmapShader().setUniform("shadowMap" + i, i + 1); } } // Update shadowmaps _pssmPass.updateShadowMaps(renderer); // Render scene and terrain with shadows super.renderExample(renderer); renderer.renderBuckets(); // Render overlay shadows for all objects except the terrain _pssmPass.renderShadowedScene(renderer); // TODO: this results in text etc also being shadowed, since they are drawn in the main render... } /** * Initialize pssm pass and scene. */ @Override protected void initExample() { _canvas.setTitle("Terrain Example"); final Camera cam = _canvas.getCanvasRenderer().getCamera(); cam.setLocation(new Vector3(440, 215, 275)); cam.lookAt(new Vector3(450, 140, 360), Vector3.UNIT_Y); cam.setFrustumPerspective(70.0, (float) cam.getWidth() / cam.getHeight(), 1.0f, farPlane); final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer(); final RenderContext renderContext = canvasRenderer.getRenderContext(); final Renderer renderer = canvasRenderer.getRenderer(); GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() { @Override public Void call() throws Exception { renderer.setBackgroundColor(ColorRGBA.GRAY); return null; } }); _controlHandle.setMoveSpeed(200); setupDefaultStates(); sphere.getSceneHints().setAllPickingHints(false); sphere.getSceneHints().setCullHint(CullHint.Always); _root.attachChild(sphere); try { // Keep a separate camera to be able to freeze terrain update terrainCamera = new Camera(cam); final int SIZE = 2048; final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f); raw.setHeightRange(0.2f); final float[] heightMap = raw.getHeightData(); final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3( 1, 300, 1)); terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build(); terrain.setPixelShader(new UrlInputSupplier(ResourceLocatorTool .getClassPathResource(ShadowedTerrainExample.class, "com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag"))); terrain.reloadShader(); _root.attachChild(terrain); } catch (final Exception e) { logger.log(Level.SEVERE, "Problem setting up terrain...", e); System.exit(1); } // Initialize PSSM shadows _pssmPass = new ParallelSplitShadowMapPass(light, 1024, 4); _pssmPass.setFiltering(Filter.Pcf); _pssmPass.setRenderShadowedScene(false); _pssmPass.setKeepMainShader(true); _pssmPass.setMaxShadowDistance(750); // XXX: Tune this // _pssmPass.setMinimumLightDistance(500); // XXX: Tune this _pssmPass.setUseSceneTexturing(false); _pssmPass.setUseObjectCullFace(false); // _pssmPass.setDrawDebug(true); final Node occluders = setupOccluders(); _root.attachChild(occluders); // TODO: could we use the shadow variable in scenehints here?? // Add objects that will get shadowed through overlay render _pssmPass.add(occluders); // Add terrain in as bounds receiver as well, since it's not in the overlay list _pssmPass.addBoundsReceiver(terrain); // Add our occluders that will produce shadows _pssmPass.addOccluder(occluders); // Setup labels for presenting example info. final Node textNodes = new Node("Text"); _root.attachChild(textNodes); textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho); textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off); final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2; for (int i = 0; i < _exampleInfo.length; i++) { _exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16); _exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0)); textNodes.attachChild(_exampleInfo[i]); } textNodes.updateGeometricState(0.0); updateText(); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { updateTerrain = !updateTerrain; updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(5); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(50); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(400); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(1000); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { groundCamera = !groundCamera; updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) { sphere.getSceneHints().setCullHint(CullHint.Always); } else if (sphere.getSceneHints().getCullHint() == CullHint.Always) { sphere.getSceneHints().setCullHint(CullHint.Dynamic); } updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug()); terrain.reloadShader(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.reloadShader(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2); terrain.reloadShader(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2); terrain.reloadShader(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.C), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _pssmPass.setUpdateMainCamera(!_pssmPass.isUpdateMainCamera()); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Camera cam = _canvas.getCanvasRenderer().getCamera(); System.out.println("camera location: " + cam.getLocation()); System.out.println("camera direction: " + cam.getDirection()); } })); } private Node setupOccluders() { final Node occluders = new Node("Occluders"); final Box box = new Box("Box", new Vector3(), 1, 40, 1); box.setModelBound(new BoundingBox()); box.setRandomColors(); final Random rand = new Random(1337); for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { final Mesh sm = box.makeCopy(true); sm.setTranslation(500 + rand.nextDouble() * 300 - 150, 20 + rand.nextDouble() * 5.0, 500 + rand.nextDouble() * 300 - 150); occluders.attachChild(sm); } } return occluders; } private void setupDefaultStates() { _lightState.detachAll(); light = new DirectionalLight(); light.setEnabled(true); light.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1)); light.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1)); light.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1)); light.setDirection(lightPosition.normalize(null).negateLocal()); _lightState.attach(light); _lightState.setEnabled(true); final CullState cs = new CullState(); cs.setEnabled(true); cs.setCullFace(CullState.Face.Back); _root.setRenderState(cs); final FogState fs = new FogState(); fs.setStart(farPlane / 2.0f); fs.setEnd(farPlane); fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f)); fs.setDensityFunction(DensityFunction.Linear); _root.setRenderState(fs); } /** * Update text information. */ private void updateText() { _exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h"); _exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic)); _exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly")); _exampleInfo[3].setText("[J] Regenerate heightmap/texture"); _exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain); } } \ No newline at end of file
+/** * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ package com.ardor3d.example.terrain; import java.util.Random; import java.util.concurrent.Callable; import java.util.logging.Level; import java.util.logging.Logger; import com.ardor3d.bounding.BoundingBox; import com.ardor3d.example.ExampleBase; import com.ardor3d.example.Purpose; import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass; import com.ardor3d.extension.shadow.map.ParallelSplitShadowMapPass.Filter; import com.ardor3d.extension.terrain.client.Terrain; import com.ardor3d.extension.terrain.client.TerrainBuilder; import com.ardor3d.extension.terrain.client.TerrainDataProvider; import com.ardor3d.extension.terrain.client.UrlInputSupplier; import com.ardor3d.extension.terrain.heightmap.MidPointHeightMapGenerator; import com.ardor3d.extension.terrain.providers.array.ArrayTerrainDataProvider; import com.ardor3d.framework.Canvas; import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.input.Key; import com.ardor3d.input.logical.InputTrigger; import com.ardor3d.input.logical.KeyPressedCondition; import com.ardor3d.input.logical.TriggerAction; import com.ardor3d.input.logical.TwoInputStates; import com.ardor3d.intersection.PickingUtil; import com.ardor3d.intersection.PrimitivePickResults; import com.ardor3d.light.DirectionalLight; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Ray3; import com.ardor3d.math.Vector3; import com.ardor3d.renderer.Camera; import com.ardor3d.renderer.RenderContext; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.queue.RenderBucketType; import com.ardor3d.renderer.state.CullState; import com.ardor3d.renderer.state.FogState; import com.ardor3d.renderer.state.FogState.DensityFunction; import com.ardor3d.scenegraph.Mesh; import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.hint.CullHint; import com.ardor3d.scenegraph.hint.LightCombineMode; import com.ardor3d.scenegraph.shape.Box; import com.ardor3d.scenegraph.shape.Sphere; import com.ardor3d.ui.text.BasicText; import com.ardor3d.util.GameTaskQueue; import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.resource.ResourceLocatorTool; /** * Example showing the Geometry Clipmap Terrain system combined with PSSM. (a bit experimental) Requires GLSL support. */ @Purpose(htmlDescriptionKey = "com.ardor3d.example.terrain.ShadowedTerrainExample", // thumbnailPath = "com/ardor3d/example/media/thumbnails/terrain_ShadowedTerrainExample.jpg", // maxHeapMemory = 128) public class ShadowedTerrainExample extends ExampleBase { /** The Constant logger. */ private static final Logger logger = Logger.getLogger(ShadowedTerrainExample.class.getName()); private boolean updateTerrain = true; private final float farPlane = 2500.0f; private Terrain terrain; private final Sphere sphere = new Sphere("sp", 16, 16, 1); private final Ray3 pickRay = new Ray3(); private boolean groundCamera = false; private Camera terrainCamera; /** Pssm shadow map pass. */ private ParallelSplitShadowMapPass _pssmPass; private DirectionalLight directionalLight; /** Temp vec for updating light pos. */ private final Vector3 lightPosition = new Vector3(10000, 10000, 10000); /** Text fields used to present info about the example. */ private final BasicText _exampleInfo[] = new BasicText[5]; public static void main(final String[] args) { ExampleBase.start(ShadowedTerrainExample.class); } @Override protected void updateExample(final ReadOnlyTimer timer) { final Camera camera = _canvas.getCanvasRenderer().getCamera(); // Make sure camera is above terrain final double height = terrain.getHeightAt(camera.getLocation().getX(), camera.getLocation().getZ()); if (height > -Float.MAX_VALUE && (groundCamera || camera.getLocation().getY() < height + 3)) { camera.setLocation(new Vector3(camera.getLocation().getX(), height + 3, camera.getLocation().getZ())); } if (updateTerrain) { terrainCamera.set(camera); } // if we're picking... if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) { // Set up our pick ray pickRay.setOrigin(camera.getLocation()); pickRay.setDirection(camera.getDirection()); // do pick and move the sphere final PrimitivePickResults pickResults = new PrimitivePickResults(); pickResults.setCheckDistance(true); PickingUtil.findPick(_root, pickRay, pickResults); if (pickResults.getNumber() != 0) { final Vector3 intersectionPoint = pickResults.getPickData(0).getIntersectionRecord() .getIntersectionPoint(0); sphere.setTranslation(intersectionPoint); // XXX: maybe change the color of the ball for valid vs. invalid? } } } @Override protected void renderExample(final Renderer renderer) { // Lazy init since it needs the renderer... if (!_pssmPass.isInitialised()) { _pssmPass.init(renderer); _pssmPass.setPssmShader(terrain.getGeometryClipmapShader()); for (int i = 0; i < _pssmPass.getNumOfSplits(); i++) { terrain.getClipTextureState().setTexture(_pssmPass.getShadowMapTexture(i), i + 1); } for (int i = 0; i < ParallelSplitShadowMapPass._MAX_SPLITS; i++) { terrain.getGeometryClipmapShader().setUniform("shadowMap" + i, i + 1); } } // Update shadowmaps _pssmPass.updateShadowMaps(renderer); // Render scene and terrain with shadows super.renderExample(renderer); renderer.renderBuckets(); // Render overlay shadows for all objects except the terrain _pssmPass.renderShadowedScene(renderer); // TODO: this results in text etc also being shadowed, since they are drawn in the main render... } /** * Initialize pssm pass and scene. */ @Override protected void initExample() { _canvas.setTitle("Terrain Example"); final Camera cam = _canvas.getCanvasRenderer().getCamera(); cam.setLocation(new Vector3(440, 215, 275)); cam.lookAt(new Vector3(450, 140, 360), Vector3.UNIT_Y); cam.setFrustumPerspective(70.0, (float) cam.getWidth() / cam.getHeight(), 1.0f, farPlane); final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer(); final RenderContext renderContext = canvasRenderer.getRenderContext(); final Renderer renderer = canvasRenderer.getRenderer(); GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() { @Override public Void call() throws Exception { renderer.setBackgroundColor(ColorRGBA.GRAY); return null; } }); _controlHandle.setMoveSpeed(200); setupDefaultStates(); sphere.getSceneHints().setAllPickingHints(false); sphere.getSceneHints().setCullHint(CullHint.Always); _root.attachChild(sphere); try { // Keep a separate camera to be able to freeze terrain update terrainCamera = new Camera(cam); final int SIZE = 2048; final MidPointHeightMapGenerator raw = new MidPointHeightMapGenerator(SIZE, 0.6f); raw.setHeightRange(0.2f); final float[] heightMap = raw.getHeightData(); final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3( 1, 300, 1)); terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build(); terrain.setPixelShader(new UrlInputSupplier(ResourceLocatorTool .getClassPathResource(ShadowedTerrainExample.class, "com/ardor3d/extension/terrain/shadowedGeometryClipmapShaderPCF.frag"))); terrain.reloadShader(); _root.attachChild(terrain); } catch (final Exception e) { logger.log(Level.SEVERE, "Problem setting up terrain...", e); System.exit(1); } // Initialize PSSM shadows _pssmPass = new ParallelSplitShadowMapPass(directionalLight, 1024, 4); _pssmPass.setFiltering(Filter.Pcf); _pssmPass.setRenderShadowedScene(false); _pssmPass.setKeepMainShader(true); _pssmPass.setMaxShadowDistance(750); // XXX: Tune this // _pssmPass.setMinimumLightDistance(500); // XXX: Tune this _pssmPass.setUseSceneTexturing(false); _pssmPass.setUseObjectCullFace(false); // _pssmPass.setDrawDebug(true); final Node occluders = setupOccluders(); _root.attachChild(occluders); // TODO: could we use the shadow variable in scenehints here?? // Add objects that will get shadowed through overlay render _pssmPass.add(occluders); // Add terrain in as bounds receiver as well, since it's not in the overlay list _pssmPass.addBoundsReceiver(terrain); // Add our occluders that will produce shadows _pssmPass.addOccluder(occluders); // Setup labels for presenting example info. final Node textNodes = new Node("Text"); _root.attachChild(textNodes); textNodes.getSceneHints().setRenderBucketType(RenderBucketType.Ortho); textNodes.getSceneHints().setLightCombineMode(LightCombineMode.Off); final double infoStartY = _canvas.getCanvasRenderer().getCamera().getHeight() / 2; for (int i = 0; i < _exampleInfo.length; i++) { _exampleInfo[i] = BasicText.createDefaultTextLabel("Text", "", 16); _exampleInfo[i].setTranslation(new Vector3(10, infoStartY - i * 20, 0)); textNodes.attachChild(_exampleInfo[i]); } textNodes.updateGeometricState(0.0); updateText(); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.U), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { updateTerrain = !updateTerrain; updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(5); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(50); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.THREE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(400); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FOUR), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _controlHandle.setMoveSpeed(1000); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { groundCamera = !groundCamera; updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { if (sphere.getSceneHints().getCullHint() == CullHint.Dynamic) { sphere.getSceneHints().setCullHint(CullHint.Always); } else if (sphere.getSceneHints().getCullHint() == CullHint.Always) { sphere.getSceneHints().setCullHint(CullHint.Dynamic); } updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.getTextureClipmap().setShowDebug(!terrain.getTextureClipmap().isShowDebug()); terrain.reloadShader(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.G), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.reloadShader(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.FIVE), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() / 2); terrain.reloadShader(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.SIX), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { terrain.getTextureClipmap().setScale(terrain.getTextureClipmap().getScale() * 2); terrain.reloadShader(); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.C), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { _pssmPass.setUpdateMainCamera(!_pssmPass.isUpdateMainCamera()); updateText(); } })); _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ZERO), new TriggerAction() { @Override public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) { final Camera cam = _canvas.getCanvasRenderer().getCamera(); System.out.println("camera location: " + cam.getLocation()); System.out.println("camera direction: " + cam.getDirection()); } })); } private Node setupOccluders() { final Node occluders = new Node("Occluders"); final Box box = new Box("Box", new Vector3(), 1, 40, 1); box.setModelBound(new BoundingBox()); box.setRandomColors(); final Random rand = new Random(1337); for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { final Mesh sm = box.makeCopy(true); sm.setTranslation(500 + rand.nextDouble() * 300 - 150, 20 + rand.nextDouble() * 5.0, 500 + rand.nextDouble() * 300 - 150); occluders.attachChild(sm); } } return occluders; } private void setupDefaultStates() { _lightState.detachAll(); directionalLight = new DirectionalLight(); directionalLight.setEnabled(true); directionalLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1)); directionalLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1)); directionalLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1)); directionalLight.setDirection(lightPosition.normalize(null).negateLocal()); _lightState.attach(directionalLight); _lightState.setEnabled(true); final CullState cs = new CullState(); cs.setEnabled(true); cs.setCullFace(CullState.Face.Back); _root.setRenderState(cs); final FogState fs = new FogState(); fs.setStart(farPlane / 2.0f); fs.setEnd(farPlane); fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f)); fs.setDensityFunction(DensityFunction.Linear); _root.setRenderState(fs); } /** * Update text information. */ private void updateText() { _exampleInfo[0].setText("[1/2/3] Moving speed: " + _controlHandle.getMoveSpeed() * 3.6 + " km/h"); _exampleInfo[1].setText("[P] Do picking: " + (sphere.getSceneHints().getCullHint() == CullHint.Dynamic)); _exampleInfo[2].setText("[SPACE] Toggle fly/walk: " + (groundCamera ? "walk" : "fly")); _exampleInfo[3].setText("[J] Regenerate heightmap/texture"); _exampleInfo[4].setText("[U] Freeze terrain(debug): " + !updateTerrain); } } \ No newline at end of file
diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java
index 73be066..3947b1e 100644
--- a/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java
+++ b/ardor3d-examples/src/main/java/com/ardor3d/example/ui/BMFontLoader.java
@@ -25,7 +25,7 @@ public class BMFontLoader {
static Logger logger = Logger.getLogger(BMFontLoader.class.getName());
static BMFontLoader s_instance = null;
- final ArrayList<BMFont> _fontList = new ArrayList<BMFont>();
+ final ArrayList<BMFont> _fontList = new ArrayList<>();
public static List<BMFont> allFonts() {
return instance()._fontList;
diff --git a/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs b/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs
index 2d16bb6..f545444 100644
--- a/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-extras/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java
index 4bf47b5..3511b28 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TexturePacker.java
@@ -69,15 +69,15 @@ public class TexturePacker {
private final List<AtlasPacker> packers;
private final List<ByteBuffer> dataBuffers;
- private final List<Texture> textures = new ArrayList<Texture>();
+ private final List<Texture> textures = new ArrayList<>();
public TexturePacker(final int atlasWidth, final int atlasHeight) {
this.atlasWidth = atlasWidth;
this.atlasHeight = atlasHeight;
- cachedAtlases = new HashMap<TextureParameter, List<TextureParameter>>();
- packers = new ArrayList<AtlasPacker>();
- dataBuffers = new ArrayList<ByteBuffer>();
+ cachedAtlases = new HashMap<>();
+ packers = new ArrayList<>();
+ dataBuffers = new ArrayList<>();
addPacker();
}
@@ -168,7 +168,7 @@ public class TexturePacker {
return;
}
- list = new ArrayList<TextureParameter>();
+ list = new ArrayList<>();
cachedAtlases.put(parameterObject, list);
list.add(parameterObject);
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java
index 5679195..bc00ee3 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/atlas/TextureParameter.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -11,6 +11,7 @@
package com.ardor3d.extension.atlas;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.image.Texture;
import com.ardor3d.renderer.state.RenderState;
@@ -88,10 +89,7 @@ public class TextureParameter {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (textureKey == null ? 0 : textureKey.hashCode());
- return result;
+ return Objects.hashCode(textureKey);
}
@Override
@@ -106,14 +104,7 @@ public class TextureParameter {
return false;
}
final TextureParameter other = (TextureParameter) obj;
- if (textureKey == null) {
- if (other.textureKey != null) {
- return false;
- }
- } else if (!textureKey.equals(other.textureKey)) {
- return false;
- }
- return true;
+ return Objects.equals(textureKey, other.textureKey);
}
public int getTargetTextureIndex() {
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java
index 23931c9..354ceeb 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -35,7 +35,7 @@ public class InteractManager {
/**
* List of widgets currently managed by this manager.
*/
- protected final List<AbstractInteractWidget> _widgets = new ArrayList<AbstractInteractWidget>();
+ protected final List<AbstractInteractWidget> _widgets = new ArrayList<>();
/**
* The logical layer used by this manager to receive input events prior to forwarding them to the scene.
@@ -66,7 +66,7 @@ public class InteractManager {
/**
* List of filters to modify state prior to applying to a Spatial target.
*/
- protected List<UpdateFilter> _filters = new ArrayList<UpdateFilter>();
+ protected List<UpdateFilter> _filters = new ArrayList<>();
public InteractManager() {
setupLogicalLayer();
@@ -143,7 +143,7 @@ public class InteractManager {
/**
* Convenience method for setting up the manager's connection to the Ardor3D input system, along with a forwarding
* address for input events that the manager does not care about.
- *
+ *
* @param canvas
* the canvas to register with
* @param physicalLayer
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java
index 0e97fac..654cf19 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java
@@ -51,7 +51,7 @@ public abstract class AbstractInteractWidget {
/**
* List of filters to modify state after applying input.
*/
- protected List<UpdateFilter> _filters = new ArrayList<UpdateFilter>();
+ protected List<UpdateFilter> _filters = new ArrayList<>();
public AbstractInteractWidget() {
_results.setCheckDistance(true);
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java
index 00d64ac..e94451e 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/CompoundInteractWidget.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -38,13 +38,13 @@ public class CompoundInteractWidget extends AbstractInteractWidget {
public static double MIN_SCALE = 0.000001;
- protected Map<String, AbstractInteractWidget> _widgets = new HashMap<String, AbstractInteractWidget>();
+ protected Map<String, AbstractInteractWidget> _widgets = new HashMap<>();
protected AbstractInteractWidget _lastInputWidget = null;
- protected InteractMatrix _interactMatrix;
-
public CompoundInteractWidget() {
+ super();
+ _interactMatrix = null;
_handle = new Node("handleRoot");
}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java
index 0fb6fa6..d708264 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/InteractArrow.java
@@ -29,7 +29,7 @@ public class InteractArrow extends Arrow {
protected double _lengthGap = 0;
protected double _tipGap = 0;
- protected static final Quaternion rotator = new Quaternion().applyRotationX(MathUtils.HALF_PI);
+ protected static final Quaternion ROTATOR = new Quaternion().applyRotationX(MathUtils.HALF_PI);
public InteractArrow() {}
@@ -66,8 +66,8 @@ public class InteractArrow extends Arrow {
final double tipLength = _length / 2.0;
final Pyramid tip = new Pyramid("tip", 2 * _width, tipLength);
tip.getMeshData().translatePoints(0, _tipGap + _length + 0.5 * tipLength, 0);
- tip.getMeshData().rotatePoints(InteractArrow.rotator);
- tip.getMeshData().rotateNormals(InteractArrow.rotator);
+ tip.getMeshData().rotatePoints(InteractArrow.ROTATOR);
+ tip.getMeshData().rotateNormals(InteractArrow.ROTATOR);
attachChild(tip);
tip.updateModelBound();
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java
index 5a6cda9..46ee25e 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/MoveWidget.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -49,8 +49,6 @@ public class MoveWidget extends AbstractInteractWidget {
protected ColorRGBA _yColor = new ColorRGBA(0, 1, 0, .65f);
protected ColorRGBA _zColor = new ColorRGBA(0, 0, 1, .65f);
- protected InteractMatrix _interactMatrix = InteractMatrix.World;
-
public MoveWidget() {
_handle = new Node("moveHandle");
@@ -277,16 +275,6 @@ public class MoveWidget extends AbstractInteractWidget {
return _calcVec3D.subtractLocal(_calcVec3C);
}
- @Override
- public void setInteractMatrix(final InteractMatrix matrix) {
- _interactMatrix = matrix;
- }
-
- @Override
- public InteractMatrix getInteractMatrix() {
- return _interactMatrix;
- }
-
public InteractArrow getXArrow() {
return _xArrow;
}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java
index 2a4be59..f4bcf27 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2DataStore.java
@@ -21,9 +21,9 @@ public class Md2DataStore {
private final Mesh _mainMesh;
private final KeyframeController<Mesh> _controller;
- private final List<String> _frameNames = new ArrayList<String>();
+ private final List<String> _frameNames = new ArrayList<>();
- private final List<String> _skinNames = new ArrayList<String>();
+ private final List<String> _skinNames = new ArrayList<>();
public Md2DataStore(final Mesh mainMesh, final KeyframeController<Mesh> controller) {
_mainMesh = mainMesh;
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java
index 6f0e762..7f8c3a6 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md2/Md2Importer.java
@@ -159,8 +159,8 @@ public class Md2Importer {
bis.seek(header.offsetGlCommands);
int length, absLength;
Md2GlCommand cmd;
- final List<Integer> fanIndices = new ArrayList<Integer>();
- final List<Integer> stripIndices = new ArrayList<Integer>();
+ final List<Integer> fanIndices = new ArrayList<>();
+ final List<Integer> stripIndices = new ArrayList<>();
for (int i = 0; i < header.numGlCommands; i++) {
length = bis.readInt();
if (length == 0) {
@@ -299,7 +299,7 @@ public class Md2Importer {
mesh.setName(resource.getName());
// Add controller
- final KeyframeController<Mesh> controller = new KeyframeController<Mesh>();
+ final KeyframeController<Mesh> controller = new KeyframeController<>();
mesh.addController(controller);
controller.setMorphingMesh(mesh);
controller.setInterpTex(false);
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java
index 3ca598a..82573c5 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3DataStore.java
@@ -19,9 +19,9 @@ public class Md3DataStore {
private final Node _mainNode;
- private final List<String> _frameNames = new ArrayList<String>();
+ private final List<String> _frameNames = new ArrayList<>();
- private final List<String> _skinNames = new ArrayList<String>();
+ private final List<String> _skinNames = new ArrayList<>();
public Md3DataStore(final Node mainNode) {
super();
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java
index 5d64642..8ced03c 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/md3/Md3Importer.java
@@ -168,7 +168,7 @@ public class Md3Importer {
final Node node = new Node(header._name);
for (int i = 0; i < header._numSurfaces; i++) {
final Md3Surface surface = surfaces[i];
- final KeyframeController<Mesh> controller = new KeyframeController<Mesh>();
+ final KeyframeController<Mesh> controller = new KeyframeController<>();
final Mesh morphingMesh = new Mesh(surface._name);
morphingMesh.getMeshData().setIndexBuffer(BufferUtils.createIntBuffer(surface._triIndexes));
morphingMesh.getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(surface._verts[0]));
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java
index bad7afe..a2b9463 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjDataStore.java
@@ -16,10 +16,10 @@ import java.util.List;
import com.ardor3d.math.Vector3;
public class ObjDataStore {
- private final List<Vector3> _vertices = new ArrayList<Vector3>();
- private final List<Vector3> _normals = new ArrayList<Vector3>();
- private final List<Vector3> _generatedNormals = new ArrayList<Vector3>();
- private final List<Vector3> _uvs = new ArrayList<Vector3>();
+ private final List<Vector3> _vertices = new ArrayList<>();
+ private final List<Vector3> _normals = new ArrayList<>();
+ private final List<Vector3> _generatedNormals = new ArrayList<>();
+ private final List<Vector3> _uvs = new ArrayList<>();
public List<Vector3> getVertices() {
return _vertices;
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java
index 1d5e9e3..860e4f6 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjExporter.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -18,6 +18,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
import java.util.logging.Logger;
import com.ardor3d.extension.model.util.KeyframeController;
@@ -36,7 +37,7 @@ import com.ardor3d.util.TextureKey;
* WaveFront OBJ exporter. It supports only the meshes. Several meshes can be exported into the same OBJ file. Only a
* few kinds of primitives are supported. N.B: If the texture is flipped in Ardor3D, you will have to flip it manually
* when loading the resulting OBJ file.
- *
+ *
* @author Julien Gouesse
*/
public class ObjExporter {
@@ -49,7 +50,7 @@ public class ObjExporter {
/**
* Save a mesh to a single WaveFront OBJ file and a MTL file
- *
+ *
* @param mesh
* mesh to export
* @param objFile
@@ -63,7 +64,7 @@ public class ObjExporter {
save(mesh, objFile, mtlFile, false, 0, true, null, null);
} else {
final KeyframeController<?> controller = (KeyframeController<?>) mesh.getController(0);
- final ArrayList<Mesh> meshList = new ArrayList<Mesh>();
+ final ArrayList<Mesh> meshList = new ArrayList<>();
for (final KeyframeController.PointInTime pit : controller._keyframes) {
if (pit != null && pit._newShape != null) {
meshList.add(pit._newShape);
@@ -75,7 +76,7 @@ public class ObjExporter {
/**
* Save several meshes to a single WaveFront OBJ file and a MTL file
- *
+ *
* @param meshList
* meshes to export
* @param objFile
@@ -91,7 +92,7 @@ public class ObjExporter {
if (!meshList.isEmpty()) {
int firstVertexIndex = 0;
boolean firstFiles = true;
- final List<ObjMaterial> materialList = new ArrayList<ObjMaterial>();
+ final List<ObjMaterial> materialList = new ArrayList<>();
for (final Mesh mesh : meshList) {
if (mesh != null) {
if (mesh.getControllerCount() == 0 || !(mesh.getController(0) instanceof KeyframeController)) {
@@ -101,7 +102,7 @@ public class ObjExporter {
firstVertexIndex += mesh.getMeshData().getVertexCount();
} else {
final KeyframeController<?> controller = (KeyframeController<?>) mesh.getController(0);
- final ArrayList<Mesh> subMeshList = new ArrayList<Mesh>();
+ final ArrayList<Mesh> subMeshList = new ArrayList<>();
for (final KeyframeController.PointInTime pit : controller._keyframes) {
if (pit != null && pit._newShape != null) {
subMeshList.add(pit._newShape);
@@ -122,7 +123,7 @@ public class ObjExporter {
/**
* Save a mesh to the given files.
- *
+ *
* @param mesh
* mesh to export
* @param objFile
@@ -155,207 +156,191 @@ public class ObjExporter {
parentDirectory.mkdirs();
}
}
- PrintWriter objPw = null, mtlPw = null;
try {
// fills the MTL file
final String mtlName;
if (mtlFile != null) {
- final FileOutputStream mtlOs = new FileOutputStream(mtlFile, append);
- mtlPw = new PrintWriter(new BufferedOutputStream(mtlOs));
- // writes some comments
- if (firstFiles) {
- mtlPw.println("# Ardor3D 1.0 MTL file");
- }
- final ObjMaterial currentMtl = new ObjMaterial(null);
- final MaterialState mtlState = (MaterialState) mesh.getLocalRenderState(StateType.Material);
- if (mtlState != null) {
- final ReadOnlyColorRGBA ambientColor = mtlState.getAmbient();
- if (ambientColor != null) {
- currentMtl.d = ambientColor.getAlpha();
- currentMtl.Ka = new float[] { ambientColor.getRed(), ambientColor.getGreen(),
- ambientColor.getBlue(), ambientColor.getAlpha() };
+ try (final FileOutputStream mtlOs = new FileOutputStream(mtlFile, append);
+ final PrintWriter mtlPw = new PrintWriter(new BufferedOutputStream(mtlOs))) {
+ // writes some comments
+ if (firstFiles) {
+ mtlPw.println("# Ardor3D 1.0 MTL file");
}
- final ReadOnlyColorRGBA diffuseColor = mtlState.getDiffuse();
- if (diffuseColor != null) {
- currentMtl.Kd = new float[] { diffuseColor.getRed(), diffuseColor.getGreen(),
- diffuseColor.getBlue(), diffuseColor.getAlpha() };
- }
- final ReadOnlyColorRGBA specularColor = mtlState.getSpecular();
- if (specularColor != null) {
- currentMtl.Ks = new float[] { specularColor.getRed(), specularColor.getGreen(),
- specularColor.getBlue(), specularColor.getAlpha() };
- }
- currentMtl.Ns = mtlState.getShininess();
- }
- if (customTextureName == null) {
- currentMtl.textureName = getLocalMeshTextureName(mesh);
- } else {
- currentMtl.textureName = customTextureName;
- }
- if (mesh.getSceneHints().getLightCombineMode() == LightCombineMode.Off) {
- // Color on and Ambient off
- currentMtl.illumType = 0;
- } else {
- // Color on and Ambient on
- currentMtl.illumType = 1;
- }
- ObjMaterial sameObjMtl = null;
- if (materialList != null && !materialList.isEmpty()) {
- for (final ObjMaterial mtl : materialList) {
- if (mtl.illumType == currentMtl.illumType && mtl.Ns == currentMtl.Ns
- && mtl.forceBlend == currentMtl.forceBlend && mtl.d == currentMtl.d
- && Arrays.equals(mtl.Ka, currentMtl.Ka) && Arrays.equals(mtl.Kd, currentMtl.Kd)
- && Arrays.equals(mtl.Ks, currentMtl.Ks)
- && equals(mtl.textureName, currentMtl.textureName)) {
- sameObjMtl = mtl;
- break;
+ final ObjMaterial currentMtl = new ObjMaterial(null);
+ final MaterialState mtlState = (MaterialState) mesh.getLocalRenderState(StateType.Material);
+ if (mtlState != null) {
+ final ReadOnlyColorRGBA ambientColor = mtlState.getAmbient();
+ if (ambientColor != null) {
+ currentMtl.d = ambientColor.getAlpha();
+ currentMtl.Ka = new float[] { ambientColor.getRed(), ambientColor.getGreen(),
+ ambientColor.getBlue(), ambientColor.getAlpha() };
+ }
+ final ReadOnlyColorRGBA diffuseColor = mtlState.getDiffuse();
+ if (diffuseColor != null) {
+ currentMtl.Kd = new float[] { diffuseColor.getRed(), diffuseColor.getGreen(),
+ diffuseColor.getBlue(), diffuseColor.getAlpha() };
+ }
+ final ReadOnlyColorRGBA specularColor = mtlState.getSpecular();
+ if (specularColor != null) {
+ currentMtl.Ks = new float[] { specularColor.getRed(), specularColor.getGreen(),
+ specularColor.getBlue(), specularColor.getAlpha() };
}
+ currentMtl.Ns = mtlState.getShininess();
}
- }
- if (sameObjMtl == null) {
- // writes the new material library
- mtlName = mtlFile.getName().trim().replaceAll(" ", "") + "_"
- + (materialList == null ? 1 : materialList.size() + 1);
- if (materialList != null) {
- final ObjMaterial mtl = new ObjMaterial(mtlName);
- mtl.illumType = currentMtl.illumType;
- mtl.textureName = currentMtl.textureName;
- materialList.add(mtl);
+ if (customTextureName == null) {
+ currentMtl.textureName = getLocalMeshTextureName(mesh);
+ } else {
+ currentMtl.textureName = customTextureName;
}
- mtlPw.println("newmtl " + mtlName);
- if (currentMtl.Ns != -1) {
- mtlPw.println("Ns " + currentMtl.Ns);
+ if (mesh.getSceneHints().getLightCombineMode() == LightCombineMode.Off) {
+ // Color on and Ambient off
+ currentMtl.illumType = 0;
+ } else {
+ // Color on and Ambient on
+ currentMtl.illumType = 1;
}
- if (currentMtl.Ka != null) {
- mtlPw.print("Ka");
- for (final float KaCoef : currentMtl.Ka) {
- mtlPw.print(" " + KaCoef);
+ ObjMaterial sameObjMtl = null;
+ if (materialList != null && !materialList.isEmpty()) {
+ for (final ObjMaterial mtl : materialList) {
+ if (mtl.illumType == currentMtl.illumType && mtl.Ns == currentMtl.Ns
+ && mtl.forceBlend == currentMtl.forceBlend && mtl.d == currentMtl.d
+ && Arrays.equals(mtl.Ka, currentMtl.Ka) && Arrays.equals(mtl.Kd, currentMtl.Kd)
+ && Arrays.equals(mtl.Ks, currentMtl.Ks)
+ && Objects.equals(mtl.textureName, currentMtl.textureName)) {
+ sameObjMtl = mtl;
+ break;
+ }
}
- mtlPw.println();
}
- if (currentMtl.Kd != null) {
- mtlPw.print("Kd");
- for (final float KdCoef : currentMtl.Kd) {
- mtlPw.print(" " + KdCoef);
+ if (sameObjMtl == null) {
+ // writes the new material library
+ mtlName = mtlFile.getName().trim().replaceAll(" ", "") + "_"
+ + (materialList == null ? 1 : materialList.size() + 1);
+ if (materialList != null) {
+ final ObjMaterial mtl = new ObjMaterial(mtlName);
+ mtl.illumType = currentMtl.illumType;
+ mtl.textureName = currentMtl.textureName;
+ materialList.add(mtl);
}
- mtlPw.println();
- }
- if (currentMtl.Ks != null) {
- mtlPw.print("Ks");
- for (final float KsCoef : currentMtl.Ks) {
- mtlPw.print(" " + KsCoef);
+ mtlPw.println("newmtl " + mtlName);
+ if (currentMtl.Ns != -1) {
+ mtlPw.println("Ns " + currentMtl.Ns);
}
- mtlPw.println();
- }
- if (currentMtl.d != -1) {
- mtlPw.println("d " + currentMtl.d);
- }
- mtlPw.println("illum " + currentMtl.illumType);
- if (currentMtl.textureName != null) {
- mtlPw.println("map_Kd " + currentMtl.textureName);
+ if (currentMtl.Ka != null) {
+ mtlPw.print("Ka");
+ for (final float KaCoef : currentMtl.Ka) {
+ mtlPw.print(" " + KaCoef);
+ }
+ mtlPw.println();
+ }
+ if (currentMtl.Kd != null) {
+ mtlPw.print("Kd");
+ for (final float KdCoef : currentMtl.Kd) {
+ mtlPw.print(" " + KdCoef);
+ }
+ mtlPw.println();
+ }
+ if (currentMtl.Ks != null) {
+ mtlPw.print("Ks");
+ for (final float KsCoef : currentMtl.Ks) {
+ mtlPw.print(" " + KsCoef);
+ }
+ mtlPw.println();
+ }
+ if (currentMtl.d != -1) {
+ mtlPw.println("d " + currentMtl.d);
+ }
+ mtlPw.println("illum " + currentMtl.illumType);
+ if (currentMtl.textureName != null) {
+ mtlPw.println("map_Kd " + currentMtl.textureName);
+ }
+ } else {
+ mtlName = sameObjMtl.getName();
}
- } else {
- mtlName = sameObjMtl.getName();
}
} else {
mtlName = null;
}
- final FileOutputStream objOs = new FileOutputStream(objFile, append);
- objPw = new PrintWriter(new BufferedOutputStream(objOs));
- // writes some comments
- if (firstFiles) {
- objPw.println("# Ardor3D 1.0 OBJ file");
- objPw.println("# www.ardor3d.com");
- // writes the material file name if any
+ try (final FileOutputStream objOs = new FileOutputStream(objFile, append);
+ final PrintWriter objPw = new PrintWriter(new BufferedOutputStream(objOs))) {
+ // writes some comments
+ if (firstFiles) {
+ objPw.println("# Ardor3D 1.0 OBJ file");
+ objPw.println("# www.ardor3d.com");
+ // writes the material file name if any
+ if (mtlFile != null) {
+ final String mtlLibFilename = mtlFile.getName();
+ objPw.println("mtllib " + mtlLibFilename);
+ }
+ }
+ // writes the object name
+ final String objName;
+ String meshName = mesh.getName();
+ // removes all spaces from the mesh name
+ if (meshName != null && !meshName.isEmpty()) {
+ meshName = meshName.trim().replaceAll(" ", "");
+ }
+ if (meshName != null && !meshName.isEmpty()) {
+ objName = meshName;
+ } else {
+ objName = "obj_mesh" + mesh.hashCode();
+ }
+ objPw.println("o " + objName);
+ final MeshData meshData = mesh.getMeshData();
+ // writes the coordinates
+ final FloatBufferData verticesData = meshData.getVertexCoords();
+ if (verticesData == null) {
+ throw new IllegalArgumentException("cannot export a mesh with no vertices");
+ }
+ final int expectedTupleCount = verticesData.getTupleCount();
+ saveFloatBufferData(verticesData, objPw, "v", expectedTupleCount);
+ final FloatBufferData texCoordsData = meshData.getTextureCoords(0);
+ saveFloatBufferData(texCoordsData, objPw, "vt", expectedTupleCount);
+ final FloatBufferData normalsData = meshData.getNormalCoords();
+ saveFloatBufferData(normalsData, objPw, "vn", expectedTupleCount);
+ // writes the used material library
if (mtlFile != null) {
- final String mtlLibFilename = mtlFile.getName();
- objPw.println("mtllib " + mtlLibFilename);
+ objPw.println("usemtl " + mtlName);
}
- }
- // writes the object name
- final String objName;
- String meshName = mesh.getName();
- // removes all spaces from the mesh name
- if (meshName != null && !meshName.isEmpty()) {
- meshName = meshName.trim().replaceAll(" ", "");
- }
- if (meshName != null && !meshName.isEmpty()) {
- objName = meshName;
- } else {
- objName = "obj_mesh" + mesh.hashCode();
- }
- objPw.println("o " + objName);
- final MeshData meshData = mesh.getMeshData();
- // writes the coordinates
- final FloatBufferData verticesData = meshData.getVertexCoords();
- if (verticesData == null) {
- throw new IllegalArgumentException("cannot export a mesh with no vertices");
- }
- final int expectedTupleCount = verticesData.getTupleCount();
- saveFloatBufferData(verticesData, objPw, "v", expectedTupleCount);
- final FloatBufferData texCoordsData = meshData.getTextureCoords(0);
- saveFloatBufferData(texCoordsData, objPw, "vt", expectedTupleCount);
- final FloatBufferData normalsData = meshData.getNormalCoords();
- saveFloatBufferData(normalsData, objPw, "vn", expectedTupleCount);
- // writes the used material library
- if (mtlFile != null) {
- objPw.println("usemtl " + mtlName);
- }
- // writes the faces
- for (int sectionIndex = 0; sectionIndex < meshData.getSectionCount(); sectionIndex++) {
- final IndexMode indexMode = meshData.getIndexMode(sectionIndex);
- final int[] indices = new int[indexMode.getVertexCount()];
- switch (indexMode) {
- case TriangleFan:
- case Triangles:
- case TriangleStrip:
- case Quads:
- for (int primIndex = 0, primCount = meshData.getPrimitiveCount(sectionIndex); primIndex < primCount; primIndex++) {
- meshData.getPrimitiveIndices(primIndex, sectionIndex, indices);
- objPw.print("f");
- for (int vertexIndex = 0; vertexIndex < indices.length; vertexIndex++) {
- // indices start at 1 in the WaveFront OBJ format whereas indices start at 0 in
- // Ardor3D
- final int shiftedIndex = indices[vertexIndex] + 1 + firstVertexIndex;
- // vertex index
- objPw.print(" " + shiftedIndex);
- // texture coordinate index
- if (texCoordsData != null) {
- objPw.print("/" + shiftedIndex);
- }
- // normal coordinate index
- if (normalsData != null) {
- objPw.print("/" + shiftedIndex);
+ // writes the faces
+ for (int sectionIndex = 0; sectionIndex < meshData.getSectionCount(); sectionIndex++) {
+ final IndexMode indexMode = meshData.getIndexMode(sectionIndex);
+ final int[] indices = new int[indexMode.getVertexCount()];
+ switch (indexMode) {
+ case TriangleFan:
+ case Triangles:
+ case TriangleStrip:
+ case Quads:
+ for (int primIndex = 0, primCount = meshData
+ .getPrimitiveCount(sectionIndex); primIndex < primCount; primIndex++) {
+ meshData.getPrimitiveIndices(primIndex, sectionIndex, indices);
+ objPw.print("f");
+ for (int vertexIndex = 0; vertexIndex < indices.length; vertexIndex++) {
+ // indices start at 1 in the WaveFront OBJ format whereas indices start at 0 in
+ // Ardor3D
+ final int shiftedIndex = indices[vertexIndex] + 1 + firstVertexIndex;
+ // vertex index
+ objPw.print(" " + shiftedIndex);
+ // texture coordinate index
+ if (texCoordsData != null) {
+ objPw.print("/" + shiftedIndex);
+ }
+ // normal coordinate index
+ if (normalsData != null) {
+ objPw.print("/" + shiftedIndex);
+ }
}
+ objPw.println();
}
- objPw.println();
- }
- break;
- default:
- throw new IllegalArgumentException("index mode " + indexMode + " not supported");
+ break;
+ default:
+ throw new IllegalArgumentException("index mode " + indexMode + " not supported");
+ }
}
}
} catch (final Throwable t) {
throw new Error("Unable to save the mesh into an obj", t);
- } finally {
- if (objPw != null) {
- objPw.flush();
- objPw.close();
- }
- if (mtlPw != null) {
- mtlPw.flush();
- mtlPw.close();
- }
- }
- }
-
- // TODO replace it by java.util.Objects.equals(Object, Object)
- private boolean equals(final Object a, final Object b) {
- if (a == b) {
- return true;
- } else {
- return a != null && a.equals(b);
}
}
@@ -407,9 +392,9 @@ public class ObjExporter {
final int tupleSize = data.getValuesPerTuple();
final int tupleCount = data.getTupleCount();
if (tupleCount < expectedTupleCount) {
- throw new IllegalArgumentException("[" + keyword
- + "] not enough data to match with the vertex count: " + tupleCount + " < "
- + expectedTupleCount);
+ throw new IllegalArgumentException(
+ "[" + keyword + "] not enough data to match with the vertex count: " + tupleCount + " < "
+ + expectedTupleCount);
} else {
if (tupleCount > expectedTupleCount) {
ObjExporter.logger.warning("[" + keyword + "] too much data to match with the vertex count: "
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java
index 42b1f98..b742faa 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjGeometryStore.java
@@ -45,7 +45,7 @@ public class ObjGeometryStore {
private int _totalLines = 0;
private int _totalMeshes = 0;
private final Node _root = new Node();
- private final Map<String, Spatial> _groupMap = new HashMap<String, Spatial>();
+ private final Map<String, Spatial> _groupMap = new HashMap<>();
private ObjMaterial _currentMaterial = new ObjMaterial("default");
private String _currentObjectName;
@@ -55,8 +55,8 @@ public class ObjGeometryStore {
private ObjSetManager _lineManager;
private ObjSetManager _pointManager;
- private final Map<String, ObjMaterial> materialLibrary = new HashMap<String, ObjMaterial>();
- private final Map<Spatial, String> _materialMap = new HashMap<Spatial, String>();
+ private final Map<String, ObjMaterial> materialLibrary = new HashMap<>();
+ private final Map<Spatial, String> _materialMap = new HashMap<>();
private final GeometryTool _geometryTool;
@@ -274,7 +274,7 @@ public class ObjGeometryStore {
int j = 0;
final long[] vertGroups = new long[_meshManager.getStore().size()];
- final List<Long> groups = new ArrayList<Long>();
+ final List<Long> groups = new ArrayList<>();
Vector3 vector;
for (final ObjIndexSet set : _meshManager.getStore().keySet()) {
vertGroups[j] = set.getSmoothGroup();
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java
index 8e0107f..e31e2ee 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjImporter.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -103,7 +103,7 @@ public class ObjImporter {
/**
* Reads a Wavefront OBJ file from the given resource
- *
+ *
* @param resource
* the name of the resource to find.
* @return an ObjGeometryStore data object containing the scene and other useful elements.
@@ -114,7 +114,7 @@ public class ObjImporter {
/**
* Reads a Wavefront OBJ file from the given resource
- *
+ *
* @param resource
* the name of the resource to find.
* @param geometryTool
@@ -138,7 +138,7 @@ public class ObjImporter {
/**
* Reads a Wavefront OBJ file from the given resource
- *
+ *
* @param resource
* the name of the resource to find.
* @return an ObjGeometryStore data object containing the scene and other useful elements.
@@ -149,7 +149,7 @@ public class ObjImporter {
/**
* Reads a Wavefront OBJ file from the given resource
- *
+ *
* @param resource
* the name of the resource to find.
* @param geometryTool
@@ -259,7 +259,7 @@ public class ObjImporter {
if (tokens.length < 2) {
store.setCurrentGroupNames(null);
continue;
- // throw new Error("wrong number of args. g must have at least 1 argument. (line " + lineNo
+ // throw new Error("wrong number of args. g must have at least 1 argument. (line " + lineNo
// + ") " + line);
}
@@ -272,7 +272,8 @@ public class ObjImporter {
// if smoothing group
else if ("s".equals(keyword)) {
if (tokens.length != 2) {
- throw new Error("wrong number of args. s must have 1 argument. (line " + lineNo + ") " + line);
+ throw new Error(
+ "wrong number of args. s must have 1 argument. (line " + lineNo + ") " + line);
}
if ("off".equalsIgnoreCase(tokens[1])) {
@@ -291,7 +292,8 @@ public class ObjImporter {
// if object name
else if ("o".equals(keyword)) {
if (tokens.length < 2) {
- throw new Error("wrong number of args. o must have 1 argument. (line " + lineNo + ") " + line);
+ throw new Error(
+ "wrong number of args. o must have 1 argument. (line " + lineNo + ") " + line);
}
store.setCurrentObjectName(tokens[1]);
}
@@ -314,8 +316,8 @@ public class ObjImporter {
// if use material command
else if ("usemtl".equals(keyword)) {
if (tokens.length != 2) {
- throw new Error("wrong number of args. usemtl must have 1 argument. (line " + lineNo + ") "
- + line);
+ throw new Error(
+ "wrong number of args. usemtl must have 1 argument. (line " + lineNo + ") " + line);
}
// set new material
@@ -327,12 +329,12 @@ public class ObjImporter {
// if point
else if ("p".equals(keyword) && tokens.length > 1) {
if (tokens.length < 2) {
- throw new Error("wrong number of args. p must have at least 1 vertex. (line " + lineNo + ") "
- + line);
+ throw new Error(
+ "wrong number of args. p must have at least 1 vertex. (line " + lineNo + ") " + line);
}
// Each token corresponds to 1 vertex entry
- final List<ObjIndexSet> indices = new ArrayList<ObjIndexSet>();
+ final List<ObjIndexSet> indices = new ArrayList<>();
for (int i = 1; i < tokens.length; i++) {
indices.add(new ObjIndexSet(tokens[i], store.getDataStore(), currentSmoothGroup));
}
@@ -347,7 +349,7 @@ public class ObjImporter {
}
// Each token corresponds to 1 vertex entry and possibly one texture entry
- final List<ObjIndexSet> indices = new ArrayList<ObjIndexSet>();
+ final List<ObjIndexSet> indices = new ArrayList<>();
for (int i = 1; i < tokens.length; i++) {
indices.add(new ObjIndexSet(tokens[i], store.getDataStore(), currentSmoothGroup));
}
@@ -362,7 +364,7 @@ public class ObjImporter {
}
// Each token corresponds to 1 vertex entry and possibly one texture entry and normal entry.
- final List<ObjIndexSet> indices = new ArrayList<ObjIndexSet>();
+ final List<ObjIndexSet> indices = new ArrayList<>();
for (int i = 1; i < tokens.length; i++) {
indices.add(new ObjIndexSet(tokens[i], store.getDataStore(), currentSmoothGroup));
}
@@ -398,7 +400,7 @@ public class ObjImporter {
/**
* Load a .mtl resource
- *
+ *
* @param fileName
* the name of the mtl resource to load.
* @param modelSource
@@ -424,7 +426,7 @@ public class ObjImporter {
/**
* Load a .mtl resource
- *
+ *
* @param resource
* the mtl file to load, as a ResourceSource
* @param store
@@ -524,14 +526,18 @@ public class ObjImporter {
final String textureName = line.substring("map_Kd".length()).trim();
currentMaterial.textureName = textureName;
if (_textureLocator == null) {
- currentMaterial.map_Kd = TextureManager.load(textureName, getMinificationFilter(),
- isUseCompression() ? TextureStoreFormat.GuessCompressedFormat
- : TextureStoreFormat.GuessNoCompressedFormat, isFlipTextureVertically());
+ currentMaterial.map_Kd = TextureManager
+ .load(textureName, getMinificationFilter(),
+ isUseCompression() ? TextureStoreFormat.GuessCompressedFormat
+ : TextureStoreFormat.GuessNoCompressedFormat,
+ isFlipTextureVertically());
} else {
final ResourceSource source = _textureLocator.locateResource(textureName);
- currentMaterial.map_Kd = TextureManager.load(source, getMinificationFilter(),
- isUseCompression() ? TextureStoreFormat.GuessCompressedFormat
- : TextureStoreFormat.GuessNoCompressedFormat, isFlipTextureVertically());
+ currentMaterial.map_Kd = TextureManager
+ .load(source, getMinificationFilter(),
+ isUseCompression() ? TextureStoreFormat.GuessCompressedFormat
+ : TextureStoreFormat.GuessNoCompressedFormat,
+ isFlipTextureVertically());
}
}
}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java
index 0e2bec1..81c7d29 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjIndexSet.java
@@ -3,13 +3,15 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.model.obj;
+import java.util.Objects;
+
public class ObjIndexSet {
private final int _vIndex, _vtIndex;
private final long _sGroup;
@@ -64,12 +66,8 @@ public class ObjIndexSet {
@Override
public int hashCode() {
- int result = 17;
- result += 31 * result + _vIndex;
- result += 31 * result + _vtIndex;
- result += 31 * result + _vnIndex;
- result += 31 * result + _sGroup;
- return result;
+ return Objects.hash(Integer.valueOf(getVIndex()), Integer.valueOf(getVtIndex()), Integer.valueOf(getVnIndex()),
+ Long.valueOf(getSmoothGroup()));
}
@Override
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java
index e070e0b..bee824a 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/obj/ObjSetManager.java
@@ -16,9 +16,9 @@ import java.util.List;
import java.util.Map;
public class ObjSetManager {
- private final Map<ObjIndexSet, Integer> _store = new LinkedHashMap<ObjIndexSet, Integer>();
- private final List<Integer> _indices = new ArrayList<Integer>();
- private final List<Integer> _lengths = new ArrayList<Integer>();
+ private final Map<ObjIndexSet, Integer> _store = new LinkedHashMap<>();
+ private final List<Integer> _indices = new ArrayList<>();
+ private final List<Integer> _lengths = new ArrayList<>();
public int findSet(final ObjIndexSet set) {
if (_store.containsKey(set)) {
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java
index 15c810a..608ce86 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java
@@ -127,7 +127,7 @@ public class KeyframeController<T extends Spatial> extends ComplexSpatialControl
*/
public KeyframeController() {
setSpeed(1);
- _keyframes = new ArrayList<PointInTime>();
+ _keyframes = new ArrayList<>();
_curFrame = 0;
setRepeatType(ComplexSpatialController.RepeatType.WRAP);
setMinTime(0);
@@ -245,7 +245,7 @@ public class KeyframeController<T extends Spatial> extends ComplexSpatialControl
}
Mesh begin = null, end = null;
if (_prevKeyframes == null) {
- _prevKeyframes = new ArrayList<PointInTime>();
+ _prevKeyframes = new ArrayList<>();
begin = new Mesh();
end = new Mesh();
} else {
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java
index dd341ca..e06992a 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripInfo.java
@@ -15,7 +15,7 @@ import java.util.List;
final class NvStripInfo {
NvStripStartInfo _startInfo;
- List<NvFaceInfo> _faces = new ArrayList<NvFaceInfo>();
+ List<NvFaceInfo> _faces = new ArrayList<>();
int _stripId;
int _experimentId;
@@ -176,11 +176,11 @@ final class NvStripInfo {
*/
void build(final List<NvEdgeInfo> edgeInfos, final List<NvFaceInfo> faceInfos) {
// used in building the strips forward and backward
- final List<Integer> scratchIndices = new ArrayList<Integer>();
+ final List<Integer> scratchIndices = new ArrayList<>();
// build forward... start with the initial face
- final List<NvFaceInfo> forwardFaces = new ArrayList<NvFaceInfo>();
- final List<NvFaceInfo> backwardFaces = new ArrayList<NvFaceInfo>();
+ final List<NvFaceInfo> forwardFaces = new ArrayList<>();
+ final List<NvFaceInfo> backwardFaces = new ArrayList<>();
forwardFaces.add(_startInfo._startFace);
markTriangle(_startInfo._startFace);
@@ -250,7 +250,7 @@ final class NvStripInfo {
// tempAllFaces is going to be forwardFaces + backwardFaces
// it's used for Unique()
- final List<NvFaceInfo> tempAllFaces = new ArrayList<NvFaceInfo>();
+ final List<NvFaceInfo> tempAllFaces = new ArrayList<>();
for (int i = 0; i < forwardFaces.size(); i++) {
tempAllFaces.add(forwardFaces.get(i));
}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java
index a872493..762199e 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvStripifier.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -24,14 +24,14 @@ final class NvStripifier {
public static int CACHE_INEFFICIENCY = 6;
- protected List<Integer> _indices = new ArrayList<Integer>();
+ protected List<Integer> _indices = new ArrayList<>();
protected int _cacheSize;
protected int _minStripLength;
protected float _meshJump;
protected boolean _firstTimeResetPoint;
/**
- *
+ *
* @param in_indices
* the input indices of the mesh to stripify
* @param in_cacheSize
@@ -58,12 +58,12 @@ final class NvStripifier {
_indices = in_indices;
// build the stripification info
- final List<NvFaceInfo> allFaceInfos = new ArrayList<NvFaceInfo>();
- final List<NvEdgeInfo> allEdgeInfos = new ArrayList<NvEdgeInfo>();
+ final List<NvFaceInfo> allFaceInfos = new ArrayList<>();
+ final List<NvEdgeInfo> allEdgeInfos = new ArrayList<>();
buildStripifyInfo(allFaceInfos, allEdgeInfos, maxIndex);
- final List<NvStripInfo> allStrips = new ArrayList<NvStripInfo>();
+ final List<NvStripInfo> allStrips = new ArrayList<>();
// stripify
findAllStrips(allStrips, allFaceInfos, allEdgeInfos, numSamples);
@@ -74,7 +74,7 @@ final class NvStripifier {
/**
* Generates actual strips from the list-in-strip-order.
- *
+ *
* @param allStrips
* @param stripIndices
* @param bStitchStrips
@@ -149,8 +149,8 @@ final class NvStripifier {
stripIndices.add(tFirstFace._v0);
// Check CW/CCW ordering
- if (NvStripifier.nextIsCW(stripIndices.size() - accountForNegatives) != NvStripifier.isCW(
- strip._faces.get(0), tFirstFace._v0, tFirstFace._v1)) {
+ if (NvStripifier.nextIsCW(stripIndices.size() - accountForNegatives) != NvStripifier
+ .isCW(strip._faces.get(0), tFirstFace._v0, tFirstFace._v1)) {
stripIndices.add(tFirstFace._v0);
}
}
@@ -324,7 +324,7 @@ final class NvStripifier {
}
/**
- *
+ *
* @param numIndices
* @return true if the next face should be ordered in CW fashion
*/
@@ -384,7 +384,7 @@ final class NvStripifier {
/**
* find the edge info for these two indices
- *
+ *
* @param edgeInfos
* @param v0
* @param v1
@@ -415,13 +415,14 @@ final class NvStripifier {
/**
* find the other face sharing these vertices
- *
+ *
* @param edgeInfos
* @param v0
* @param v1
* @param faceInfo
* @return
*/
+ @SuppressWarnings("null")
static NvFaceInfo findOtherFace(final List<NvEdgeInfo> edgeInfos, final int v0, final int v1,
final NvFaceInfo faceInfo) {
final NvEdgeInfo edgeInfo = NvStripifier.findEdgeInfo(edgeInfos, v0, v1);
@@ -438,7 +439,7 @@ final class NvStripifier {
/**
* A good reset point is one near other committed areas so that we know that when we've made the longest strips its
* because we're stripifying in the same general orientation.
- *
+ *
* @param faceInfos
* @param edgeInfos
* @return
@@ -493,11 +494,11 @@ final class NvStripifier {
/**
* Does the stripification, puts output strips into vector allStrips
- *
+ *
* Works by setting running a number of experiments in different areas of the mesh, and accepting the one which
* results in the longest strips. It then accepts this, and moves on to a different area of the mesh. We try to jump
* around the mesh some, to ensure that large open spans of strips get generated.
- *
+ *
* @param allStrips
* @param allFaceInfos
* @param allEdgeInfos
@@ -518,11 +519,11 @@ final class NvStripifier {
//
final List<NvStripInfo>[] experiments = new List[numSamples * 6];
for (int i = 0; i < experiments.length; i++) {
- experiments[i] = new ArrayList<NvStripInfo>();
+ experiments[i] = new ArrayList<>();
}
int experimentIndex = 0;
- final Set<NvFaceInfo> resetPoints = new HashSet<NvFaceInfo>();
+ final Set<NvFaceInfo> resetPoints = new HashSet<>();
for (int i = 0; i < numSamples; i++) {
// Try to find another good reset point.
@@ -640,7 +641,7 @@ final class NvStripifier {
/**
* Splits the input vector of strips (allBigStrips) into smaller, cache friendly pieces, then reorders these pieces
* to maximize cache hits. The final strips are stored in outStrips
- *
+ *
* @param allStrips
* @param outStrips
* @param edgeInfos
@@ -649,7 +650,7 @@ final class NvStripifier {
void splitUpStripsAndOptimize(final List<NvStripInfo> allStrips, final List<NvStripInfo> outStrips,
final List<NvEdgeInfo> edgeInfos, final List<NvFaceInfo> outFaceList) {
final int threshold = _cacheSize;
- final List<NvStripInfo> tempStrips = new ArrayList<NvStripInfo>();
+ final List<NvStripInfo> tempStrips = new ArrayList<>();
// split up strips into threshold-sized pieces
for (int i = 0; i < allStrips.size(); i++) {
@@ -680,9 +681,8 @@ final class NvStripifier {
degenerateCount++;
// last time or first time through, no need for a degenerate
- if ((faceCtr + 1 != threshold + j * threshold + degenerateCount || j == numTimes - 1
- && numLeftover < 4 && numLeftover > 0)
- && !bFirstTime) {
+ if ((faceCtr + 1 != threshold + j * threshold + degenerateCount
+ || j == numTimes - 1 && numLeftover < 4 && numLeftover > 0) && !bFirstTime) {
currentStrip._faces.add(allStripI._faces.get(faceCtr++));
} else {
++faceCtr;
@@ -746,7 +746,7 @@ final class NvStripifier {
}
// add small strips to face list
- final List<NvStripInfo> tempStrips2 = new ArrayList<NvStripInfo>();
+ final List<NvStripInfo> tempStrips2 = new ArrayList<>();
removeSmallStrips(tempStrips, tempStrips2, outFaceList);
outStrips.clear();
@@ -867,7 +867,7 @@ final class NvStripifier {
final List<NvFaceInfo> faceList) {
faceList.clear();
allBigStrips.clear(); // make sure these are empty
- final List<NvFaceInfo> tempFaceList = new ArrayList<NvFaceInfo>();
+ final List<NvFaceInfo> tempFaceList = new ArrayList<>();
for (int i = 0; i < allStrips.size(); i++) {
final NvStripInfo allStripI = allStrips.get(i);
@@ -917,7 +917,7 @@ final class NvStripifier {
/**
* Finds the next face to start the next strip on.
- *
+ *
* @param faceInfos
* @param edgeInfos
* @param strip
@@ -961,7 +961,7 @@ final class NvStripifier {
/**
* "Commits" the input strips by setting their m_experimentId to -1 and adding to the allStrips vector
- *
+ *
* @param allStrips
* @param strips
*/
@@ -984,7 +984,7 @@ final class NvStripifier {
}
/**
- *
+ *
* @param strips
* @return the average strip size of the input vector of strips
*/
@@ -999,7 +999,7 @@ final class NvStripifier {
/**
* Finds a good starting point, namely one which has only one neighbor
- *
+ *
* @param faceInfos
* @param edgeInfos
* @return
@@ -1037,7 +1037,7 @@ final class NvStripifier {
/**
* Updates the input vertex cache with this strip's vertices
- *
+ *
* @param vcache
* @param strip
*/
@@ -1049,7 +1049,7 @@ final class NvStripifier {
/**
* Updates the input vertex cache with this face's vertices
- *
+ *
* @param vcache
* @param face
*/
@@ -1119,7 +1119,7 @@ final class NvStripifier {
}
/**
- *
+ *
* @param face
* @param edgeInfoVec
* @return the number of neighbors that this face has
@@ -1144,7 +1144,7 @@ final class NvStripifier {
/**
* Builds the list of all face and edge infos
- *
+ *
* @param faceInfos
* @param edgeInfos
* @param maxIndex
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java
index 2ae9059..0086ad0 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/nvtristrip/NvTriangleStripper.java
@@ -241,7 +241,7 @@ public class NvTriangleStripper implements Visitor {
PrimitiveGroup[] primGroups;
// put data in format that the stripifier likes
- final List<Integer> tempIndices = new ArrayList<Integer>();
+ final List<Integer> tempIndices = new ArrayList<>();
int maxIndex = 0;
for (int i = 0; i < in_indices.length; i++) {
tempIndices.add(in_indices[i]);
@@ -249,8 +249,8 @@ public class NvTriangleStripper implements Visitor {
maxIndex = in_indices[i];
}
}
- final List<NvStripInfo> tempStrips = new ArrayList<NvStripInfo>();
- final List<NvFaceInfo> tempFaces = new ArrayList<NvFaceInfo>();
+ final List<NvStripInfo> tempStrips = new ArrayList<>();
+ final List<NvFaceInfo> tempFaces = new ArrayList<>();
final NvStripifier stripifier = new NvStripifier();
@@ -258,7 +258,7 @@ public class NvTriangleStripper implements Visitor {
stripifier.stripify(tempIndices, _cacheSize, _minStripSize, maxIndex, tempStrips, tempFaces);
// stitch strips together
- final List<Integer> stripIndices = new ArrayList<Integer>();
+ final List<Integer> stripIndices = new ArrayList<>();
int numSeparateStrips = 0;
if (_listsOnly) {
@@ -374,7 +374,7 @@ public class NvTriangleStripper implements Visitor {
final List<NvFaceInfo> in_bins[] = new List[NUMBINS];
for (int i = 0; i < NUMBINS; i++) {
- in_bins[i] = new ArrayList<NvFaceInfo>();
+ in_bins[i] = new ArrayList<>();
}
// hash input indices on first index
@@ -525,7 +525,7 @@ public class NvTriangleStripper implements Visitor {
PrimitiveGroup[] strips = generateStrips(indices, false);
if (_reorderVertices) {
- final AtomicReference<int[]> newOrder = new AtomicReference<int[]>();
+ final AtomicReference<int[]> newOrder = new AtomicReference<>();
strips = remapIndices(strips, newOrder, md.getVertexCount());
// ask mesh to apply new vertex order
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java
index 558d9fb..e125872 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/useful/TrailMesh.java
@@ -90,7 +90,7 @@ public class TrailMesh extends Mesh {
this.nrTrailSections = nrTrailSections;
trailVertices = nrTrailSections * 2;
- trailVectors = new LinkedList<TrailData>();
+ trailVectors = new LinkedList<>();
for (int i = 0; i < nrTrailSections; i++) {
trailVectors.add(new TrailData());
}
diff --git a/ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java b/ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java
index 52ab50a..f789f54 100644
--- a/ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java
+++ b/ardor3d-jinput/src/main/java/com/ardor3d/input/jinput/JInputControllerWrapper.java
@@ -33,7 +33,7 @@ public class JInputControllerWrapper implements ControllerWrapper {
protected final Event _event = new Event();
protected final List<ControllerEvent> _events = Collections.synchronizedList(new ArrayList<ControllerEvent>());
protected JInputControllerEventIterator _eventsIt = new JInputControllerEventIterator();
- protected final List<ControllerInfo> _controllers = new ArrayList<ControllerInfo>();
+ protected final List<ControllerInfo> _controllers = new ArrayList<>();
protected static boolean _inited = false;
@Override
@@ -91,8 +91,8 @@ public class JInputControllerWrapper implements ControllerWrapper {
}
protected ControllerInfo getControllerInfo(final Controller controller) {
- final List<String> axisNames = new ArrayList<String>();
- final List<String> buttonNames = new ArrayList<String>();
+ final List<String> axisNames = new ArrayList<>();
+ final List<String> buttonNames = new ArrayList<>();
for (final Component comp : controller.getComponents()) {
if (comp.getIdentifier() instanceof Identifier.Axis) {
diff --git a/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs b/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs
index 19eadb6..941c850 100644
--- a/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-jogl/.settings/org.eclipse.jdt.core.prefs
@@ -8,16 +8,16 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
index 045324a..49089fc 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
@@ -75,7 +75,7 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer {
// FIXME rather pass the monitor(s) to the constructor, create a screen to get the primary monitor
_newtWindow = GLWindow.create(capsUtil.getCapsForSettingsWithHints(settings, onscreen, bitmapRequested,
pbufferRequested, fboRequested));
- _monitorDevices = new ArrayList<MonitorDevice>();
+ _monitorDevices = new ArrayList<>();
// uses the primary monitor by default
_newtWindow.getScreen().createNative();
final MonitorDevice primaryMonitor = _newtWindow.getScreen().getPrimaryMonitor();
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java
index 3de8a8d..df4ef29 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageLoader.java
@@ -60,7 +60,7 @@ public class JoglImageLoader implements ImageLoader {
private static final String[] _supportedFormats = computeSupportedFormats();
private static final String[] computeSupportedFormats() {
- final List<String> supportedFormatsList = new ArrayList<String>();
+ final List<String> supportedFormatsList = new ArrayList<>();
if (Platform.AWT_AVAILABLE) {
supportedFormatsList.add("." + TextureIO.GIF.toUpperCase());
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java
index f936f73..c8a5d3d 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/image/util/jogl/JoglImageUtil.java
@@ -56,7 +56,7 @@ public class JoglImageUtil {
final int width = input.getWidth(), height = input.getHeight();
// create our return list
- final List<TextureData> rVal = new ArrayList<TextureData>();
+ final List<TextureData> rVal = new ArrayList<>();
// go through each layer
for (int i = 0; i < size; i++) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java
index bce6810..bb6f812 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtKeyboardWrapper.java
@@ -31,7 +31,7 @@ import com.jogamp.newt.opengl.GLWindow;
public class JoglNewtKeyboardWrapper extends KeyAdapter implements KeyboardWrapper {
@GuardedBy("this")
- protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<KeyEvent>();
+ protected final LinkedList<KeyEvent> _upcomingEvents = new LinkedList<>();
@GuardedBy("this")
protected JoglNewtKeyboardIterator _currentIterator = null;
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java
index 23f7e32..af88590 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java
@@ -36,7 +36,7 @@ import com.jogamp.newt.opengl.GLWindow;
public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener {
@GuardedBy("this")
- protected final LinkedList<MouseState> _upcomingEvents = new LinkedList<MouseState>();
+ protected final LinkedList<MouseState> _upcomingEvents = new LinkedList<>();
@GuardedBy("this")
protected JoglNewtMouseIterator _currentIterator = null;
@@ -53,7 +53,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener {
protected boolean _skipAutoRepeatEvents = false;
protected final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class);
- protected final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<MouseButton, Long>(MouseButton.class);
+ protected final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<>(MouseButton.class);
protected final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class);
protected int _ignoreX = Integer.MAX_VALUE;
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java
index c781f4d..176d8d5 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglTextureRenderer.java
@@ -179,8 +179,8 @@ public class JoglTextureRenderer extends AbstractFBOTextureRenderer {
// Otherwise, we can streamline this by rendering to multiple textures at once.
// first determine how many groups we need
- final LinkedList<Texture> depths = new LinkedList<Texture>();
- final LinkedList<Texture> colors = new LinkedList<Texture>();
+ final LinkedList<Texture> depths = new LinkedList<>();
+ final LinkedList<Texture> colors = new LinkedList<>();
for (int i = 0; i < texs.size(); i++) {
final Texture tex = texs.get(i);
if (tex.getTextureStoreFormat().isDepthFormat()) {
diff --git a/ardor3d-math/.settings/org.eclipse.jdt.core.prefs b/ardor3d-math/.settings/org.eclipse.jdt.core.prefs
index ed7a9e8..644ac20 100644
--- a/ardor3d-math/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-math/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java b/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java
index a6879cd..61aebce 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/ColorRGBA.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
import com.ardor3d.util.export.InputCapsule;
@@ -107,7 +108,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Constructs a new, mutable color set to the (r, g, b, a) values of the provided source color.
- *
+ *
* @param src
*/
public ColorRGBA(final ReadOnlyColorRGBA src) {
@@ -116,7 +117,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Constructs a new color set to (r, g, b, a).
- *
+ *
* @param r
* @param g
* @param b
@@ -198,7 +199,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Stores the float values of this color in the given float array.
- *
+ *
* @param store
* if null, a new float[4] array is created.
* @return the float array
@@ -222,7 +223,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the red component of this color to the given float value.
- *
+ *
* @param r
* new red value, generally should be in the range [0.0f, 1.0f]
*/
@@ -232,7 +233,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the green component of this color to the given float value.
- *
+ *
* @param g
* new green value, generally should be in the range [0.0f, 1.0f]
*/
@@ -242,7 +243,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the blue component of this color to the given float value.
- *
+ *
* @param b
* new blue value, generally should be in the range [0.0f, 1.0f]
*/
@@ -253,7 +254,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the alpha component of this color to the given float value. Consider that an alpha of 1.0f means opaque (can
* not see through) and 0.0f means transparent.
- *
+ *
* @param a
* new alpha value, generally should be in the range [0.0f, 1.0f]
*/
@@ -263,7 +264,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the value of this color to (r, g, b, a)
- *
+ *
* @param r
* new red value, generally should be in the range [0.0f, 1.0f]
* @param g
@@ -284,7 +285,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the value of this color to the (r, g, b, a) values of the provided source color.
- *
+ *
* @param source
* @return this color for chaining
* @throws NullPointerException
@@ -300,7 +301,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Sets the value of this color to (0, 0, 0, 0)
- *
+ *
* @return this color for chaining
*/
public ColorRGBA zero() {
@@ -310,7 +311,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Brings all values (r,g,b,a) into the range [0.0f, 1.0f]. If a value is above or below this range it is replaced
* with the appropriate end of the range.
- *
+ *
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
*/
@@ -353,7 +354,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Brings all values (r,g,b,a) into the range [0.0f, 1.0f]. If a value is above or below this range it is replaced
* with the appropriate end of the range.
- *
+ *
* @return this color for chaining
*/
public ColorRGBA clampLocal() {
@@ -405,7 +406,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Reads a color, packed into a 4 byte int as 1 byte values in the order ARGB. These byte values are normalized to
* the range [0.0f, 1.0f]
- *
+ *
* @param color
* @return this color for chaining
*/
@@ -420,7 +421,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Reads a color, packed into a 4 byte int as 1 byte values in the order RGBA. These byte values are normalized to
* the range [0.0f, 1.0f]
- *
+ *
* @param color
* @return this color for chaining
*/
@@ -463,7 +464,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Adds the given values to those of this color and returns them in store.
- *
+ *
* @param r
* @param g
* @param b
@@ -484,7 +485,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Increments the values of this color with the given r, g, b and a values.
- *
+ *
* @param r
* @param g
* @param b
@@ -497,7 +498,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Adds the values of the given source color to those of this color and returns them in store.
- *
+ *
* @param source
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
@@ -512,7 +513,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Increments the values of this color with the r, g, b and a values of the given color.
- *
+ *
* @param source
* @return this color for chaining
* @throws NullPointerException
@@ -524,7 +525,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Subtracts the given values from those of this color and returns them in store.
- *
+ *
* @param r
* @param g
* @param b
@@ -545,7 +546,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Decrements the values of this color by the given r, g, b and a values.
- *
+ *
* @param r
* @param g
* @param b
@@ -558,7 +559,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Subtracts the values of the given source color from those of this color and returns them in store.
- *
+ *
* @param source
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
@@ -573,7 +574,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Decrements the values of this color by the r, g, b and a values from the given source color.
- *
+ *
* @param source
* @return this color for chaining
* @throws NullPointerException
@@ -585,7 +586,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Multiplies the values of this color by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
@@ -603,10 +604,10 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Internally modifies the values of this color by multiplying them each by the given scalar value.
- *
+ *
* @param scalar
* @return this color for chaining
- *
+ *
* .
*/
public ColorRGBA multiplyLocal(final float scalar) {
@@ -615,7 +616,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Multiplies the values of this color by the given scalar value and returns the result in store.
- *
+ *
* @param scale
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
@@ -634,18 +635,18 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Internally modifies the values of this color by multiplying them each by the given scale values.
- *
+ *
* @param scale
* @return this color for chaining
*/
public ColorRGBA multiplyLocal(final ReadOnlyColorRGBA scale) {
- return set(getRed() * scale.getRed(), getGreen() * scale.getGreen(), getBlue() * scale.getBlue(), getAlpha()
- * scale.getAlpha());
+ return set(getRed() * scale.getRed(), getGreen() * scale.getGreen(), getBlue() * scale.getBlue(),
+ getAlpha() * scale.getAlpha());
}
/**
* Divides the values of this color by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
@@ -663,7 +664,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Internally modifies the values of this color by dividing them each by the given scalar value.
- *
+ *
* @param scalar
* @return this color for chaining
* @throws ArithmeticException
@@ -677,7 +678,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Divides the values of this color by the given scale values and returns the result in store.
- *
+ *
* @param scale
* @param store
* the color to store the result in for return. If null, a new color object is created and returned.
@@ -696,20 +697,20 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Internally modifies the values of this color by dividing them each by the given scale values.
- *
+ *
* @param scale
* @return this color for chaining
*/
public ColorRGBA divideLocal(final ReadOnlyColorRGBA scale) {
- return set(getRed() / scale.getRed(), getGreen() / scale.getGreen(), getBlue() / scale.getBlue(), getAlpha()
- / scale.getAlpha());
+ return set(getRed() / scale.getRed(), getGreen() / scale.getGreen(), getBlue() / scale.getBlue(),
+ getAlpha() / scale.getAlpha());
}
/**
* Performs a linear interpolation between this color and the given end color, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the current value of this color and if it is
* closer to 1, the result will be closer to the end value.
- *
+ *
* @param endColor
* @param scalar
* @param store
@@ -736,7 +737,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
* Performs a linear interpolation between this color and the given end color, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the current value of this color and if it is
* closer to 1, the result will be closer to the end value. The result is stored back in this color.
- *
+ *
* @param endColor
* @param scalar
* @return this color for chaining
@@ -755,7 +756,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
* Performs a linear interpolation between the given begin and end colors, using the given scalar as a percent. iow,
* if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the result
* will be closer to the end value.
- *
+ *
* @param beginColor
* @param endColor
* @param scalar
@@ -784,7 +785,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
* Performs a linear interpolation between the given begin and end colors, using the given scalar as a percent. iow,
* if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the result
* will be closer to the end value. The result is stored back in this color.
- *
+ *
* @param beginColor
* @param endColor
* @param changeAmnt
@@ -793,7 +794,8 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
* @throws NullPointerException
* if beginVec or endVec are null.
*/
- public ColorRGBA lerpLocal(final ReadOnlyColorRGBA beginColor, final ReadOnlyColorRGBA endColor, final float scalar) {
+ public ColorRGBA lerpLocal(final ReadOnlyColorRGBA beginColor, final ReadOnlyColorRGBA endColor,
+ final float scalar) {
setRed((1.0f - scalar) * beginColor.getRed() + scalar * endColor.getRed());
setGreen((1.0f - scalar) * beginColor.getGreen() + scalar * endColor.getGreen());
setBlue((1.0f - scalar) * beginColor.getBlue() + scalar * endColor.getBlue());
@@ -803,7 +805,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Check a color... if it is null or its values are NaN or infinite, return false. Else return true.
- *
+ *
* @param color
* the color to check
* @return true or false as stated above.
@@ -838,21 +840,8 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
*/
@Override
public int hashCode() {
- int result = 17;
-
- final int r = Float.floatToIntBits(getRed());
- result += 31 * result + r;
-
- final int g = Float.floatToIntBits(getGreen());
- result += 31 * result + g;
-
- final int b = Float.floatToIntBits(getBlue());
- result += 31 * result + b;
-
- final int a = Float.floatToIntBits(getAlpha());
- result += 31 * result + a;
-
- return result;
+ return Objects.hash(Float.valueOf(getRed()), Float.valueOf(getGreen()), Float.valueOf(getBlue()),
+ Float.valueOf(getAlpha()));
}
/**
@@ -913,7 +902,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -929,7 +918,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -961,7 +950,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
/**
* Releases a ColorRGBA back to be used by a future call to fetchTempInstance. TAKE CARE: this ColorRGBA object
* should no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param color
* the ColorRGBA to release.
*/
@@ -983,7 +972,7 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
* <li>6: RRGGBB - RGB is parsed as RR/255, GG/255, BB/255, A=1</li>
* <li>8: RRGGBBAA - RGBA is parsed as RR/255, GG/255, BB/255, AA/255</li>
* </ul>
- *
+ *
* @param colorString
* @param store
* @return
@@ -1030,8 +1019,8 @@ public class ColorRGBA implements Cloneable, Savable, Externalizable, ReadOnlyCo
b = Integer.parseInt(colorString.substring(5, 7), 16) / 255f;
a = Integer.parseInt(colorString.substring(7, 9), 16) / 255f;
} else {
- throw new IllegalArgumentException("unsupported value, must be 1, 2, 3, 4, 5, 7 or 9 hexvalues: "
- + colorString);
+ throw new IllegalArgumentException(
+ "unsupported value, must be 1, 2, 3, 4, 5, 7 or 9 hexvalues: " + colorString);
}
rVal.set(r, g, b, a);
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java b/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java
index 409268a..3e4fbbf 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Line3Base.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyVector3;
import com.ardor3d.util.export.InputCapsule;
@@ -46,7 +47,7 @@ public abstract class Line3Base implements Savable, Externalizable {
/**
* Sets the line's origin point to the values of the given vector.
- *
+ *
* @param origin
* @throws NullPointerException
* if normal is null.
@@ -57,7 +58,7 @@ public abstract class Line3Base implements Savable, Externalizable {
/**
* Sets the line's direction to the values of the given vector.
- *
+ *
* @param direction
* @throws NullPointerException
* if direction is null.
@@ -72,12 +73,7 @@ public abstract class Line3Base implements Savable, Externalizable {
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _origin.hashCode();
- result += 31 * result + _direction.hashCode();
-
- return result;
+ return Objects.hash(getOrigin(), getDirection());
}
// /////////////////
@@ -107,7 +103,7 @@ public abstract class Line3Base implements Savable, Externalizable {
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -121,7 +117,7 @@ public abstract class Line3Base implements Savable, Externalizable {
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java b/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java
index aa62875..8005268 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/LineSegment3.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -13,6 +13,7 @@ package com.ardor3d.math;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyLineSegment3;
import com.ardor3d.math.type.ReadOnlyVector3;
@@ -42,7 +43,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Copy constructor.
- *
+ *
* @param source
* the line segment to copy from.
*/
@@ -52,7 +53,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Constructs a new segment segment using the supplied origin point, unit length direction vector and extent
- *
+ *
* @param origin
* @param direction
* - unit length
@@ -65,7 +66,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Constructs a new segment segment using the supplied start and end points
- *
+ *
* @param start
* @param end
*/
@@ -79,7 +80,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Copies the values of the given source segment into this segment.
- *
+ *
* @param source
* @return this segment for chaining
* @throws NullPointerException
@@ -101,7 +102,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Sets the segment's extent to the provided value.
- *
+ *
* @param extent
*/
public void setExtent(final double extent) {
@@ -170,7 +171,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
}
/**
- *
+ *
* @param position
* a random position lying somewhere on this line segment.
*/
@@ -191,7 +192,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Check a segment... if it is null or the values of its origin or direction or extent are NaN or infinite, return
* false. Else return true.
- *
+ *
* @param segment
* the segment to check
* @return true or false as stated above.
@@ -237,14 +238,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _origin.hashCode();
- result += 31 * result + _direction.hashCode();
- final long ex = Double.doubleToLongBits(_extent);
- result += 31 * result + (int) (ex ^ ex >>> 32);
-
- return result;
+ return Objects.hash(getOrigin(), getDirection(), Double.valueOf(getExtent()));
}
// /////////////////
@@ -278,7 +272,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -292,7 +286,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -322,7 +316,7 @@ public class LineSegment3 extends Line3Base implements ReadOnlyLineSegment3, Poo
/**
* Releases a LineSegment3 back to be used by a future call to fetchTempInstance. TAKE CARE: this LineSegment3
* object should no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param segment
* the LineSegment3 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java
index 78a9b16..702a467 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix3.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -17,6 +17,7 @@ import java.io.ObjectOutput;
import java.nio.BufferOverflowException;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyMatrix3;
import com.ardor3d.math.type.ReadOnlyQuaternion;
@@ -27,7 +28,7 @@ import com.ardor3d.util.export.Savable;
/**
* Matrix3 represents a double precision 3x3 matrix.
- *
+ *
* Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java.
*/
public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatrix3, Poolable {
@@ -61,7 +62,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Constructs a new, mutable matrix using the given matrix values (names are mRC = m[ROW][COL])
- *
+ *
* @param m00
* @param m01
* @param m02
@@ -88,7 +89,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Constructs a new, mutable matrix using the values from the given matrix
- *
+ *
* @param source
*/
public Matrix3(final ReadOnlyMatrix3 source) {
@@ -235,7 +236,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Same as set(IDENTITY)
- *
+ *
* @return this matrix for chaining
*/
public Matrix3 setIdentity() {
@@ -252,7 +253,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the value of this matrix at row, column to the given value.
- *
+ *
* @param row
* @param column
* @param value
@@ -319,7 +320,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values given.
- *
+ *
* @param m00
* @param m01
* @param m02
@@ -349,7 +350,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values of the provided source matrix.
- *
+ *
* @param source
* @return this matrix for chaining
* @throws NullPointerException
@@ -373,7 +374,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the rotational value of the given quaternion.
- *
+ *
* @param quaternion
* @return this matrix for chaining
*/
@@ -425,7 +426,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to read our matrix data from.
* @return this matrix for chaining.
@@ -436,7 +437,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to read our matrix data from.
* @param rowMajor
@@ -471,7 +472,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values of the provided double array.
- *
+ *
* @param source
* @return this matrix for chaining
* @throws NullPointerException
@@ -485,7 +486,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values of the provided double array.
- *
+ *
* @param source
* @param rowMajor
* @return this matrix for chaining
@@ -521,7 +522,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Replaces a column in this matrix with the values of the given vector.
- *
+ *
* @param columnIndex
* @param columnData
* @return this matrix for chaining
@@ -555,7 +556,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Replaces a row in this matrix with the values of the given vector.
- *
+ *
* @param rowIndex
* @param rowData
* @return this matrix for chaining
@@ -589,7 +590,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Set the values of this matrix from the axes (columns) provided.
- *
+ *
* @param uAxis
* @param vAxis
* @param wAxis
@@ -607,7 +608,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets this matrix to the rotation indicated by the given angle and axis of rotation. Note: This method creates an
* object, so use fromAngleNormalAxis when possible, particularly if your axis is already normalized.
- *
+ *
* @param angle
* the angle to rotate (in radians).
* @param axis
@@ -626,7 +627,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets this matrix to the rotation indicated by the given angle and a unit-length axis of rotation.
- *
+ *
* @param angle
* the angle to rotate (in radians).
* @param axis
@@ -665,11 +666,11 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* XXX: Need to redo this again... or at least correct the terms. YRP are arbitrary terms, based on a specific frame
* of axis.
- *
+ *
* Updates this matrix from the given Euler rotation angles (y,r,p). Note that we are applying in order: roll,
* pitch, yaw but we've ordered them in x, y, and z for convenience. See:
* http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToMatrix/index.htm
- *
+ *
* @param yaw
* the Euler yaw of rotation (in radians). (aka Bank, often rot around x)
* @param roll
@@ -700,8 +701,8 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
public Matrix3 applyRotation(final double angle, final double x, final double y, final double z) {
final double m00 = _m00, m01 = _m01, m02 = _m02, //
- m10 = _m10, m11 = _m11, m12 = _m12, //
- m20 = _m20, m21 = _m21, m22 = _m22;
+ m10 = _m10, m11 = _m11, m12 = _m12, //
+ m20 = _m20, m21 = _m21, m22 = _m22;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -740,14 +741,14 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Apply rotation around X (Mrx * this)
- *
+ *
* @param angle
* @return
*/
public Matrix3 applyRotationX(final double angle) {
final double m01 = _m01, m02 = _m02, //
- m11 = _m11, m12 = _m12, //
- m21 = _m21, m22 = _m22;
+ m11 = _m11, m12 = _m12, //
+ m21 = _m21, m22 = _m22;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -766,14 +767,14 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Apply rotation around Y (Mry * this)
- *
+ *
* @param angle
* @return
*/
public Matrix3 applyRotationY(final double angle) {
final double m00 = _m00, m02 = _m02, //
- m10 = _m10, m12 = _m12, //
- m20 = _m20, m22 = _m22;
+ m10 = _m10, m12 = _m12, //
+ m20 = _m20, m22 = _m22;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -792,14 +793,14 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Apply rotation around Z (Mrz * this)
- *
+ *
* @param angle
* @return
*/
public Matrix3 applyRotationZ(final double angle) {
final double m00 = _m00, m01 = _m01, //
- m10 = _m10, m11 = _m11, //
- m20 = _m20, m21 = _m21;
+ m10 = _m10, m11 = _m11, //
+ m20 = _m20, m21 = _m21;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -946,7 +947,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer
* position.
@@ -963,7 +964,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer
* position.
@@ -1060,7 +1061,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* converts this matrix to Euler rotation angles (yaw, roll, pitch). See
* http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm
- *
+ *
* @param store
* the double[] array to store the computed angles in. If null, a new double[] will be created
* @return the double[] array.
@@ -1141,7 +1142,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies this matrix by the diagonal matrix formed by the given vector (v^D * M). If supplied, the result is
* stored into the supplied "store" matrix.
- *
+ *
* @param vec
* @param store
* a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for
@@ -1168,7 +1169,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies this matrix by the diagonal matrix formed by the given vector (M * v^D). If supplied, the result is
* stored into the supplied "store" matrix.
- *
+ *
* @param vec
* @param store
* a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for
@@ -1194,7 +1195,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Internally scales all values of this matrix by the given scalar.
- *
+ *
* @param scalar
* @return this matrix for chaining.
*/
@@ -1243,7 +1244,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Internally adds the values of the given matrix to this matrix.
- *
+ *
* @param matrix
* the matrix to add to this.
* @return this matrix for chaining
@@ -1286,7 +1287,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Internally subtracts the values of the given matrix from this matrix.
- *
+ *
* @param matrix
* the matrix to subtract from this.
* @return this matrix for chaining
@@ -1299,7 +1300,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Applies the given scale to this matrix and returns the result as a new matrix
- *
+ *
* @param scale
* @param store
* a matrix to store the result in. If store is null, a new matrix is created.
@@ -1322,7 +1323,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Applies the given scale to this matrix values internally
- *
+ *
* @param scale
* @return this matrix for chaining.
* @throws NullPointerException
@@ -1334,7 +1335,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* transposes this matrix as a new matrix, basically flipping it across the diagonal
- *
+ *
* @param store
* a matrix to store the result in. If store is null, a new matrix is created.
* @return this matrix for chaining.
@@ -1361,7 +1362,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* transposes this matrix in place
- *
+ *
* @return this matrix for chaining.
* @see <a href="http://en.wikipedia.org/wiki/Transpose">wikipedia.org-Transpose</a>
*/
@@ -1383,7 +1384,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
* a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for
* store == this.
* @return a matrix that represents this matrix, inverted.
- *
+ *
* if store is not null and is read only
* @throws ArithmeticException
* if this matrix can not be inverted.
@@ -1416,7 +1417,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Inverts this matrix locally.
- *
+ *
* @return this matrix inverted internally.
* @throws ArithmeticException
* if this matrix can not be inverted.
@@ -1471,7 +1472,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* A function for creating a rotation matrix that rotates a vector called "start" into another vector called "end".
- *
+ *
* @param start
* normalized non-zero starting vector
* @param end
@@ -1554,7 +1555,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies the given vector by this matrix (v * M). If supplied, the result is stored into the supplied "store"
* vector.
- *
+ *
* @param vec
* the vector to multiply this matrix by.
* @param store
@@ -1584,7 +1585,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store"
* vector.
- *
+ *
* @param vec
* the vector to multiply this matrix by.
* @param store
@@ -1613,7 +1614,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Modifies this matrix to equal the rotation required to point the z-axis at 'direction' and the y-axis to 'up'.
- *
+ *
* @param direction
* where to 'look' at
* @param up
@@ -1638,7 +1639,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Check a matrix... if it is null or its doubles are NaN or infinite, return false. Else return true.
- *
+ *
* @param matrix
* the vector to check
* @return true or false as stated above.
@@ -1704,7 +1705,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
*/
@Override
public String toString() {
- final StringBuffer result = new StringBuffer("com.ardor3d.math.Matrix3\n[\n");
+ final StringBuilder result = new StringBuilder("com.ardor3d.math.Matrix3\n[\n");
result.append(' ');
result.append(_m00);
result.append(' ');
@@ -1739,30 +1740,9 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
*/
@Override
public int hashCode() {
- int result = 17;
-
- long val = Double.doubleToLongBits(_m00);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m01);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m02);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- val = Double.doubleToLongBits(_m10);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m11);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m12);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- val = Double.doubleToLongBits(_m20);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m21);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m22);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- return result;
+ return Objects.hash(Double.valueOf(getM00()), Double.valueOf(getM01()), Double.valueOf(getM02()),
+ Double.valueOf(getM10()), Double.valueOf(getM11()), Double.valueOf(getM12()), Double.valueOf(getM20()),
+ Double.valueOf(getM21()), Double.valueOf(getM22()));
}
/**
@@ -1889,7 +1869,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -1910,7 +1890,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -1947,7 +1927,7 @@ public class Matrix3 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Releases a Matrix3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Matrix3 object should
* no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param mat
* the Matrix3 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java
index 8d21433..5579aac 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Matrix4.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -17,6 +17,7 @@ import java.io.ObjectOutput;
import java.nio.BufferOverflowException;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyMatrix3;
import com.ardor3d.math.type.ReadOnlyMatrix4;
@@ -30,7 +31,7 @@ import com.ardor3d.util.export.Savable;
/**
* Matrix4 represents a double precision 4x4 matrix and contains a flag, set at object creation, indicating if the given
* Matrix4 object is mutable.
- *
+ *
* Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java.
*/
public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatrix4, Poolable {
@@ -65,7 +66,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Constructs a new matrix set to the given matrix values. (names are mRC = m[ROW][COL])
- *
+ *
* @param m00
* @param m01
* @param m02
@@ -107,7 +108,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Constructs a new matrix set to the values of the given matrix.
- *
+ *
* @param source
*/
public Matrix4(final ReadOnlyMatrix4 source) {
@@ -336,7 +337,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Same as set(IDENTITY)
- *
+ *
* @return this matrix for chaining
*/
public Matrix4 setIdentity() {
@@ -353,7 +354,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the value of this matrix at row, column to the given value.
- *
+ *
* @param row
* @param column
* @param value
@@ -448,7 +449,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values given.
- *
+ *
* @param m00
* @param m01
* @param m02
@@ -493,7 +494,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values of the provided source matrix.
- *
+ *
* @param source
* @return this matrix for chaining
* @throws NullPointerException
@@ -525,7 +526,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the 3x3 rotation part of this matrix to the values of the provided source matrix.
- *
+ *
* @param source
* @return this matrix for chaining
* @throws NullPointerException
@@ -547,7 +548,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the rotational value of the given quaternion. Only modifies the 3x3 rotation
* part of this matrix.
- *
+ *
* @param quaternion
* @return this matrix for chaining
*/
@@ -613,7 +614,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to read our matrix data from.
* @return this matrix for chaining.
@@ -624,7 +625,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to read our matrix data from.
* @param rowMajor
@@ -673,7 +674,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values of the provided double array.
- *
+ *
* @param source
* @return this matrix for chaining
* @throws NullPointerException
@@ -687,7 +688,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the values of this matrix to the values of the provided double array.
- *
+ *
* @param source
* @param rowMajor
* @return this matrix for chaining
@@ -737,7 +738,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Replaces a column in this matrix with the values of the given array.
- *
+ *
* @param columnIndex
* @param columnData
* @return this matrix for chaining
@@ -782,7 +783,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Replaces a row in this matrix with the values of the given array.
- *
+ *
* @param rowIndex
* @param rowData
* @return this matrix for chaining
@@ -829,7 +830,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
* Sets the 3x3 rotation portion of this matrix to the rotation indicated by the given angle and axis of rotation.
* Note: This method creates an object, so use fromAngleNormalAxis when possible, particularly if your axis is
* already normalized.
- *
+ *
* @param angle
* the angle to rotate (in radians).
* @param axis
@@ -849,7 +850,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Sets the 3x3 rotation portion of this matrix to the rotation indicated by the given angle and a unit-length axis
* of rotation.
- *
+ *
* @param angle
* the angle to rotate (in radians).
* @param axis
@@ -887,9 +888,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
public Matrix4 applyRotation(final double angle, final double x, final double y, final double z) {
final double m00 = _m00, m01 = _m01, m02 = _m02, //
- m10 = _m10, m11 = _m11, m12 = _m12, //
- m20 = _m20, m21 = _m21, m22 = _m22, //
- m30 = _m30, m31 = _m31, m32 = _m32;
+ m10 = _m10, m11 = _m11, m12 = _m12, //
+ m20 = _m20, m21 = _m21, m22 = _m22, //
+ m30 = _m30, m31 = _m31, m32 = _m32;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -936,9 +937,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
public Matrix4 applyRotationX(final double angle) {
final double m01 = _m01, m02 = _m02, //
- m11 = _m11, m12 = _m12, //
- m21 = _m21, m22 = _m22, //
- m31 = _m31, m32 = _m32;
+ m11 = _m11, m12 = _m12, //
+ m21 = _m21, m22 = _m22, //
+ m31 = _m31, m32 = _m32;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -960,9 +961,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
public Matrix4 applyRotationY(final double angle) {
final double m00 = _m00, m02 = _m02, //
- m10 = _m10, m12 = _m12, //
- m20 = _m20, m22 = _m22, //
- m30 = _m30, m32 = _m32;
+ m10 = _m10, m12 = _m12, //
+ m20 = _m20, m22 = _m22, //
+ m30 = _m30, m32 = _m32;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -984,9 +985,9 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
public Matrix4 applyRotationZ(final double angle) {
final double m00 = _m00, m01 = _m01, //
- m10 = _m10, m11 = _m11, //
- m20 = _m20, m21 = _m21, //
- m30 = _m30, m31 = _m31;
+ m10 = _m10, m11 = _m11, //
+ m20 = _m20, m21 = _m21, //
+ m30 = _m30, m31 = _m31;
final double cosAngle = Math.cos(angle);
final double sinAngle = Math.sin(angle);
@@ -1008,7 +1009,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* M*T
- *
+ *
* @param x
* @param y
* @param z
@@ -1025,7 +1026,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* T*M
- *
+ *
* @param x
* @param y
* @param z
@@ -1200,7 +1201,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer
* @return matrix data as a FloatBuffer in row major order. The position is at the end of the inserted data.
@@ -1216,7 +1217,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Note: data is cast to floats.
- *
+ *
* @param store
* the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer
* @param rowMajor
@@ -1340,7 +1341,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies this matrix by the diagonal matrix formed by the given vector (v^D * M). If supplied, the result is
* stored into the supplied "store" matrix.
- *
+ *
* @param vec
* @param store
* a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for
@@ -1368,7 +1369,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies this matrix by the diagonal matrix formed by the given vector (M * v^D). If supplied, the result is
* stored into the supplied "store" matrix.
- *
+ *
* @param vec
* @param store
* a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for
@@ -1419,41 +1420,41 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
result = new Matrix4();
}
- final double temp00 = _m00 * matrix.getM00() + _m01 * matrix.getM10() + _m02 * matrix.getM20() + _m03
- * matrix.getM30();
- final double temp01 = _m00 * matrix.getM01() + _m01 * matrix.getM11() + _m02 * matrix.getM21() + _m03
- * matrix.getM31();
- final double temp02 = _m00 * matrix.getM02() + _m01 * matrix.getM12() + _m02 * matrix.getM22() + _m03
- * matrix.getM32();
- final double temp03 = _m00 * matrix.getM03() + _m01 * matrix.getM13() + _m02 * matrix.getM23() + _m03
- * matrix.getM33();
-
- final double temp10 = _m10 * matrix.getM00() + _m11 * matrix.getM10() + _m12 * matrix.getM20() + _m13
- * matrix.getM30();
- final double temp11 = _m10 * matrix.getM01() + _m11 * matrix.getM11() + _m12 * matrix.getM21() + _m13
- * matrix.getM31();
- final double temp12 = _m10 * matrix.getM02() + _m11 * matrix.getM12() + _m12 * matrix.getM22() + _m13
- * matrix.getM32();
- final double temp13 = _m10 * matrix.getM03() + _m11 * matrix.getM13() + _m12 * matrix.getM23() + _m13
- * matrix.getM33();
-
- final double temp20 = _m20 * matrix.getM00() + _m21 * matrix.getM10() + _m22 * matrix.getM20() + _m23
- * matrix.getM30();
- final double temp21 = _m20 * matrix.getM01() + _m21 * matrix.getM11() + _m22 * matrix.getM21() + _m23
- * matrix.getM31();
- final double temp22 = _m20 * matrix.getM02() + _m21 * matrix.getM12() + _m22 * matrix.getM22() + _m23
- * matrix.getM32();
- final double temp23 = _m20 * matrix.getM03() + _m21 * matrix.getM13() + _m22 * matrix.getM23() + _m23
- * matrix.getM33();
-
- final double temp30 = _m30 * matrix.getM00() + _m31 * matrix.getM10() + _m32 * matrix.getM20() + _m33
- * matrix.getM30();
- final double temp31 = _m30 * matrix.getM01() + _m31 * matrix.getM11() + _m32 * matrix.getM21() + _m33
- * matrix.getM31();
- final double temp32 = _m30 * matrix.getM02() + _m31 * matrix.getM12() + _m32 * matrix.getM22() + _m33
- * matrix.getM32();
- final double temp33 = _m30 * matrix.getM03() + _m31 * matrix.getM13() + _m32 * matrix.getM23() + _m33
- * matrix.getM33();
+ final double temp00 = _m00 * matrix.getM00() + _m01 * matrix.getM10() + _m02 * matrix.getM20()
+ + _m03 * matrix.getM30();
+ final double temp01 = _m00 * matrix.getM01() + _m01 * matrix.getM11() + _m02 * matrix.getM21()
+ + _m03 * matrix.getM31();
+ final double temp02 = _m00 * matrix.getM02() + _m01 * matrix.getM12() + _m02 * matrix.getM22()
+ + _m03 * matrix.getM32();
+ final double temp03 = _m00 * matrix.getM03() + _m01 * matrix.getM13() + _m02 * matrix.getM23()
+ + _m03 * matrix.getM33();
+
+ final double temp10 = _m10 * matrix.getM00() + _m11 * matrix.getM10() + _m12 * matrix.getM20()
+ + _m13 * matrix.getM30();
+ final double temp11 = _m10 * matrix.getM01() + _m11 * matrix.getM11() + _m12 * matrix.getM21()
+ + _m13 * matrix.getM31();
+ final double temp12 = _m10 * matrix.getM02() + _m11 * matrix.getM12() + _m12 * matrix.getM22()
+ + _m13 * matrix.getM32();
+ final double temp13 = _m10 * matrix.getM03() + _m11 * matrix.getM13() + _m12 * matrix.getM23()
+ + _m13 * matrix.getM33();
+
+ final double temp20 = _m20 * matrix.getM00() + _m21 * matrix.getM10() + _m22 * matrix.getM20()
+ + _m23 * matrix.getM30();
+ final double temp21 = _m20 * matrix.getM01() + _m21 * matrix.getM11() + _m22 * matrix.getM21()
+ + _m23 * matrix.getM31();
+ final double temp22 = _m20 * matrix.getM02() + _m21 * matrix.getM12() + _m22 * matrix.getM22()
+ + _m23 * matrix.getM32();
+ final double temp23 = _m20 * matrix.getM03() + _m21 * matrix.getM13() + _m22 * matrix.getM23()
+ + _m23 * matrix.getM33();
+
+ final double temp30 = _m30 * matrix.getM00() + _m31 * matrix.getM10() + _m32 * matrix.getM20()
+ + _m33 * matrix.getM30();
+ final double temp31 = _m30 * matrix.getM01() + _m31 * matrix.getM11() + _m32 * matrix.getM21()
+ + _m33 * matrix.getM31();
+ final double temp32 = _m30 * matrix.getM02() + _m31 * matrix.getM12() + _m32 * matrix.getM22()
+ + _m33 * matrix.getM32();
+ final double temp33 = _m30 * matrix.getM03() + _m31 * matrix.getM13() + _m32 * matrix.getM23()
+ + _m33 * matrix.getM33();
result._m00 = temp00;
result._m01 = temp01;
@@ -1477,7 +1478,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Internally scales all values of this matrix by the given scalar.
- *
+ *
* @param scalar
* @return this matrix for chaining.
*/
@@ -1541,7 +1542,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Internally adds the values of the given matrix to this matrix.
- *
+ *
* @param matrix
* the matrix to add to this.
* @return this matrix for chaining
@@ -1591,7 +1592,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Internally subtracts the values of the given matrix from this matrix.
- *
+ *
* @param matrix
* the matrix to subtract from this.
* @return this matrix for chaining
@@ -1604,7 +1605,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Applies the given scale to this matrix and returns the result as a new matrix
- *
+ *
* @param scale
* @param store
* a matrix to store the result in. If store is null, a new matrix is created.
@@ -1628,7 +1629,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Applies the given scale to this matrix values internally
- *
+ *
* @param scale
* @return this matrix for chaining.
* @throws NullPointerException
@@ -1640,7 +1641,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* transposes this matrix as a new matrix, basically flipping it across the diagonal
- *
+ *
* @param store
* a matrix to store the result in. If store is null, a new matrix is created. It is NOT safe for store
* to == this.
@@ -1676,7 +1677,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* transposes this matrix in place
- *
+ *
* @return this matrix for chaining.
* @see <a href="http://en.wikipedia.org/wiki/Transpose">wikipedia.org-Transpose</a>
*/
@@ -1761,7 +1762,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* inverts this matrix locally.
- *
+ *
* @return this matrix inverted internally.
* @throws ArithmeticException
* if this matrix can not be inverted.
@@ -1846,7 +1847,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies the given vector by this matrix (v * M). If supplied, the result is stored into the supplied "store"
* vector.
- *
+ *
* @param vector
* the vector to multiply this matrix by.
* @param store
@@ -1878,7 +1879,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store"
* vector.
- *
+ *
* @param vector
* the vector to multiply this matrix by.
* @param store
@@ -1910,7 +1911,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies the given point by this matrix (M * p). If supplied, the result is stored into the supplied "store"
* vector.
- *
+ *
* @param point
* the point to multiply against this matrix.
* @param store
@@ -1940,7 +1941,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store"
* vector.
- *
+ *
* @param vector
* the vector to multiply this matrix by.
* @param store
@@ -1969,7 +1970,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Check a matrix... if it is null or its doubles are NaN or infinite, return false. Else return true.
- *
+ *
* @param matrix
* the vector to check
* @return true or false as stated above.
@@ -2098,7 +2099,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
*/
@Override
public String toString() {
- final StringBuffer result = new StringBuffer("com.ardor3d.math.Matrix4\n[\n");
+ final StringBuilder result = new StringBuilder("com.ardor3d.math.Matrix4\n[\n");
result.append(' ');
result.append(_m00);
result.append(' ');
@@ -2149,45 +2150,11 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
*/
@Override
public int hashCode() {
- int result = 17;
-
- long val = Double.doubleToLongBits(_m00);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m01);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m02);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m03);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- val = Double.doubleToLongBits(_m10);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m11);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m12);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m13);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- val = Double.doubleToLongBits(_m20);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m21);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m22);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m23);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- val = Double.doubleToLongBits(_m30);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m31);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m32);
- result += 31 * result + (int) (val ^ val >>> 32);
- val = Double.doubleToLongBits(_m33);
- result += 31 * result + (int) (val ^ val >>> 32);
-
- return result;
+ return Objects.hash(Double.valueOf(getM00()), Double.valueOf(getM01()), Double.valueOf(getM02()),
+ Double.valueOf(getM03()), Double.valueOf(getM10()), Double.valueOf(getM11()), Double.valueOf(getM12()),
+ Double.valueOf(getM13()), Double.valueOf(getM20()), Double.valueOf(getM21()), Double.valueOf(getM22()),
+ Double.valueOf(getM23()), Double.valueOf(getM30()), Double.valueOf(getM31()), Double.valueOf(getM32()),
+ Double.valueOf(getM33()));
}
/**
@@ -2356,7 +2323,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -2384,7 +2351,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -2428,7 +2395,7 @@ public class Matrix4 implements Cloneable, Savable, Externalizable, ReadOnlyMatr
/**
* Releases a Matrix4 back to be used by a future call to fetchTempInstance. TAKE CARE: this Matrix4 object should
* no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param mat
* the Matrix4 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java b/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java
index 2c2110b..1defcba 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/ObjectPool.java
@@ -24,7 +24,7 @@ public abstract class ObjectPool<T extends Poolable> {
private final ThreadLocal<List<T>> _pool = new ThreadLocal<List<T>>() {
@Override
protected List<T> initialValue() {
- return new ArrayList<T>(_maxSize);
+ return new ArrayList<>(_maxSize);
}
};
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java b/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java
index 7567310..1b73217 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Plane.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyPlane;
import com.ardor3d.math.type.ReadOnlyVector3;
@@ -48,7 +49,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Copy constructor.
- *
+ *
* @param source
* the plane to copy from.
*/
@@ -58,7 +59,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Constructs a new plane using the supplied normal vector and plane constant
- *
+ *
* @param normal
* @param constant
*/
@@ -73,7 +74,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
}
/**
- *
+ *
* @return normal as a readable vector
*/
@Override
@@ -83,7 +84,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Sets the value of this plane to the constant and normal values of the provided source plane.
- *
+ *
* @param source
* @return this plane for chaining
* @throws NullPointerException
@@ -97,7 +98,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Sets the constant value of this plane to the given double value.
- *
+ *
* @param constant
*/
public void setConstant(final double constant) {
@@ -106,7 +107,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Sets the plane normal to the values of the given vector.
- *
+ *
* @param normal
* @throws NullPointerException
* if normal is null.
@@ -148,7 +149,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Sets this plane to the plane defined by the given three points.
- *
+ *
* @param pointA
* @param pointB
* @param pointC
@@ -156,7 +157,8 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
* @throws NullPointerException
* if one or more of the points are null.
*/
- public Plane setPlanePoints(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB, final ReadOnlyVector3 pointC) {
+ public Plane setPlanePoints(final ReadOnlyVector3 pointA, final ReadOnlyVector3 pointB,
+ final ReadOnlyVector3 pointC) {
_normal.set(pointB).subtractLocal(pointA);
_normal.crossLocal(pointC.getX() - pointA.getX(), pointC.getY() - pointA.getY(), pointC.getZ() - pointA.getZ())
.normalizeLocal();
@@ -166,7 +168,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Reflects an incoming vector across the normal of this Plane.
- *
+ *
* @param unitVector
* the incoming vector. Must be a unit vector.
* @param store
@@ -189,7 +191,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Check a plane... if it is null or its constant, or the doubles of its normal are NaN or infinite, return false.
* Else return true.
- *
+ *
* @param plane
* the plane to check
* @return true or false as stated above.
@@ -219,14 +221,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _normal.hashCode();
-
- final long c = Double.doubleToLongBits(getConstant());
- result += 31 * result + (int) (c ^ c >>> 32);
-
- return result;
+ return Objects.hash(getNormal(), Double.valueOf(getConstant()));
}
/**
@@ -282,7 +277,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -296,7 +291,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -326,7 +321,7 @@ public class Plane implements Cloneable, Savable, Externalizable, ReadOnlyPlane,
/**
* Releases a Plane back to be used by a future call to fetchTempInstance. TAKE CARE: this Plane object should no
* longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param plane
* the Plane to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java b/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java
index 7cb1b3b..458fa78 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Quaternion.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyMatrix3;
import com.ardor3d.math.type.ReadOnlyQuaternion;
@@ -25,7 +26,7 @@ import com.ardor3d.util.export.Savable;
/**
* Quaternion represents a 4 value math object used in Ardor3D to describe rotations. It has the advantage of being able
* to avoid lock by adding a 4th dimension to rotation.
- *
+ *
* Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java.
*/
public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQuaternion, Poolable {
@@ -57,7 +58,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Constructs a new quaternion set to the (x, y, z, w) values of the given source quaternion.
- *
+ *
* @param source
*/
public Quaternion(final ReadOnlyQuaternion source) {
@@ -66,7 +67,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Constructs a new quaternion set to (x, y, z, w).
- *
+ *
* @param x
* @param y
* @param z
@@ -121,7 +122,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Stores the double values of this quaternion in the given double array as (x,y,z,w).
- *
+ *
* @param store
* The array in which to store the values of this quaternion. If null, a new double[4] array is created.
* @return the double array
@@ -143,7 +144,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the x component of this quaternion to the given double value.
- *
+ *
* @param x
*/
public void setX(final double x) {
@@ -152,7 +153,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the y component of this quaternion to the given double value.
- *
+ *
* @param y
*/
public void setY(final double y) {
@@ -161,7 +162,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the z component of this quaternion to the given double value.
- *
+ *
* @param z
*/
public void setZ(final double z) {
@@ -170,7 +171,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the w component of this quaternion to the given double value.
- *
+ *
* @param w
*/
public void setW(final double w) {
@@ -179,7 +180,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the value of this quaternion to (x, y, z, w)
- *
+ *
* @param x
* @param y
* @param z
@@ -196,7 +197,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the value of this quaternion to the (x, y, z, w) values of the provided source quaternion.
- *
+ *
* @param source
* @return this quaternion for chaining
* @throws NullPointerException
@@ -213,7 +214,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude,
* bank.
- *
+ *
* @param angles
* the Euler angles of rotation (in radians) stored as heading, attitude, and bank.
* @return this quaternion for chaining
@@ -229,7 +230,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude,
* bank.
- *
+ *
* @param heading
* the Euler heading angle in radians. (rotation about the y axis)
* @param attitude
@@ -237,8 +238,8 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* @param bank
* the Euler bank angle in radians. (rotation about the x axis)
* @return this quaternion for chaining
- * @see <a
- * href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm">euclideanspace.com-eulerToQuaternion</a>
+ * @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm">
+ * euclideanspace.com-eulerToQuaternion</a>
*/
public Quaternion fromEulerAngles(final double heading, final double attitude, final double bank) {
double angle = heading * 0.5;
@@ -269,14 +270,14 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Converts this quaternion to Euler rotation angles in radians (heading, attitude, bank).
- *
+ *
* @param store
* the double[] array to store the computed angles in. If null, a new double[] will be created
* @return the double[] array, filled with heading, attitude and bank in that order..
* @throws ArrayIndexOutOfBoundsException
* if non-null store is not at least length 3
- * @see <a
- * href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm">euclideanspace.com-quaternionToEuler</a>
+ * @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm">
+ * euclideanspace.com-quaternionToEuler</a>
* @see #fromEulerAngles(double, double, double)
*/
@Override
@@ -313,7 +314,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the value of this quaternion to the rotation described by the given matrix.
- *
+ *
* @param matrix
* @return this quaternion for chaining
* @throws NullPointerException
@@ -326,7 +327,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the value of this quaternion to the rotation described by the given matrix values.
- *
+ *
* @param m00
* @param m01
* @param m02
@@ -387,7 +388,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* @param store
* the matrix to store our result in. If null, a new matrix is created.
* @return the rotation matrix representation of this quaternion (normalized)
- *
+ *
* if store is not null and is read only.
*/
@Override
@@ -534,7 +535,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* Sets the values of this quaternion to the values represented by a given angle and axis of rotation. Note that
* this method creates an object, so use fromAngleNormalAxis if your axis is already normalized. If axis == 0,0,0
* the quaternion is set to identity.
- *
+ *
* @param angle
* the angle to rotate (in radians).
* @param axis
@@ -553,7 +554,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the values of this quaternion to the values represented by a given angle and unit length axis of rotation.
* If axis == 0,0,0 the quaternion is set to identity.
- *
+ *
* @param angle
* the angle to rotate (in radians).
* @param axis
@@ -578,7 +579,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Returns the rotation angle represented by this quaternion. If a non-null vector is provided, the axis of rotation
* is stored in that vector as well.
- *
+ *
* @param axisStore
* the object we'll store the computed axis in. If null, no computations are done to determine axis.
* @return the angle of rotation in radians.
@@ -610,7 +611,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets this quaternion to that which will rotate vector "from" into vector "to". from and to do not have to be the
* same length.
- *
+ *
* @param from
* the source vector to rotate
* @param to
@@ -696,7 +697,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* Calculates the <i>multiplicative inverse</i> <code>Q<sup>-1</sup></code> of this quaternion <code>Q</code> such
* that <code>QQ<sup>-1</sup> = [0,0,0,1]</code> (the identity quaternion). Note that for unit quaternions, a
* quaternion's inverse is equal to its (far easier to calculate) conjugate.
- *
+ *
* @param store
* the <code>Quaternion</code> to store the result in. If <code>null</code>, a new one is created.
* @see #conjugate(Quaternion)
@@ -719,9 +720,9 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* Locally sets this quaternion <code>Q</code> to its <i>multiplicative inverse</i> <code>Q<sup>-1</sup></code> such
* that <code>QQ<sup>-1</sup> = [0,0,0,1]</code> (the identity quaternion). Note that for unit quaternions, a
* quaternion's inverse is equal to its (far easier to calculate) conjugate.
- *
+ *
* @see #conjugate(Quaternion)
- *
+ *
* @return this <code>Quaternion</code> for chaining.
*/
public Quaternion invertLocal() {
@@ -736,7 +737,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Creates a new quaternion that is the conjugate <code>[-x, -y, -z, w]</code> of this quaternion.
- *
+ *
* @param store
* the <code>Quaternion</code> to store the result in. If <code>null</code>, a new one is created.
* @return the conjugate to this quaternion.
@@ -751,7 +752,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Internally sets this quaternion to its conjugate <code>[-x, -y, -z, w]</code>.
- *
+ *
* @return this <code>Quaternion</code> for chaining.
*/
public Quaternion conjugateLocal() {
@@ -760,7 +761,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Adds this quaternion to another and places the result in the given store.
- *
+ *
* @param quat
* @param store
* the Quaternion to store the result in. if null, a new one is created.
@@ -778,7 +779,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Internally increments the fields of this quaternion with the field values of the given quaternion.
- *
+ *
* @param quat
* @return this quaternion for chaining
*/
@@ -808,7 +809,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Internally decrements the fields of this quaternion by the field values of the given quaternion.
- *
+ *
* @param quat
* @return this quaternion for chaining.
*/
@@ -822,7 +823,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiplies each value of this quaternion by the given scalar value.
- *
+ *
* @param scalar
* the quaternion to multiply this quaternion by.
* @param store
@@ -841,7 +842,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiplies each value of this quaternion by the given scalar value. The result is stored in this quaternion.
- *
+ *
* @param scalar
* the quaternion to multiply this quaternion by.
* @return this quaternion for chaining.
@@ -857,15 +858,15 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiplies this quaternion by the supplied quaternion. The result is stored in the given store quaternion or a
* new quaternion if store is null.
- *
+ *
* It IS safe for quat and store to be the same object.
- *
+ *
* @param quat
* the quaternion to multiply this quaternion by.
* @param store
* the quaternion to store the result in.
* @return the new quaternion.
- *
+ *
* if the given store is read only.
*/
@Override
@@ -882,7 +883,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiplies this quaternion by the supplied quaternion. The result is stored locally.
- *
+ *
* @param quat
* The Quaternion to multiply this one by.
* @return this quaternion for chaining
@@ -895,7 +896,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiplies this quaternion by the supplied matrix. The result is stored locally.
- *
+ *
* @param matrix
* the matrix to apply to this quaternion.
* @return this quaternion for chaining
@@ -916,7 +917,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiplies this quaternion by the supplied quaternion values. The result is stored locally.
- *
+ *
* @param qx
* @param qy
* @param qz
@@ -934,7 +935,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Multiply this quaternion by a rotational quaternion made from the given angle and axis. The axis must be a
* normalized vector.
- *
+ *
* @param angle
* in radians
* @param x
@@ -968,7 +969,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Apply rotation around X
- *
+ *
* @param angle
* in radians
* @return this quaternion for chaining.
@@ -988,7 +989,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Apply rotation around Y
- *
+ *
* @param angle
* in radians
* @return this quaternion for chaining.
@@ -1008,7 +1009,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Apply rotation around Z
- *
+ *
* @param angle
* in radians
* @return this quaternion for chaining.
@@ -1028,7 +1029,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Rotates the given vector by this quaternion. If supplied, the result is stored into the supplied "store" vector.
- *
+ *
* @param vec
* the vector to multiply this quaternion by.
* @param store
@@ -1037,7 +1038,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* @return the store vector, or a new vector if store is null.
* @throws NullPointerException
* if vec is null
- *
+ *
* if the given store is read only.
*/
@Override
@@ -1048,15 +1049,15 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
if (vec.equals(Vector3.ZERO)) {
store.set(0, 0, 0);
} else {
- final double x = getW() * getW() * vec.getX() + 2 * getY() * getW() * vec.getZ() - 2 * getZ() * getW()
- * vec.getY() + getX() * getX() * vec.getX() + 2 * getY() * getX() * vec.getY() + 2 * getZ()
- * getX() * vec.getZ() - getZ() * getZ() * vec.getX() - getY() * getY() * vec.getX();
- final double y = 2 * getX() * getY() * vec.getX() + getY() * getY() * vec.getY() + 2 * getZ() * getY()
- * vec.getZ() + 2 * getW() * getZ() * vec.getX() - getZ() * getZ() * vec.getY() + getW() * getW()
- * vec.getY() - 2 * getX() * getW() * vec.getZ() - getX() * getX() * vec.getY();
- final double z = 2 * getX() * getZ() * vec.getX() + 2 * getY() * getZ() * vec.getY() + getZ() * getZ()
- * vec.getZ() - 2 * getW() * getY() * vec.getX() - getY() * getY() * vec.getZ() + 2 * getW()
- * getX() * vec.getY() - getX() * getX() * vec.getZ() + getW() * getW() * vec.getZ();
+ final double x = getW() * getW() * vec.getX() + 2 * getY() * getW() * vec.getZ()
+ - 2 * getZ() * getW() * vec.getY() + getX() * getX() * vec.getX() + 2 * getY() * getX() * vec.getY()
+ + 2 * getZ() * getX() * vec.getZ() - getZ() * getZ() * vec.getX() - getY() * getY() * vec.getX();
+ final double y = 2 * getX() * getY() * vec.getX() + getY() * getY() * vec.getY()
+ + 2 * getZ() * getY() * vec.getZ() + 2 * getW() * getZ() * vec.getX() - getZ() * getZ() * vec.getY()
+ + getW() * getW() * vec.getY() - 2 * getX() * getW() * vec.getZ() - getX() * getX() * vec.getY();
+ final double z = 2 * getX() * getZ() * vec.getX() + 2 * getY() * getZ() * vec.getY()
+ + getZ() * getZ() * vec.getZ() - 2 * getW() * getY() * vec.getX() - getY() * getY() * vec.getZ()
+ + 2 * getW() * getX() * vec.getY() - getX() * getX() * vec.getZ() + getW() * getW() * vec.getZ();
store.set(x, y, z);
}
return store;
@@ -1066,7 +1067,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
* Updates this quaternion to represent a rotation formed by the given three axes. These axes are assumed to be
* orthogonal and no error checking is applied. It is the user's job to insure that the three axes being provided
* indeed represent a proper right handed coordinate system.
- *
+ *
* @param xAxis
* vector representing the x-axis of the coordinate system.
* @param yAxis
@@ -1082,7 +1083,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Converts this quaternion to a rotation matrix and then extracts rotation axes.
- *
+ *
* @param axes
* the array of vectors to be filled.
* @throws ArrayIndexOutOfBoundsException
@@ -1102,7 +1103,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change
* amount.
- *
+ *
* @param endQuat
* @param changeAmnt
* @param store
@@ -1118,7 +1119,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change
* amount. Stores the results locally in this quaternion.
- *
+ *
* @param endQuat
* @param changeAmnt
* @return this quaternion for chaining.
@@ -1130,7 +1131,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Does a spherical linear interpolation between the given start and end quaternions by the given change amount.
* Returns the result as a new quaternion.
- *
+ *
* @param startQuat
* @param endQuat
* @param changeAmnt
@@ -1198,7 +1199,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Does a spherical linear interpolation between the given start and end quaternions by the given change amount.
* Stores the result locally.
- *
+ *
* @param startQuat
* @param endQuat
* @param changeAmnt
@@ -1264,7 +1265,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Does a spherical linear interpolation between the given start and end quaternions by the given change amount.
* Stores the result locally.
- *
+ *
* @param startQuat
* @param endQuat
* @param changeAmnt
@@ -1283,7 +1284,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Modifies this quaternion to equal the rotation required to point the z-axis at 'direction' and the y-axis to
* 'up'.
- *
+ *
* @param direction
* where to 'look' at
* @param up
@@ -1351,7 +1352,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Sets the value of this quaternion to (0, 0, 0, 1). Equivalent to calling set(0, 0, 0, 1)
- *
+ *
* @return this quaternion for chaining
*/
public Quaternion setIdentity() {
@@ -1368,7 +1369,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Check a quaternion... if it is null or its doubles are NaN or infinite, return false. Else return true.
- *
+ *
* @param quat
* the quaternion to check
* @return true or false as stated above.
@@ -1406,21 +1407,8 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
*/
@Override
public int hashCode() {
- int result = 17;
-
- final long x = Double.doubleToLongBits(getX());
- result += 31 * result + (int) (x ^ x >>> 32);
-
- final long y = Double.doubleToLongBits(getY());
- result += 31 * result + (int) (y ^ y >>> 32);
-
- final long z = Double.doubleToLongBits(getZ());
- result += 31 * result + (int) (z ^ z >>> 32);
-
- final long w = Double.doubleToLongBits(getW());
- result += 31 * result + (int) (w ^ w >>> 32);
-
- return result;
+ return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()), Double.valueOf(getZ()),
+ Double.valueOf(getW()));
}
/**
@@ -1500,7 +1488,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -1516,7 +1504,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -1548,7 +1536,7 @@ public class Quaternion implements Cloneable, Savable, Externalizable, ReadOnlyQ
/**
* Releases a Quaternion back to be used by a future call to fetchTempInstance. TAKE CARE: this Quaternion object
* should no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param mat
* the Quaternion to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java
index ced2fe8..36b1655 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle2.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyRectangle2;
import com.ardor3d.util.export.InputCapsule;
@@ -46,7 +47,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Constructor creates a new <code>Rectangle2</code> with using the given x,y,width and height values.
- *
+ *
*/
public Rectangle2(final int x, final int y, final int width, final int height) {
setX(x);
@@ -57,7 +58,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Constructor creates a new <code>Rectangle2</code> using the values of the provided source rectangle.
- *
+ *
* @param source
* the rectangle to copy from
*/
@@ -167,14 +168,8 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _x;
- result += 31 * result + _y;
- result += 31 * result + _width;
- result += 31 * result + _height;
-
- return result;
+ return Objects.hash(Integer.valueOf(getX()), Integer.valueOf(getY()), Integer.valueOf(getWidth()),
+ Integer.valueOf(getHeight()));
}
/**
@@ -235,7 +230,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -251,7 +246,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -283,7 +278,7 @@ public class Rectangle2 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Releases a Rectangle2 back to be used by a future call to fetchTempInstance. TAKE CARE: this object should no
* longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param rectangle
* the Rectangle2 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java
index be10f94..8a2f9ee 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Rectangle3.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyRectangle3;
import com.ardor3d.math.type.ReadOnlyVector3;
@@ -43,7 +44,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Constructor creates a new Rectangle3 using the values of the provided source rectangle.
- *
+ *
* @param source
* the rectangle to copy from
*/
@@ -53,7 +54,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Constructor creates a new Rectangle3 with defined A, B, and C points that define the area of the rectangle.
- *
+ *
* @param a
* the first corner of the rectangle.
* @param b
@@ -69,7 +70,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Copy the value of the given source Rectangle3 into this Rectangle3.
- *
+ *
* @param source
* the source of the data to copy.
* @return this rectangle for chaining
@@ -85,7 +86,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* getA returns the first point of the rectangle.
- *
+ *
* @return the first point of the rectangle.
*/
@Override
@@ -95,7 +96,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* setA sets the first point of the rectangle.
- *
+ *
* @param a
* the first point of the rectangle.
*/
@@ -105,7 +106,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* getB returns the second point of the rectangle.
- *
+ *
* @return the second point of the rectangle.
*/
@Override
@@ -115,7 +116,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* setB sets the second point of the rectangle.
- *
+ *
* @param b
* the second point of the rectangle.
*/
@@ -125,7 +126,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* getC returns the third point of the rectangle.
- *
+ *
* @return the third point of the rectangle.
*/
@Override
@@ -135,7 +136,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* setC sets the third point of the rectangle.
- *
+ *
* @param c
* the third point of the rectangle.
*/
@@ -145,7 +146,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* random returns a random point within the plane defined by: A, B, C, and (B + C) - A.
- *
+ *
* @param result
* Vector to store result in
* @return a random point within the rectangle.
@@ -184,13 +185,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _a.hashCode();
- result += 31 * result + _b.hashCode();
- result += 31 * result + _c.hashCode();
-
- return result;
+ return Objects.hash(getA(), getB(), getC());
}
/**
@@ -248,7 +243,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -263,7 +258,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -294,7 +289,7 @@ public class Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyR
/**
* Releases a Rectangle3 back to be used by a future call to fetchTempInstance. TAKE CARE: this object should no
* longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param rectangle
* the Rectangle3 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java b/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java
index d734003..aca8ded 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Ring.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyRing;
import com.ardor3d.math.type.ReadOnlyVector3;
@@ -46,7 +47,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Copy constructor.
- *
+ *
* @param source
* the ring to copy from.
*/
@@ -56,7 +57,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Constructor creates a new <code>Ring</code> with defined center point, up vector, and inner and outer radii.
- *
+ *
* @param center
* the center of the ring.
* @param up
@@ -76,7 +77,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Copy the value of the given source Ring into this Ring.
- *
+ *
* @param source
* the source of the data to copy.
* @return this ring for chaining
@@ -93,7 +94,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>getCenter</code> returns the center of the ring.
- *
+ *
* @return the center of the ring.
*/
@Override
@@ -103,7 +104,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>setCenter</code> sets the center of the ring.
- *
+ *
* @param center
* the center of the ring.
*/
@@ -113,7 +114,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>getUp</code> returns the ring's up vector.
- *
+ *
* @return the ring's up vector.
*/
@Override
@@ -123,7 +124,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>setUp</code> sets the ring's up vector.
- *
+ *
* @param up
* the ring's up vector.
*/
@@ -133,7 +134,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>getInnerRadius</code> returns the ring's inner radius.
- *
+ *
* @return the ring's inner radius.
*/
@Override
@@ -143,7 +144,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>setInnerRadius</code> sets the ring's inner radius.
- *
+ *
* @param innerRadius
* the ring's inner radius.
*/
@@ -153,7 +154,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>getOuterRadius</code> returns the ring's outer radius.
- *
+ *
* @return the ring's outer radius.
*/
@Override
@@ -163,7 +164,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* <code>setOuterRadius</code> sets the ring's outer radius.
- *
+ *
* @param outerRadius
* the ring's outer radius.
*/
@@ -172,9 +173,9 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
}
/**
- *
+ *
* <code>random</code> returns a random point within the ring.
- *
+ *
* @param store
* Vector to store result in
* @return a random point within the ring.
@@ -213,7 +214,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Check a ring... if it is null or its radii, or the doubles of its center or up are NaN or infinite, return false.
* Else return true.
- *
+ *
* @param ring
* the ring to check
* @return true or false as stated above.
@@ -247,18 +248,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _center.hashCode();
- result += 31 * result + _up.hashCode();
-
- final long ir = Double.doubleToLongBits(getInnerRadius());
- result += 31 * result + (int) (ir ^ ir >>> 32);
-
- final long or = Double.doubleToLongBits(getOuterRadius());
- result += 31 * result + (int) (or ^ or >>> 32);
-
- return result;
+ return Objects.hash(getCenter(), getUp(), Double.valueOf(getInnerRadius()), Double.valueOf(getOuterRadius()));
}
/**
@@ -320,7 +310,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -336,7 +326,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -368,7 +358,7 @@ public class Ring implements Cloneable, Savable, Externalizable, ReadOnlyRing, P
/**
* Releases a Ring back to be used by a future call to fetchTempInstance. TAKE CARE: this Ring object should no
* longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param ring
* the Ring to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java b/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java
index 47d0a88..629d035 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Transform.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -16,6 +16,7 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyMatrix3;
import com.ardor3d.math.type.ReadOnlyMatrix4;
@@ -78,7 +79,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Constructs a new Transform object from the information stored in the given source Transform.
- *
+ *
* @param source
* @throws NullPointerException
* if source is null.
@@ -96,7 +97,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Internal only constructor, generally used for making an immutable transform.
- *
+ *
* @param matrix
* @param scale
* @param translation
@@ -158,7 +159,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Resets this transform to identity and resets all flags.
- *
+ *
* @return this Transform for chaining.
*/
public Transform setIdentity() {
@@ -173,10 +174,10 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the matrix portion of this transform to the given value.
- *
+ *
* NB: Calling this with a matrix that is not purely rotational (orthonormal) will result in a Transform whose scale
* comes from its matrix. Further attempts to set scale directly will throw an error.
- *
+ *
* @param rotation
* our new matrix.
* @return this transform for chaining.
@@ -193,7 +194,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the matrix portion of this transform to the rotational value of the given Quaternion. Calling this allows
* scale to be set and used.
- *
+ *
* @param rotation
* @return this transform for chaining.
* @throws NullPointerException
@@ -207,7 +208,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the translation portion of this transform to the given value.
- *
+ *
* @param translation
* @return this transform for chaining.
* @throws NullPointerException
@@ -221,7 +222,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the translation portion of this transform to the given values.
- *
+ *
* @param x
* @param y
* @param z
@@ -235,7 +236,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the scale portion of this transform to the given value.
- *
+ *
* @param scale
* @return this transform for chaining.
* @throws NullPointerException
@@ -262,7 +263,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the scale portion of this transform to the given values.
- *
+ *
* @param x
* @param y
* @param z
@@ -291,7 +292,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Sets the scale portion of this transform to the given value as a vector (u, u, u)
- *
+ *
* @param uniformScale
* @return this transform for chaining.
* @throws TransformException
@@ -316,7 +317,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Copies the given transform values into this transform object.
- *
+ *
* @param source
* @return this transform for chaining.
* @throws NullPointerException
@@ -339,7 +340,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Locally adds to the translation of this transform.
- *
+ *
* @param x
* @param y
* @param z
@@ -353,7 +354,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Locally adds to the translation of this transform.
- *
+ *
* @param vec
* @return this transform for chaining.
*/
@@ -365,7 +366,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Locally applies this transform to the given point: P' = M*P+T
- *
+ *
* @param point
* @return the transformed point.
* @throws NullPointerException
@@ -402,7 +403,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Applies this transform to the given point and returns the result in the given store vector: P' = M*P+T
- *
+ *
* @param point
* @param store
* the vector to store our result in. if null, a new vector will be created.
@@ -422,7 +423,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Locally applies the inverse of this transform to the given point: P' = M^{-1}*(P-T)
- *
+ *
* @param point
* @return the transformed point.
* @throws NullPointerException
@@ -467,7 +468,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Applies the inverse of this transform to the given point and returns the result in the given store vector: P' =
* M^{-1}*(P-T)
- *
+ *
* @param point
* @param store
* the vector to store our result in. if null, a new vector will be created.
@@ -487,7 +488,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Locally applies this transform to the given vector: V' = M*V
- *
+ *
* @param vector
* @return the transformed vector.
* @throws NullPointerException
@@ -522,7 +523,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Applies this transform to the given vector and returns the result in the given store vector: V' = M*V
- *
+ *
* @param vector
* @param store
* the vector to store our result in. if null, a new vector will be created.
@@ -542,7 +543,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Locally applies the inverse of this transform to the given vector: V' = M^{-1}*V
- *
+ *
* @param vector
* @return the transformed vector.
* @throws NullPointerException
@@ -584,7 +585,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Applies the inverse of this transform to the given vector and returns the result in the given store vector: V' =
* M^{-1}*V
- *
+ *
* @param vector
* @param store
* the vector to store our result in. if null, a new vector will be created.
@@ -605,7 +606,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Calculates the product of this transform with the given "transformBy" transform (P = this * T) and stores this in
* store.
- *
+ *
* @param transformBy
* @param store
* the transform to store the result in for return. If null, a new transform object is created and
@@ -654,11 +655,12 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
}
// In all remaining cases, the matrix cannot be written as R*S*X+T.
- final ReadOnlyMatrix3 matrixA = isRotationMatrix() ? _matrix.multiplyDiagonalPost(_scale,
- Matrix3.fetchTempInstance()) : _matrix;
+ final ReadOnlyMatrix3 matrixA = isRotationMatrix()
+ ? _matrix.multiplyDiagonalPost(_scale, Matrix3.fetchTempInstance()) : _matrix;
- final ReadOnlyMatrix3 matrixB = transformBy.isRotationMatrix() ? transformBy.getMatrix().multiplyDiagonalPost(
- transformBy.getScale(), Matrix3.fetchTempInstance()) : transformBy.getMatrix();
+ final ReadOnlyMatrix3 matrixB = transformBy.isRotationMatrix()
+ ? transformBy.getMatrix().multiplyDiagonalPost(transformBy.getScale(), Matrix3.fetchTempInstance())
+ : transformBy.getMatrix();
final Matrix3 newMatrix = result._matrix;
newMatrix.set(matrixA).multiplyLocal(matrixB);
@@ -684,7 +686,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Updates _rotationMatrix, _uniformScale and _identity based on the current contents of this Transform.
- *
+ *
* @param rotationMatrixGuaranteed
* true if we know for sure that the _matrix component is rotational.
*/
@@ -701,7 +703,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Calculates the inverse of this transform.
- *
+ *
* @param store
* the transform to store the result in for return. If null, a new transform object is created and
* returned. It IS safe for store to be the same object as "this".
@@ -744,13 +746,13 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
* @param store
* the matrix to store the result in for return. If null, a new matrix object is created and returned.
* @return this transform represented as a 4x4 matrix:
- *
+ *
* <pre>
* R R R Tx
* R R R Ty
* R R R Tz
* 0 0 0 1
- * </pre>
+ * </pre>
*/
@Override
public Matrix4 getHomogeneousMatrix(final Matrix4 store) {
@@ -855,7 +857,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Reads in a 4x4 matrix as a 3x3 matrix and translation.
- *
+ *
* @param matrix
* @return this matrix for chaining.
* @throws NullPointerException
@@ -872,10 +874,10 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Check a transform... if it is null or one of its members are invalid, return false. Else return true.
- *
+ *
* @param transform
* the transform to check
- *
+ *
* @return true or false as stated above.
*/
public static boolean isValid(final ReadOnlyTransform transform) {
@@ -903,13 +905,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _matrix.hashCode();
- result += 31 * result + _scale.hashCode();
- result += 31 * result + _translation.hashCode();
-
- return result;
+ return Objects.hash(getMatrix(), getScale(), getTranslation());
}
/**
@@ -997,7 +993,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -1015,9 +1011,9 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/*
* Used with serialization. Not to be called manually.
- *
+ *
* @param out ObjectOutput
- *
+ *
* @throws IOException
*/
@Override
@@ -1049,7 +1045,7 @@ public class Transform implements Cloneable, Savable, Externalizable, ReadOnlyTr
/**
* Releases a Transform back to be used by a future call to fetchTempInstance. TAKE CARE: this Transform object
* should no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param trans
* the Transform to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java b/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java
index d1db728..97bdccf 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Triangle.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyTriangle;
import com.ardor3d.math.type.ReadOnlyVector3;
@@ -51,7 +52,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Copy constructor.
- *
+ *
* @param source
* the triangle to copy from.
*/
@@ -61,7 +62,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Construct a new, mutable triangle using the given points and an index of 0.
- *
+ *
* @param pointA
* @param pointB
* @param pointC
@@ -72,7 +73,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Constructs a new triangle using the given points and index.
- *
+ *
* @param pointA
* @param pointB
* @param pointC
@@ -88,7 +89,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Copies the values of the given source Triangle into this Triangle.
- *
+ *
* @param source
* @return this Triangle for chaining
* @throws NullPointerException
@@ -138,7 +139,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Obtains the unit length normal vector of this triangle... Will create and recalculate this normal vector if this
* is the first request, or if one of the points on the triangle has changed since the last request.
- *
+ *
* @return the normal vector
* @throws NullPointerException
* if store is null.
@@ -165,7 +166,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Sets the index value of this triangle to the given int value.
- *
+ *
* @param index
*/
public void setIndex(final int index) {
@@ -174,7 +175,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Sets the first point of this triangle to the values of the given vector.
- *
+ *
* @param pointA
*/
public void setA(final ReadOnlyVector3 pointA) {
@@ -184,7 +185,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Sets the second point of this triangle to the values of the given vector.
- *
+ *
* @param pointB
*/
public void setB(final ReadOnlyVector3 pointB) {
@@ -194,7 +195,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Sets the third point of this triangle to the values of the given vector.
- *
+ *
* @param pointC
*/
public void setC(final ReadOnlyVector3 pointC) {
@@ -204,7 +205,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Sets a point to a new value.
- *
+ *
* @param index
* the index of the point to set (0-2, corresponding to A-C)
* @param point
@@ -257,7 +258,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Check a triangle... if it is null or its points are invalid, return false. Else return true.
- *
+ *
* @param triangle
* the triangle to check
* @return true or false as stated above.
@@ -289,14 +290,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
*/
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _pointA.hashCode();
- result += 31 * result + _pointB.hashCode();
- result += 31 * result + _pointC.hashCode();
- result += 31 * result + _index;
-
- return result;
+ return Objects.hash(getA(), getB(), getC(), Integer.valueOf(getIndex()));
}
/**
@@ -357,7 +351,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -373,7 +367,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -405,7 +399,7 @@ public class Triangle implements Cloneable, Savable, Externalizable, ReadOnlyTri
/**
* Releases a Triangle back to be used by a future call to fetchTempInstance. TAKE CARE: this Triangle object should
* no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param tri
* the Triangle to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java b/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java
index c6f1d46..a8de730 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Vector2.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyVector2;
import com.ardor3d.util.export.InputCapsule;
@@ -77,7 +78,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Constructs a new vector set to the (x, y) values of the given source vector.
- *
+ *
* @param src
*/
public Vector2(final ReadOnlyVector2 src) {
@@ -86,7 +87,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Constructs a new vector set to (x, y).
- *
+ *
* @param x
* @param y
*/
@@ -160,7 +161,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Stores the double values of this vector in the given double array.
- *
+ *
* @param store
* if null, a new double[2] array is created.
* @return the double array
@@ -180,7 +181,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the first component of this vector to the given double value.
- *
+ *
* @param x
*/
public void setX(final double x) {
@@ -189,7 +190,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the second component of this vector to the given double value.
- *
+ *
* @param y
*/
public void setY(final double y) {
@@ -198,7 +199,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to (x, y)
- *
+ *
* @param x
* @param y
* @return this vector for chaining
@@ -211,7 +212,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to the (x, y) values of the provided source vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -225,7 +226,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to (0, 0)
- *
+ *
* @return this vector for chaining
*/
public Vector2 zero() {
@@ -235,7 +236,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Adds the given values to those of this vector and returns them in store * @param store the vector to store the
* result in for return. If null, a new vector object is created and returned. .
- *
+ *
* @param x
* @param y
* @param store
@@ -254,7 +255,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Increments the values of this vector with the given x and y values.
- *
+ *
* @param x
* @param y
* @return this vector for chaining
@@ -265,7 +266,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Adds the values of the given source vector to those of this vector and returns them in store.
- *
+ *
* @param source
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -280,7 +281,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Increments the values of this vector with the x and y values of the given vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -292,7 +293,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Subtracts the given values from those of this vector and returns them in store.
- *
+ *
* @param x
* @param y
* @param store
@@ -311,7 +312,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Decrements the values of this vector by the given x and y values.
- *
+ *
* @param x
* @param y
* @return this vector for chaining
@@ -322,7 +323,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Subtracts the values of the given source vector from those of this vector and returns them in store.
- *
+ *
* @param source
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -337,7 +338,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Decrements the values of this vector by the x and y values from the given source vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -349,7 +350,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -367,7 +368,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scalar value.
- *
+ *
* @param scalar
* @return this vector for chaining
*/
@@ -377,7 +378,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param scale
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -395,7 +396,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the values of the given scale.
- *
+ *
* @param scale
* @return this vector for chaining
*/
@@ -405,7 +406,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param x
* @param y
* @param store
@@ -424,7 +425,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the values of the given scale.
- *
+ *
* @param x
* @param y
* @return this vector for chaining
@@ -435,7 +436,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -453,7 +454,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scalar value.
- *
+ *
* @param scalar
* @return this vector for chaining
* @throws ArithmeticException
@@ -467,7 +468,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param scale
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -485,7 +486,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the values of the given scale.
- *
+ *
* @param scale
* @return this vector for chaining
*/
@@ -495,7 +496,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param x
* @param y
* @param store
@@ -514,7 +515,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the values of the given scale.
- *
+ *
* @param x
* @param y
* @return this vector for chaining
@@ -524,10 +525,10 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
}
/**
- *
+ *
* Internally modifies this vector by multiplying its values with a given scale value, then adding a given "add"
* value.
- *
+ *
* @param scale
* the value to multiply this vector by.
* @param add
@@ -543,7 +544,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The
* result is store in the given store parameter.
- *
+ *
* @param scale
* the value to multiply by.
* @param add
@@ -584,7 +585,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is
* 0, 0) then a new vector (0, 0) is returned.
- *
+ *
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
* @return a new unit vector (or 0, 0 if this unit is 0 length)
@@ -602,7 +603,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the
* vector is 0, 0) then no action is taken.
- *
+ *
* @return this vector for chaining
*/
public Vector2 normalizeLocal() {
@@ -616,7 +617,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Creates a new vector representing this vector rotated around 0,0 by a specified angle in a given direction.
- *
+ *
* @param angle
* in radians
* @param clockwise
@@ -642,7 +643,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally rotates this vector around 0,0 by a specified angle in a given direction.
- *
+ *
* @param angle
* in radians
* @param clockwise
@@ -662,7 +663,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
* percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
* it is closer to 1, the result will be closer to the end value. The result is returned as a new vector object.
- *
+ *
* @param endVec
* @param scalar
* @param store
@@ -687,7 +688,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
* percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
* it is closer to 1, the result will be closer to the end value. The result is stored back in this vector.
- *
+ *
* @param endVec
* @param scalar
* @return this vector for chaining
@@ -704,7 +705,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
* result will be closer to the end value. The result is returned as a new vector object.
- *
+ *
* @param beginVec
* @param endVec
* @param scalar
@@ -731,7 +732,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
* result will be closer to the end value. The result is stored back in this vector.
- *
+ *
* @param beginVec
* @param endVec
* @param changeAmnt
@@ -834,8 +835,8 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* @return the angle - in radians [-pi, pi) - represented by this Vector2 as expressed by a conversion from
- * rectangular coordinates (<code>x</code>,&nbsp;<code>y</code>) to polar coordinates
- * (r,&nbsp;<i>theta</i>).
+ * rectangular coordinates (<code>x</code>,&nbsp;<code>y</code>) to polar coordinates (r,&nbsp;<i>theta</i>
+ * ).
*/
@Override
public double getPolarAngle() {
@@ -872,7 +873,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Check a vector... if it is null or its doubles are NaN or infinite, return false. Else return true.
- *
+ *
* @param vector
* the vector to check
* @return true or false as stated above.
@@ -904,15 +905,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
*/
@Override
public int hashCode() {
- int result = 17;
-
- final long x = Double.doubleToLongBits(getX());
- result += 31 * result + (int) (x ^ x >>> 32);
-
- final long y = Double.doubleToLongBits(getY());
- result += 31 * result + (int) (y ^ y >>> 32);
-
- return result;
+ return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()));
}
/**
@@ -968,7 +961,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -982,7 +975,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -1012,7 +1005,7 @@ public class Vector2 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Releases a Vector2 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector2 object should
* no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param vec
* the Vector2 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java b/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java
index f8754b2..d23814b 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Vector3.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyVector3;
import com.ardor3d.util.export.InputCapsule;
@@ -88,7 +89,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Constructs a new vector set to the (x, y, z) values of the given source vector.
- *
+ *
* @param src
*/
public Vector3(final ReadOnlyVector3 src) {
@@ -97,7 +98,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Constructs a new vector set to (x, y, z).
- *
+ *
* @param x
* @param y
* @param z
@@ -191,7 +192,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Stores the double values of this vector in the given double array.
- *
+ *
* @param store
* if null, a new double[3] array is created.
* @return the double array
@@ -213,7 +214,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Stores the double values of this vector in the given float array.
- *
+ *
* @param store
* if null, a new float[3] array is created.
* @return the float array
@@ -236,7 +237,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the first component of this vector to the given double value.
- *
+ *
* @param x
*/
public void setX(final double x) {
@@ -245,7 +246,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the second component of this vector to the given double value.
- *
+ *
* @param y
*/
public void setY(final double y) {
@@ -254,7 +255,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the third component of this vector to the given double value.
- *
+ *
* @param z
*/
public void setZ(final double z) {
@@ -263,7 +264,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to (x, y, z)
- *
+ *
* @param x
* @param y
* @param z
@@ -278,7 +279,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to the (x, y, z) values of the provided source vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -293,7 +294,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to (0, 0, 0)
- *
+ *
* @return this vector for chaining
*/
public Vector3 zero() {
@@ -303,7 +304,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Adds the given values to those of this vector and returns them in store * @param store the vector to store the
* result in for return. If null, a new vector object is created and returned. .
- *
+ *
* @param x
* @param y
* @param z
@@ -323,7 +324,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Increments the values of this vector with the given x, y and z values.
- *
+ *
* @param x
* @param y
* @param z
@@ -335,7 +336,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Adds the values of the given source vector to those of this vector and returns them in store.
- *
+ *
* @param source
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -350,7 +351,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Increments the values of this vector with the x, y and z values of the given vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -362,7 +363,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Subtracts the given values from those of this vector and returns them in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -382,7 +383,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Decrements the values of this vector by the given x, y and z values.
- *
+ *
* @param x
* @param y
* @param z
@@ -394,7 +395,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Subtracts the values of the given source vector from those of this vector and returns them in store.
- *
+ *
* @param source
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -409,7 +410,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Decrements the values of this vector by the x, y and z values from the given source vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -421,7 +422,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -439,7 +440,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scalar value.
- *
+ *
* @param scalar
* @return this vector for chaining
*/
@@ -449,7 +450,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param scale
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -467,7 +468,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scale values.
- *
+ *
* @param scalar
* @return this vector for chaining
*/
@@ -477,7 +478,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -497,7 +498,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scale values.
- *
+ *
* @param x
* @param y
* @param z
@@ -509,7 +510,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -527,7 +528,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scalar value.
- *
+ *
* @param scalar
* @return this vector for chaining
* @throws ArithmeticException
@@ -541,7 +542,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param scale
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -559,7 +560,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scale values.
- *
+ *
* @param scale
* @return this vector for chaining
*/
@@ -569,7 +570,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -589,7 +590,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scale values.
- *
+ *
* @param x
* @param y
* @param z
@@ -600,10 +601,10 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
}
/**
- *
+ *
* Internally modifies this vector by multiplying its values with a given scale value, then adding a given "add"
* value.
- *
+ *
* @param scale
* the value to multiply this vector by.
* @param add
@@ -620,7 +621,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The
* result is store in the given store parameter.
- *
+ *
* @param scale
* the value to multiply by.
* @param add
@@ -662,7 +663,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is
* 0, 0, 0) then a new vector (0, 0, 0) is returned.
- *
+ *
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
* @return a new unit vector (or 0, 0, 0 if this unit is 0 length)
@@ -680,7 +681,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the
* vector is 0, 0, 0) then no action is taken.
- *
+ *
* @return this vector for chaining
*/
public Vector3 normalizeLocal() {
@@ -696,7 +697,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
* percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
* it is closer to 1, the result will be closer to the end value. The result is returned as a new vector object.
- *
+ *
* @param endVec
* @param scalar
* @param store
@@ -722,7 +723,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
* percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
* it is closer to 1, the result will be closer to the end value. The result is stored back in this vector.
- *
+ *
* @param endVec
* @param scalar
* @return this vector for chaining
@@ -740,7 +741,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
* result will be closer to the end value. The result is returned as a new vector object.
- *
+ *
* @param beginVec
* @param endVec
* @param scalar
@@ -774,7 +775,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
* result will be closer to the end value. The result is stored back in this vector.
- *
+ *
* @param beginVec
* @param endVec
* @param changeAmnt
@@ -959,7 +960,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Check a vector... if it is null or its doubles are NaN or infinite, return false. Else return true.
- *
+ *
* @param vector
* the vector to check
* @return true or false as stated above.
@@ -979,7 +980,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Check if a vector is non-null and has infinite values.
- *
+ *
* @param vector
* the vector to check
* @return true or false as stated above.
@@ -1008,18 +1009,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
*/
@Override
public int hashCode() {
- int result = 17;
-
- final long x = Double.doubleToLongBits(getX());
- result += 31 * result + (int) (x ^ x >>> 32);
-
- final long y = Double.doubleToLongBits(getY());
- result += 31 * result + (int) (y ^ y >>> 32);
-
- final long z = Double.doubleToLongBits(getZ());
- result += 31 * result + (int) (z ^ z >>> 32);
-
- return result;
+ return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()), Double.valueOf(getZ()));
}
/**
@@ -1077,7 +1067,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -1092,7 +1082,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -1123,7 +1113,7 @@ public class Vector3 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Releases a Vector3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector3 object should
* no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param vec
* the Vector3 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java b/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java
index 74927d6..53e57b7 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/Vector4.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -14,6 +14,7 @@ import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.util.Objects;
import com.ardor3d.math.type.ReadOnlyVector4;
import com.ardor3d.util.export.InputCapsule;
@@ -99,7 +100,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Constructs a new vector set to the (x, y, z, w) values of the given source vector.
- *
+ *
* @param src
*/
public Vector4(final ReadOnlyVector4 src) {
@@ -108,7 +109,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Constructs a new vector set to (x, y, z, w).
- *
+ *
* @param x
* @param y
* @param z
@@ -201,7 +202,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* to set to one of x, y, z or w.
* @throws IllegalArgumentException
* if index is not one of 0, 1, 2, 3.
- *
+ *
* if this vector is read only
*/
public void setValue(final int index, final double value) {
@@ -224,7 +225,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Stores the double values of this vector in the given double array.
- *
+ *
* @param store
* if null, a new double[4] array is created.
* @return the double array
@@ -246,7 +247,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the first component of this vector to the given double value.
- *
+ *
* @param x
*/
public void setX(final double x) {
@@ -255,7 +256,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the second component of this vector to the given double value.
- *
+ *
* @param y
*/
public void setY(final double y) {
@@ -264,7 +265,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the third component of this vector to the given double value.
- *
+ *
* @param z
*/
public void setZ(final double z) {
@@ -273,7 +274,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the fourth component of this vector to the given double value.
- *
+ *
* @param w
*/
public void setW(final double w) {
@@ -282,7 +283,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to (x, y, z, w)
- *
+ *
* @param x
* @param y
* @param z
@@ -299,7 +300,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to the (x, y, z, w) values of the provided source vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -315,7 +316,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Sets the value of this vector to (0, 0, 0, 0)
- *
+ *
* @return this vector for chaining
*/
public Vector4 zero() {
@@ -324,7 +325,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Adds the given values to those of this vector and returns them in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -345,7 +346,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Increments the values of this vector with the given x, y, z and w values.
- *
+ *
* @param x
* @param y
* @param z
@@ -358,7 +359,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Adds the values of the given source vector to those of this vector and returns them in store.
- *
+ *
* @param source
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -373,7 +374,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Increments the values of this vector with the x, y, z and w values of the given vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -385,7 +386,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Subtracts the given values from those of this vector and returns them in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -406,7 +407,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Decrements the values of this vector by the given x, y, z and w values.
- *
+ *
* @param x
* @param y
* @param z
@@ -419,7 +420,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Subtracts the values of the given source vector from those of this vector and returns them in store.
- *
+ *
* @param source
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -434,7 +435,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Decrements the values of this vector by the x, y, z and w values from the given source vector.
- *
+ *
* @param source
* @return this vector for chaining
* @throws NullPointerException
@@ -446,7 +447,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -464,7 +465,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scalar value.
- *
+ *
* @param scalar
* @return this vector for chaining
*/
@@ -474,7 +475,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scale
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -492,7 +493,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scale values.
- *
+ *
* @param scale
* @return this vector for chaining
*/
@@ -502,7 +503,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Multiplies the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -523,7 +524,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by multiplying them each by the given scale values.
- *
+ *
* @param x
* @param y
* @param z
@@ -536,7 +537,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scalar value and returns the result in store.
- *
+ *
* @param scalar
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -554,11 +555,11 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scalar value.
- *
+ *
* @param scalar
* @return this vector for chaining
- *
- *
+ *
+ *
* @throws ArithmeticException
* if scalar is 0
*/
@@ -570,7 +571,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param scale
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
@@ -588,7 +589,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scale values.
- *
+ *
* @param scale
* @return this vector for chaining
*/
@@ -598,7 +599,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Divides the values of this vector by the given scale values and returns the result in store.
- *
+ *
* @param x
* @param y
* @param z
@@ -619,7 +620,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Internally modifies the values of this vector by dividing them each by the given scale values.
- *
+ *
* @param x
* @param y
* @param z
@@ -631,10 +632,10 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
}
/**
- *
+ *
* Internally modifies this vector by multiplying its values with a given scale value, then adding a given "add"
* value.
- *
+ *
* @param scale
* the value to multiply this vector by.
* @param add
@@ -652,7 +653,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Scales this vector by multiplying its values with a given scale value, then adding a given "add" value. The
* result is store in the given store parameter.
- *
+ *
* @param scale
* the value to multiply by.
* @param add
@@ -695,7 +696,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Creates a new unit length vector from this one by dividing by length. If the length is 0, (ie, if the vector is
* 0, 0, 0, 0) then a new vector (0, 0, 0, 0) is returned.
- *
+ *
* @param store
* the vector to store the result in for return. If null, a new vector object is created and returned.
* @return a new unit vector (or 0, 0, 0, 0 if this unit is 0 length)
@@ -713,7 +714,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Converts this vector into a unit vector by dividing it internally by its length. If the length is 0, (ie, if the
* vector is 0, 0, 0, 0) then no action is taken.
- *
+ *
* @return this vector for chaining
*/
public Vector4 normalizeLocal() {
@@ -729,7 +730,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
* percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
* it is closer to 1, the result will be closer to the end value. The result is returned as a new vector object.
- *
+ *
* @param endVec
* @param scalar
* @param store
@@ -756,12 +757,12 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between this vector and the given end vector, using the given scalar as a
* percent. iow, if changeAmnt is closer to 0, the result will be closer to the current value of this vector and if
* it is closer to 1, the result will be closer to the end value. The result is stored back in this vector.
- *
+ *
* @param endVec
* @param scalar
* @return this vector for chaining
- *
- *
+ *
+ *
* @throws NullPointerException
* if endVec is null.
*/
@@ -777,7 +778,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
* result will be closer to the end value. The result is returned as a new vector object.
- *
+ *
* @param beginVec
* @param endVec
* @param scalar
@@ -806,14 +807,14 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
* Performs a linear interpolation between the given begin and end vectors, using the given scalar as a percent.
* iow, if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the
* result will be closer to the end value. The result is stored back in this vector.
- *
+ *
* @param beginVec
* @param endVec
* @param changeAmnt
* the scalar as a percent.
* @return this vector for chaining
- *
- *
+ *
+ *
* @throws NullPointerException
* if beginVec or endVec are null.
*/
@@ -922,7 +923,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Check a vector... if it is null or its doubles are NaN or infinite, return false. Else return true.
- *
+ *
* @param vector
* the vector to check
* @return true or false as stated above.
@@ -956,21 +957,8 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
*/
@Override
public int hashCode() {
- int result = 17;
-
- final long x = Double.doubleToLongBits(getX());
- result += 31 * result + (int) (x ^ x >>> 32);
-
- final long y = Double.doubleToLongBits(getY());
- result += 31 * result + (int) (y ^ y >>> 32);
-
- final long z = Double.doubleToLongBits(getZ());
- result += 31 * result + (int) (z ^ z >>> 32);
-
- final long w = Double.doubleToLongBits(getW());
- result += 31 * result + (int) (w ^ w >>> 32);
-
- return result;
+ return Objects.hash(Double.valueOf(getX()), Double.valueOf(getY()), Double.valueOf(getZ()),
+ Double.valueOf(getW()));
}
/**
@@ -1030,7 +1018,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param in
* ObjectInput
* @throws IOException
@@ -1046,7 +1034,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Used with serialization. Not to be called manually.
- *
+ *
* @param out
* ObjectOutput
* @throws IOException
@@ -1078,7 +1066,7 @@ public class Vector4 implements Cloneable, Savable, Externalizable, ReadOnlyVect
/**
* Releases a Vector4 back to be used by a future call to fetchTempInstance. TAKE CARE: this Vector4 object should
* no longer have other classes referencing it or "Bad Things" will happen.
- *
+ *
* @param vec
* the Vector4 to release.
*/
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java
index 1a64086..9fbe781 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/MapperFunction3D.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -22,12 +22,12 @@ import com.ardor3d.math.MathUtils;
public class MapperFunction3D implements Function3D {
private Function3D _mapFunction;
- private final List<Entry> _entries = new ArrayList<Entry>();
+ private final List<Entry> _entries = new ArrayList<>();
private double _domainStart, _domainEnd;
/**
* Construct a mapper function using the given map function and a start and end for the domain we'll use.
- *
+ *
* @param mapFunction
* @param domainStart
* @param domainEnd
@@ -38,6 +38,7 @@ public class MapperFunction3D implements Function3D {
_domainEnd = domainEnd;
}
+ @SuppressWarnings("null")
@Override
public double eval(final double x, final double y, final double z) {
// grab a value from our map function.
@@ -66,7 +67,7 @@ public class MapperFunction3D implements Function3D {
// check if we are in the ease-out region and have a next function.
else if (next != null && mappingValue > end - current.easeOut) {
// ...interpolate with a quintic S-curve.
- final double ratio = ((mappingValue - end) / current.easeOut) + 1;
+ final double ratio = (mappingValue - end) / current.easeOut + 1;
final double amount = MathUtils.scurve5(ratio);
return MathUtils.lerp(amount, current.source.eval(x, y, z), next.source.eval(x, y, z));
}
@@ -108,7 +109,7 @@ public class MapperFunction3D implements Function3D {
/**
* Add a new source function to the end of our set of ranged functions. Our place in the range is based on the place
* of the previous source function and the offsetStart provided.
- *
+ *
* @param source
* the new function to add
* @param offsetStart
@@ -120,7 +121,8 @@ public class MapperFunction3D implements Function3D {
* a "fade out" range between this function and the next function, starting at the next function's
* offsetStart - easeOut. Over this range we'll lerp between the two functions.
*/
- public void addFunction(final Function3D source, final double offsetStart, final double easeIn, final double easeOut) {
+ public void addFunction(final Function3D source, final double offsetStart, final double easeIn,
+ final double easeOut) {
final Entry e = new Entry();
e.source = source;
e.offsetStart = offsetStart;
diff --git a/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java b/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java
index 149db66..96b26bd 100644
--- a/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java
+++ b/ardor3d-math/src/main/java/com/ardor3d/math/functions/VoroniFunction3D.java
@@ -31,7 +31,7 @@ public class VoroniFunction3D implements Function3D {
private int _seed = 0;
// A cache for cube values
- private final Map<Key, Vector3> _points = new HashMap<Key, Vector3>();
+ private final Map<Key, Vector3> _points = new HashMap<>();
/**
* Construct with default values.
diff --git a/ardor3d-savable/.settings/org.eclipse.jdt.core.prefs b/ardor3d-savable/.settings/org.eclipse.jdt.core.prefs
index ed7a9e8..644ac20 100644
--- a/ardor3d-savable/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-savable/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java
index 1c32f12..00e43e4 100644
--- a/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java
+++ b/ardor3d-savable/src/main/java/com/ardor3d/util/export/ByteUtils.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -22,7 +22,7 @@ public abstract class ByteUtils {
/**
* Takes an InputStream and returns the complete byte content of it
- *
+ *
* @param inputStream
* The input stream to read from
* @return The byte array containing the data from the input stream
@@ -30,30 +30,28 @@ public abstract class ByteUtils {
* thrown if there is a problem reading from the input stream provided
*/
public static byte[] getByteContent(final InputStream inputStream) throws IOException {
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
- final byte[] buffer = new byte[1024];
- int byteCount = -1;
- byte[] data = null;
-
- // Read the byte content into the output stream first
- while ((byteCount = inputStream.read(buffer)) > 0) {
- outputStream.write(buffer, 0, byteCount);
- }
-
- // Set data with byte content from stream
- data = outputStream.toByteArray();
+ try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024)) {
+ final byte[] buffer = new byte[1024];
+ int byteCount = -1;
+ byte[] data = null;
+
+ // Read the byte content into the output stream first
+ while ((byteCount = inputStream.read(buffer)) > 0) {
+ outputStream.write(buffer, 0, byteCount);
+ }
- // Release resources
- outputStream.close();
+ // Set data with byte content from stream
+ data = outputStream.toByteArray();
- return data;
+ return data;
+ }
}
// ********** byte <> short METHODS **********
/**
* Writes a short out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the short will be written to
* @param value
@@ -79,7 +77,7 @@ public abstract class ByteUtils {
/**
* Read in a short from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the short
* @return A short, which is the next 2 bytes converted from the InputStream
@@ -111,7 +109,7 @@ public abstract class ByteUtils {
/**
* Writes an integer out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the integer will be written to
* @param integer
@@ -139,7 +137,7 @@ public abstract class ByteUtils {
/**
* Read in an integer from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the integer
* @return An int, which is the next 4 bytes converted from the InputStream
@@ -172,7 +170,7 @@ public abstract class ByteUtils {
/**
* Writes a long out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the long will be written to
* @param value
@@ -191,28 +189,28 @@ public abstract class ByteUtils {
public static byte[] convertToBytes(long n) {
final byte[] bytes = new byte[8];
- bytes[7] = (byte) (n);
+ bytes[7] = (byte) n;
n >>>= 8;
- bytes[6] = (byte) (n);
+ bytes[6] = (byte) n;
n >>>= 8;
- bytes[5] = (byte) (n);
+ bytes[5] = (byte) n;
n >>>= 8;
- bytes[4] = (byte) (n);
+ bytes[4] = (byte) n;
n >>>= 8;
- bytes[3] = (byte) (n);
+ bytes[3] = (byte) n;
n >>>= 8;
- bytes[2] = (byte) (n);
+ bytes[2] = (byte) n;
n >>>= 8;
- bytes[1] = (byte) (n);
+ bytes[1] = (byte) n;
n >>>= 8;
- bytes[0] = (byte) (n);
+ bytes[0] = (byte) n;
return bytes;
}
/**
* Read in a long from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the long
* @return A long, which is the next 8 bytes converted from the InputStream
@@ -236,17 +234,17 @@ public abstract class ByteUtils {
public static long convertLongFromBytes(final byte[] bytes, final int offset) {
// Convert it to an long
- return ((((long) bytes[offset + 7]) & 0xFF) + ((((long) bytes[offset + 6]) & 0xFF) << 8)
- + ((((long) bytes[offset + 5]) & 0xFF) << 16) + ((((long) bytes[offset + 4]) & 0xFF) << 24)
- + ((((long) bytes[offset + 3]) & 0xFF) << 32) + ((((long) bytes[offset + 2]) & 0xFF) << 40)
- + ((((long) bytes[offset + 1]) & 0xFF) << 48) + ((((long) bytes[offset + 0]) & 0xFF) << 56));
+ return ((long) bytes[offset + 7] & 0xFF) + (((long) bytes[offset + 6] & 0xFF) << 8)
+ + (((long) bytes[offset + 5] & 0xFF) << 16) + (((long) bytes[offset + 4] & 0xFF) << 24)
+ + (((long) bytes[offset + 3] & 0xFF) << 32) + (((long) bytes[offset + 2] & 0xFF) << 40)
+ + (((long) bytes[offset + 1] & 0xFF) << 48) + (((long) bytes[offset + 0] & 0xFF) << 56);
}
// ********** byte <> double METHODS **********
/**
* Writes a double out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the double will be written to
* @param value
@@ -269,7 +267,7 @@ public abstract class ByteUtils {
/**
* Read in a double from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the double
* @return A double, which is the next 8 bytes converted from the InputStream
@@ -301,7 +299,7 @@ public abstract class ByteUtils {
/**
* Writes an float out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the float will be written to
* @param fVal
@@ -324,7 +322,7 @@ public abstract class ByteUtils {
/**
* Read in a float from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the float
* @return A float, which is the next 4 bytes converted from the InputStream
@@ -356,7 +354,7 @@ public abstract class ByteUtils {
/**
* Writes a boolean out to an OutputStream.
- *
+ *
* @param outputStream
* The OutputStream the boolean will be written to
* @param bVal
@@ -380,7 +378,7 @@ public abstract class ByteUtils {
/**
* Read in a boolean from an InputStream
- *
+ *
* @param inputStream
* The InputStream used to read the boolean
* @return A boolean, which is the next byte converted from the InputStream (iow, byte != 0)
diff --git a/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs b/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs
index 19eadb6..941c850 100644
--- a/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-swt/.settings/org.eclipse.jdt.core.prefs
@@ -8,16 +8,16 @@ org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java b/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java
index 7ac9068..24324a0 100644
--- a/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java
+++ b/ardor3d-swt/src/main/java/com/ardor3d/image/util/SWTImageUtil.java
@@ -65,7 +65,7 @@ public abstract class SWTImageUtil {
final int width = input.getWidth(), height = input.getHeight();
// create our return list
- final List<ImageData> rVal = new ArrayList<ImageData>();
+ final List<ImageData> rVal = new ArrayList<>();
// Calculate our modulation or "tint" values per channel
final double tRed = tint != null ? tint.getRed() / 255. : 1.0;
diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java
index 7996aa4..10554d3 100644
--- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java
+++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtKeyboardWrapper.java
@@ -42,7 +42,7 @@ public class SwtKeyboardWrapper implements KeyboardWrapper, KeyListener {
private Key _lastKeyPressed = null;
public SwtKeyboardWrapper(final Control control) {
- _upcomingEvents = new LinkedList<KeyEvent>();
+ _upcomingEvents = new LinkedList<>();
_control = checkNotNull(control, "control");
}
diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java
index 2937ec1..442b8b1 100644
--- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java
+++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseWrapper.java
@@ -39,7 +39,7 @@ import com.google.common.collect.PeekingIterator;
@ThreadSafe
public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveListener, MouseWheelListener {
@GuardedBy("this")
- private final LinkedList<MouseState> _upcomingEvents = new LinkedList<MouseState>();
+ private final LinkedList<MouseState> _upcomingEvents = new LinkedList<>();
private final Control _control;
@@ -50,7 +50,7 @@ public class SwtMouseWrapper implements MouseWrapper, MouseListener, MouseMoveLi
private MouseState _lastState = null;
private final Multiset<MouseButton> _clicks = EnumMultiset.create(MouseButton.class);
- private final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<MouseButton, Long>(MouseButton.class);
+ private final EnumMap<MouseButton, Long> _lastClickTime = new EnumMap<>(MouseButton.class);
private final EnumSet<MouseButton> _clickArmed = EnumSet.noneOf(MouseButton.class);
public SwtMouseWrapper(final Control control) {
diff --git a/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs b/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs
index ec451b2..3fa3efd 100644
--- a/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-terrain/.settings/org.eclipse.jdt.core.prefs
@@ -10,16 +10,16 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java
index 4debbd9..18dc7aa 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/Terrain.java
@@ -73,7 +73,7 @@ public class Terrain extends Node implements Pickable {
private GLSLShaderObjectsState _geometryClipmapShader;
/** Reference to the texture clipmap */
- private final List<TextureClipmap> _textureClipmaps = new ArrayList<TextureClipmap>();
+ private final List<TextureClipmap> _textureClipmaps = new ArrayList<>();
/** Reference to normal map */
private TextureClipmap _normalClipmap;
@@ -81,7 +81,7 @@ public class Terrain extends Node implements Pickable {
private final Vector3 transformedFrustumPos = new Vector3();
- private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<Region>();
+ private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<>();
private ByteSource vertexShader;
private ByteSource pixelShader;
@@ -130,7 +130,7 @@ public class Terrain extends Node implements Pickable {
// getSceneHints().setLightCombineMode(LightCombineMode.Off);
try {
- _clips = new ArrayList<ClipmapLevel>();
+ _clips = new ArrayList<>();
final float heightScale = terrainConfiguration.getScale().getYf();
@@ -167,7 +167,7 @@ public class Terrain extends Node implements Pickable {
setHeightRange(terrainConfiguration.getHeightRangeMin(), terrainConfiguration.getHeightRangeMax());
}
- private final List<Long> timers = new ArrayList<Long>();
+ private final List<Long> timers = new ArrayList<>();
@Override
protected void updateChildren(final double time) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java
index c4c228c..26d823d 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainBuilder.java
@@ -51,7 +51,7 @@ public class TerrainBuilder {
private boolean showDebugPanels = false;
- private final List<TextureSource> extraTextureSources = new ArrayList<TextureSource>();
+ private final List<TextureSource> extraTextureSources = new ArrayList<>();
public TerrainBuilder(final TerrainDataProvider terrainDataProvider, final Camera camera) {
this.terrainDataProvider = terrainDataProvider;
@@ -112,7 +112,7 @@ public class TerrainBuilder {
logger.info("server clipmapLevels: " + clipmapLevels);
- final List<TerrainCache> cacheList = new ArrayList<TerrainCache>();
+ final List<TerrainCache> cacheList = new ArrayList<>();
TerrainCache parentCache = null;
final int baseLevel = Math.max(clipmapLevels - clipLevelCount, 0);
@@ -167,7 +167,7 @@ public class TerrainBuilder {
logger.info("server clipmapLevels: " + clipmapLevels);
- final List<TextureCache> cacheList = new ArrayList<TextureCache>();
+ final List<TextureCache> cacheList = new ArrayList<>();
TextureCache parentCache = null;
final int baseLevel = Math.max(clipmapLevels - textureClipLevelCount, 0);
int level = textureClipLevelCount - 1;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java
index 8a02f85..e36f8f6 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TerrainGridCache.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -13,6 +13,7 @@ package com.ardor3d.extension.terrain.client;
import java.nio.FloatBuffer;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
@@ -48,9 +49,9 @@ public class TerrainGridCache implements TerrainCache, Runnable {
private final int clipmapLevel;
private final int requestedLevel;
- private final Set<TileLoadingData> currentTiles = new HashSet<TileLoadingData>();
- private Set<TileLoadingData> newThreadTiles = new HashSet<TileLoadingData>();
- private Set<TileLoadingData> backThreadTiles = new HashSet<TileLoadingData>();
+ private final Set<TileLoadingData> currentTiles = new HashSet<>();
+ private Set<TileLoadingData> newThreadTiles = new HashSet<>();
+ private Set<TileLoadingData> backThreadTiles = new HashSet<>();
private final Object SWAP_LOCK = new Object();
private int backCurrentTileX = Integer.MAX_VALUE;
private int backCurrentTileY = Integer.MAX_VALUE;
@@ -66,12 +67,12 @@ public class TerrainGridCache implements TerrainCache, Runnable {
private boolean exit = false;
private final boolean enableDebug = true;
- private final Set<TileLoadingData> debugTiles = new HashSet<TileLoadingData>();
+ private final Set<TileLoadingData> debugTiles = new HashSet<>();
public Set<TileLoadingData> getDebugTiles() {
Set<TileLoadingData> copyTiles = null;
synchronized (debugTiles) {
- copyTiles = new HashSet<TileLoadingData>(debugTiles);
+ copyTiles = new HashSet<>(debugTiles);
}
return copyTiles;
}
@@ -122,8 +123,8 @@ public class TerrainGridCache implements TerrainCache, Runnable {
public Set<Tile> handleUpdateRequests() {
Set<Tile> updateTiles;
try {
- updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2, backCurrentTileY
- - cacheSize / 2, cacheSize, cacheSize);
+ updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2,
+ backCurrentTileY - cacheSize / 2, cacheSize, cacheSize);
if (updateTiles == null || updateTiles.isEmpty()) {
return null;
}
@@ -176,7 +177,7 @@ public class TerrainGridCache implements TerrainCache, Runnable {
backCurrentTileX = tileX;
backCurrentTileY = tileY;
- final Set<TileLoadingData> newTiles = new HashSet<TileLoadingData>();
+ final Set<TileLoadingData> newTiles = new HashSet<>();
for (int i = 0; i < cacheSize; i++) {
for (int j = 0; j < cacheSize; j++) {
final int sourceX = tileX + j - cacheSize / 2;
@@ -265,8 +266,8 @@ public class TerrainGridCache implements TerrainCache, Runnable {
|| tileY <= locatorTile.getY() - locatorSize / 2 + 1
|| tileY >= locatorTile.getY() + locatorSize / 2 - 2) {
try {
- validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2, tileY - locatorSize
- / 2, locatorSize, locatorSize);
+ validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2,
+ tileY - locatorSize / 2, locatorSize, locatorSize);
} catch (final Exception e) {
logger.log(Level.WARNING, "Exception getting source info", e);
}
@@ -553,7 +554,8 @@ public class TerrainGridCache implements TerrainCache, Runnable {
final int vertexDistance = MathUtils.pow2(clipmapLevel);
final Region region = new Region(clipmapLevel, sourceTile.getX() * tileSize * vertexDistance,
- sourceTile.getY() * tileSize * vertexDistance, tileSize * vertexDistance, tileSize * vertexDistance);
+ sourceTile.getY() * tileSize * vertexDistance, tileSize * vertexDistance,
+ tileSize * vertexDistance);
if (mailBox != null) {
mailBox.add(region);
}
@@ -574,11 +576,7 @@ public class TerrainGridCache implements TerrainCache, Runnable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (destTile == null ? 0 : destTile.hashCode());
- result = prime * result + (sourceTile == null ? 0 : sourceTile.hashCode());
- return result;
+ return Objects.hash(destTile, sourceTile);
}
@Override
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java
index 645d79d..6c4166f 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureClipmap.java
@@ -60,7 +60,7 @@ public class TextureClipmap {
private Texture3D textureClipmap;
private GLSLShaderObjectsState textureClipmapShader;
- private final List<LevelData> levelDataList = new ArrayList<LevelData>();
+ private final List<LevelData> levelDataList = new ArrayList<>();
private final FloatBuffer sliceDataBuffer;
@@ -70,7 +70,7 @@ public class TextureClipmap {
private final List<TextureCache> cacheList;
- private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<Region>();
+ private final DoubleBufferedList<Region> mailBox = new DoubleBufferedList<>();
private final boolean useAlpha;
private final int colorBits;
@@ -115,7 +115,7 @@ public class TextureClipmap {
createTexture();
}
- private final List<Long> timers = new ArrayList<Long>();
+ private final List<Long> timers = new ArrayList<>();
public void update(final Renderer renderer, final ReadOnlyVector3 position) {
eyePosition.set(position);
@@ -279,7 +279,7 @@ public class TextureClipmap {
Collections.sort(regionList, regionSorter);
- final Set<Integer> affectedUnits = new HashSet<Integer>();
+ final Set<Integer> affectedUnits = new HashSet<>();
for (int i = regionList.size() - 1; i >= 0; i--) {
final Region region = regionList.get(i);
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java
index dee86c6..1839eb6 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/TextureGridCache.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -13,6 +13,7 @@ package com.ardor3d.extension.terrain.client;
import java.nio.ByteBuffer;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
@@ -51,9 +52,9 @@ public class TextureGridCache implements TextureCache, Runnable {
private final int clipmapLevel;
private final int requestedLevel;
- private final Set<TileLoadingData> currentTiles = new HashSet<TileLoadingData>();
- private Set<TileLoadingData> newThreadTiles = new HashSet<TileLoadingData>();
- private Set<TileLoadingData> backThreadTiles = new HashSet<TileLoadingData>();
+ private final Set<TileLoadingData> currentTiles = new HashSet<>();
+ private Set<TileLoadingData> newThreadTiles = new HashSet<>();
+ private Set<TileLoadingData> backThreadTiles = new HashSet<>();
private final Object SWAP_LOCK = new Object();
private int backCurrentTileX = Integer.MAX_VALUE;
private int backCurrentTileY = Integer.MAX_VALUE;
@@ -69,12 +70,12 @@ public class TextureGridCache implements TextureCache, Runnable {
// Debug
private final boolean enableDebug = true;
- private final Set<TileLoadingData> debugTiles = new HashSet<TileLoadingData>();
+ private final Set<TileLoadingData> debugTiles = new HashSet<>();
public Set<TileLoadingData> getDebugTiles() {
Set<TileLoadingData> copyTiles = null;
synchronized (debugTiles) {
- copyTiles = new HashSet<TileLoadingData>(debugTiles);
+ copyTiles = new HashSet<>(debugTiles);
}
return copyTiles;
}
@@ -129,8 +130,8 @@ public class TextureGridCache implements TextureCache, Runnable {
public Set<Tile> handleUpdateRequests() {
Set<Tile> updateTiles;
try {
- updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2, backCurrentTileY
- - cacheSize / 2, cacheSize, cacheSize);
+ updateTiles = source.getInvalidTiles(requestedLevel, backCurrentTileX - cacheSize / 2,
+ backCurrentTileY - cacheSize / 2, cacheSize, cacheSize);
if (updateTiles == null || updateTiles.isEmpty()) {
return null;
}
@@ -158,8 +159,8 @@ public class TextureGridCache implements TextureCache, Runnable {
final int destX = MathUtils.moduloPositive(tile.getX(), cacheSize);
final int destY = MathUtils.moduloPositive(tile.getY(), cacheSize);
- final TextureStoreFormat format = textureConfiguration.getTextureDataType(source.getContributorId(
- requestedLevel, tile));
+ final TextureStoreFormat format = textureConfiguration
+ .getTextureDataType(source.getContributorId(requestedLevel, tile));
CacheFunctionUtil.applyFunction(useAlpha, function, sourceData, data, destX, destY, format, tileSize,
dataSize);
}
@@ -183,7 +184,7 @@ public class TextureGridCache implements TextureCache, Runnable {
backCurrentTileX = tileX;
backCurrentTileY = tileY;
- final Set<TileLoadingData> newTiles = new HashSet<TileLoadingData>();
+ final Set<TileLoadingData> newTiles = new HashSet<>();
for (int i = 0; i < cacheSize; i++) {
for (int j = 0; j < cacheSize; j++) {
final int sourceX = tileX + j - cacheSize / 2;
@@ -273,8 +274,8 @@ public class TextureGridCache implements TextureCache, Runnable {
|| tileY <= locatorTile.getY() - locatorSize / 2 + 1
|| tileY >= locatorTile.getY() + locatorSize / 2 - 2) {
try {
- validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2, tileY - locatorSize
- / 2, locatorSize, locatorSize);
+ validTiles = source.getValidTiles(requestedLevel, tileX - locatorSize / 2,
+ tileY - locatorSize / 2, locatorSize, locatorSize);
} catch (final Exception e) {
logger.log(Level.WARNING, "Exception getting source info", e);
}
@@ -410,8 +411,8 @@ public class TextureGridCache implements TextureCache, Runnable {
destinationData.put(rgbArray, 0, (destinationSize - dataX) * colorBits);
destinationData.position(destIndex);
- destinationData.put(rgbArray, (destinationSize - dataX) * colorBits, (dataX + width - destinationSize)
- * colorBits);
+ destinationData.put(rgbArray, (destinationSize - dataX) * colorBits,
+ (dataX + width - destinationSize) * colorBits);
} else {
final int destIndex = (dataY * destinationSize + dataX) * colorBits;
destinationData.position(destIndex);
@@ -450,9 +451,8 @@ public class TextureGridCache implements TextureCache, Runnable {
public TileLoadingData(final DoubleBufferedList<Region> mailBox, final Tile sourceTile, final Tile destTile,
final TextureSource source, final CacheData[][] cache, final byte[] data, final int tileSize,
- final int dataSize, final SourceCacheFunction function,
- final TextureConfiguration textureConfiguration, final boolean useAlpha, final int clipmapLevel,
- final int requestedLevel) {
+ final int dataSize, final SourceCacheFunction function, final TextureConfiguration textureConfiguration,
+ final boolean useAlpha, final int clipmapLevel, final int requestedLevel) {
this.mailBox = mailBox;
this.sourceTile = sourceTile;
@@ -494,8 +494,8 @@ public class TextureGridCache implements TextureCache, Runnable {
return false;
}
- final TextureStoreFormat format = textureConfiguration.getTextureDataType(source.getContributorId(
- requestedLevel, sourceTile));
+ final TextureStoreFormat format = textureConfiguration
+ .getTextureDataType(source.getContributorId(requestedLevel, sourceTile));
CacheFunctionUtil.applyFunction(useAlpha, function, sourceData, data, destTile.getX(), destTile.getY(),
format, tileSize, dataSize);
@@ -528,11 +528,7 @@ public class TextureGridCache implements TextureCache, Runnable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (destTile == null ? 0 : destTile.hashCode());
- result = prime * result + (sourceTile == null ? 0 : sourceTile.hashCode());
- return result;
+ return Objects.hash(destTile, sourceTile);
}
@Override
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java
index 032f32d..9ad824c 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/heightmap/RawHeightMap.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -83,7 +83,7 @@ public class RawHeightMap {
/**
* <code>load</code> fills the height data array with the appropriate data from the set RAW image stream or file.
- *
+ *
* @return true if the load is successful, false otherwise.
*/
public boolean loadHeightmap() {
@@ -91,14 +91,14 @@ public class RawHeightMap {
heightData = new float[size * size];
// attempt to connect to the supplied file.
- BufferedInputStream bis = null;
- try {
- bis = new BufferedInputStream(stream);
- final DataInputStream dis = new DataInputStream(bis);
- DataInput di = dis;
+ try (final BufferedInputStream bis = new BufferedInputStream(stream);
+ final DataInputStream dis = new DataInputStream(bis)) {
+ final DataInput di;
if (isLittleEndian) {
di = new LittleEndianDataInput(dis);
+ } else {
+ di = dis;
}
// read the raw file
@@ -143,7 +143,6 @@ public class RawHeightMap {
}
}
}
- dis.close();
} catch (final IOException e1) {
logger.warning("Error reading height data from stream.");
return false;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java
index 76cc052..0fa3e02 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainDataProvider.java
@@ -49,8 +49,8 @@ public class ArrayTerrainDataProvider implements TerrainDataProvider {
final int clipLevelCount = 6;
int currentSize = size;
- heightMaps = new ArrayList<float[]>();
- heightMapSizes = new ArrayList<Integer>();
+ heightMaps = new ArrayList<>();
+ heightMapSizes = new ArrayList<>();
heightMaps.add(data);
heightMapSizes.add(currentSize);
float[] parentHeightMap = data;
@@ -73,7 +73,7 @@ public class ArrayTerrainDataProvider implements TerrainDataProvider {
@Override
public Map<Integer, String> getAvailableMaps() throws Exception {
- final Map<Integer, String> maps = new HashMap<Integer, String>();
+ final Map<Integer, String> maps = new HashMap<>();
maps.put(0, "ArrayBasedMap");
return maps;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java
index a274eee..33b7423 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTerrainSource.java
@@ -52,7 +52,7 @@ public class ArrayTerrainSource implements TerrainSource {
@Override
public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX,
final int numTilesY) throws Exception {
- final Set<Tile> validTiles = new HashSet<Tile>();
+ final Set<Tile> validTiles = new HashSet<>();
final int heightMapSize = heightMapSizes.get(clipmapLevel);
for (int y = 0; y < numTilesY; y++) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java
index e69a1b5..23f4716 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/array/ArrayTextureSource.java
@@ -43,7 +43,7 @@ public class ArrayTextureSource implements TextureSource {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, TextureStoreFormat.Luminance8);
return new TextureConfiguration(heightMaps.size(), textureStoreFormat, tileSize, 1f, true, false);
@@ -52,7 +52,7 @@ public class ArrayTextureSource implements TextureSource {
@Override
public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX,
final int numTilesY) throws Exception {
- final Set<Tile> validTiles = new HashSet<Tile>();
+ final Set<Tile> validTiles = new HashSet<>();
final int heightMapSize = heightMapSizes.get(clipmapLevel);
for (int y = 0; y < numTilesY; y++) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java
index 31d9e29..88d9326 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AbstractAwtElement.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -13,7 +13,6 @@ package com.ardor3d.extension.terrain.providers.awt;
import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.RenderingHints;
-import java.awt.RenderingHints.Key;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
@@ -29,7 +28,7 @@ public abstract class AbstractAwtElement {
protected final Transform _transform = new Transform();
protected Composite _compositeOverride;
protected ElementUpdateListener _listener;
- protected Map<RenderingHints.Key, Object> hints = new HashMap<Key, Object>();
+ protected Map<RenderingHints.Key, Object> hints = new HashMap<>();
protected Vector4 _awtBounds = new Vector4();
@@ -70,10 +69,10 @@ public abstract class AbstractAwtElement {
updateBoundsFromElement();
// So apply transform
- final double x = _awtBounds.getX(), y = _awtBounds.getY(), width = _awtBounds.getZ(), height = _awtBounds
- .getW();
+ final double x = _awtBounds.getX(), y = _awtBounds.getY(), width = _awtBounds.getZ(),
+ height = _awtBounds.getW();
final Vector3[] vects = new Vector3[] { //
- //
+ //
new Vector3(x, y, 0), //
new Vector3(x + width, y, 0), //
new Vector3(x + width, y + height, 0), //
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java
index 1a59724..975a94a 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtElementProvider.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -16,8 +16,8 @@ import java.util.List;
import com.ardor3d.math.type.ReadOnlyVector4;
public class AwtElementProvider implements ElementUpdateListener {
- private final List<AbstractAwtElement> _elements = new LinkedList<AbstractAwtElement>();
- private final List<ElementUpdateListener> _updateListeners = new LinkedList<ElementUpdateListener>();
+ private final List<AbstractAwtElement> _elements = new LinkedList<>();
+ private final List<ElementUpdateListener> _updateListeners = new LinkedList<>();
public List<AbstractAwtElement> getElements() {
return _elements;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java
index 7dd594a..361453c 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtShapeElement.java
@@ -40,7 +40,7 @@ public class AwtShapeElement extends AbstractAwtElement {
protected Vector4 _margin = new Vector4(1, 1, 1, 1);
- protected final Map<Integer, BasicStroke> _strokes = new HashMap<Integer, BasicStroke>();
+ protected final Map<Integer, BasicStroke> _strokes = new HashMap<>();
public AwtShapeElement(final Shape shape) {
this(shape, Transform.IDENTITY, null);
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java
index eab9105..f0ed254 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/awt/AwtTextureSource.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -69,7 +69,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener {
for (int i = 0; i < availableClipmapLevels; i++) {
_image[i] = new BufferedImage(tileSize, tileSize, BufferedImage.TYPE_INT_ARGB);
- _updatedTiles[i] = new HashSet<Tile>();
+ _updatedTiles[i] = new HashSet<>();
}
}
@@ -79,7 +79,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, format);
return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, true);
@@ -100,7 +100,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener {
return null;
}
- final Set<Tile> tiles = new HashSet<Tile>();
+ final Set<Tile> tiles = new HashSet<>();
int checkX, checkY;
for (final Iterator<Tile> it = _updatedTiles[baseClipmapLevel].iterator(); it.hasNext();) {
@@ -149,7 +149,7 @@ public class AwtTextureSource implements TextureSource, ElementUpdateListener {
graphics.setComposite(composite);
// get list of elements that intersect the given region
- final List<AbstractAwtElement> elements = new ArrayList<AbstractAwtElement>(provider.getElements());
+ final List<AbstractAwtElement> elements = new ArrayList<>(provider.getElements());
for (final Iterator<AbstractAwtElement> it = elements.iterator(); it.hasNext();) {
final AbstractAwtElement element = it.next();
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java
index 53e20ac..8b03423 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/image/ImageTextureSource.java
@@ -40,8 +40,8 @@ public class ImageTextureSource implements TextureSource {
public ImageTextureSource(final int tileSize, final Image map, final List<Integer> heightMapSizes) {
this.tileSize = tileSize;
- maps = new ArrayList<byte[]>(heightMapSizes.size());
- this.heightMapSizes = new ArrayList<Integer>(heightMapSizes);
+ maps = new ArrayList<>(heightMapSizes.size());
+ this.heightMapSizes = new ArrayList<>(heightMapSizes);
buildMips(map);
}
@@ -72,7 +72,7 @@ public class ImageTextureSource implements TextureSource {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, TextureStoreFormat.RGB8);
return new TextureConfiguration(maps.size(), textureStoreFormat, tileSize, 1f, true, false);
@@ -81,7 +81,7 @@ public class ImageTextureSource implements TextureSource {
@Override
public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX,
final int numTilesY) throws Exception {
- final Set<Tile> validTiles = new HashSet<Tile>();
+ final Set<Tile> validTiles = new HashSet<>();
final int heightMapSize = heightMapSizes.get(clipmapLevel);
for (int y = 0; y < numTilesY; y++) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java
index f2511c3..5d71f6a 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainDataProvider.java
@@ -40,7 +40,7 @@ public class InMemoryTerrainDataProvider implements TerrainDataProvider {
@Override
public Map<Integer, String> getAvailableMaps() throws Exception {
- final Map<Integer, String> maps = new HashMap<Integer, String>();
+ final Map<Integer, String> maps = new HashMap<>();
maps.put(0, "InMemoryData");
return maps;
@@ -64,7 +64,7 @@ public class InMemoryTerrainDataProvider implements TerrainDataProvider {
inMemoryTerrainData.getSide(), inMemoryTerrainData.getMaxHeight(), inMemoryTerrainData
.getScale().getX(), inMemoryTerrainData.getScale().getY());
- final List<Integer> heightMapSizes = new ArrayList<Integer>();
+ final List<Integer> heightMapSizes = new ArrayList<>();
int currentSize = inMemoryTerrainData.getSide();
heightMapSizes.add(currentSize);
for (int i = 0; i < inMemoryTerrainData.getClipmapLevels(); i++) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java
index ce0e655..76c770f 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTerrainSource.java
@@ -41,7 +41,7 @@ public class InMemoryTerrainSource implements TerrainSource {
final int numTilesY) throws Exception {
final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1;
- final Set<Tile> validTiles = new HashSet<Tile>();
+ final Set<Tile> validTiles = new HashSet<>();
final int levelSize = 1 << baseClipmapLevel;
final int size = inMemoryTerrainData.getSide();
@@ -70,7 +70,7 @@ public class InMemoryTerrainSource implements TerrainSource {
final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1;
- final Set<Tile> tiles = new HashSet<Tile>();
+ final Set<Tile> tiles = new HashSet<>();
synchronized (updatedTiles[baseClipmapLevel]) {
if (updatedTiles[baseClipmapLevel].isEmpty()) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java
index 26b9b73..c151fac 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/InMemoryTextureSource.java
@@ -37,7 +37,7 @@ public class InMemoryTextureSource implements TextureSource {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, TextureStoreFormat.RGBA8);
return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, true, true);
@@ -48,7 +48,7 @@ public class InMemoryTextureSource implements TextureSource {
final int numTilesY) throws Exception {
final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1;
- final Set<Tile> validTiles = new HashSet<Tile>();
+ final Set<Tile> validTiles = new HashSet<>();
final int levelSize = 1 << baseClipmapLevel;
final int size = inMemoryTerrainData.getSide();
@@ -77,7 +77,7 @@ public class InMemoryTextureSource implements TextureSource {
final int baseClipmapLevel = availableClipmapLevels - clipmapLevel - 1;
- final Set<Tile> tiles = new HashSet<Tile>();
+ final Set<Tile> tiles = new HashSet<>();
synchronized (updatedTiles[baseClipmapLevel]) {
if (updatedTiles[baseClipmapLevel].isEmpty()) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java
index f6e6cc0..94d1aa9 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/inmemory/data/InMemoryTerrainData.java
@@ -62,8 +62,8 @@ public class InMemoryTerrainData {
updatedTerrainTiles = new Set[clipmapLevels];
updatedTextureTiles = new Set[clipmapLevels];
for (int i = 0; i < clipmapLevels; i++) {
- updatedTerrainTiles[i] = new HashSet<Tile>();
- updatedTextureTiles[i] = new HashSet<Tile>();
+ updatedTerrainTiles[i] = new HashSet<>();
+ updatedTextureTiles[i] = new HashSet<>();
}
final double procScale = 1.0 / 4000.0;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java
index 37a5c26..d50cca2 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralNormalMapSource.java
@@ -44,7 +44,7 @@ public class ProceduralNormalMapSource implements TextureSource {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, TextureStoreFormat.RGB8);
return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, false);
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java
index 6b94f04..005d20c 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTerrainDataProvider.java
@@ -43,7 +43,7 @@ public class ProceduralTerrainDataProvider implements TerrainDataProvider {
@Override
public Map<Integer, String> getAvailableMaps() throws Exception {
- final Map<Integer, String> maps = new HashMap<Integer, String>();
+ final Map<Integer, String> maps = new HashMap<>();
maps.put(0, "ProceduralMap");
return maps;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java
index 5970070..9ae73b4 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/procedural/ProceduralTextureSource.java
@@ -59,7 +59,7 @@ public class ProceduralTextureSource implements TextureSource {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, TextureStoreFormat.RGB8);
return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, false, false);
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java
index ea98407..fc086f0 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTerrainDataProvider.java
@@ -45,7 +45,7 @@ public class SimpleArrayTerrainDataProvider implements TerrainDataProvider {
@Override
public Map<Integer, String> getAvailableMaps() throws Exception {
- final Map<Integer, String> maps = new HashMap<Integer, String>();
+ final Map<Integer, String> maps = new HashMap<>();
maps.put(0, "InMemoryData");
return maps;
@@ -66,7 +66,7 @@ public class SimpleArrayTerrainDataProvider implements TerrainDataProvider {
if (generateNormalMap) {
try {
final Image normalImage = NormalMapUtil.constructNormalMap(heightData, side, 1, 1, 1);
- final List<Integer> heightMapSizes = new ArrayList<Integer>();
+ final List<Integer> heightMapSizes = new ArrayList<>();
int currentSize = side;
heightMapSizes.add(currentSize);
for (int i = 0; i < 8; i++) {
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java
index 6d52f99..d94f497 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/providers/simplearray/SimpleArrayTextureSource.java
@@ -36,7 +36,7 @@ public class SimpleArrayTextureSource implements TextureSource {
@Override
public TextureConfiguration getConfiguration() throws Exception {
- final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<Integer, TextureStoreFormat>();
+ final Map<Integer, TextureStoreFormat> textureStoreFormat = new HashMap<>();
textureStoreFormat.put(0, TextureStoreFormat.RGBA8);
return new TextureConfiguration(availableClipmapLevels, textureStoreFormat, tileSize, 1f, true, true);
@@ -45,7 +45,7 @@ public class SimpleArrayTextureSource implements TextureSource {
@Override
public Set<Tile> getValidTiles(final int clipmapLevel, final int tileX, final int tileY, final int numTilesX,
final int numTilesY) throws Exception {
- final Set<Tile> validTiles = new HashSet<Tile>();
+ final Set<Tile> validTiles = new HashSet<>();
final int levelSize = 1 << availableClipmapLevels - clipmapLevel;
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java
index f5a5349..b346486 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/ClipmapTerrainPicker.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -41,7 +41,7 @@ public class ClipmapTerrainPicker {
/**
* Construct a new picker using the supplied pyramid, tracer and arguments.
- *
+ *
* @param levels
* the source for our height information..
* @param tracerClass
@@ -57,7 +57,7 @@ public class ClipmapTerrainPicker {
final Class<? extends AbstractBresenhamTracer> tracerClass, final int maxChecks,
final Vector3 initialSpacing) throws InstantiationException, IllegalAccessException {
_clipmapLevels = levels;
- _tracers = new ArrayList<AbstractBresenhamTracer>();
+ _tracers = new ArrayList<>();
for (int i = 0, max = levels.size(); i < max; i++) {
final AbstractBresenhamTracer tracer = tracerClass.newInstance();
final int space = 1 << i;
@@ -117,8 +117,8 @@ public class ClipmapTerrainPicker {
final double x = _workEyePos.getX();
final double z = _workEyePos.getZ();
final double intOnX = x - Math.floor(x), intOnZ = z - Math.floor(z);
- final double height = MathUtils
- .lerp(intOnZ, MathUtils.lerp(intOnX, h1, h2), MathUtils.lerp(intOnX, h3, h4));
+ final double height = MathUtils.lerp(intOnZ, MathUtils.lerp(intOnX, h1, h2),
+ MathUtils.lerp(intOnX, h3, h4));
intersection.set(x, height, z);
terrainWorldTransform.applyForward(intersection, intersection);
@@ -208,7 +208,7 @@ public class ClipmapTerrainPicker {
/**
* Check the two triangles of a given grid space for intersection.
- *
+ *
* @param gridX
* grid row
* @param gridY
@@ -225,8 +225,8 @@ public class ClipmapTerrainPicker {
}
if (!_workRay.intersectsTriangle(_gridTriA.getA(), _gridTriA.getB(), _gridTriA.getC(), store)) {
- final boolean intersects = _workRay.intersectsTriangle(_gridTriB.getA(), _gridTriB.getB(),
- _gridTriB.getC(), store);
+ final boolean intersects = _workRay.intersectsTriangle(_gridTriB.getA(), _gridTriB.getB(), _gridTriB.getC(),
+ store);
if (intersects && normalStore != null) {
final Vector3 edge1 = Vector3.fetchTempInstance().set(_gridTriB.getB()).subtractLocal(_gridTriB.getA());
final Vector3 edge2 = Vector3.fetchTempInstance().set(_gridTriB.getC()).subtractLocal(_gridTriB.getA());
@@ -247,7 +247,7 @@ public class ClipmapTerrainPicker {
/**
* Calculate the triangles (in world coordinate space) of a Pyramid that correspond to the given grid location. The
* triangles are stored in the class fields _gridTriA and _gridTriB.
- *
+ *
* @param gridX
* grid row
* @param gridY
@@ -267,7 +267,8 @@ public class ClipmapTerrainPicker {
final float h1 = getWeightedHeight(tileStore[0], tileStore[1], tileStore[2], tileStore[3], scaledClipSideSize);
final float h2 = getWeightedHeight(tileStore[4], tileStore[5], tileStore[6], tileStore[7], scaledClipSideSize);
- final float h3 = getWeightedHeight(tileStore[8], tileStore[9], tileStore[10], tileStore[11], scaledClipSideSize);
+ final float h3 = getWeightedHeight(tileStore[8], tileStore[9], tileStore[10], tileStore[11],
+ scaledClipSideSize);
final float h4 = getWeightedHeight(tileStore[12], tileStore[13], tileStore[14], tileStore[15],
scaledClipSideSize);
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java
index 73bcffc..4ae0591 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/DoubleBufferedList.java
@@ -10,8 +10,8 @@ import java.util.List;
* @param <T>
*/
public class DoubleBufferedList<T> {
- private List<T> frontList = new ArrayList<T>();
- private List<T> backList = new ArrayList<T>();
+ private List<T> frontList = new ArrayList<>();
+ private List<T> backList = new ArrayList<>();
/**
* The add method can be called at any point.
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java
index d46d85f..d00f3cb 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Region.java
@@ -3,13 +3,15 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.terrain.util;
+import java.util.Objects;
+
/**
* Used to calculate clipmap block boundaries etc
*/
@@ -201,14 +203,8 @@ public class Region {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + height;
- result = prime * result + level;
- result = prime * result + width;
- result = prime * result + x;
- result = prime * result + y;
- return result;
+ return Objects.hash(Integer.valueOf(getHeight()), Integer.valueOf(getLevel()), Integer.valueOf(getWidth()),
+ Integer.valueOf(getX()), Integer.valueOf(getY()));
}
@Override
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java
index 7210382..4aebc8e 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/Tile.java
@@ -2,6 +2,7 @@
package com.ardor3d.extension.terrain.util;
import java.io.Serializable;
+import java.util.Objects;
public class Tile implements Serializable {
private static final long serialVersionUID = 1L;
@@ -23,10 +24,7 @@ public class Tile implements Serializable {
@Override
public int hashCode() {
- int result = 17;
- result += 31 * result + x;
- result += 31 * result + y;
- return result;
+ return Objects.hash(Integer.valueOf(getX()), Integer.valueOf(getY()));
}
@Override
diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java
index 1d0a22d..71f6d7f 100644
--- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java
+++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/util/TileLocator.java
@@ -3,6 +3,7 @@ package com.ardor3d.extension.terrain.util;
import java.io.Serializable;
import java.net.URL;
+import java.util.Objects;
public class TileLocator implements Serializable {
private static final long serialVersionUID = 1L;
@@ -37,12 +38,7 @@ public class TileLocator implements Serializable {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + clipmapLevel;
- result = prime * result + sourceId;
- result = prime * result + (tile == null ? 0 : tile.hashCode());
- return result;
+ return Objects.hash(Integer.valueOf(getClipmapLevel()), Integer.valueOf(getSourceId()), tile);
}
@Override
diff --git a/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java b/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java
index 66f3345..1511e50 100644
--- a/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java
+++ b/ardor3d-terrain/src/test/java/com/ardor3d/extension/terrain/util/TestRegion.java
@@ -3,15 +3,14 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.terrain.util;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
public class TestRegion {
diff --git a/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs b/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs
index 6fe5961..65ceabb 100644
--- a/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs
+++ b/ardor3d-ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java
index e7273ca..6040efc 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIButton.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -45,7 +45,7 @@ public class UIButton extends AbstractLabelUIComponent {
protected LabelState _disabledSelectedState = new LabelState();
/** List of action listeners notified when this button is pressed. */
- private final List<ActionListener> _listeners = new ArrayList<ActionListener>();
+ private final List<ActionListener> _listeners = new ArrayList<>();
/** True if this is button is selectable/toggleable. */
private boolean _selectable = false;
@@ -67,7 +67,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Construct a new button with the given text.
- *
+ *
* @param text
*/
public UIButton(final String text) {
@@ -76,7 +76,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Construct a new button with the given text and icon.
- *
+ *
* @param text
* @param icon
*/
@@ -106,7 +106,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Add the specified listener to this button's list of listeners notified when pressed.
- *
+ *
* @param listener
*/
public void addActionListener(final ActionListener listener) {
@@ -115,7 +115,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Remove the given listener from the notification list.
- *
+ *
* @param listener
*/
public boolean removeActionListener(final ActionListener listener) {
@@ -195,7 +195,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* If selectable, set this button's state to either selected (true) or default (false) - or disabled versions of
* each if currently disabled.
- *
+ *
* @param selected
*/
public void setSelected(boolean selected) {
@@ -297,7 +297,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Sets the text on this button and all contained states.
- *
+ *
* @param text
* the new text
*/
@@ -312,7 +312,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Sets the text on this button and all contained states.
- *
+ *
* @param text
* the new text
* @param isStyled
@@ -331,7 +331,7 @@ public class UIButton extends AbstractLabelUIComponent {
/**
* Sets the icon on this button and all contained states.
- *
+ *
* @param icon
* the new icon
*/
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java
index bc6c158..90297ca 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComboBox.java
@@ -40,7 +40,7 @@ public class UIComboBox extends UIPanel {
protected int _selectedIndex = 0;
- private final List<SelectionListener<UIComboBox>> _listeners = new ArrayList<SelectionListener<UIComboBox>>();
+ private final List<SelectionListener<UIComboBox>> _listeners = new ArrayList<>();
private SkinningTask _itemSkinCallback;
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java
index 1f417b2..e4b2654 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIComponent.java
@@ -93,9 +93,9 @@ public abstract class UIComponent extends Node implements UIKeyHandler {
private static int _defaultFontSize = 18;
/** The default font styles to use. */
- private static Map<String, Object> _defaultFontStyles = new HashMap<String, Object>();
+ private static Map<String, Object> _defaultFontStyles = new HashMap<>();
/** The font styles to use for text on this component, if needed. */
- private Map<String, Object> _fontStyles = new HashMap<String, Object>();
+ private Map<String, Object> _fontStyles = new HashMap<>();
/** Optional information used by a parent container's layout. */
private UILayoutData _layoutData = null;
@@ -232,7 +232,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler {
if (getParent() != null && getParent() instanceof UIComponent) {
styles = ((UIComponent) getParent()).getFontStyles();
} else {
- styles = new HashMap<String, Object>(UIComponent._defaultFontStyles);
+ styles = new HashMap<>(UIComponent._defaultFontStyles);
styles.put(StyleConstants.KEY_COLOR, UIComponent.DEFAULT_FOREGROUND_COLOR);
}
styles.putAll(_fontStyles);
@@ -1166,9 +1166,9 @@ public abstract class UIComponent extends Node implements UIKeyHandler {
*/
public static void setDefaultFontStyles(final Map<String, Object> defaultStyles) {
if (defaultStyles == null) {
- UIComponent._defaultFontStyles = new HashMap<String, Object>();
+ UIComponent._defaultFontStyles = new HashMap<>();
} else {
- UIComponent._defaultFontStyles = new HashMap<String, Object>(defaultStyles);
+ UIComponent._defaultFontStyles = new HashMap<>(defaultStyles);
}
}
@@ -1387,7 +1387,7 @@ public abstract class UIComponent extends Node implements UIKeyHandler {
};
cancelTooltipTimer();
resetToolTipTime();
- _showTask = new FutureTask<Void>(show);
+ _showTask = new FutureTask<>(show);
final Thread t = new Thread() {
@Override
public void run() {
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java
index baaafda..1f39a17 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIHud.java
@@ -94,7 +94,7 @@ public class UIHud extends Node {
* List of potential drag listeners. When a drag operation is detected, we will offer it to each item in the list
* until one accepts it.
*/
- private final List<WeakReference<DragListener>> _dragListeners = new ArrayList<WeakReference<DragListener>>();
+ private final List<WeakReference<DragListener>> _dragListeners = new ArrayList<>();
/** Our current drag listener. When an drag finished, this is set back to null. */
private DragListener _dragListener = null;
@@ -108,7 +108,7 @@ public class UIHud extends Node {
/**
* List of hud listeners.
*/
- private final List<HudListener> _hudListeners = new ArrayList<HudListener>();
+ private final List<HudListener> _hudListeners = new ArrayList<>();
/**
* An optional mouseManager, required in order to test mouse is grabbed.
@@ -118,7 +118,7 @@ public class UIHud extends Node {
/**
* The list of currently displayed popup menus, with each entry being a submenu of the one previous.
*/
- private final List<UIPopupMenu> _popupMenus = new ArrayList<UIPopupMenu>();
+ private final List<UIPopupMenu> _popupMenus = new ArrayList<>();
/**
* Construct a new UIHud
@@ -376,7 +376,7 @@ public class UIHud extends Node {
* the listener to add
*/
public void addDragListener(final DragListener listener) {
- _dragListeners.add(new WeakReference<DragListener>(listener));
+ _dragListeners.add(new WeakReference<>(listener));
// Clean list.
for (int i = _dragListeners.size(); --i >= 0;) {
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java
index 267daeb..7e1e72b 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UIScrollBar.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -29,7 +29,7 @@ public class UIScrollBar extends UIPanel {
private final UIButton btBottomRight;
private int sliderLength;
/** List of action listeners notified when this scrollbar is changed. */
- private final List<ActionListener> _listeners = new ArrayList<ActionListener>();
+ private final List<ActionListener> _listeners = new ArrayList<>();
public UIScrollBar(final Orientation orientation) {
setLayout(new BorderLayout());
@@ -98,7 +98,7 @@ public class UIScrollBar extends UIPanel {
/**
* Add the specified listener to this scrollbar's list of listeners notified when it's changed.
- *
+ *
* @param listener
*/
public void addActionListener(final ActionListener listener) {
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java
index 3fd04cc..3348f43 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UISlider.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -33,7 +33,7 @@ public class UISlider extends UIContainer {
private final UISliderKnob _knob;
/** List of action listeners notified when this slider is changed. */
- private final List<ActionListener> _listeners = new ArrayList<ActionListener>();
+ private final List<ActionListener> _listeners = new ArrayList<>();
/** The orientation of this slider knob. */
private final Orientation _orientation;
@@ -43,7 +43,7 @@ public class UISlider extends UIContainer {
/**
* create a slider widget with a default range of [0,100]. Initial value is 50.
- *
+ *
* @param orientation
* the orientation of the slider (Orientation.Horizontal or Orientation.Vertical)
*/
@@ -53,7 +53,7 @@ public class UISlider extends UIContainer {
/**
* create a slider widget with a default range of [minValue,maxOffset] and the given initialValue.
- *
+ *
* @param orientation
* the orientation of the slider (Orientation.Horizontal or Orientation.Vertical)
* @param minValue
@@ -66,7 +66,8 @@ public class UISlider extends UIContainer {
public UISlider(final Orientation orientation, final int minValue, final int maxValue, final int initialValue) {
assert orientation != null : "orientation must not be null.";
assert minValue <= maxValue : "minValue must be less than maxValue.";
- assert minValue <= initialValue && initialValue <= maxValue : "initialValue must be between minValue and maxValue.";
+ assert minValue <= initialValue
+ && initialValue <= maxValue : "initialValue must be between minValue and maxValue.";
// Set our orientation
_orientation = orientation;
@@ -150,7 +151,7 @@ public class UISlider extends UIContainer {
/**
* Set the value on this slider
- *
+ *
* @param value
* the new value. Clamps between min and max values.
*/
@@ -196,7 +197,7 @@ public class UISlider extends UIContainer {
/**
* Add the specified listener to this slider's list of listeners notified when it has changed.
- *
+ *
* @param listener
* the listener to add
*/
@@ -206,7 +207,7 @@ public class UISlider extends UIContainer {
/**
* Remove a listener from this slider's list of listeners.
- *
+ *
* @param listener
* the listener to remove
* @return true if the listener was removed.
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java
index 37e2855..53351b4 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITabbedPane.java
@@ -32,7 +32,7 @@ public class UITabbedPane extends UIPanel {
private static final Logger logger = Logger.getLogger(UITabbedPane.class.getName());
/** Our contents... Used instead of the normal children field because we need to track and show just one at a time. */
- private final ArrayList<UIComponent> _contents = new ArrayList<UIComponent>();
+ private final ArrayList<UIComponent> _contents = new ArrayList<>();
/** The panel containing our navigation tab buttons. */
private final UIPanel _tabsPanel;
@@ -272,7 +272,7 @@ public class UITabbedPane extends UIPanel {
* @return an array of tabs from our tab panel.
*/
private ArrayList<UITab> getTabs() {
- final ArrayList<UITab> buttons = new ArrayList<UITab>();
+ final ArrayList<UITab> buttons = new ArrayList<>();
for (int x = 0, max = _tabsPanel.getNumberOfChildren(); x < max; x++) {
final Spatial spat = _tabsPanel.getChild(x);
if (spat instanceof UITab) {
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java
index 3a70e1f..eb6bafb 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/UITextField.java
@@ -3,7 +3,7 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
@@ -16,8 +16,8 @@ import java.util.List;
import com.ardor3d.extension.ui.event.ActionEvent;
import com.ardor3d.extension.ui.event.ActionListener;
import com.ardor3d.extension.ui.text.DefaultLatinTextFieldKeyHandler;
-import com.ardor3d.extension.ui.text.UIKeyHandler;
import com.ardor3d.extension.ui.text.TextSelection.SelectionState;
+import com.ardor3d.extension.ui.text.UIKeyHandler;
import com.ardor3d.input.InputState;
import com.ardor3d.input.Key;
import com.ardor3d.input.MouseButton;
@@ -37,7 +37,7 @@ public class UITextField extends AbstractUITextEntryComponent {
private final Rectangle2 _clipRectangleStore = new Rectangle2();
/** List of action listeners notified when the enter key is pressed. */
- private final List<ActionListener> _listeners = new ArrayList<ActionListener>();
+ private final List<ActionListener> _listeners = new ArrayList<>();
public UITextField() {
_disabledState = new UIState();
@@ -91,7 +91,7 @@ public class UITextField extends AbstractUITextEntryComponent {
/**
* Add the specified listener to this button's list of listeners notified when pressed.
- *
+ *
* @param listener
*/
public void addActionListener(final ActionListener listener) {
@@ -100,7 +100,7 @@ public class UITextField extends AbstractUITextEntryComponent {
/**
* Remove the given listener from the notification list.
- *
+ *
* @param listener
*/
public boolean removeActionListener(final ActionListener listener) {
@@ -169,8 +169,8 @@ public class UITextField extends AbstractUITextEntryComponent {
// TODO: alpha of text...
final boolean needsPop = getWorldRotation().isIdentity();
if (needsPop) {
- _clipRectangleStore.set(getHudX() + getTotalLeft(), getHudY() + getTotalBottom(),
- getContentWidth(), getContentHeight());
+ _clipRectangleStore.set(getHudX() + getTotalLeft(), getHudY() + getTotalBottom(), getContentWidth(),
+ getContentHeight());
r.pushClip(_clipRectangleStore);
}
_uiText.render(r);
@@ -206,12 +206,12 @@ public class UITextField extends AbstractUITextEntryComponent {
@Override
public void mouseEntered(final int mouseX, final int mouseY, final InputState state) {
- // TODO: set cursor to text entry
+ // TODO: set cursor to text entry
}
@Override
public void mouseDeparted(final int mouseX, final int mouseY, final InputState state) {
- // TODO: set cursor to default
+ // TODO: set cursor to default
}
@Override
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java
index e9b951d..490d81b 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/backdrop/MultiImageBackdrop.java
@@ -27,7 +27,7 @@ import com.ardor3d.renderer.Renderer;
public class MultiImageBackdrop extends SolidBackdrop {
/** The image(s) to draw. */
- private final List<TransformedSubTex> _images = new ArrayList<TransformedSubTex>();
+ private final List<TransformedSubTex> _images = new ArrayList<>();
/**
* Construct this back drop, using the default, no alpha backdrop color.
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java
index bf146c5..1b5ec74 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/AnchorLayout.java
@@ -51,7 +51,7 @@ import com.ardor3d.scenegraph.Spatial;
public class AnchorLayout extends UILayout {
/** map used to track anchor relationship during layout. */
- private final Map<UIComponent, AnchorRecord> _records = new HashMap<UIComponent, AnchorRecord>();
+ private final Map<UIComponent, AnchorRecord> _records = new HashMap<>();
// Various min/max values set and used during a layout operation.
private int _maxX = 0;
@@ -219,6 +219,6 @@ public class AnchorLayout extends UILayout {
private class AnchorRecord {
private transient boolean visited = false;
- private transient final ArrayList<UIComponent> dependants = new ArrayList<UIComponent>();
+ private transient final ArrayList<UIComponent> dependants = new ArrayList<>();
}
}
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java
index 44b9666..8c939e2 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/GridLayout.java
@@ -198,8 +198,8 @@ public class GridLayout extends UILayout {
ArrayList<Integer> columnWidths;
LayoutGrid() {
- components = new LinkedList<LayoutComponent>();
- columnWidths = new ArrayList<Integer>();
+ components = new LinkedList<>();
+ columnWidths = new ArrayList<>();
}
void add(final UIComponent c) {
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java
index 29724f5..e125e38 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/layout/RowLayout.java
@@ -94,8 +94,8 @@ public class RowLayout extends UILayout {
final Rectangle2 storeB = Rectangle2.fetchTempInstance();
// Grab a list of components, squeezing them down to their min size on the flow axis
- List<UIComponent> comps = new ArrayList<UIComponent>();
- List<UIComponent> compsBack = new ArrayList<UIComponent>();
+ List<UIComponent> comps = new ArrayList<>();
+ List<UIComponent> compsBack = new ArrayList<>();
for (int i = 0; i < content.size(); i++) {
final Spatial spat = content.get(i);
if (spat instanceof UIComponent) {
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java
index ffc3a1f..d1c8125 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/model/DefaultComboBoxModel.java
@@ -18,7 +18,7 @@ import java.util.List;
*/
public class DefaultComboBoxModel implements ComboBoxModel {
- protected List<ModelElement> _elements = new ArrayList<ModelElement>();
+ protected List<ModelElement> _elements = new ArrayList<>();
public DefaultComboBoxModel() {}
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java
index 4250696..5eb84c1 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/RenderedText.java
@@ -27,7 +27,7 @@ import com.ardor3d.util.scenegraph.RenderDelegate;
public class RenderedText extends Node implements Renderable {
protected String _plainText = null;
- protected List<StyleSpan> _parsedStyles = new LinkedList<StyleSpan>();
+ protected List<StyleSpan> _parsedStyles = new LinkedList<>();
protected float _width;
protected float _height;
@@ -203,11 +203,11 @@ public class RenderedText extends Node implements Renderable {
}
public static class RenderedTextData {
- public List<Integer> _xStarts = new ArrayList<Integer>();
- public List<Integer> _lineHeights = new ArrayList<Integer>();
- public List<Integer> _lineEnds = new ArrayList<Integer>();
- public List<Integer> _fontHeights = new ArrayList<Integer>();
- public List<CharacterDescriptor> _characters = new ArrayList<CharacterDescriptor>();
+ public List<Integer> _xStarts = new ArrayList<>();
+ public List<Integer> _lineHeights = new ArrayList<>();
+ public List<Integer> _lineEnds = new ArrayList<>();
+ public List<Integer> _fontHeights = new ArrayList<>();
+ public List<CharacterDescriptor> _characters = new ArrayList<>();
public RenderedTextData() {}
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java
index dde688c..6877cba 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextFactory.java
@@ -83,11 +83,11 @@ public enum TextFactory {
rVal.setStyled(styled);
// note: spans must be in order by start index
- final LinkedList<StyleSpan> spans = new LinkedList<StyleSpan>();
+ final LinkedList<StyleSpan> spans = new LinkedList<>();
final String plainText;
if (styled && _styleParser != null) {
// parse text for style spans
- final List<StyleSpan> styleStore = new ArrayList<StyleSpan>();
+ final List<StyleSpan> styleStore = new ArrayList<>();
plainText = _styleParser.parseStyleSpans(text, styleStore);
Collections.sort(styleStore);
if (!styleStore.isEmpty()) {
@@ -110,7 +110,7 @@ public enum TextFactory {
textData.reset();
char prevChar = 0, c = 0;
- final List<StyleSpan> currentStyles = new LinkedList<StyleSpan>();
+ final List<StyleSpan> currentStyles = new LinkedList<>();
// indexed by character offset
final List<CharacterDescriptor> descs = textData._characters;
final List<Integer> descXStarts = textData._xStarts;
@@ -123,7 +123,7 @@ public enum TextFactory {
int maxLineHeight = 0, xOffset = 0, maxSizeHeight = 0;
UIFont prevFont = null;
double scale = 1, prevScale = 0;
- final Map<String, Object> stylesMap = new HashMap<String, Object>();
+ final Map<String, Object> stylesMap = new HashMap<>();
final char[] chars = plainText.toCharArray();
for (int i = 0; i < chars.length; i++) {
@@ -156,7 +156,7 @@ public enum TextFactory {
}
// find the UIFont related to the given font family & size & styles
- final AtomicReference<Double> scaleRef = new AtomicReference<Double>();
+ final AtomicReference<Double> scaleRef = new AtomicReference<>();
final UIFont font = _fontProvider.getClosestMatchingFont(stylesMap, scaleRef);
if (font == null) {
return rVal;
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java
index c770582..99c6dd7 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/TextSelection.java
@@ -184,7 +184,7 @@ public abstract class TextSelection {
final RenderedTextData data = getTextData();
float xStart = 0, xEnd = 0, height = 0, yOffset = 0;
boolean exit = false;
- final List<Float> verts = new ArrayList<Float>();
+ final List<Float> verts = new ArrayList<>();
for (int j = 0; !exit && j < data._lineEnds.size(); j++) {
height = data._lineHeights.get(j);
final int end = data._lineEnds.get(j);
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java
index dfe7ef9..1d199ad 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/BMFontProvider.java
@@ -36,9 +36,9 @@ public class BMFontProvider implements FontProvider {
private static Logger logger = Logger.getLogger(BMFontProvider.class.getName());
- protected Map<UIFont, Integer> _scoreMap = new HashMap<UIFont, Integer>();
+ protected Map<UIFont, Integer> _scoreMap = new HashMap<>();
- protected final Set<FontInfo> _fonts = new HashSet<FontInfo>();
+ protected final Set<FontInfo> _fonts = new HashSet<>();
public void addFont(final String source, final String family, final int size, final boolean bold,
final boolean italic) {
@@ -128,7 +128,7 @@ public class BMFontProvider implements FontProvider {
}
}
- final Map<Character, CharacterDescriptor> descriptors = new HashMap<Character, CharacterDescriptor>();
+ final Map<Character, CharacterDescriptor> descriptors = new HashMap<>();
for (final int val : closest.bmFont.getMappedChars()) {
final Char c = closest.bmFont.getChar(val);
final CharacterDescriptor desc = new CharacterDescriptor(c.x, c.y, c.width, c.height, c.xadvance,
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java
index 9de2ff4..07f9cd8 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/font/UIFont.java
@@ -21,8 +21,8 @@ import com.ardor3d.image.Texture2D;
*/
public class UIFont {
- private final Map<Character, CharacterDescriptor> _charDescriptors = new HashMap<Character, CharacterDescriptor>();
- private final Map<Character, Map<Character, Integer>> _kernMap = new HashMap<Character, Map<Character, Integer>>();
+ private final Map<Character, CharacterDescriptor> _charDescriptors = new HashMap<>();
+ private final Map<Character, Map<Character, Integer>> _kernMap = new HashMap<>();
private final Texture2D _fontTexture;
private final int _fontHeight;
private final int _fontSize;
@@ -59,7 +59,7 @@ public class UIFont {
public void addKerning(final char charA, final char charB, final int amount) {
Map<Character, Integer> map = _kernMap.get(charA);
if (map == null) {
- map = new HashMap<Character, Integer>();
+ map = new HashMap<>();
_kernMap.put(charA, map);
}
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java
index 7fd0629..407640a 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParser.java
@@ -38,7 +38,7 @@ public class ForumLikeMarkupParser implements StyleParser {
int index = 0;
TagStatus tagStatus = TagStatus.NONE;
String currTagText = "";
- final LinkedList<StyleSpan> buildingSpans = new LinkedList<StyleSpan>();
+ final LinkedList<StyleSpan> buildingSpans = new LinkedList<>();
final StringTokenizer st = new StringTokenizer(text, "[]\\", true);
String token;
while (st.hasMoreTokens()) {
@@ -184,12 +184,12 @@ public class ForumLikeMarkupParser implements StyleParser {
}
// list of spans, sorted by start index
- final List<StyleSpan> starts = new ArrayList<StyleSpan>();
+ final List<StyleSpan> starts = new ArrayList<>();
starts.addAll(spans);
Collections.sort(starts);
// list of spans, to be sorted by end index
- final List<StyleSpan> ends = new LinkedList<StyleSpan>();
+ final List<StyleSpan> ends = new LinkedList<>();
final StringBuilder builder = new StringBuilder();
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java
index ad7f059..d3ecee9 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/ButtonGroup.java
@@ -23,7 +23,7 @@ import com.ardor3d.extension.ui.UIButton;
public class ButtonGroup {
/** The list of buttons participating in this group. */
- private final List<UIButton> _buttons = new ArrayList<UIButton>();
+ private final List<UIButton> _buttons = new ArrayList<>();
/** The currently selected button. */
private UIButton _selected;
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java
index 31cb508..6f6394d 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Dimension.java
@@ -3,13 +3,15 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.ui.util;
+import java.util.Objects;
+
/**
* This class is patterned after awt's {@link java.awt.Dimension Dimension} class. It describes the width and height of
* something (in our case, generally a UI element.)
@@ -28,7 +30,7 @@ public class Dimension {
/**
* Construct a new dimension object using the given values.
- *
+ *
* @param width
* @param height
*/
@@ -39,7 +41,7 @@ public class Dimension {
/**
* Construct a new dimension object using the values of the given source.
- *
+ *
* @param source
*/
public Dimension(final Dimension source) {
@@ -90,10 +92,7 @@ public class Dimension {
@Override
public int hashCode() {
- int result = 17;
- result += 31 * result + getWidth();
- result += 31 * result + getHeight();
- return result;
+ return Objects.hash(Integer.valueOf(getWidth()), Integer.valueOf(getHeight()));
}
@Override
diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java
index d9f8fe6..9035ad2 100644
--- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java
+++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/util/Insets.java
@@ -3,13 +3,15 @@
*
* This file is part of Ardor3D.
*
- * Ardor3D is free software: you can redistribute it and/or modify it
+ * Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.extension.ui.util;
+import java.util.Objects;
+
/**
* This class is patterned after awt's {@link java.awt.Insets Insets} class. It describes the margins on four sides of a
* rectangular area and is the foundation of our UIBorder class.
@@ -30,7 +32,7 @@ public class Insets {
/**
* Constructs a new insets using the given sizes.
- *
+ *
* @param top
* @param left
* @param bottom
@@ -42,7 +44,7 @@ public class Insets {
/**
* Constructs a new insets using the sizes from the given source.
- *
+ *
* @param source
*/
public Insets(final Insets source) {
@@ -51,7 +53,7 @@ public class Insets {
/**
* Set the size of the sides to the given values.
- *
+ *
* @param top
* @param left
* @param bottom
@@ -114,11 +116,7 @@ public class Insets {
@Override
public int hashCode() {
- int result = 17;
- result += 31 * result + getLeft();
- result += 31 * result + getRight();
- result += 31 * result + getTop();
- result += 31 * result + getBottom();
- return result;
+ return Objects.hash(Integer.valueOf(getLeft()), Integer.valueOf(getRight()), Integer.valueOf(getTop()),
+ Integer.valueOf(getBottom()));
}
}
diff --git a/ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java b/ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java
index da890d9..7974022 100644
--- a/ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java
+++ b/ardor3d-ui/src/test/java/com/ardor3d/extension/ui/text/parser/ForumLikeMarkupParserTest.java
@@ -35,7 +35,7 @@ public class ForumLikeMarkupParserTest {
@Test
public void parseWithoutMarkup() {
final String text = "A text without any markup what so ever [13] dum di dum [/23]";
- final List<StyleSpan> spans = new ArrayList<StyleSpan>();
+ final List<StyleSpan> spans = new ArrayList<>();
final String result = parser.parseStyleSpans(text, spans);
Assert.assertEquals(text, result);
@@ -46,7 +46,7 @@ public class ForumLikeMarkupParserTest {
@Test
public void parseWithSimpleStyle() throws Exception {
final String text = "A text with [size=30]simple markup[/size] dum di dum";
- final List<StyleSpan> spans = new ArrayList<StyleSpan>();
+ final List<StyleSpan> spans = new ArrayList<>();
final String result = parser.parseStyleSpans(text, spans);
Assert.assertEquals("A text with simple markup dum di dum", result);
@@ -62,13 +62,13 @@ public class ForumLikeMarkupParserTest {
@Test
public void parseWithNestedStyle() throws Exception {
final String text = "A text [size=30]with [f=arial]simple markup[/f][/size] dum di dum";
- final List<StyleSpan> spans = new ArrayList<StyleSpan>();
+ final List<StyleSpan> spans = new ArrayList<>();
final String result = parser.parseStyleSpans(text, spans);
Assert.assertEquals("A text with simple markup dum di dum", result);
Assert.assertEquals(2, spans.size());
- final SortedSet<StyleSpan> sortedSpans = new TreeSet<StyleSpan>(spans);
+ final SortedSet<StyleSpan> sortedSpans = new TreeSet<>(spans);
final Iterator<StyleSpan> spanIterator = sortedSpans.iterator();
final StyleSpan span1 = spanIterator.next();
Assert.assertEquals(7, span1.getSpanStart());
@@ -83,13 +83,13 @@ public class ForumLikeMarkupParserTest {
@Test
public void parseWithNestedSameStyleBackToBackTags() throws Exception {
final String text = "[size=10][size=20]A text [/size]with simple markup[/size] dum di dum";
- final List<StyleSpan> spans = new ArrayList<StyleSpan>();
+ final List<StyleSpan> spans = new ArrayList<>();
final String result = parser.parseStyleSpans(text, spans);
Assert.assertEquals("A text with simple markup dum di dum", result);
Assert.assertEquals(2, spans.size());
- final SortedSet<StyleSpan> sortedSpans = new TreeSet<StyleSpan>(spans);
+ final SortedSet<StyleSpan> sortedSpans = new TreeSet<>(spans);
final Iterator<StyleSpan> spanIterator = sortedSpans.iterator();
final StyleSpan span1 = spanIterator.next();
Assert.assertEquals(0, span1.getSpanStart());
diff --git a/pom.xml b/pom.xml
index 721c848..0c2d807 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,8 +132,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
<encoding>UTF-8</encoding>
<debug>true</debug>
</configuration>
@@ -235,8 +235,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
</configuration>
</plugin>
<plugin>
@@ -258,7 +258,7 @@
<manifestLocation>target/classes/META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- <Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment>
+ <Bundle-RequiredExecutionEnvironment>JavaSE-1.7</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
</plugin>