Module org.dyn4j
Package org.dyn4j.collision
Class BasicCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Object
-
- AbstractCollisionPair<T,E>
-
- BasicCollisionPair<T,E>
-
- Type Parameters:
T
- the body typeE
- the fixture type
- All Implemented Interfaces:
CollisionPair<T,E>
,Copyable<CollisionPair<T,E>>
public final class BasicCollisionPair<T extends CollisionBody<E>,E extends Fixture> extends AbstractCollisionPair<T,E> implements CollisionPair<T,E>
Represents a basic, immutable implementation of theCollisionPair
interface.- Since:
- 4.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
-
-
Constructor Summary
Constructors Constructor Description BasicCollisionPair(T body1, E fixture1, T body2, E fixture2)
Minimal constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicCollisionPair<T,E>
copy()
Returns a deep copy of this object.boolean
equals(Object obj)
T
getBody(CollisionBody<?> body)
Returns the body that matches the given body.T
getBody1()
Returns the firstCollisionBody
.T
getBody2()
Returns the secondCollisionBody
.E
getFixture(CollisionBody<?> body)
Returns the fixture for the body that matches the given body.E
getFixture1()
Returns the firstFixture
.E
getFixture2()
Returns the secondFixture
.T
getOtherBody(CollisionBody<?> body)
Returns the body that does not match the given body.E
getOtherFixture(CollisionBody<?> body)
Returns the fixture for the body that does not match the given body.int
hashCode()
-
Methods inherited from class AbstractCollisionPair
equals, getHashCode
-
-
-
-
Method Detail
-
copy
public BasicCollisionPair<T,E> copy()
Description copied from interface:Copyable
Returns a deep copy of this object.- Specified by:
copy
in interfaceCopyable<T extends CollisionBody<E>>
- Returns:
- T
-
getBody1
public T getBody1()
Description copied from interface:CollisionPair
Returns the firstCollisionBody
.- Specified by:
getBody1
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Returns:
- E
-
getFixture1
public E getFixture1()
Description copied from interface:CollisionPair
Returns the firstFixture
.- Specified by:
getFixture1
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Returns:
- T
-
getBody2
public T getBody2()
Description copied from interface:CollisionPair
Returns the secondCollisionBody
.- Specified by:
getBody2
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Returns:
- E
-
getFixture2
public E getFixture2()
Description copied from interface:CollisionPair
Returns the secondFixture
.- Specified by:
getFixture2
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Returns:
- T
-
getBody
public T getBody(CollisionBody<?> body)
Description copied from interface:CollisionPair
Returns the body that matches the given body.If the given body is neither body1 or body2, null is returned.
- Specified by:
getBody
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Parameters:
body
- the body- Returns:
- T
-
getFixture
public E getFixture(CollisionBody<?> body)
Description copied from interface:CollisionPair
Returns the fixture for the body that matches the given body.If the given body is neither body1 or body2, null is returned.
- Specified by:
getFixture
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Parameters:
body
- the body- Returns:
- E
-
getOtherBody
public T getOtherBody(CollisionBody<?> body)
Description copied from interface:CollisionPair
Returns the body that does not match the given body.If the given body is neither body1 or body2, null is returned.
- Specified by:
getOtherBody
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Parameters:
body
- the body- Returns:
- T
-
getOtherFixture
public E getOtherFixture(CollisionBody<?> body)
Description copied from interface:CollisionPair
Returns the fixture for the body that does not match the given body.If the given body is neither body1 or body2, null is returned.
- Specified by:
getOtherFixture
in interfaceCollisionPair<T extends CollisionBody<E>,E extends Fixture>
- Parameters:
body
- the body- Returns:
- E
-
-