| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetAlgorithm (String id) const as owning Algorithm | 
| { | 
|   Description: | 
|   [* | 
|     Get the `Algorithm` from the `AlgorithmStore`. | 
|      | 
|     Make sure to put it back in the `AlgorithmStore` after using this method. | 
|     One exception: when you want to remove it. | 
|   *] | 
|   TextBody: | 
|   [* | 
|     result := AlgorithmStore::TryRetrieve( id ); | 
|      | 
|     if( result = null( Algorithm ) ) | 
|     { | 
|       timelimit := Duration::Seconds( 5 ); | 
|       stop := OS::PrecisionCounter() + timelimit.TotalInSeconds() * OS::PrecisionCounterFrequency(); | 
|       repeat | 
|       { | 
|         result := AlgorithmStore::TryRetrieve( id ); | 
|       } | 
|       until( result <> null( Algorithm ) or OS::PrecisionCounter() >= stop ); | 
|       if( OS::PrecisionCounter() >= stop ) | 
|       { | 
|         error( Translations::LibOpt_Channel_GetAlgorithm_Error_Timelimit( this.Name(), timelimit ) ); | 
|       } | 
|     } | 
|      | 
|     return & result; | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |