Skip to content

Commit

Permalink
comm/manager/imc/ImcId16: Added new compareTo method against integers.
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-paz committed Jan 17, 2025
1 parent 5986808 commit 7e5e14f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/java/pt/lsts/neptus/comm/manager/imc/ImcId16.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ public static boolean isValidIdForSource(long id) {

@Override
public int compareTo(ImcId16 o) {
//return (int) (longValue() - o.longValue());
return (longValue() < o.longValue() ? -1 : (longValue() == o.longValue() ? 0 : 1));
}

public int compareTo(int id) {
long i = id & 0xFFFF;
return (longValue() < i ? -1 : (longValue() == i ? 0 : 1));
}

@Override
public boolean equals(Object obj) {
if(this == obj)
Expand Down

0 comments on commit 7e5e14f

Please sign in to comment.