<commit_before>package org.opennms.features.topology.app.internal;

import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;

import org.opennms.features.topology.api.BoundingBox;
import org.opennms.features.topology.api.MapViewManager;
import org.opennms.features.topology.api.MapViewManagerListener;
import org.opennms.features.topology.api.Point;

public class DefaultMapViewManager implements MapViewManager{
    
    private BoundingBox m_mapBounds  = new BoundingBox(0, 0, 100, 100);
    private int m_viewPortWidth = 100;
    private int m_viewPortHeight = 100;
    private double m_scale = 0.0;
    private Point m_center = new Point(0,0);
    private Set<MapViewManagerListener> m_listeners = new CopyOnWriteArraySet<MapViewManagerListener>();
    
    @Override
    public void addListener(MapViewManagerListener listener) {
        m_listeners.add(listener);
    }
    
    @Override
    public void removeListener(MapViewManagerListener listener) {
        m_listeners.remove(listener);
    }
    
    private void fireUpdate() {
        for(MapViewManagerListener listener : m_listeners) {
            listener.boundingBoxChanged(this);
        }
    }
    @Override
    public void setMapBounds(BoundingBox boundingBox) {
        if (!m_mapBounds.equals(boundingBox)) {
            m_mapBounds = boundingBox;<commit_msg>SPC-795 fix<commit_after>package org.opennms.features.topology.app.internal;

import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;

import org.opennms.features.topology.api.BoundingBox;
import org.opennms.features.topology.api.MapViewManager;
import org.opennms.features.topology.api.MapViewManagerListener;
import org.opennms.features.topology.api.Point;

public class DefaultMapViewManager implements MapViewManager{
    
    private BoundingBox m_mapBounds  = new BoundingBox(0, 0, 100, 100);
    private int m_viewPortWidth = 100;
    private int m_viewPortHeight = 100;
    private double m_scale = 0.0;
    private Point m_center = new Point(0,0);
    private Set<MapViewManagerListener> m_listeners = new CopyOnWriteArraySet<MapViewManagerListener>();
    
    @Override
    public void addListener(MapViewManagerListener listener) {
        m_listeners.add(listener);
    }
    
    @Override
    public void removeListener(MapViewManagerListener listener) {
        m_listeners.remove(listener);
    }
    
    private void fireUpdate() {
        for(MapViewManagerListener listener : m_listeners) {
            listener.boundingBoxChanged(this);
        }
    }
    @Override
    public void setMapBounds(BoundingBox boundingBox) {
        if (!m_mapBounds.equals(boundingBox)) {
            if(boundingBox.getHeight() < m_viewPortHeight/2){
                //Don't allow the height to be less than half the viewport height
                m_mapBounds = new BoundingBox(boundingBox.getCenter(), boundingBox.getWidth(), m_viewPortHeight/2);
            } else {
                m_mapBounds = boundingBox;
            }

{'fraction_non_alphanumeric': 0.0841683366733467, 'fraction_numerical': 0.013694054776219105, 'mean_word_length': 3.470149253731343, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '2411567', 'n_tokens_mistral': 922, 'n_tokens_neox': 877, 'n_words': 174}