解析话题热度因子 @param topicHeatFactor 话题热度因子 @return
(String topicHeatFactor)
| 21 | * @return |
| 22 | */ |
| 23 | public static Map<String,Object> parseTopicHeatFactor(String topicHeatFactor) { |
| 24 | Map<String,Object> heatMap = new HashMap<String,Object>(); |
| 25 | |
| 26 | if(topicHeatFactor != null && !topicHeatFactor.trim().isEmpty()){ |
| 27 | String[] factorGroup = topicHeatFactor.trim().split("\\|"); |
| 28 | for(String factor : factorGroup){ |
| 29 | |
| 30 | String[] paramGroup = factor.trim().split("="); |
| 31 | if(paramGroup.length==2){ |
| 32 | if(paramGroup[0].trim().equals("评论") && Verification.isPositiveIntegerZero(paramGroup[1].trim())){ |
| 33 | long number = Long.parseLong(paramGroup[1].trim()); |
| 34 | if(number >=0L && number <=99999L){ |
| 35 | heatMap.put("评论", number); |
| 36 | } |
| 37 | }else if(paramGroup[0].trim().equals("点赞") && Verification.isPositiveIntegerZero(paramGroup[1].trim())){ |
| 38 | long number = Long.parseLong(paramGroup[1].trim()); |
| 39 | if(number >=0L && number <=99999L){ |
| 40 | heatMap.put("点赞", number); |
| 41 | } |
| 42 | }else if(paramGroup[0].trim().equals("浏览量") && Verification.isPositiveIntegerZero(paramGroup[1].trim())){ |
| 43 | long number = Long.parseLong(paramGroup[1].trim()); |
| 44 | if(number >=0L && number <=99999L){ |
| 45 | heatMap.put("浏览量", number); |
| 46 | } |
| 47 | }else if(paramGroup[0].trim().equals("重力因子") && Verification.isAmount(paramGroup[1].trim())){ |
| 48 | double number = Double.parseDouble(paramGroup[1].trim()); |
| 49 | if(number >=0.1d && number <=2d){ |
| 50 | heatMap.put("重力因子", number); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | return heatMap; |
| 57 | } |
| 58 | |
| 59 | |
| 60 | /** |
no test coverage detected