1 package net.sf.josceleton.motion.impl.gesture;
2
3 import java.util.Collection;
4
5 import net.sf.josceleton.core.api.entity.Coordinate;
6 import net.sf.josceleton.core.api.entity.joint.Joint;
7 import net.sf.josceleton.core.api.entity.joint.Skeleton;
8 import net.sf.josceleton.motion.api.gesture.GestureListener;
9 import net.sf.josceleton.motion.api.gesture.JointableGesture;
10 import net.sf.josceleton.motion.api.gesture.JointableGestureConfig;
11
12
13
14
15 public abstract class AbstractJointableGesture<C extends JointableGestureConfig, L extends GestureListener>
16 extends AbstractGesture<C, L>
17 implements JointableGesture<C, L> {
18
19 private final Collection<Joint> relevantJoints;
20
21
22 public AbstractJointableGesture(final JointableGestureConfig configuration) {
23 this.relevantJoints = configuration.getRelevantJoints();
24 }
25
26
27
28
29 protected abstract void onMovedRelevantJoint(Joint movedJoint, Coordinate updatedCoordinate, Skeleton skeleton);
30
31
32 @Override public final void onMoved(
33 final Joint movedJoint, final Coordinate updatedCoordinate, final Skeleton skeleton) {
34
35 if(this.relevantJoints.contains(movedJoint) == true) {
36 this.onMovedRelevantJoint(movedJoint, updatedCoordinate, skeleton);
37 }
38 }
39
40 }