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

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

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

Transfer.isEmpty介绍

暂无

代码示例

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

public static boolean isEmpty(BigDecimal bigDecimal) {
  return bigDecimal == null || isEmpty(bigDecimal.doubleValue());
}

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

private Double parseSeconds(String string) {
  Double result = parseDouble(string);
  return !isEmpty(result) ? result : null;
}

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

private static Double parseDouble(String string) {
  Double aDouble = Transfer.parseDouble(string);
  return !isEmpty(aDouble) ? aDouble : null;
}

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

private String addHeading(String description, Double heading) {
  if (isEmpty(heading))
    return description;
  return (description != null ? description + " " : "") +
      "Heading: " + formatHeadingAsString(heading);
}

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

protected boolean isValidRoute(GpxRoute route) {
    // is really greedy in parsing the data of various text files
    List<GpxPosition> positions = route.getPositions();
    int count = 0;
    for (GpxPosition position : positions) {
      if ((isEmpty(position.getLongitude()) && isEmpty(position.getLatitude())) ||
          (isEmpty(position.getLongitude()) && isEmpty(position.getElevation())) ||
          (isEmpty(position.getLatitude()) && isEmpty(position.getElevation())))
        count++;
    }
    return count != positions.size();
  }
}

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

private boolean isEmptyExtension(slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint) {
  return isEmpty(trackPoint.getAtemp()) && isEmpty(trackPoint.getBearing()) && isEmpty(trackPoint.getCad()) &&
      isEmpty(trackPoint.getCourse()) &&  isEmpty(trackPoint.getDepth()) && isEmpty(trackPoint.getHr()) &&
      isEmpty(trackPoint.getSpeed()) && isEmpty(trackPoint.getWtemp()) &&
      (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().size() == 0);
}

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

protected boolean isValidRoute(GpxRoute route) {
  List<GpxPosition> positions = route.getPositions();
  int count = 0;
  // has lots of zero element routes and routes with only one 0.0/0.0 waypoint
  for (GpxPosition position : positions) {
    if (isEmpty(position.getLongitude()) &&
        isEmpty(position.getLatitude()) &&
        isEmpty(position.getElevation()))
      count++;
  }
  return count != positions.size();
}

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

protected boolean isValidRoute(GpxRoute route) {
  // clashes with some iGo8 .trk files
  List<GpxPosition> positions = route.getPositions();
  int count = 0;
  for (GpxPosition position : positions) {
    if (isEmpty(position.getLongitude()) && isEmpty(position.getLatitude()))
      count++;
  }
  return count != positions.size();
}

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

private boolean isEmptyExtension(slash.navigation.gpx.trackpoint1.TrackPointExtensionT trackPoint) {
  return isEmpty(trackPoint.getAtemp()) && isEmpty(trackPoint.getCad()) && isEmpty(trackPoint.getDepth()) &&
      isEmpty(trackPoint.getHr()) && isEmpty(trackPoint.getWtemp()) &&
      (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().size() == 0);
}

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

private CompactCalendar parseTime(String time) {
  Long milliseconds = parseLong(time);
  if (isEmpty(milliseconds))
    return null;
  return fromMillis(milliseconds * 1000);
}

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

protected boolean isValidRoute(GpxRoute route) {
    // clashes with some TomTom POI .ov2 files
    List<GpxPosition> positions = route.getPositions();
    if (positions.size() == 0)
      return false;
    int count = 0;
    for (GpxPosition position : positions) {
      if ((isEmpty(position.getLongitude()) && (position.getElevation() != null) && (position.getElevation() > 100000.0)) ||
          (isEmpty(position.getLongitude()) && isEmpty(position.getLatitude())))
        count++;
    }
    return count != positions.size();
  }
}

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

private void mergeExtension(slash.navigation.gpx.trackpoint1.TrackPointExtensionT trackpoint1, slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackpoint2) {
  if(!isEmpty(trackpoint1.getAtemp()) && isEmpty(trackpoint2.getAtemp()))
    trackpoint2.setAtemp(trackpoint1.getAtemp());
  if(!isEmpty(trackpoint1.getCad()) && isEmpty(trackpoint2.getCad()))
    trackpoint2.setCad(trackpoint1.getCad());
  if(!isEmpty(trackpoint1.getDepth()) && isEmpty(trackpoint2.getDepth()))
    trackpoint2.setDepth(trackpoint1.getDepth());
  if(!isEmpty(trackpoint1.getHr()) && isEmpty(trackpoint2.getHr()))
    trackpoint2.setHr(trackpoint1.getHr());
  if(!isEmpty(trackpoint1.getWtemp()) && isEmpty(trackpoint2.getWtemp()))
    trackpoint2.setWtemp(trackpoint1.getWtemp());
}

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

private String formatSpeedDescription(String description, Double speed) {
  if (isEmpty(speed) || parseSpeed(description) != null)
    return description;
  return (description != null ? description + " " : "") +
      "Speed: " + formatSpeedAsString(speed) + " Km/h";
}

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

private CompactCalendar parseTime(String time) {
  Long milliseconds = parseLong(time);
  if (isEmpty(milliseconds))
    return null;
  return fromMillis(milliseconds * 1000);
}

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

private void mergeExtension(slash.navigation.gpx.garmin3.TrackPointExtensionT garmin3, slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackpoint2) {
  if(!isEmpty(garmin3.getDepth()) && isEmpty(trackpoint2.getDepth()))
    trackpoint2.setDepth(garmin3.getDepth());
  if(!isEmpty(garmin3.getTemperature()) && isEmpty(trackpoint2.getAtemp()))
    trackpoint2.setAtemp(garmin3.getTemperature());
}

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

private boolean isEmptyExtension(slash.navigation.gpx.garmin3.TrackPointExtensionT trackPoint) {
  return isEmpty(trackPoint.getDepth()) && isEmpty(trackPoint.getTemperature()) &&
      (trackPoint.getExtensions() == null || trackPoint.getExtensions().getAny().size() == 0);
}

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

protected boolean isValidRoute(GpxRoute route) {
    // is reading GarminPoiDb files
    List<GpxPosition> positions = route.getPositions();
    int count = 0;
    for (GpxPosition position : positions) {
      if ((position.getSatellites() == null || position.getSatellites() < 12) &&
          (position.getVdop() == null || position.getVdop() < 20.0) &&
          !isEmpty(position.getLongitude()) &&
          !isEmpty(position.getLatitude()))
        count++;
    }
    return count == positions.size();
  }
}

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

@SuppressWarnings("unused")
public static CompactCalendar extrapolateTime(NavigationPosition position, NavigationPosition predecessor, NavigationPosition beforePredecessor) {
  if (!predecessor.hasTime() || !beforePredecessor.hasTime())
    return null;
  long timeDelta = abs(beforePredecessor.calculateTime(predecessor));
  Double distanceDelta = beforePredecessor.calculateDistance(predecessor);
  if (isEmpty(distanceDelta))
    return null;
  Double distance = predecessor.calculateDistance(position);
  if (isEmpty(distance))
    return null;
  long time = (long) (predecessor.getTime().getTimeInMillis() + (double) timeDelta * (distance / distanceDelta));
  return fromMillis(time);
}

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

@SuppressWarnings("unused")
public static CompactCalendar interpolateTime(NavigationPosition position, NavigationPosition predecessor, NavigationPosition successor) {
  if (!predecessor.hasTime() || !successor.hasTime())
    return null;
  long timeDelta = abs(predecessor.calculateTime(successor));
  Double distanceToPredecessor = predecessor.calculateDistance(position);
  if (isEmpty(distanceToPredecessor))
    return null;
  Double distanceToSuccessor = position.calculateDistance(successor);
  if (isEmpty(distanceToSuccessor))
    return null;
  Double distanceRatio = distanceToPredecessor / (distanceToPredecessor + distanceToSuccessor);
  long time = (long) (predecessor.getTime().getTimeInMillis() + (double) timeDelta * distanceRatio);
  return fromMillis(time);
}

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

public Double calculateSpeed(NavigationPosition other) {
  if (hasTime() && other.hasTime()) {
    double interval = abs(getTime().getTimeInMillis() - other.getTime().getTimeInMillis()) / MILLISECONDS_OF_A_SECOND;
    Double distance = calculateDistance(other);
    if (!isEmpty(distance) && interval > 0.0)
      return distance / interval * 3.6;
  }
  return null;
}

相关文章