2 * Copyright (c) 2010 The Desert team
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
26 package org
.sourceforge
.desert
;
30 * @author codistmonk (creation 2010-04-17)
32 public class ParticleDefaultImplementation
implements Particle
{
44 public ParticleDefaultImplementation() {
45 this(Type
.values()[0], 0F
, 0F
, 0F
, 0F
);
51 * <br>Should not be null
53 * <br>Should not be null
54 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
56 * <br>Should not be null
57 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
59 * <br>Should not be null
60 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
62 * <br>Should not be null
63 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
65 public ParticleDefaultImplementation(final Type type
, final float x
, final float y
, final float speedX
, final float speedY
) {
74 public final float getSpeedX() {
81 * <br>Should not be null
82 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
84 public final void setSpeedX(final float speedX
) {
89 public final float getSpeedY() {
96 * <br>Should not be null
97 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
99 public final void setSpeedY(final float speedY
) {
100 this.speedY
= speedY
;
104 public final Type
getType() {
111 * <br>Should not be null
113 public final void setType(final Type type
) {
118 public final float getX() {
125 * <br>Should not be null
126 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
128 public final void setX(final float x
) {
133 public final float getY() {
140 * <br>Should not be null
141 * <br>Range: <code>]float.NEGATIVE_INFINITY .. float.POSITIVE_INFINITY[</code>
143 public final void setY(final float y
) {
148 public String
toString() {
149 return "(" + this.getType() + ", " + this.getX() + ", " + this.getY() + ", " + this.getSpeedX() + ", " + this.getSpeedY() + ")";
153 public final boolean equals(final Object obj
) {
157 if (!Particle
.class.isAssignableFrom(obj
.getClass())) {
160 final Particle other
= (Particle
) obj
;
161 if (this.getType() != other
.getType() && (this.getType() == null || !this.getType().equals(other
.getType()))) {
164 if (this.getX() != other
.getX()) {
167 if (this.getY() != other
.getY()) {
170 if (this.getSpeedX() != other
.getSpeedX()) {
173 if (this.getSpeedY() != other
.getSpeedY()) {
180 public final int hashCode() {
183 hash
= 47 * hash
+ (this.type
!= null ?
this.type
.hashCode() : 0);