All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.hgross.blaubot.messaging.BlaubotChannelManagerInfo Maven / Gradle / Ivy

package eu.hgross.blaubot.messaging;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * Debug infos created by the BlaubotChannelManager.
 * Exposes some usally protected data, so be cautios.
 *
 */
public class BlaubotChannelManagerInfo {
    private List channels;
    private List connections;

    public BlaubotChannelManagerInfo(Collection channels, Collection messageManagers, String ownDeviceId) {
        this.channels = new ArrayList<>();
        this.connections = new ArrayList<>();

        for (BlaubotChannel channel : channels) {
            ChannelInfo channelInfo = new ChannelInfo(channel, ownDeviceId);
            this.channels.add(channelInfo);
        }

        for (BlaubotMessageManager messageManager : messageManagers) {
            ConnectionInfo connectionInfo = new ConnectionInfo(messageManager);
            this.connections.add(connectionInfo);
        }

        Collections.sort(this.channels, new Comparator() {
            @Override
            public int compare(ChannelInfo o1, ChannelInfo o2) {
                return Integer.valueOf(o1.getChannelConfig().getChannelId()).compareTo(Integer.valueOf(o2.getChannelConfig().getChannelId()));
            }
        });
    }

    public List getChannels() {
        return channels;
    }

    public List getConnections() {
        return connections;
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy