View Javadoc

1   package net.sf.josceleton.motion.impl.gesture;
2   
3   import java.util.Collection;
4   
5   import net.sf.josceleton.commons.util.CollectionUtil;
6   import net.sf.josceleton.core.api.entity.joint.Joint;
7   import net.sf.josceleton.motion.api.gesture.GestureListener;
8   import net.sf.josceleton.motion.api.gesture.JointableGesture;
9   import net.sf.josceleton.motion.api.gesture.JointableGestureBuilder;
10  import net.sf.josceleton.motion.api.gesture.JointableGestureConfig;
11  
12  public abstract class AbstractJointableGestureBuilder<
13  		B extends JointableGestureBuilder<B, G, C, L>,
14  		G extends JointableGesture<C, L>,
15  		C extends JointableGestureConfig,
16  		L extends GestureListener>
17  	extends AbstractGestureBuilder<B, G, C, L>
18  		implements JointableGestureBuilder<B, G, C, L> {
19  
20  
21  	private Collection<Joint> pAttachedJoints;
22  	
23  	// MINOR only little Generics glitch in here :(
24  	//       would need AbstractJointableGestureBuilder (or lower) as B,
25  	//       but can only define JointableGestureBuilder to not assume too much...
26  	
27  	/** {@inheritDoc} from {@link JointableGestureBuilder} */
28  	@SuppressWarnings("unchecked")
29  	@Override public final B relevantJoints(final Joint[] joints) {
30  		this.pAttachedJoints = CollectionUtil.toUnmodifiableSet(joints);
31  		return (B) this;
32  	}
33  
34  	/** {@inheritDoc} from {@link JointableGestureBuilder} */
35  	@SuppressWarnings("unchecked")
36  	@Override public final B relevantJoint(final Joint atLeastOneJoint, final Joint... optionallyMoreJoints) {
37  		this.pAttachedJoints = CollectionUtil.mergeToUnmodifiableSet(atLeastOneJoint, optionallyMoreJoints);
38  		return (B) this;
39  	}
40  	
41  	protected final Collection<Joint> getPAttachedJoints() {
42  		return this.pAttachedJoints;
43  	}
44  }