java setlength_Java StringBuilder.setLength() – 是时间复杂度O(1)?

Sets the length of the character sequence. The sequence is changed to a new character sequence whose length is specified by the argument. For every nonnegative index k less than newLength, the character at index k in the new character sequence is the same as the character at index k in the old sequence if k is less than the length of the old character sequence; otherwise, it is the null character ‘\u0000’. In other words, if the newLength argument is less than the current length, the length is changed to the specified length.

If the newLength argument is greater than or equal to the current length, sufficient null characters (‘\u0000’) are appended so that length becomes the newLength argument.

The newLength argument must be greater than or equal to 0.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#include "prepare_ogm.hpp" namespace senior { namespace guardian { namespace prepare { std::string PrepareOgm::Name() { return "Prepare Ogm Element"; } void PrepareOgm::Initiate() {} void PrepareOgm::Process(data::DataFrame& his, data::DataFrame& cur) { if (cur.source_ogm_points_.is_invalid()) return; if (cur.source_visual_ogm_points_.is_valid()) { cur.source_ogm_points_.insert(cur.source_ogm_points_.end(), cur.source_visual_ogm_points_.begin(), cur.source_visual_ogm_points_.end()); } if (cur.source_higher_ogm_points_.is_valid()) { cur.source_ogm_points_.insert(cur.source_ogm_points_.end(), cur.source_higher_ogm_points_.begin(), cur.source_higher_ogm_points_.end()); } auto& predict_path = cur.monitor_data_.mutable_predict_path(); predict_path.GenerateBoundary(cur); cur.AABox2d_ = predict_path.vehicle_AABox2d_; // if (!his.monitor_data_.is_need_to_take_over()) { // LOG(INFO)<<"1"; cur.AABox2d_.SetWidth(cur.AABox2d_.width() + 1.0); cur.AABox2d_.SetLength(cur.AABox2d_.length() + 1.0); // } std::vector<math::Vec2d> corner_points_; cur.AABox2d_.GetAllCorners(&corner_points_); auto& polygon2d = predict_path.tractor_polygon2d_; math::Vec2d temp; VoxelGrid filter_; common::Time now = common::Time::Now(); for (auto& point : cur.source_ogm_points_) { temp.set_x(point.x()); temp.set_y(-point.y()); if (cur.AABox2d_.IsPointIn(temp)) { cur.AABB_ogm_points_.emplace_back(point); } } cur.guardian_diagnose_["Prepare_PrepareOgm_AABox_filter"] = std::to_string((common::Time::Now() - now).ToSecond() * 1000); now = common::Time::Now(); filter_.VoxelGrid_ApplyFilter( cur.AABB_ogm_points_, cur.ogm_points_, corner_points_, 0.1, 0.1, 0); cur.guardian_diagnose_["Prepare_PrepareOgm_VoxelGrid_ApplyFilter"] = std::to_string((common::Time::Now() - now).ToSecond() * 1000); cur.ogm_points_.set_stamp(cur.source_ogm_points_.stamp()); cur.ogm_points_.set_time(cur.source_ogm_points_.time()); cur.ogm_points_.set_delay_time(cur.source_ogm_points_.delay_time()); cur.ogm_points_.set_valid(); } } // namespace prepare } // namespace guardian } // namespace senior 改变为C语言程序
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值