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

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

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

Transfer.ceiling介绍

暂无

代码示例

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

private void addMarkersToMap(List<NavigationPosition> positions) {
  int maximumMarkerSegmentLength = positionReducer.getMaximumSegmentLength(Waypoints);
  int markersCount = ceiling(positions.size(), maximumMarkerSegmentLength, false);
  for (int j = 0; j < markersCount; j++) {
    StringBuilder buffer = new StringBuilder();
    int maximum = min(positions.size(), (j + 1) * maximumMarkerSegmentLength);
    for (int i = j * maximumMarkerSegmentLength; i < maximum; i++) {
      NavigationPosition position = positions.get(i);
      buffer.append("addMarker(new google.maps.LatLng(").append(asCoordinates(position)).append("),").
          append("\"").append(escape(position.getDescription())).append("\",").
          append(showWaypointDescription.getBoolean()).append(");\n");
    }
    executeScript(buffer.toString());
  }
  removeDirections();
}

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

public static int getNumberOfFilesToWriteFor(BaseRoute route, NavigationFormat format, boolean duplicateFirstPosition) {
  return ceiling(route.getPositionCount() + (duplicateFirstPosition ? 1 : 0), format.getMaximumPositionCount(), true);
}

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

int width = preferences.getInt(ROUTE_LINE_WIDTH_PREFERENCE, 5);
int maximumRouteSegmentLength = positionReducer.getMaximumSegmentLength(Route);
int directionsCount = ceiling(positions.size(), maximumRouteSegmentLength, false);
for (int j = 0; j < directionsCount; j++) {
  StringBuilder waypoints = new StringBuilder();

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

@Test
public void testCeiling() {
  assertEquals(3, ceiling(184, 90, true));
  assertEquals(1, ceiling(0, 1, true));
  assertEquals(3, ceiling(184, 90, false));
  assertEquals(0, ceiling(0, 1, false));
  assertEquals(0, ceiling(0, 20, false));
  assertEquals(1, ceiling(1, 20, false));
}

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

private void addPolylinesToMap(final List<NavigationPosition> reducedPositions, List<NavigationPosition> allPositions) {
  // display markers if there is no polyline to show
  if (reducedPositions.size() < 2) {
    addMarkersToMap(reducedPositions);
    return;
  }
  String color = asColor(trackColorModel.getColor());
  float opacity = asOpacity(trackColorModel.getColor());
  int width = preferences.getInt(TRACK_LINE_WIDTH_PREFERENCE, 2);
  int maximumPolylineSegmentLength = positionReducer.getMaximumSegmentLength(Track);
  int polylinesCount = ceiling(reducedPositions.size(), maximumPolylineSegmentLength, true);
  for (int j = 0; j < polylinesCount; j++) {
    StringBuilder latlngs = new StringBuilder();
    int minimum = max(0, j * maximumPolylineSegmentLength - 1);
    int maximum = min(reducedPositions.size(), (j + 1) * maximumPolylineSegmentLength);
    for (int i = minimum; i < maximum; i++) {
      NavigationPosition position = reducedPositions.get(i);
      latlngs.append("new google.maps.LatLng(").append(asCoordinates(position)).append(")");
      if (i < maximum - 1)
        latlngs.append(",");
    }
    executeScript("addPolyline([" + latlngs + "],\"#" + color + "\"," + opacity + "," + width + ");");
  }
  addWaypointIconsToMap(allPositions);
  removeDirections();
}

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

public void write(NmeaRoute route, PrintWriter writer, int startIndex, int endIndex) {
  writeHeader(writer);
  List<NmeaPosition> positions = route.getPositions();
  for (int i = startIndex; i < endIndex; i++) {
    NmeaPosition position = positions.get(i);
    writePosition(position, writer);
  }
  String routeName = formatRouteName(asRouteName(route.getName()));
  int count = ceiling(endIndex - startIndex, 2, true);
  for (int i = startIndex; i < endIndex; i += 2) {
    NmeaPosition start = positions.get(i);
    NmeaPosition end = positions.size() > i + 1 ? positions.get(i + 1) : null;
    writeRte(start, end, writer, count, i / 2, routeName);
  }
  writeFooter(writer);
}

相关文章