| 146 | |
| 147 | // return if order changed |
| 148 | public static boolean bringInOrder(Position start, Position end) { |
| 149 | if (start == null || end == null) { |
| 150 | return false; |
| 151 | } |
| 152 | boolean change = false; |
| 153 | int firstValue = start.getX(); |
| 154 | int secondValue = end.getX(); |
| 155 | if (firstValue > secondValue) { |
| 156 | start.setX(secondValue); |
| 157 | end.setX(firstValue); |
| 158 | change = true; |
| 159 | } |
| 160 | firstValue = start.getY(); |
| 161 | secondValue = end.getY(); |
| 162 | if (firstValue > secondValue) { |
| 163 | start.setY(secondValue); |
| 164 | end.setY(firstValue); |
| 165 | change = true; |
| 166 | } |
| 167 | firstValue = start.getZ(); |
| 168 | secondValue = end.getZ(); |
| 169 | if (firstValue > secondValue) { |
| 170 | start.setZ(secondValue); |
| 171 | end.setZ(firstValue); |
| 172 | change = true; |
| 173 | } |
| 174 | return change; |
| 175 | } |
| 176 | |
| 177 | public static void addTo(Position writeTarget, Position diff) { |
| 178 | writeTarget.x += diff.x; |