/**
   * Registers a class to be used with this node type registry. Note that if we ever want to stop
   * registering a type name in the future, its fully-qualified class name should be passed to
   * reserve(...) to prevent its hashfrom being reused in the future.
   */
  public <T extends R> void register(int typeId, ITypeFactory<T> toRegister) {
    if ((typeId & 0xFFFF0000) != 0) {
      throw new IllegalArgumentException(
          "The typeId " + typeId + " does not fit within a short int"); // $NON-NLS-1$//$NON-NLS-2$
    }
    short shortTypeId = (short) typeId;
    String fullyQualifiedClassName = toRegister.getElementClass().getName();

    if (this.types.containsKey(typeId) || this.reserved.get(typeId)) {
      throw new IllegalArgumentException(
          "The type id "
              + typeId
              + " for class "
              + fullyQualifiedClassName
              + " is already in use."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    this.types.put(shortTypeId, toRegister);
    this.registeredClasses.put(toRegister.getElementClass(), shortTypeId);
  }
  public R createNode(Nd nd, long address, short nodeType) throws IndexException {
    ITypeFactory<? extends R> typeFactory = this.types.get(nodeType);

    return typeFactory.create(nd, address);
  }