<commit_before>package org.opennms.mock.snmp;

import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Map.Entry;

import org.snmp4j.agent.DefaultMOScope;
import org.snmp4j.agent.MOScope;
import org.snmp4j.agent.ManagedObject;
import org.snmp4j.agent.request.SubRequest;
import org.snmp4j.smi.Null;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.Variable;
import org.snmp4j.smi.VariableBinding;
import org.springframework.core.io.Resource;

public class PropertiesBackedManagedObject implements ManagedObject, MockSnmpMOLoader, Updatable {
    
    private TreeMap<OID, Object> m_vars = null;
    
    private MOScope m_scope = null;
    
    public PropertiesBackedManagedObject(Resource moFile) {
        
        Properties props = PropsMockSnmpMOLoaderImpl.loadProperties(moFile);
        
        m_vars = new TreeMap<OID, Object>();
        System.err.println(new Date()+": Begin adding properties to tree Map");

        for(Entry<Object, Object> e : props.entrySet()) {
            String key = (String)e.getKey();
            Object value = e.getValue();
            m_vars.put(new OID(key), value);
        }
        
        System.err.println(new Date()+": End adding properties to tree Map");
        
        m_scope = new DefaultMOScope(
                    m_vars.firstKey(),
                    true,
                    m_vars.lastKey(),
                    true
                );
    }
    
    public void cleanup(SubRequest request) {
        throw new UnsupportedOperationException("this object read only");
    }

    public void commit(SubRequest request) {
        throw new UnsupportedOperationException("this object read only");
    }

    public OID find(MOScope range) {
        if (!m_scope.isOverlapping(range)) {
            return null;<commit_msg>remove debug statements<commit_after>package org.opennms.mock.snmp;

import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Map.Entry;

import org.snmp4j.agent.DefaultMOScope;
import org.snmp4j.agent.MOScope;
import org.snmp4j.agent.ManagedObject;
import org.snmp4j.agent.request.SubRequest;
import org.snmp4j.smi.Null;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.Variable;
import org.snmp4j.smi.VariableBinding;
import org.springframework.core.io.Resource;

public class PropertiesBackedManagedObject implements ManagedObject, MockSnmpMOLoader, Updatable {
    
    private TreeMap<OID, Object> m_vars = null;
    
    private MOScope m_scope = null;
    
    public PropertiesBackedManagedObject(Resource moFile) {
        
        Properties props = PropsMockSnmpMOLoaderImpl.loadProperties(moFile);
        
        m_vars = new TreeMap<OID, Object>();

        for(Entry<Object, Object> e : props.entrySet()) {
            String key = (String)e.getKey();
            Object value = e.getValue();
            m_vars.put(new OID(key), value);
        }
        
        
        m_scope = new DefaultMOScope(
                    m_vars.firstKey(),
                    true,
                    m_vars.lastKey(),
                    true
                );
    }
    
    public void cleanup(SubRequest request) {
        throw new UnsupportedOperationException("this object read only");
    }

    public void commit(SubRequest request) {
        throw new UnsupportedOperationException("this object read only");
    }

    public OID find(MOScope range) {
        if (!m_scope.isOverlapping(range)) {
            return null;
{'fraction_non_alphanumeric': 0.09670563230605739, 'fraction_numerical': 0.004250797024442083, 'mean_word_length': 2.6517943743937926, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, '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': '5835774', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1133, 'n_words': 241}