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

com.linkedin.dagli.tuple.FieldTuple1 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 tuple/FieldTupleX.ftl file.
// See the README in the module's src/template directory for details.
package com.linkedin.dagli.tuple;

/**
 * A tuple of arity 1.
 *
 * FieldTuples are more memory-efficient than ArrayTuples because they do not need to store an extra object (the array),
 * but ArrayTuples are faster to create if the tuple elements are already extant within an array.
 */
final class FieldTuple1 extends AbstractTuple implements Tuple1 {
  private static final long serialVersionUID = 1;

  private final A _element0;

  /**
   * Creates a new tuple from the given fields.
   */
  public FieldTuple1(A element0) {
    _element0 = element0;
  }

  @Override
  public A get0() {
    return _element0;
  }

  @Override
  public Object get(int index) {
    switch (index) {
      case 0:
        return _element0;
      default:
        throw new IndexOutOfBoundsException();
    }
  }

  @Override
  public int size() {
    return 1;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy