Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1102 Adds Comparable to identifiers that are used in TreeSets. #1103

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -29,7 +26,7 @@
/**
* Identifier for an MDC1200 radio identity
*/
public class MDC1200Identifier extends TalkgroupIdentifier
public class MDC1200Identifier extends TalkgroupIdentifier implements Comparable<MDC1200Identifier>
{

/**
Expand Down Expand Up @@ -61,4 +58,10 @@ public static MDC1200Identifier createFrom(int value)
{
return new MDC1200Identifier(value, Role.FROM);
}

@Override
public int compareTo(MDC1200Identifier other)
{
return Integer.compare(getValue(), other != null ? other.getValue() : 0);
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -25,11 +24,12 @@
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
Expand Down Expand Up @@ -60,4 +60,10 @@ public static TaitIdentifier createTo(String value)
{
return new TaitIdentifier(value, Role.TO);
}

@Override
public int compareTo(TaitIdentifier other)
{
return StringUtils.compare(getValue(), other != null ? other.getValue() : null);
}
}