Files
safedispatch-mobile/libSafeMobile/src/main/java/com/safemobile/lib/radio/Zone.java
2022-03-14 11:53:00 +02:00

52 lines
1.1 KiB
Java

package com.safemobile.lib.radio;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class Zone {
public int dbID;
public int id;
public String ZoneName="";
public ArrayList<Channel> channelList = new ArrayList<Channel>();
public Zone()
{
channelList = new ArrayList<Channel>();
}
public String toString()
{
return "zoneDbID: " + id +" |zoneID: " + dbID + " | ZoneName: " + ZoneName ;
}
/**
* sort the list of channels based on their names
*/
public void sortChannelListByName() {
//Sorting
Collections.sort(channelList, new Comparator<Channel>() {
@Override
public int compare(Channel channel1, Channel channel2)
{
return channel1.chName.compareTo(channel2.chName);
}
});
}
/**
* sort the list of channels based on their ids
*/
public void sortChannelListByChannelID() {
//Sorting
Collections.sort(channelList, new Comparator<Channel>() {
@Override
public int compare(Channel channel1, Channel channel2)
{
return (channel1.id < channel2.id ? 1 : 0);
}
});
}
}