コード例 #1
0
  @Override
  public void visitShot(
      long timestamp,
      Shot shot,
      boolean isMalfunction,
      boolean isReload,
      Optional<Integer> targetIndex,
      Optional<Integer> hitRegionIndex,
      Optional<String> videoString) {

    int targIndex;
    if (targetIndex.isPresent()) {
      targIndex = targetIndex.get();
    } else {
      targIndex = -1;
    }

    int hitRegIndex;
    if (hitRegionIndex.isPresent()) {
      hitRegIndex = hitRegionIndex.get();
    } else {
      hitRegIndex = -1;
    }

    if (videoString.isPresent()) {
      xmlBody.append(
          String.format(
              Locale.US,
              "\t\t<shot timestamp=\"%d\" color=\"%s\""
                  + " x=\"%f\" y=\"%f\" shotTimestamp=\"%d\" markerRadius=\"%d\" isMalfunction=\"%b\""
                  + " isReload=\"%b\" targetIndex=\"%d\" hitRegionIndex=\"%d\" videos=\"%s\" />%n",
              timestamp,
              shot.getColor().toString(),
              shot.getX(),
              shot.getY(),
              shot.getTimestamp(),
              (int) shot.getMarker().getRadiusX(),
              isMalfunction,
              isReload,
              targIndex,
              hitRegIndex,
              videoString.get()));

    } else {
      xmlBody.append(
          String.format(
              Locale.US,
              "\t\t<shot timestamp=\"%d\" color=\"%s\""
                  + " x=\"%f\" y=\"%f\" shotTimestamp=\"%d\" markerRadius=\"%d\" isMalfunction=\"%b\""
                  + " isReload=\"%b\" targetIndex=\"%d\" hitRegionIndex=\"%d\" />%n",
              timestamp,
              shot.getColor().toString(),
              shot.getX(),
              shot.getY(),
              shot.getTimestamp(),
              (int) shot.getMarker().getRadiusX(),
              isMalfunction,
              isReload,
              targIndex,
              hitRegIndex));
    }
  }