/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.1
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.deepspeech.libdeepspeech;

/**
 * An array of CandidateTranscript objects computed by the model.
 */
public class Metadata {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected Metadata(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(Metadata obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        implJNI.delete_Metadata(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  /**
   *  Size of the transcripts array 
   */
  public long getNumTranscripts() {
    return implJNI.Metadata_NumTranscripts_get(swigCPtr, this);
  }

  /**
   * Retrieve one CandidateTranscript element<br>
   * <br>
   * @param i Array index of the CandidateTranscript to get<br>
   * <br>
   * @return The CandidateTranscript requested or null
   */
  public CandidateTranscript getTranscript(int i) {
    return new CandidateTranscript(implJNI.Metadata_getTranscript(swigCPtr, this, i), false);
  }

}
