mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Adds Comparable to identifiers that are used in TreeSets. (#1103)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2021 Dennis Sheirer
|
||||
*
|
||||
* * ******************************************************************************
|
||||
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||
* *
|
||||
* * 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/>
|
||||
* * *****************************************************************************
|
||||
* 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/>
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.module.decode.mdc1200.identifier;
|
||||
@@ -29,7 +26,7 @@ import io.github.dsheirer.protocol.Protocol;
|
||||
/**
|
||||
* Identifier for an MDC1200 radio identity
|
||||
*/
|
||||
public class MDC1200Identifier extends TalkgroupIdentifier
|
||||
public class MDC1200Identifier extends TalkgroupIdentifier implements Comparable<MDC1200Identifier>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -61,4 +58,10 @@ public class MDC1200Identifier extends TalkgroupIdentifier
|
||||
{
|
||||
return new MDC1200Identifier(value, Role.FROM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(MDC1200Identifier other)
|
||||
{
|
||||
return Integer.compare(getValue(), other != null ? other.getValue() : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2018 Dennis Sheirer
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2021 Dennis Sheirer
|
||||
*
|
||||
* 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
|
||||
@@ -15,7 +14,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* *****************************************************************************
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.module.decode.tait.identifier;
|
||||
@@ -25,11 +24,12 @@ import io.github.dsheirer.identifier.IdentifierClass;
|
||||
import io.github.dsheirer.identifier.Role;
|
||||
import io.github.dsheirer.identifier.string.StringIdentifier;
|
||||
import io.github.dsheirer.protocol.Protocol;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* Tait-1200 String (ASCII) Identifier
|
||||
*/
|
||||
public class TaitIdentifier extends StringIdentifier
|
||||
public class TaitIdentifier extends StringIdentifier implements Comparable<TaitIdentifier>
|
||||
{
|
||||
/**
|
||||
* Constructs an identifier with the specified role
|
||||
@@ -60,4 +60,10 @@ public class TaitIdentifier extends StringIdentifier
|
||||
{
|
||||
return new TaitIdentifier(value, Role.TO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TaitIdentifier other)
|
||||
{
|
||||
return StringUtils.compare(getValue(), other != null ? other.getValue() : null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user