Package com.oss.asn1

Interface IndexProcedure


public interface IndexProcedure
When the protocol definition extensively uses information object sets, an application might need a better way to index such a large number of information object sets rather than explicit invocation of indexByXXX method per each individual information object set. This interface defines a default indexing procedure that is automatically applied to every instance of information object set of a particular class. In order to activate automatic indexing you develop the class that implements this interface and associate it with the corresponding class of information object sets. For example, having:
 NBAP-PROTOCOL-IES ::= CLASS {
     &id ProtocolIE-ID UNIQUE,
     &criticality Criticality,
     &Value,
     &presence Presence
 }
 ...
 CommonTransportChannelSetupRequestFDD-IEs NBAP-PROTOCOL-IES ::= ...
 CommonTransportChannelSetupRequestTDD-IEs NBAP-PROTOCOL-IES ::= ...
 ... (another 143 information object sets of this class)
 ErrorIndication-IEs NBAP-PROTOCOL-IES ::= ...
 
you enable automatic indexing for all these 146 information object sets as follows:
 Mod.NBAP_PROTOCOL_IES_OSET.setIndexProcedure(
     new IndexProcedure() {
         public Index create(IndexedInfoObjectSet oset) {
             // Do not index information object sets that are empty
             // or contain just a few elements.
             if (oset.getSize() > 2) {
                 Index index = new DefaultIndex() {
                     public int mapKey(AbstractData key) {
                          ProtocolIE_ID id = (ProtocolIE_ID)key;
                          return id.intValue();
                     }
                 };
                 NBAP_PROTOCOL_IES_OSET oset_ies =
                      (NBAP_PROTOCOL_IES_OSET)oset;
                 if (oset_ies.indexById(index))
                     return oset_ies.getIndex();
             }
             return null;
         }
     });
 
After the invocation of the setIndexProcedure all instances of the NBAP_PROTOCOL_IES_OSET will be automatically indexed right after the information object set is instantiated.
Since:
ASN.1/Java 1.4-beta C
  • Method Summary

    Modifier and Type
    Method
    Description
    Create the index for the indexed information object set.
  • Method Details

    • create

      Create the index for the indexed information object set. Whenever the IndexProcedure is associated with the particular subclass of IndexedInfoObjectSet, this method is automatically invoked by the constructor to index the information object set.
      Parameters:
      ios - the information object set to index.
      Returns:
      the index created or null if the information object set cannot be indexed.