<commit_before>package de.datenhahn.ffmobile.json.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class NodesJson {
    Date timestamp;
    String version;
    Map<String, FreifunkNode> nodes;

    public List<FreifunkNode> getRouters() {
        ArrayList<FreifunkNode> routers = new ArrayList<>();
        for(FreifunkNode node : nodes.values()) {
            if(!node.getFlags().isGateway()) {
                routers.add(node);
            }
        }
        return routers;
    }

    public List<FreifunkNode> getOnlineRouters() {
        ArrayList<FreifunkNode> routers = new ArrayList<>();
        for(FreifunkNode node : nodes.values()) {
            if(!node.getFlags().isGateway() && node.getFlags().isOnline()) {
                routers.add(node);
            }
        }
        return routers;
    }

    public List<FreifunkNode> getGateways() {
        ArrayList<FreifunkNode> gateways = new ArrayList<>();
        for(FreifunkNode node : nodes.values()) {
            if(node.getFlags().isGateway()) {
                gateways.add(node);
            }
        }
        return gateways;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public String getVersion() {
        return version;<commit_msg>- try to detect offloaders<commit_after>package de.datenhahn.ffmobile.json.model;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class NodesJson {
    Date timestamp;
    String version;

    private static final Logger logger = LoggerFactory.getLogger(NodesJson.class);
    Map<String, FreifunkNode> nodes;

    public List<FreifunkNode> getRouters() {
        ArrayList<FreifunkNode> routers = new ArrayList<>();
        for(FreifunkNode node : nodes.values()) {
            if(!node.getFlags().isGateway()) {
                routers.add(node);
            }
        }
        return routers;
    }

    private boolean hasWirelessMesh(FreifunkNode node) {
        if(node.getNodeInfo().getNetwork() != null) {
            if(node.getNodeInfo().getNetwork().getMesh() != null) {
                if(node.getNodeInfo().getNetwork().getMesh().get("bat0") != null) {
                    if(node.getNodeInfo().getNetwork().getMesh().get("bat0").getInterfaces() != null) {
                        if( node.getNodeInfo().getNetwork().getMesh().get("bat0").getInterfaces().getWireless() != null) {
                            return true;
                        }
                    }
                }
            }
        }
        logger.info("Dropping Non Wireless router: " + node.getNodeInfo().getHostname());
        return false;
    }

    public List<FreifunkNode> getOnlineRouters() {
        ArrayList<FreifunkNode> routers = new ArrayList<>();
        for(FreifunkNode node : nodes.values()) {
            if(!node.getFlags().isGateway() && node.getFlags().isOnline() && hasWirelessMesh(node)) {
                routers.add(node);
            }
        }
        return routers;
    }

    public List<FreifunkNode> getGateways() {
        ArrayList<FreifunkNode> gateways = new ArrayList<>();
        for(FreifunkNode node : nodes.values()) {
            if(node.getFlags().isGateway()) {
                gateways.add(node);
            }
        }
        return gateways;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public String getVersion() {
        return version;
{'fraction_non_alphanumeric': 0.1239247311827957, 'fraction_numerical': 0.0013440860215053765, 'mean_word_length': 2.1216442953020134, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '373069', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1045, 'n_words': 196}