/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MovingAverageReferenceType createMovingAverageReferenceTypeFromString ( EDataType eDataType, String initialValue ) { MovingAverageReferenceType result = MovingAverageReferenceType.get ( initialValue ); if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName () + "'" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return result; }
/** * Returns the '<em><b>Moving Average Reference Type</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param name the name. * @return the matching enumerator or <code>null</code>. * @generated */ public static MovingAverageReferenceType getByName ( String name ) { for ( int i = 0; i < VALUES_ARRAY.length; ++i ) { MovingAverageReferenceType result = VALUES_ARRAY[i]; if ( result.getName ().equals ( name ) ) { return result; } } return null; }
/** * Returns the '<em><b>Moving Average Reference Type</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param literal the literal. * @return the matching enumerator or <code>null</code>. * @generated */ public static MovingAverageReferenceType get ( String literal ) { for ( int i = 0; i < VALUES_ARRAY.length; ++i ) { MovingAverageReferenceType result = VALUES_ARRAY[i]; if ( result.toString ().equals ( literal ) ) { return result; } } return null; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<OutputSpecification> getKnownOutputs () { if ( this.knownOutputs == null ) { final BasicEList<OutputSpecification> outputs = ECollections.newBasicEList (); for ( final MovingAverageReferenceType type : MovingAverageReferenceType.values () ) { outputs.add ( Components.createOutput ( type.getLiteral (), DataType.FLOAT ) ); } this.knownOutputs = ECollections.unmodifiableEList ( outputs ); } return this.knownOutputs; }
@Override protected String makeSourceId () { return String.format ( "%s.%s", Names.makeName ( this.item.getSource () ), this.item.getType ().getLiteral () ); } }
@Override public void createItems ( final ItemCreator creator, final MovingAverageModule implementation ) { for ( final OutputDefinition output : this.calculationComponent.getOutputs () ) { final OutputSpecification outputSpec = Calculations.findSpecification ( implementation, output ); final MovingAverageReferenceType type = MovingAverageReferenceType.get ( output.getName () ); if ( type == null ) { throw new IllegalStateException ( String.format ( "Moving average reference type %s is unknown. Use any of: %s.", output.getName (), StringHelper.join ( MovingAverageReferenceType.values (), ", " ) ) ); } final CreationRequest<MovingAverageItem> c = createAverageItem ( creator, type ); c.localTags ( output.getLocalTag () ); c.customizationTags ( output.getCustomizationTags () );// the output of a calculation module is an input for the system c.dataType ( outputSpec.getDataType () ); c.addMasterListener ( new MasterListener<MovingAverageItem> () { @Override public void setMaster ( final MovingAverageItem item, final MasterContext master ) { final MovingAverage average = MovingAverageModuleGenerator.this.map.get ( master.getImplementation () ); item.setSource ( average ); } } ); c.create (); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<OutputSpecification> getKnownOutputs () { if ( this.knownOutputs == null ) { final BasicEList<OutputSpecification> outputs = ECollections.newBasicEList (); for ( final MovingAverageReferenceType type : MovingAverageReferenceType.values () ) { outputs.add ( Components.createOutput ( type.getLiteral (), DataType.FLOAT ) ); } this.knownOutputs = ECollections.unmodifiableEList ( outputs ); } return this.knownOutputs; }
@Override protected String makeSourceId () { return String.format ( "%s.%s", Names.makeName ( this.item.getSource () ), this.item.getType ().getLiteral () ); } }