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

com.acrolinx.sidebar.pojo.settings.DocumentSelection Maven / Gradle / Ivy

/* Copyright (c) 2018 Acrolinx GmbH */
package com.acrolinx.sidebar.pojo.settings;

import com.acrolinx.sidebar.pojo.document.IntRange;
import com.google.gson.Gson;
import java.util.List;

public class DocumentSelection {
  private final int[][] ranges;

  public DocumentSelection(List intRanges) {
    this.ranges = convertDocumentSelection(intRanges);
  }

  public int[][] convertDocumentSelection(List intRanges) {
    if (intRanges != null) {
      int size = intRanges.size();
      int[][] rangesArray = new int[size][2];
      int index = 0;

      for (IntRange intRange : intRanges) {
        rangesArray[index][0] = intRanges.get(index).getMinimumInteger();
        rangesArray[index][1] = intRanges.get(index).getMaximumInteger();
        index++;
      }

      return rangesArray;
    }

    return null;
  }

  @Override
  public String toString() {
    Gson gson = new Gson();
    return gson.toJson(this);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy