예제 #1
0
 /**
  * Insert the given {@code Provider} at the specified {@code position}. The positions define the
  * preference order in which providers are searched for requested algorithms.
  *
  * @param provider the provider to insert.
  * @param position the position (starting from 1).
  * @return the actual position or {@code -1} if the given {@code provider} was already in the
  *     list. The actual position may be different from the desired position.
  */
 public static synchronized int insertProviderAt(Provider provider, int position) {
   // check that provider is not already
   // installed, else return -1; if (position <1) or (position > max
   // position) position = max position + 1; insert provider, shift up
   // one position for next providers; Note: The position is 1-based
   if (getProvider(provider.getName()) != null) {
     return -1;
   }
   int result = Services.insertProviderAt(provider, position);
   renumProviders();
   return result;
 }