-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
167 changed files
with
5,474 additions
and
1,510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
sumaris-core-shared/src/main/java/net/sumaris/core/dao/data/IPosition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.sumaris.core.dao.data; | ||
|
||
/*- | ||
* #%L | ||
* SUMARiS:: Core | ||
* %% | ||
* Copyright (C) 2018 SUMARiS Consortium | ||
* %% | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-3.0.html>. | ||
* #L% | ||
*/ | ||
|
||
public interface IPosition { | ||
|
||
|
||
Double getLatitude(); | ||
|
||
void setLatitude(Double latitude); | ||
|
||
Double getLongitude(); | ||
|
||
void setLongitude(Double longitude); | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
sumaris-core-shared/src/main/java/net/sumaris/core/dao/data/Positions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* #%L | ||
* SUMARiS | ||
* %% | ||
* Copyright (C) 2019 SUMARiS Consortium | ||
* %% | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-3.0.html>. | ||
* #L% | ||
*/ | ||
|
||
package net.sumaris.core.dao.data; | ||
|
||
public abstract class Positions { | ||
|
||
protected Positions() { | ||
// Helper class | ||
} | ||
|
||
public static boolean isNotNullAndValid(IPosition position) { | ||
|
||
if (position == null || position.getLatitude() == null || position.getLongitude() == null) return false; | ||
|
||
// Invalid lat/lon | ||
if (position.getLatitude() < -90 || position.getLatitude() > 90 | ||
|| position.getLongitude() < -180 || position.getLongitude() > 180) { | ||
return false; | ||
} | ||
|
||
// OK: valid | ||
return true; | ||
} | ||
|
||
public static boolean isNullOrInvalid(IPosition position) { | ||
return !isNotNullAndValid(position); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.