gt:                         if (null != values)
context: package org.wheatgenetics.coordinate.model;
  
  /**
   * Uses:
   * androidx.annotation.IntRange
   * androidx.annotation.NonNull
   * androidx.annotation.Nullable
   * androidx.annotation.RestrictTo
   * androidx.annotation.RestrictTo.Scope
   *
   * org.wheatgenetics.javalib.CsvWriter
   *
   * org.wheatgenetics.coordinate.Utils
   *
   * org.wheatgenetics.coordinate.optionalField.NonNullOptionalFields
   *
   * org.wheatgenetics.coordinate.preference.Utils.Advancement
   *
   * org.wheatgenetics.coordinate.model.Cells
   * org.wheatgenetics.coordinate.model.Cells.AmountIsTooLarge
   * org.wheatgenetics.coordinate.model.Cells.MaxRowAndOrMaxColOutOfRange
   * org.wheatgenetics.coordinate.model.DisplayModel
   * org.wheatgenetics.coordinate.model.ElementModel
   * org.wheatgenetics.coordinate.model.EntryModel
   * org.wheatgenetics.coordinate.model.EntryModels
   * org.wheatgenetics.coordinate.model.EntryModels.FilledHandler
   * org.wheatgenetics.coordinate.model.ExcludedEntryModel
   * org.wheatgenetics.coordinate.model.GridModel
   * org.wheatgenetics.coordinate.model.IncludedEntryModel
   * org.wheatgenetics.coordinate.model.TemplateModel
   * org.wheatgenetics.coordinate.model.TemplateType
   */
  public class JoinedGridModel extends org.wheatgenetics.coordinate.model.GridModel
  implements org.wheatgenetics.coordinate.model.DisplayModel
  {
      @java.lang.SuppressWarnings({"UnnecessaryInterfaceModifier"}) public interface Helper
      { public abstract void publishProgress(@androidx.annotation.IntRange(from = 1) int col); }
  
      // region Fields
      @androidx.annotation.NonNull private final org.wheatgenetics.coordinate.model.TemplateModel
          templateModel;
      private org.wheatgenetics.coordinate.model.EntryModels entryModels = null;
      // endregion
  
      // region Private Methods
      @androidx.annotation.Nullable
      private org.wheatgenetics.coordinate.model.EntryModel getEntryModel(
      @androidx.annotation.IntRange(from = 1) final int row,
      @androidx.annotation.IntRange(from = 1) final int col)
      {
          // noinspection ConstantConditions
          return this.entryModelsIsNull() ? null : this.getEntryModels().get(row, col);
      }
  
      // region export*() Private Methods
      private void exportSeed(
      @androidx.annotation.NonNull  final org.wheatgenetics.javalib.CsvWriter csvWriter     ,
                                    final java.lang.String                    exportFileName,
      @androidx.annotation.Nullable final org.wheatgenetics.coordinate.model.JoinedGridModel.Helper
          helper,
      final boolean includeHeader) throws java.io.IOException
      {
          final java.lang.String tray_id, person, date;
          {
              final org.wheatgenetics.coordinate.optionalField.NonNullOptionalFields optionalFields =
                  this.optionalFields();
              if (null == optionalFields)
                  tray_id = person = date = null;
              else
              {
                  // noinspection CStyleArrayDeclaration
                  final java.lang.String values[] = optionalFields.values(
                      /* names[] => */ new java.lang.String[]{"Tray", "Person", "date"});
                  if (null == values)
                      tray_id = person = date = null;
                  else
                      { tray_id = values[0]; person = values[1]; date = values[2]; }
              }
          }
  
          if (includeHeader) csvWriter.writeRecord(new java.lang.String[]{"tray_id", "cell_id",
              "tray_num", "tray_column", "tray_row", "seed_id", "person", "date"});
          {
              @androidx.annotation.IntRange(from = 1) final int
                  cols = this.getCols(), rows = this.getRows();
  
              for (@androidx.annotation.IntRange(from = 1) int col = 1; col <= cols; col++)
              {
                  for (@androidx.annotation.IntRange(from = 1) int row = 1; row <= rows; row++)
                  {
                      final org.wheatgenetics.coordinate.model.EntryModel entryModel =
                          this.getEntryModel(row, col);
                      if (null != entryModel)
                      {
                          csvWriter.write(tray_id                                 );    // tray id
                          csvWriter.write("%s_C%02d_R%d", exportFileName, col, row);    // cell_id
                          csvWriter.write(                                        );    // tray_num
                          csvWriter.write(col                                     );    // tray_column
                          csvWriter.write(row                                     );    // tray_row
                          csvWriter.write(entryModel.getSeedExportValue()         );    // seed_id
                          csvWriter.write(person                                  );    // person
                          csvWriter.write(date                                    );    // date
  
                          csvWriter.endRecord();
                      }
                  }
                  if (null != helper) helper.publishProgress(col);
              }
          }
          csvWriter.close();
      }
  
      @java.lang.SuppressWarnings({"DefaultLocale"}) private void exportDNA(
      @androidx.annotation.NonNull  final org.wheatgenetics.javalib.CsvWriter csvWriter,
      @androidx.annotation.Nullable final org.wheatgenetics.coordinate.model.JoinedGridModel.Helper
          helper,
      final boolean includeHeader) throws java.io.IOException
      {
          final java.lang.String date, plate_id, plate_name,
              dna_person, notes, tissue_type, extraction;
          {
              final org.wheatgenetics.coordinate.optionalField.NonNullOptionalFields optionalFields =
                  this.optionalFields();
              if (null == optionalFields)
                  date = plate_id = plate_name = dna_person = notes = tissue_type = extraction = null;
              else
              {
                  // noinspection CStyleArrayDeclaration
                  final java.lang.String values[] = optionalFields.values(
                      /* names[] => */ new java.lang.String[]{"date", "Plate",
                          "Plate Name", "person", "Notes", "tissue_type", "extraction"});
                  if (null == values)
                      date = plate_id = plate_name = dna_person =
                          notes = tissue_type = extraction = null;
                  else
                  {
                      date       = values[0]; plate_id = values[1]; plate_name  = values[2];
                      dna_person = values[3]; notes    = values[4]; tissue_type = values[5];
                      extraction = values[6];
                  }
              }
          }
  
          if (includeHeader) csvWriter.writeRecord(new java.lang.String[]{
              "date", "plate_id", "plate_name", "sample_id", "well_A01", "well_01A",
              "tissue_id", "dna_person", "notes", "tissue_type", "extraction"});
          {
              @androidx.annotation.IntRange(from = 1) final int
                  cols = this.getCols(), rows = this.getRows();
  
              for (@androidx.annotation.IntRange(from = 1) int col = 1; col <= cols; col++)
              {
                  for (@androidx.annotation.IntRange(from = 0) int r = 0; r < rows; r++)
                  {
                      @androidx.annotation.IntRange(from = 1) final int row = r + 1;
                      final org.wheatgenetics.coordinate.model.EntryModel entryModel =
                          this.getEntryModel(row, col);
                      if (null != entryModel)
                      {
                          csvWriter.write(date      );
                          csvWriter.write(plate_id  );
                          csvWriter.write(plate_name);
                          {
                              final java.lang.String sample_id;
                              {
                                  final java.lang.String rowName =
                                      org.wheatgenetics.coordinate.Utils.convert(r);
                                  final java.lang.String colName =
                                      java.lang.String.format("%02d", col);
  
                                  sample_id = java.lang.String.format(
                                      "%s_%s%s", plate_id, rowName, colName);
                                  csvWriter.write(sample_id               );              // sample_id
                                  csvWriter.write("%s%s", rowName, colName);              // well_A01
                                  csvWriter.write("%s%s", colName, rowName);              // well_01A
                              }
                              csvWriter.write(entryModel.getDNAExportValue(sample_id));   // tissue_id
                          }
                          csvWriter.write(dna_person ); csvWriter.write(notes     );
                          csvWriter.write(tissue_type); csvWriter.write(extraction);
  
                          csvWriter.endRecord();
                      }
                  }
                  if (null != helper) helper.publishProgress(col);
              }
          }
          csvWriter.close();
      }
  
      private void exportUserDefined(
      @androidx.annotation.NonNull  final org.wheatgenetics.javalib.CsvWriter csvWriter,
      @androidx.annotation.Nullable final org.wheatgenetics.coordinate.model.JoinedGridModel.Helper
          helper,
      final boolean includeHeader) throws java.io.IOException
      {
          final org.wheatgenetics.coordinate.optionalField.NonNullOptionalFields optionalFields =
              this.optionalFields();
          if (includeHeader)
          {
              csvWriter.write(this.templateModel.entryLabelIsNotNull() ?
                  this.templateModel.getEntryLabel() : "Value");
              csvWriter.write("Column"); csvWriter.write("Row");
  
              if (null != optionalFields)
              {
                  // noinspection CStyleArrayDeclaration
                  final java.lang.String names[] = optionalFields.names();
                  for (final java.lang.String name: names) csvWriter.write(name);
              }
              csvWriter.endRecord();
          }
  
          {
              @androidx.annotation.IntRange(from = 1) final int
                  cols = this.getCols(), rows = this.getRows();
              // noinspection CStyleArrayDeclaration
              final java.lang.String values[] =
                  null == optionalFields ? null : optionalFields.values();
  
              final boolean
                  colNumbering = this.templateModel.getColNumbering(),
                  rowNumbering = this.templateModel.getRowNumbering();
              for (@androidx.annotation.IntRange(from = 1) int col = 1; col <= cols; col++)
              {
                  for (@androidx.annotation.IntRange(from = 1) int row = 1; row <= rows; row++)
                  {
                      final org.wheatgenetics.coordinate.model.EntryModel entryModel =
                          this.getEntryModel(row, col);
                      if (null != entryModel)
                      {
                          csvWriter.write(entryModel.getUserDefinedExportValue());
  
                          if (colNumbering)
                              csvWriter.write(col);
                          else
                              csvWriter.write(
                                  org.wheatgenetics.coordinate.Utils.convert(col - 1));
  
                          if (rowNumbering)
                              csvWriter.write(row);
                          else
                              csvWriter.write(
                                  org.wheatgenetics.coordinate.Utils.convert(row - 1));
  
  