/** * Creates and returns a deep copy of this object. * * @return a clone of this instance. */ public Object clone() { try { final Implementations ret = (Implementations) super.clone(); final Implementation[] impls = this.getImplementations(); final Implementation[] cloned = new Implementation[ impls.length ]; for ( int i = impls.length - 1; i >= 0; i-- ) { cloned[i] = (Implementation) impls[i].clone(); } ret.setImplementations( cloned ); return ret; } catch ( final CloneNotSupportedException e ) { throw new AssertionError( e ); } }
impls.setImplementations( (Implementation[]) list.toArray( new Implementation[ list.size() ] ) );
impls.setImplementations( (Implementation[]) col.toArray( new Implementation[ col.size() ] ) );
/** * Gets a collection of all implementations of all modules held by the * instance. * * @return a reference to all implementations of all modules held by the * instance. */ public Implementations getImplementations() { if ( this.implementations == null ) { this.implementations = new Implementations(); } final Collection col = new ArrayList( this.implementations.size() ); for ( int i = this.size() - 1; i >= 0; i-- ) { final Module mod = this.getModule( i ); for ( int j = mod.getImplementations().size() - 1; j >= 0; j-- ) { col.add( mod.getImplementations().getImplementation( j ) ); } } this.implementations.setImplementations( (Implementation[]) col.toArray( new Implementation[ col.size() ] ) ); return this.implementations; }