protected Implementation getImplementation() { return ModelFactory.getModel().getModules(). getImplementation( DTAUSDisk.class.getName() ); }
/** * 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; }
/** * Gets a module for an index. * * @param index the index of the module to return. * * @return a reference to the module at {@code index}. * * @throws IndexOutOfBoundsException if {@code index} is negativ, * greater than or equal to {@code size()}. */ public final Module getModule( final int index ) { if ( index < 0 || index >= this.size() ) { throw new ArrayIndexOutOfBoundsException( index ); } return this.getModules()[index]; }
/** * Creates a string representing the properties of the instance. * * @return a string representing the properties of the instance. */ private String internalString() { final StringBuffer buf = new StringBuffer( 200 ).append( '{' ); buf.append( this.internalString( this ) ); final Module[] mods = this.getModules(); for ( int i = mods.length - 1; i >= 0; i-- ) { buf.append( ", [" ).append( i ).append( "]=" ). append( mods[i] ); } buf.append( '}' ); return buf.toString(); }
/** * Creates and returns a deep copy of this object. * * @return a clone of this instance. */ public Object clone() { try { final Modules ret = (Modules) super.clone(); final Module[] mods = this.getModules(); final Module[] cloned = new Module[ mods.length ]; for ( int i = mods.length - 1; i >= 0; i-- ) { cloned[i] = (Module) mods[i].clone(); } ret.setModules( cloned ); return ret; } catch ( final CloneNotSupportedException e ) { throw new AssertionError( e ); } }
public JFileChooser getSaveAsFileChooser() { if(this.saveAsFileChooser == null) { this.saveAsFileChooser = new JFileChooser(); this.saveAsFileChooser.setAcceptAllFileFilterUsed(false); this.saveAsFileChooser.setMultiSelectionEnabled(false); final Implementations formatters = ModelFactory.getModel().getModules(). getSpecification(PhysicalFileFormatter.class.getName()). getImplementations(); for(int i = formatters.size() - 1; i >= 0; i--) { final PhysicalFileFormatter formatter = (PhysicalFileFormatter) ContainerFactory. getContainer().getImplementation( PhysicalFileFormatter.class, formatters.getImplementation(i).getName()); this.saveAsFileChooser.addChoosableFileFilter( new PhysicalFileFormatterFileFilter(formatter)); } } return this.saveAsFileChooser; }
new Module[ this.modules.size() + 1 ]; System.arraycopy( this.modules.getModules(), 0, modulesWithPlatform, 0, this.modules.size() ); modulesWithPlatform[this.modules.size()] = this.getPlatformModule(); this.modules.setModules( modulesWithPlatform );
private void assertSpecificationsAvailable() getImplementations(); specs.getSpecification( j ).getIdentifier() ); deps.getDependency( j ).getSpecification(). getIdentifier() );
private Modules transformDocuments( final Map xml ) throws ParseException, IOException, TransformerException final Modules mods = new Modules(); mods.setModelVersion( MODEL_VERSION ); mods.setModules( (Module[]) list.toArray( new Module[ list.size() ] ) );
/** * Gets the number of modules held by the instance. * * @return the number of modules held by the instance. */ public final int size() { return this.getModules().length; }
/** * Resolves application messages for a given exception by querying any * available {@code ExceptionMessageResolver} implementation stopping at the * first implementation not returning {@code null}. * * @param exception The exception to resolve application messages for. * * @throws NullPointerException if {@code exception} is {@code null}. */ private Message[] resolveMessages( final Exception exception ) { if ( exception == null ) { throw new NullPointerException( "exception" ); } Message[] messages = null; final Specification spec = ModelFactory.getModel().getModules(). getSpecification( ExceptionMessageResolver.class.getName() ); final Implementation[] resolvers = spec.getImplementations(). getImplementations(); for ( int i = resolvers.length - 1; i >= 0 && messages == null; i-- ) { final ExceptionMessageResolver resolver = (ExceptionMessageResolver) ContainerFactory.getContainer(). getObject( ExceptionMessageResolver.class, resolvers[i].getName() ); messages = resolver.resolve( exception ); } return messages; }
private void assertCompatibility() throws ParseException for ( int i = this.modules.getImplementations().size() - 1; i >= 0; i-- ) final Implementation impl = this.modules.getImplementations(). getImplementation( i ); this.modules.getSpecification( implemented.getIdentifier() ); this.modules.getSpecification( required.getIdentifier() );
protected Implementation getImplementation() { if ( this.implementation == null ) { this.implementation = ModelFactory.getModel().getModules(). getImplementation( DefaultPhysicalFileFactory.class.getName() ); } return this.implementation; }
/** * Gets a collection of all specifications of all modules. * * @return a reference to all specifications of all modules held by the * instance. */ public Specifications getSpecifications() { if ( this.specifications == null ) { this.specifications = new Specifications(); } final Collection col = new ArrayList( this.specifications.size() ); for ( int i = this.size() - 1; i >= 0; i-- ) { final Module mod = this.getModule( i ); for ( int j = mod.getSpecifications().size() - 1; j >= 0; j-- ) { col.add( mod.getSpecifications().getSpecification( j ) ); } } this.specifications.setSpecifications( (Specification[]) col.toArray( new Specification[ col.size() ] ) ); return this.specifications; }
getModules().getSpecification( specificationIdentifier );
/** * Indicates whether some other object is equal to this one by comparing * the values of all properties. * * @param o the reference object with which to compare. * * @return {@code true} if this object is the same as {@code o}; * {@code false} otherwise. */ public boolean equals( final Object o ) { boolean equal = this == o; if ( !equal && o instanceof Modules ) { final Modules that = (Modules) o; final Collection these = Arrays.asList( this.getModules() ); final Collection those = Arrays.asList( that.getModules() ); equal = this.size() == that.size() && these.containsAll( those ); } return equal; }
protected Implementation getImplementation() { return ModelFactory.getModel().getModules().getImplementation( DTAUSTape.class.getName() ); }
getSpecification( SequenceValidator.class.getName() );
private Implementation getImplementation( final Object object ) { MissingImplementationException exception = null; Implementation implementation = null; Class clazz = object.getClass(); do { try { implementation = ModelFactory.getModel().getModules(). getImplementation( clazz.getName() ); break; } catch ( final MissingImplementationException e ) { if ( exception == null ) { exception = e; } } } while ( ( clazz = clazz.getSuperclass() ) != null ); if ( implementation == null ) { throw exception; } return implementation; }