Source Code Cross Referenced for HAnimJointTree.java in  » 6.0-JDK-Modules » java-3d » com » db » hanim » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » com.db.hanim 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2000-2001 Silvere Martin-Michiellot All Rights Reserved.
003:         *
004:         * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
005:         * royalty free, license to use, but not to modify or redistribute this
006:         * software in source and binary code form,
007:         * provided that i) this copyright notice and license appear on all copies of
008:         * the software; and ii) Licensee does not utilize the software in a manner
009:         * which is disparaging to Silvere Martin-Michiellot.
010:         *
011:         * This software is provided "AS IS," without a warranty of any kind. ALL
012:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
013:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
014:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
015:         * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
016:         * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
017:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
018:         * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
019:         * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
020:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
021:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
022:         * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
023:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
024:         *
025:         * This software is not designed or intended for use in on-line control of
026:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
027:         * the design, construction, operation or maintenance of any nuclear
028:         * facility. Licensee represents and warrants that it will not use or
029:         * redistribute the Software for such purposes.
030:         *
031:         * @Author: Silvere Martin-Michiellot for Digital Biosphere
032:         * @Version: 1.1 (to stay in touch with h-anim)
033:         *
034:         */
035:
036:        package com.db.hanim;
037:
038:        import java.util.*;
039:
040:        /**
041:         * This class is to implement a HAnimJointTree checker. Basically, given two Joints, it ouputs an boolean if the first Joint has the second Joint as child.
042:         *
043:         * @author Silvere Martin-Michiellot
044:         * @version 1.1
045:         */
046:
047:        public final class HAnimJointTree {
048:
049:            private static JointTree humanoidRootJointTree;
050:            private static JointTree sacroiliacJointTree;
051:            private static JointTree l_hipJointTree;
052:            private static JointTree l_kneeJointTree;
053:            private static JointTree l_ankleJointTree;
054:            private static JointTree l_subtalarJointTree;
055:            private static JointTree l_midtarsalJointTree;
056:            private static JointTree l_metatarsalJointTree;
057:            private static JointTree r_hipJointTree;
058:            private static JointTree r_kneeJointTree;
059:            private static JointTree r_ankleJointTree;
060:            private static JointTree r_subtalarJointTree;
061:            private static JointTree r_midtarsalJointTree;
062:            private static JointTree r_metatarsalJointTree;
063:            private static JointTree vl5JointTree;
064:            private static JointTree vl4JointTree;
065:            private static JointTree vl3JointTree;
066:            private static JointTree vl2JointTree;
067:            private static JointTree vl1JointTree;
068:            private static JointTree vt12JointTree;
069:            private static JointTree vt11JointTree;
070:            private static JointTree vt10JointTree;
071:            private static JointTree vt9JointTree;
072:            private static JointTree vt8JointTree;
073:            private static JointTree vt7JointTree;
074:            private static JointTree vt6JointTree;
075:            private static JointTree vt5JointTree;
076:            private static JointTree vt4JointTree;
077:            private static JointTree vt3JointTree;
078:            private static JointTree vt2JointTree;
079:            private static JointTree vt1JointTree;
080:            private static JointTree vc7JointTree;
081:            private static JointTree vc6JointTree;
082:            private static JointTree vc5JointTree;
083:            private static JointTree vc4JointTree;
084:            private static JointTree vc3JointTree;
085:            private static JointTree vc2JointTree;
086:            private static JointTree vc1JointTree;
087:            private static JointTree skullbaseJointTree;
088:            private static JointTree l_eyelid_jointJointTree;
089:            private static JointTree r_eyelid_jointJointTree;
090:            private static JointTree l_eyeball_jointJointTree;
091:            private static JointTree r_eyeball_jointJointTree;
092:            private static JointTree l_eyebrow_jointJointTree;
093:            private static JointTree r_eyebrow_jointJointTree;
094:            private static JointTree temporomandibularJointTree;
095:            private static JointTree l_sternoclavicularJointTree;
096:            private static JointTree l_acromioclavicularJointTree;
097:            private static JointTree l_shoulderJointTree;
098:            private static JointTree l_elbowJointTree;
099:            private static JointTree l_wristJointTree;
100:            private static JointTree l_thumb1JointTree;
101:            private static JointTree l_thumb2JointTree;
102:            private static JointTree l_thumb3JointTree;
103:            private static JointTree l_index0JointTree;
104:            private static JointTree l_index1JointTree;
105:            private static JointTree l_index2JointTree;
106:            private static JointTree l_index3JointTree;
107:            private static JointTree l_middle0JointTree;
108:            private static JointTree l_middle1JointTree;
109:            private static JointTree l_middle2JointTree;
110:            private static JointTree l_middle3JointTree;
111:            private static JointTree l_ring0JointTree;
112:            private static JointTree l_ring1JointTree;
113:            private static JointTree l_ring2JointTree;
114:            private static JointTree l_ring3JointTree;
115:            private static JointTree l_pinky0JointTree;
116:            private static JointTree l_pinky1JointTree;
117:            private static JointTree l_pinky2JointTree;
118:            private static JointTree l_pinky3JointTree;
119:            private static JointTree r_sternoclavicularJointTree;
120:            private static JointTree r_acromioclavicularJointTree;
121:            private static JointTree r_shoulderJointTree;
122:            private static JointTree r_elbowJointTree;
123:            private static JointTree r_wristJointTree;
124:            private static JointTree r_thumb1JointTree;
125:            private static JointTree r_thumb2JointTree;
126:            private static JointTree r_thumb3JointTree;
127:            private static JointTree r_index0JointTree;
128:            private static JointTree r_index1JointTree;
129:            private static JointTree r_index2JointTree;
130:            private static JointTree r_index3JointTree;
131:            private static JointTree r_middle0JointTree;
132:            private static JointTree r_middle1JointTree;
133:            private static JointTree r_middle2JointTree;
134:            private static JointTree r_middle3JointTree;
135:            private static JointTree r_ring0JointTree;
136:            private static JointTree r_ring1JointTree;
137:            private static JointTree r_ring2JointTree;
138:            private static JointTree r_ring3JointTree;
139:            private static JointTree r_pinky0JointTree;
140:            private static JointTree r_pinky1JointTree;
141:            private static JointTree r_pinky2JointTree;
142:            private static JointTree r_pinky3JointTree;
143:
144:            /**
145:             * Construct a new HAnimJointTree. This class has only to be instanciated once.
146:             */
147:            public HAnimJointTree() {
148:
149:                humanoidRootJointTree = new JointTree(Joint.HumanoidRoot);
150:                sacroiliacJointTree = new JointTree(Joint.sacroiliac);
151:                l_hipJointTree = new JointTree(Joint.l_hip);
152:                l_kneeJointTree = new JointTree(Joint.l_knee);
153:                l_ankleJointTree = new JointTree(Joint.l_ankle);
154:                l_subtalarJointTree = new JointTree(Joint.l_subtalar);
155:                l_midtarsalJointTree = new JointTree(Joint.l_midtarsal);
156:                l_metatarsalJointTree = new JointTree(Joint.l_metatarsal);
157:                r_hipJointTree = new JointTree(Joint.r_hip);
158:                r_kneeJointTree = new JointTree(Joint.r_knee);
159:                r_ankleJointTree = new JointTree(Joint.r_ankle);
160:                r_subtalarJointTree = new JointTree(Joint.r_subtalar);
161:                r_midtarsalJointTree = new JointTree(Joint.r_midtarsal);
162:                r_metatarsalJointTree = new JointTree(Joint.r_metatarsal);
163:                vl5JointTree = new JointTree(Joint.vl5);
164:                vl4JointTree = new JointTree(Joint.vl4);
165:                vl3JointTree = new JointTree(Joint.vl3);
166:                vl2JointTree = new JointTree(Joint.vl2);
167:                vl1JointTree = new JointTree(Joint.vl1);
168:                vt12JointTree = new JointTree(Joint.vt12);
169:                vt11JointTree = new JointTree(Joint.vt11);
170:                vt10JointTree = new JointTree(Joint.vt10);
171:                vt9JointTree = new JointTree(Joint.vt9);
172:                vt8JointTree = new JointTree(Joint.vt8);
173:                vt7JointTree = new JointTree(Joint.vt7);
174:                vt6JointTree = new JointTree(Joint.vt6);
175:                vt5JointTree = new JointTree(Joint.vt5);
176:                vt4JointTree = new JointTree(Joint.vt4);
177:                vt3JointTree = new JointTree(Joint.vt3);
178:                vt2JointTree = new JointTree(Joint.vt2);
179:                vt1JointTree = new JointTree(Joint.vt1);
180:                vc7JointTree = new JointTree(Joint.vc7);
181:                vc6JointTree = new JointTree(Joint.vc6);
182:                vc5JointTree = new JointTree(Joint.vc5);
183:                vc4JointTree = new JointTree(Joint.vc4);
184:                vc3JointTree = new JointTree(Joint.vc3);
185:                vc2JointTree = new JointTree(Joint.vc2);
186:                vc1JointTree = new JointTree(Joint.vc1);
187:                skullbaseJointTree = new JointTree(Joint.skullbase);
188:                l_eyelid_jointJointTree = new JointTree(Joint.l_eyelid_joint);
189:                r_eyelid_jointJointTree = new JointTree(Joint.r_eyelid_joint);
190:                l_eyeball_jointJointTree = new JointTree(Joint.l_eyeball_joint);
191:                r_eyeball_jointJointTree = new JointTree(Joint.r_eyeball_joint);
192:                l_eyebrow_jointJointTree = new JointTree(Joint.l_eyebrow_joint);
193:                r_eyebrow_jointJointTree = new JointTree(Joint.r_eyebrow_joint);
194:                temporomandibularJointTree = new JointTree(
195:                        Joint.temporomandibular);
196:                l_sternoclavicularJointTree = new JointTree(
197:                        Joint.l_sternoclavicular);
198:                l_acromioclavicularJointTree = new JointTree(
199:                        Joint.l_acromioclavicular);
200:                l_shoulderJointTree = new JointTree(Joint.l_shoulder);
201:                l_elbowJointTree = new JointTree(Joint.l_elbow);
202:                l_wristJointTree = new JointTree(Joint.l_wrist);
203:                l_thumb1JointTree = new JointTree(Joint.l_thumb1);
204:                l_thumb2JointTree = new JointTree(Joint.l_thumb2);
205:                l_thumb3JointTree = new JointTree(Joint.l_thumb3);
206:                l_index0JointTree = new JointTree(Joint.l_index0);
207:                l_index1JointTree = new JointTree(Joint.l_index1);
208:                l_index2JointTree = new JointTree(Joint.l_index2);
209:                l_index3JointTree = new JointTree(Joint.l_index3);
210:                l_middle0JointTree = new JointTree(Joint.l_middle0);
211:                l_middle1JointTree = new JointTree(Joint.l_middle1);
212:                l_middle2JointTree = new JointTree(Joint.l_middle2);
213:                l_middle3JointTree = new JointTree(Joint.l_middle3);
214:                l_ring0JointTree = new JointTree(Joint.l_ring0);
215:                l_ring1JointTree = new JointTree(Joint.l_ring1);
216:                l_ring2JointTree = new JointTree(Joint.l_ring2);
217:                l_ring3JointTree = new JointTree(Joint.l_ring3);
218:                l_pinky0JointTree = new JointTree(Joint.l_pinky0);
219:                l_pinky1JointTree = new JointTree(Joint.l_pinky1);
220:                l_pinky2JointTree = new JointTree(Joint.l_pinky2);
221:                l_pinky3JointTree = new JointTree(Joint.l_pinky3);
222:                r_sternoclavicularJointTree = new JointTree(
223:                        Joint.r_sternoclavicular);
224:                r_acromioclavicularJointTree = new JointTree(
225:                        Joint.r_acromioclavicular);
226:                r_shoulderJointTree = new JointTree(Joint.r_shoulder);
227:                r_elbowJointTree = new JointTree(Joint.r_elbow);
228:                r_wristJointTree = new JointTree(Joint.r_wrist);
229:                r_thumb1JointTree = new JointTree(Joint.r_thumb1);
230:                r_thumb2JointTree = new JointTree(Joint.r_thumb2);
231:                r_thumb3JointTree = new JointTree(Joint.r_thumb3);
232:                r_index0JointTree = new JointTree(Joint.r_index0);
233:                r_index1JointTree = new JointTree(Joint.r_index1);
234:                r_index2JointTree = new JointTree(Joint.r_index2);
235:                r_index3JointTree = new JointTree(Joint.r_index3);
236:                r_middle0JointTree = new JointTree(Joint.r_middle0);
237:                r_middle1JointTree = new JointTree(Joint.r_middle1);
238:                r_middle2JointTree = new JointTree(Joint.r_middle2);
239:                r_middle3JointTree = new JointTree(Joint.r_middle3);
240:                r_ring0JointTree = new JointTree(Joint.r_ring0);
241:                r_ring1JointTree = new JointTree(Joint.r_ring1);
242:                r_ring2JointTree = new JointTree(Joint.r_ring2);
243:                r_ring3JointTree = new JointTree(Joint.r_ring3);
244:                r_pinky0JointTree = new JointTree(Joint.r_pinky0);
245:                r_pinky1JointTree = new JointTree(Joint.r_pinky1);
246:                r_pinky2JointTree = new JointTree(Joint.r_pinky2);
247:                r_pinky3JointTree = new JointTree(Joint.r_pinky3);
248:
249:                r_pinky2JointTree.addChild(r_pinky3JointTree);
250:                r_pinky1JointTree.addChild(r_pinky2JointTree);
251:                r_pinky0JointTree.addChild(r_pinky1JointTree);
252:                r_wristJointTree.addChild(r_pinky0JointTree);
253:                r_ring2JointTree.addChild(r_ring3JointTree);
254:                r_ring1JointTree.addChild(r_ring2JointTree);
255:                r_ring0JointTree.addChild(r_ring1JointTree);
256:                r_wristJointTree.addChild(r_ring0JointTree);
257:                r_middle2JointTree.addChild(r_middle3JointTree);
258:                r_middle1JointTree.addChild(r_middle2JointTree);
259:                r_middle0JointTree.addChild(r_middle1JointTree);
260:                r_wristJointTree.addChild(r_middle0JointTree);
261:                r_index2JointTree.addChild(r_index3JointTree);
262:                r_index1JointTree.addChild(r_index2JointTree);
263:                r_index0JointTree.addChild(r_index1JointTree);
264:                r_wristJointTree.addChild(r_index0JointTree);
265:                r_thumb2JointTree.addChild(r_thumb3JointTree);
266:                r_thumb1JointTree.addChild(r_thumb2JointTree);
267:                r_wristJointTree.addChild(r_thumb1JointTree);
268:                r_elbowJointTree.addChild(r_wristJointTree);
269:                r_shoulderJointTree.addChild(r_elbowJointTree);
270:                r_acromioclavicularJointTree.addChild(r_shoulderJointTree);
271:                r_sternoclavicularJointTree
272:                        .addChild(r_acromioclavicularJointTree);
273:                vt1JointTree.addChild(r_sternoclavicularJointTree);
274:                l_pinky2JointTree.addChild(l_pinky3JointTree);
275:                l_pinky1JointTree.addChild(l_pinky2JointTree);
276:                l_pinky0JointTree.addChild(l_pinky1JointTree);
277:                l_wristJointTree.addChild(l_pinky0JointTree);
278:                l_ring2JointTree.addChild(l_ring3JointTree);
279:                l_ring1JointTree.addChild(l_ring2JointTree);
280:                l_ring0JointTree.addChild(l_ring1JointTree);
281:                l_wristJointTree.addChild(l_ring0JointTree);
282:                l_middle2JointTree.addChild(l_middle3JointTree);
283:                l_middle1JointTree.addChild(l_middle2JointTree);
284:                l_middle0JointTree.addChild(l_middle1JointTree);
285:                l_wristJointTree.addChild(l_middle0JointTree);
286:                l_index2JointTree.addChild(l_index3JointTree);
287:                l_index1JointTree.addChild(l_index2JointTree);
288:                l_index0JointTree.addChild(l_index1JointTree);
289:                l_wristJointTree.addChild(l_index0JointTree);
290:                l_thumb2JointTree.addChild(l_thumb3JointTree);
291:                l_thumb1JointTree.addChild(l_thumb2JointTree);
292:                l_wristJointTree.addChild(l_thumb1JointTree);
293:                l_elbowJointTree.addChild(l_wristJointTree);
294:                l_shoulderJointTree.addChild(l_elbowJointTree);
295:                l_acromioclavicularJointTree.addChild(l_shoulderJointTree);
296:                l_sternoclavicularJointTree
297:                        .addChild(l_acromioclavicularJointTree);
298:                vt1JointTree.addChild(l_sternoclavicularJointTree);
299:                skullbaseJointTree.addChild(temporomandibularJointTree);
300:                skullbaseJointTree.addChild(r_eyebrow_jointJointTree);
301:                skullbaseJointTree.addChild(l_eyebrow_jointJointTree);
302:                skullbaseJointTree.addChild(r_eyeball_jointJointTree);
303:                skullbaseJointTree.addChild(l_eyeball_jointJointTree);
304:                skullbaseJointTree.addChild(r_eyelid_jointJointTree);
305:                skullbaseJointTree.addChild(l_eyelid_jointJointTree);
306:                vc1JointTree.addChild(skullbaseJointTree);
307:                vc2JointTree.addChild(vc1JointTree);
308:                vc3JointTree.addChild(vc2JointTree);
309:                vc4JointTree.addChild(vc3JointTree);
310:                vc5JointTree.addChild(vc4JointTree);
311:                vc6JointTree.addChild(vc5JointTree);
312:                vc7JointTree.addChild(vc6JointTree);
313:                vt1JointTree.addChild(vc7JointTree);
314:                vt2JointTree.addChild(vt1JointTree);
315:                vt3JointTree.addChild(vt2JointTree);
316:                vt4JointTree.addChild(vt3JointTree);
317:                vt5JointTree.addChild(vt4JointTree);
318:                vt6JointTree.addChild(vt5JointTree);
319:                vt7JointTree.addChild(vt6JointTree);
320:                vt8JointTree.addChild(vt7JointTree);
321:                vt9JointTree.addChild(vt8JointTree);
322:                vt10JointTree.addChild(vt9JointTree);
323:                vt11JointTree.addChild(vt10JointTree);
324:                vt12JointTree.addChild(vt11JointTree);
325:                vl1JointTree.addChild(vt12JointTree);
326:                vl2JointTree.addChild(vl1JointTree);
327:                vl3JointTree.addChild(vl2JointTree);
328:                vl4JointTree.addChild(vl3JointTree);
329:                vl5JointTree.addChild(vl4JointTree);
330:                humanoidRootJointTree.addChild(vl5JointTree);
331:                r_midtarsalJointTree.addChild(r_metatarsalJointTree);
332:                r_subtalarJointTree.addChild(r_midtarsalJointTree);
333:                r_ankleJointTree.addChild(r_subtalarJointTree);
334:                r_kneeJointTree.addChild(r_ankleJointTree);
335:                r_hipJointTree.addChild(r_kneeJointTree);
336:                sacroiliacJointTree.addChild(r_hipJointTree);
337:                l_midtarsalJointTree.addChild(l_metatarsalJointTree);
338:                l_subtalarJointTree.addChild(l_midtarsalJointTree);
339:                l_ankleJointTree.addChild(l_subtalarJointTree);
340:                l_kneeJointTree.addChild(l_ankleJointTree);
341:                l_hipJointTree.addChild(l_kneeJointTree);
342:                sacroiliacJointTree.addChild(l_hipJointTree);
343:                humanoidRootJointTree.addChild(sacroiliacJointTree);
344:
345:            }
346:
347:            /**
348:             * Verify that according to the H-Anim specification, a Joint is the child of the other in the standard joint hierarchy. See the H-Anim specification for more details.
349:             * @param joint1 a standard Joint believed to be the parent
350:             * @param joint2 a standard Joint believed to be the child
351:             * @return the boolean that if true if and only if the Joint joint1 has a child Joint joint2
352:             */
353:            public static boolean checkChild(Joint joint1, Joint joint2) {
354:                //it is assumed that joint1 and joint2 are standard Joints
355:
356:                return findCorrespondingJointTree(humanoidRootJointTree, joint1)
357:                        .hasDescendant(
358:                                Joint
359:                                        .getJointIdentifierNumber(joint2
360:                                                .getName()));
361:
362:            }
363:
364:            private static JointTree findCorrespondingJointTree(
365:                    JointTree jointTree, Joint joint) {
366:                //assuming that joint exists in HAnimJointTree, returns the JointTree corresponding to the joint
367:
368:                JointTree resultJointTree;
369:                HashSet hashSet;
370:                Iterator iterator;
371:                boolean found;
372:
373:                if (jointTree.getIdentifier() == Joint
374:                        .getJointIdentifierNumber(joint.getName())) {
375:                    return jointTree;
376:                } else {
377:                    hashSet = jointTree.getChildren();
378:                    if (hashSet.isEmpty()) {
379:                        return null;
380:                    } else {
381:                        iterator = hashSet.iterator();
382:                        found = false;
383:                        resultJointTree = null;
384:                        while ((iterator.hasNext()) && (!found)) {
385:                            resultJointTree = findCorrespondingJointTree(
386:                                    (JointTree) iterator.next(), joint);
387:                            found = (resultJointTree != null);
388:                        }
389:                        return resultJointTree;
390:                    }
391:                }
392:
393:            }
394:
395:            private class JointTree {
396:
397:                protected int jointIdentifier;
398:                protected HashSet children;
399:
400:                public JointTree(int jointIdentifier) {
401:
402:                    super ();
403:                    this .jointIdentifier = jointIdentifier;
404:                    children = new HashSet();
405:
406:                }
407:
408:                public int getIdentifier() {
409:
410:                    return this .jointIdentifier;
411:
412:                }
413:
414:                public void addChild(JointTree jointTree) {
415:
416:                    boolean returnedValue;
417:
418:                    returnedValue = this .getChildren().add(jointTree);
419:
420:                }
421:
422:                public HashSet getChildren() {
423:
424:                    return this .children;
425:
426:                }
427:
428:                public boolean hasChild(int jointIdentifier) {
429:
430:                    boolean returnedValue;
431:                    Iterator iterator;
432:
433:                    iterator = this .getChildren().iterator();
434:
435:                    returnedValue = false;
436:
437:                    while ((iterator.hasNext()) && (!returnedValue)) {
438:
439:                        returnedValue = (((JointTree) iterator.next())
440:                                .getIdentifier() == jointIdentifier);
441:
442:                    }
443:
444:                    return returnedValue;
445:
446:                }
447:
448:                public boolean hasChild(JointTree jointTree) {
449:
450:                    return this .getChildren().contains(jointTree);
451:
452:                }
453:
454:                public boolean hasDescendant(int jointIdentifier) {
455:                    //...checks for a recursive child
456:
457:                    JointTree child;
458:                    boolean returnedValue;
459:                    Iterator iterator;
460:
461:                    iterator = this .getChildren().iterator();
462:
463:                    returnedValue = false;
464:
465:                    while ((iterator.hasNext()) && (!returnedValue)) {
466:
467:                        child = (JointTree) iterator.next();
468:                        returnedValue = ((child.getIdentifier() == jointIdentifier) || (child
469:                                .hasDescendant(jointIdentifier)));
470:
471:                    }
472:
473:                    return returnedValue;
474:
475:                }
476:
477:                public boolean hasDescendant(JointTree jointTree) {
478:                    //...checks for a recursive child
479:
480:                    return this .hasDescendant(jointTree.getIdentifier());
481:
482:                }
483:
484:                public void removeChild(JointTree jointTree) {
485:
486:                    boolean returnedValue;
487:
488:                    returnedValue = this.getChildren().remove(jointTree);
489:
490:                }
491:
492:            }
493:
494:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.