/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2020 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
package org.onap.holmes.common.api.stat;\r
\r
-import com.alibaba.fastjson.JSONObject;\r
+import com.google.gson.Gson;\r
import lombok.Getter;\r
import lombok.Setter;\r
\r
linkIdNodeIdxMap.put(linkId, index);\r
}\r
\r
- /**\r
- * Comparison of the location of different links: 999 the same link: the location of the node\r
- * number less than otherIdIdx in the location of the number (in the otherIdIdx upstream):-1,\r
- * the same link: the node position number is equal to the number of position in the otherIdIdx\r
- * (in the same site otherIdIdx):0, the same link: the node location number is greater than the\r
- * number of locations in otherIdIdx (otherIdIdx) with the site):1,\r
- */\r
- public int CompareLinkPosition(Map<Integer, Integer> otherIdIdx) {\r
- Set<Integer> myIdSet = new HashSet<>();\r
- myIdSet.addAll(this.linkIdNodeIdxMap.keySet());\r
- myIdSet.retainAll(otherIdIdx.keySet());\r
-\r
- if (myIdSet.isEmpty()) {\r
- return 999;\r
- }\r
-\r
- for (int tempLinkId : myIdSet) {\r
- return this.linkIdNodeIdxMap.get(tempLinkId) - otherIdIdx.get(tempLinkId);\r
- }\r
- return 999;\r
- }\r
-\r
public boolean containNode(int linkId, int index) {\r
return linkIdNodeIdxMap.containsKey(linkId) && linkIdNodeIdxMap.get(linkId) == index;\r
}\r
@Override\r
public String toString() {\r
\r
- return JSONObject.toJSONString(this);\r
+ return new Gson().toJson(this);\r
}\r
\r
@Override\r