80 likes | 190 Vues
DJ Example in UAV Context. Karl Lieberherr. Frame Structure. Frame. X1. X2. X3. X4. X5. A. X6. X7. B. X8. Annotation. Frame Traversal Strategy. from Frame through {A,B} to Annotation. Frame. X1. X2. X3. X4. X5. A. X6. X7. B. X8. Annotation. Selected Paths.
E N D
DJ Examplein UAV Context Karl Lieberherr
Frame Structure Frame X1 X2 X3 X4 X5 A X6 X7 B X8 Annotation
Frame Traversal Strategy from Frame through {A,B} to Annotation Frame X1 X2 X3 X4 X5 A X6 X7 B X8 Annotation
Selected Paths from Frame through {A,B} to Annotation Frame X1 X2 X3 X4 X5 A X6 X7 B X8 Annotation
DJ Program class Frame { public updateAnnotations(){ List annotations = Main.cg.asList(this, “from Frame through {A,B} to Annotation”); Iterator it = annotations.iterator(); while (it.hasNext()) { Annotation a = (Annotation) it.next(); // use set on iterator to // replace Annotation object } } }
asList • Adapts a traversal to the Java Collections Framework as a List object. • Lazy traversal. • Crosscutting lists: they cut across an object. • Can go forward and backward and modify object in place.
asList (continued) • Implementation uses a separate Java thread as a coroutine. • Modifications to the object structure while a traversal is paused can be seen when the traversal resumes.
Conclusion • If we add complex object structures to the UAV application the benefits of DJ become apparent. • asList is only one possible method to invoke on a ClassGraph object. • Alternatives: traverse, fetch, gather.