| | |
| | | return ints; |
| | | } |
| | | |
| | | //获取最近并在当前位置前边的位置 |
| | | // //获取最近并在当前位置前边的位置1000000===>10000==>0==>1000000 |
| | | // public static Integer LatelyAndLessThan(List<BasDevpPosition> devpPosition, long nowPosition,long perimeter){ |
| | | // Integer result = 0; |
| | | // long Difference = perimeter; |
| | | // for (BasDevpPosition positions : devpPosition){ |
| | | // Long position = positions.getPlcPosition(); |
| | | // if (position<=nowPosition){ |
| | | // if ((nowPosition-position) < Difference){ |
| | | // Difference = nowPosition-position; |
| | | // result = positions.getDevNo(); |
| | | // } |
| | | // } else { |
| | | // if ((nowPosition-(position - perimeter)) < Difference){ |
| | | // Difference = nowPosition-(position - perimeter); |
| | | // result = positions.getDevNo(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return result; |
| | | // } |
| | | //获取最近并在当前位置前边的位置 0==>1000===>1000000==>0 |
| | | public static Integer LatelyAndLessThan(List<BasDevpPosition> devpPosition, long nowPosition,long perimeter){ |
| | | Integer result = 0; |
| | | long Difference = perimeter; |
| | | for (BasDevpPosition positions : devpPosition){ |
| | | Long position = positions.getPlcPosition(); |
| | | if (position<=nowPosition){ |
| | | if ((nowPosition-position) < Difference){ |
| | | Difference = nowPosition-position; |
| | | if (position >= nowPosition){ |
| | | if ((position-nowPosition) < Difference){ |
| | | Difference = position-nowPosition; |
| | | result = positions.getDevNo(); |
| | | } |
| | | } else { |
| | | if ((nowPosition-(position - perimeter)) < Difference){ |
| | | Difference = nowPosition-(position - perimeter); |
| | | if (perimeter - (nowPosition - position) < Difference){ |
| | | Difference = perimeter - (nowPosition - position); |
| | | result = positions.getDevNo(); |
| | | } |
| | | } |
| | |
| | | return result; |
| | | } |
| | | |
| | | //获取最近并在当前位置后边的位置 |
| | | // //获取最近并在当前位置后边的位置 1000000===>10000==>0==>1000000 |
| | | // public static Integer LatelyAndLessThanWcs(List<BasDevpPosition> devpPosition, long nowPosition,long perimeter){ |
| | | // Integer result = 0; |
| | | // Integer integer = LatelyAndLessThan(devpPosition, nowPosition,perimeter); |
| | | // for (BasDevpPosition basDevpPosition:devpPosition){ |
| | | // if (basDevpPosition.getDevNo().equals(integer)){ |
| | | // if (basDevpPosition.getDevNo() == 101){ |
| | | // result = 133; |
| | | // } |
| | | // break; |
| | | // } |
| | | // result = basDevpPosition.getDevNo(); |
| | | // } |
| | | // return result; |
| | | // } |
| | | //获取最近并在当前位置后边的位置 0==>1000===>1000000==>0 |
| | | public static Integer LatelyAndLessThanWcs(List<BasDevpPosition> devpPosition, long nowPosition,long perimeter){ |
| | | Integer result = 0; |
| | | Integer result = -1; |
| | | Integer integer = LatelyAndLessThan(devpPosition, nowPosition,perimeter); |
| | | for (BasDevpPosition basDevpPosition:devpPosition){ |
| | | if (basDevpPosition.getDevNo().equals(integer)){ |
| | | if (basDevpPosition.getDevNo() == 101){ |
| | | result = 133; |
| | | if (basDevpPosition.getDevNo() == 133){ |
| | | result = 101; |
| | | } |
| | | break; |
| | | } |
| | |
| | | // return result; |
| | | // } |
| | | |
| | | //获取最近并在当前位置后边的位置 |
| | | // //获取最近并在当前位置后边的位置 1000000===>10000==>0==>1000000 |
| | | // public static Integer LatelyAndGreaterThan(List<List<Long>> sitePosition, long nowPosition ,long perimeter){ |
| | | // int result = 0; |
| | | // long Difference = perimeter; |
| | | // for (List<Long> rgvPositions: sitePosition){ |
| | | // Long position = rgvPositions.get(1); |
| | | // if (position>nowPosition){ |
| | | // if ((position - nowPosition) < Difference){ |
| | | // Difference = position - nowPosition; |
| | | // result = rgvPositions.get(0).intValue(); |
| | | // } |
| | | // } else { |
| | | // if ((perimeter - (nowPosition - position)) < Difference){ |
| | | // Difference = perimeter - (nowPosition - position); |
| | | // result = rgvPositions.get(0).intValue(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return result; |
| | | // } |
| | | |
| | | //获取最近并在当前位置后边的位置 0==>1000===>1000000==>0 |
| | | public static Integer LatelyAndGreaterThan(List<List<Long>> sitePosition, long nowPosition ,long perimeter){ |
| | | int result = 0; |
| | | int result = -1; |
| | | long Difference = perimeter; |
| | | for (List<Long> rgvPositions: sitePosition){ |
| | | Long position = rgvPositions.get(1); |
| | | if (position>nowPosition){ |
| | | if ((position - nowPosition) < Difference){ |
| | | Difference = position - nowPosition; |
| | | if (position <= nowPosition){ |
| | | if ((nowPosition - position) < Difference){ |
| | | Difference = nowPosition - position; |
| | | result = rgvPositions.get(0).intValue(); |
| | | } |
| | | } else { |