slash.common.io.Transfer.toArray()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中slash.common.io.Transfer.toArray()方法的一些代码示例,展示了Transfer.toArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transfer.toArray()方法的具体详情如下:
包路径:slash.common.io.Transfer
类名称:Transfer
方法名:toArray

Transfer.toArray介绍

暂无

代码示例

代码示例来源:origin: cpesch/RouteConverter

public static int[] allButEveryNthAndFirstAndLast(int maximum, int nth) {
    if (nth < 1)
      throw new IllegalArgumentException("nth has to be more than zero");

    List<Integer> result = new ArrayList<>();
    for (int i = 1; i < maximum; i += nth) {
      int intervalMaximum = i + nth - 1;
      if (intervalMaximum > maximum)
        intervalMaximum = maximum;
      for (int j = i; j < intervalMaximum; j++) {
        result.add(j);
      }
    }
    return toArray(result);
  }
}

代码示例来源:origin: cpesch/RouteConverter

public int[] mapRows(int[] rowIndices) {
  List<Integer> result = new ArrayList<>();
  for (int rowIndex : rowIndices) {
    int mappedRow = mapRow(rowIndex);
    if (mappedRow != -1)
      result.add(mappedRow);
  }
  return toArray(result);
}

代码示例来源:origin: cpesch/RouteConverter

public int[] getContainedPositions(BoundingBox boundingBox) {
  List<Integer> result = new ArrayList<>();
  List<P> positions = getPositions();
  for (int i = 0; i < positions.size(); i++) {
    P position = positions.get(i);
    if (position.hasCoordinates() && boundingBox.contains(position))
      result.add(i);
  }
  return toArray(result);
}

代码示例来源:origin: cpesch/RouteConverter

public int[] getPositionsWithinDistanceToPredecessor(double distance) {
  List<P> positions = getPositions();
  if (positions.size() <= 2)
    return new int[0];
  P previous = positions.get(0);
  List<Integer> result = new ArrayList<>();
  for (int i = 1; i < positions.size() - 1; i++) {
    P next = positions.get(i);
    if (!next.hasCoordinates() || toDouble(next.calculateDistance(previous)) <= distance)
      result.add(i);
    else
      previous = next;
  }
  return toArray(result);
}

代码示例来源:origin: cpesch/RouteConverter

public void run() {
    r.getPositionAugmenter().addData(toArray(augmentRows), false, true, true, false, false);
  }
});

代码示例来源:origin: cpesch/RouteConverter

private void zoomChanged(byte zoomLevelMin, byte zoomLevelMax, int zoomLevel) {
  ComboBoxModel<Integer> model = comboBoxZoom.getModel();
  if (model.getSize() == 0 ||
      model.getElementAt(0) != zoomLevelMin ||
      model.getElementAt(model.getSize() - 1) != zoomLevelMax)
    comboBoxZoom.setModel(new DefaultComboBoxModel<>(toArray(asRange(zoomLevelMin, zoomLevelMax))));
  try {
    comboBoxZoom.setSelectedItem(zoomLevel);
  } catch (ArrayIndexOutOfBoundsException | NullPointerException e) {
    // work around exceptions deep in Swings BasicListUI on Mac OS X
    comboBoxZoom.setSelectedIndex(zoomLevel - 1);
  }
}

代码示例来源:origin: cpesch/RouteConverter

final int[] rows = toArray(insertedRows);
final int insertRow = rows.length > 0 ? rows[0] : table.getRowCount();
invokeLater(new Runnable() {

相关文章