package com.zy.acs.manager.common.utils; import com.alibaba.fastjson.JSON; import com.zy.acs.framework.common.Cools; import java.util.*; /** * Created by vincent on 8/7/2024 */ public class MapDataUtils { public static List parseWaveNode(String waveNodeStr) { List waveNodeList = new ArrayList<>(); if (Cools.isEmpty(waveNodeStr)) { return waveNodeList; } return JSON.parseArray(waveNodeStr, String.class); } public static List parseCdaNode(String cdaNodeStr) { List waveNodeList = new ArrayList<>(); if (Cools.isEmpty(cdaNodeStr)) { return waveNodeList; } return JSON.parseArray(cdaNodeStr, Double.class); } public static List hasOtherWave(List list, String vehicle) { if (Cools.isEmpty(list)) { return list; } list.removeIf(next -> next.equals(vehicle)); return list; } public static String generateWaveNode(String originStr, String waveNode) { List originNode = JSON.parseArray(originStr, String.class); Set set = new HashSet<>(originNode); set.add(waveNode); return JSON.toJSONString(set); } public static Double getVehicleWaveSafeDistance(Integer diameter, Double factor) { if (Cools.isEmpty(diameter)) { return 0.0D; } factor = Optional.ofNullable(factor).orElse(1.0D); return diameter * factor; } }