public void addAnimation ( Element ... elements ) { if ( elements == null || elements . length == 0 ) { throw new IllegalArgumentException ( "One or more elements must be specified." ) ; } Set < String > elementIdsInPreviousAnimationSteps = new HashSet <> ( ) ; Set < Element > elementsInThisAnimationStep = new HashSet <> ( ) ; Set < Relationship > relationshipsInThisAnimationStep = new HashSet <> ( ) ; for ( Element element : elements ) { if ( isElementInView ( element ) ) { elementIdsInPreviousAnimationSteps . add ( element . getId ( ) ) ; elementsInThisAnimationStep . add ( element ) ; } } if ( elementsInThisAnimationStep . size ( ) == 0 ) { throw new IllegalArgumentException ( "None of the specified elements exist in this view." ) ; } for ( Animation animationStep : animations ) { elementIdsInPreviousAnimationSteps . addAll ( animationStep . getElements ( ) ) ; } for ( RelationshipView relationshipView : this . getRelationships ( ) ) { if ( ( elementsInThisAnimationStep . contains ( relationshipView . getRelationship ( ) . getSource ( ) ) && elementIdsInPreviousAnimationSteps . contains ( relationshipView . getRelationship ( ) . getDestination ( ) . getId ( ) ) ) || ( elementIdsInPreviousAnimationSteps . contains ( relationshipView . getRelationship ( ) . getSource ( ) . getId ( ) ) && elementsInThisAnimationStep . contains ( relationshipView . getRelationship ( ) . getDestination ( ) ) ) ) { relationshipsInThisAnimationStep . add ( relationshipView . getRelationship ( ) ) ; } } animations . add ( new Animation ( animations . size ( ) + 1 , elementsInThisAnimationStep , relationshipsInThisAnimationStep ) ) ; }
Adds an animation step with the specified elements .