6 package com.vesoft.nebula.client.graph.data;
8 import com.vesoft.nebula.Coordinate;
9 import com.vesoft.nebula.Polygon;
10 import java.util.ArrayList;
11 import java.util.List;
12 import java.util.Objects;
15 private final Polygon polygon;
18 this.polygon = polygon;
21 public List<List<CoordinateWrapper>> getCoordListList() {
22 List<List<CoordinateWrapper>> coordListList =
new ArrayList<>();
23 for (List<Coordinate> cl: polygon.getCoordListList()) {
24 List<CoordinateWrapper> coordList =
new ArrayList<>();
25 for (Coordinate coordinate : cl) {
28 coordListList.add(coordList);
34 public int hashCode() {
35 return Objects.hash(polygon);
39 public boolean equals(Object o) {
43 if (o ==
null || getClass() != o.getClass()) {
47 List<List<CoordinateWrapper>> thisListList = getCoordListList();
48 List<List<CoordinateWrapper>> thatListList = that.getCoordListList();
49 if (thisListList.size() != thatListList.size()) {
52 for (
int i = 0; i < thisListList.size(); i++) {
53 List<CoordinateWrapper> thisList = thisListList.get(i);
54 List<CoordinateWrapper> thatList = thatListList.get(i);
55 if (thisList.size() != thatList.size()) {
58 for (
int j = 0; j < thisList.size(); j++) {
59 if (!thisList.get(j).equals(thatList.get(j))) {
68 public String toString() {
69 StringBuilder sb =
new StringBuilder();
72 if (polygon.getCoordListList() !=
null) {
73 for (List<Coordinate> cl : polygon.getCoordListList()) {
75 for (Coordinate coordinate : cl) {
76 sb.append(coordinate.getX());
78 sb.append(coordinate.getY());
81 if (sb.charAt(sb.length() - 1) ==
',') {
82 sb.deleteCharAt(sb.length() - 1);
87 if (sb.charAt(sb.length() - 1) ==
',') {
88 sb.deleteCharAt(sb.length() - 1);