All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.linkedin.dagli.dag.AbstractDAGResult5 Maven / Gradle / Ivy

Go to download

DAG-oriented machine learning framework for bug-resistant, readable, efficient, maintainable and trivially deployable models in Java and other JVM languages

There is a newer version: 15.0.0-beta9
Show newest version
// AUTOGENERATED CODE.  DO NOT MODIFY DIRECTLY!  Instead, please modify the dag/AbstractDAGResultX.ftl file.
// See the README in the module's src/template directory for details.
package com.linkedin.dagli.dag;

import com.linkedin.dagli.objectio.ObjectReader;
import com.linkedin.dagli.objectio.WrappedObjectReader;
import java.util.Objects;
import com.linkedin.dagli.tuple.Tuple5;
import com.linkedin.dagli.objectio.tuple.TupleReader;


/**
 * Base class for an object encapsulating the results of executing a DAG.
 *
 * @param  the type of result #1 of the DAG
 * @param  the type of result #2 of the DAG
 * @param  the type of result #3 of the DAG
 * @param  the type of result #4 of the DAG
 * @param  the type of result #5 of the DAG
 */
abstract class AbstractDAGResult5 extends WrappedObjectReader> implements
    DAGResult5, AutoCloseable {
  private final ObjectReader _result1;
  private final ObjectReader _result2;
  private final ObjectReader _result3;
  private final ObjectReader _result4;
  private final ObjectReader _result5;

  @Override
  public ObjectReader getResult1() {
    return _result1;
  }

  @Override
  public ObjectReader getResult2() {
    return _result2;
  }

  @Override
  public ObjectReader getResult3() {
    return _result3;
  }

  @Override
  public ObjectReader getResult4() {
    return _result4;
  }

  @Override
  public ObjectReader getResult5() {
    return _result5;
  }

  /**
   * Create a new DAG result instance from the provided array of {@link ObjectReader}s.
   *
   * @param results an array of length 5 providing an {@link ObjectReader} for each of the DAG's outputs.
   */
  @SuppressWarnings("unchecked")
  AbstractDAGResult5(ObjectReader[] results) {
    this((ObjectReader) results[0], (ObjectReader) results[1], (ObjectReader) results[2],
        (ObjectReader) results[3], (ObjectReader) results[4]);
    assert results.length == 5;
  }

  /**
   * Create a new DAG result instance from the provided {@link ObjectReader}s.
   *
   * @param results1 an {@link ObjectReader} for the DAG's first output.
   * @param results2 an {@link ObjectReader} for the DAG's second output.
   * @param results3 an {@link ObjectReader} for the DAG's third output.
   * @param results4 an {@link ObjectReader} for the DAG's fourth output.
   * @param results5 an {@link ObjectReader} for the DAG's fifth output.
   */
  AbstractDAGResult5(ObjectReader results1, ObjectReader results2, ObjectReader results3,
      ObjectReader results4, ObjectReader results5) {
    super(new TupleReader<>(results1, results2, results3, results4, results5));

    _result1 = Objects.requireNonNull(results1);
    _result2 = Objects.requireNonNull(results2);
    _result3 = Objects.requireNonNull(results3);
    _result4 = Objects.requireNonNull(results4);
    _result5 = Objects.requireNonNull(results5);
  }

  @Override
  public void close() {
    _result1.close();
    _result2.close();
    _result3.close();
    _result4.close();
    _result5.close();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy