Class AlgorithmNames


  • public class AlgorithmNames
    extends java.lang.Object
    The algorithm ids of one LLAPI, for a mock that accepts every algorithm name the host JDK supports.

    On a device an algorithm id is a constant that the LLAPI returns, and Managed Code never closes it. This registry gives the mock the same property: it assigns one id to each name, keeps that id for the lifetime of the Simulator, and allocates nothing for a name it already knows. A mock whose set of names is closed uses a constant id instead.

    Every method is synchronized, because the Simulator can call a native from several threads at the same time.

    • Constructor Summary

      Constructors 
      Constructor Description
      AlgorithmNames()
      Creates a registry that knows no algorithm name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int idOf​(java.lang.String name)
      Gets the id of the given algorithm name, and assigns one if the name is not known yet.
      java.lang.String nameOf​(int id)
      Gets the algorithm name that the given id is assigned to.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlgorithmNames

        public AlgorithmNames()
        Creates a registry that knows no algorithm name.
    • Method Detail

      • idOf

        public int idOf​(java.lang.String name)
        Gets the id of the given algorithm name, and assigns one if the name is not known yet.
        Parameters:
        name - the algorithm name
        Returns:
        the algorithm id
      • nameOf

        public java.lang.String nameOf​(int id)
        Gets the algorithm name that the given id is assigned to.
        Parameters:
        id - the algorithm id
        Returns:
        the algorithm name
        Throws:
        java.lang.IndexOutOfBoundsException - if the given id is not assigned