/** * Gets an implementation for an index. * * @param index the index of the implementation to return. * * @return a reference to the implementation at {@code index}. * * @throws IndexOutOfBoundsException if {@code index} is negativ, * greater than or equal to {@code size()}. */ public final Implementation getImplementation( final int index ) { if ( index < 0 || index >= this.size() ) { throw new ArrayIndexOutOfBoundsException( index ); } return this.getImplementations()[index]; }
/** * 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 Implementations ) { final Implementations that = (Implementations) o; final Collection these = Arrays.asList( this.getImplementations() ); final Collection those = Arrays.asList( that.getImplementations() ); equal = this.size() == that.size() && these.containsAll( those ); } return equal; }
append( ", implementations={" ); for ( int i = this.getImplementations().size() - 1; i >= 0; i-- )
/** * Setter for property {@code multiplicity}. * * @param value the new implementation multiplicity of the specification. * * @throws IllegalArgumentException if {@code value} is not equal to one of * the constants {@code MULTIPLICITY_ONE} or {@code MULTIPLICITY_MANY}. * @throws MultiplicityConstraintException if {@code value} equals * {@code MULTIPLICITY_ONE} and the specification currently has more than * one implementation defined. * * @see #MULTIPLICITY_ONE * @see #MULTIPLICITY_MANY */ public void setMultiplicity( final int value ) { if ( value != MULTIPLICITY_ONE && value != MULTIPLICITY_MANY ) { throw new IllegalArgumentException( Integer.toString( value ) ); } if ( value == MULTIPLICITY_ONE && this.getImplementations().size() > 1 ) { throw new MultiplicityConstraintException( this.getIdentifier() ); } this.multiplicity = value; }
/** * 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; }
for ( int j = impls.size() - 1; j >= 0; j-- )
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; }
for ( int j = mod.getImplementations().size() - 1; j >= 0; j-- )
for ( int i = this.modules.getImplementations().size() - 1; i >= 0; i-- )
private void assertImplementedProperties() throws ParseException for ( int i = this.modules.getImplementations().size() - 1; i >= 0; i-- )
private void assertOverwrittenProperties() throws ParseException for ( int i = this.modules.getImplementations().size() - 1; i >= 0; i-- )
private void assertCompatibility() throws ParseException for ( int i = this.modules.getImplementations().size() - 1; i >= 0; i-- )