MCPcopy Create free account
hub / github.com/Neop/mudmap2 / compare

Method compare

src/main/java/mudmap2/CopyPaste.java:154–169  ·  view source on GitHub ↗
(final Place t, final Place t1)

Source from the content-addressed store, hash-verified

152 final ArrayList<Place> ordered_places = new ArrayList<>(copyPlaces);
153 Collections.sort(ordered_places, new Comparator<Place>() {
154 @Override
155 public int compare(final Place t, final Place t1) {
156 // order by movement direction:
157 // places that might collide with other places in the
158 // list will be moved first
159 if (fact_x * t.getX() > fact_x * t1.getX()) {
160 return 1;
161 } else if (t.getX() == t1.getX()) {
162 if (fact_y * t.getY() > fact_y * t1.getY()) {
163 return 1;
164 } else if (t.getY() == t1.getY()) {
165 return 0;
166 }
167 }
168 return -1;
169 }
170 });
171
172 places = ordered_places.toArray(new Place[ordered_places.size()]);

Callers

nothing calls this directly

Calls 2

getXMethod · 0.65
getYMethod · 0.65

Tested by

no test coverage detected