<commit_before>import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
import {TreeComponent} from 'angular2-tree-component';
import {AbstractProcess} from '../../../../model/sml/AbstractProcess';
import {getDisplayName} from '../../../../decorators/DisplayName';
import {TreeNodeComponent} from './TreeNodeComponent';

const emailRegex = new RegExp('^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$');
const urlRegex = new RegExp('^(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?');

@Component({
    selector: 'object-tree',
    template: require('./ObjectTreeComponent.html'),
    styles: [require('../../styles/object-tree-component.scss')],
    directives: [TreeComponent]
})
export class ObjectTreeComponent implements OnChanges {
    @Input()
    model: AbstractProcess;

    private options = {
        treeNodeTemplate: TreeNodeComponent
    };

    private nodes: Array<INode> = [];

    private rebuildTree() {
        this.nodes = this.getNodes(this.model);
    }

    ngOnChanges(changes: SimpleChanges) {
        this.rebuildTree();
    }

    private onToggle(event) {
        event.node.data.isExpanded = event.isExpanded;
    }

    private getNodes(object: any): Array<INode> {
        var nodes: Array<INode>;
        var type = typeof object;

        if (object === null || type === 'undefined' || type === 'function') {
            return null;
        }

        if (object instanceof Array) {
            nodes = this.getNodesForArray(object);<commit_msg>Rebuild tree on hover<commit_after>import {Component, Input, OnChanges, SimpleChanges, HostListener} from '@angular/core';
import {TreeComponent} from 'angular2-tree-component';
import {AbstractProcess} from '../../../../model/sml/AbstractProcess';
import {getDisplayName} from '../../../../decorators/DisplayName';
import {TreeNodeComponent} from './TreeNodeComponent';

const emailRegex = new RegExp('^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$');
const urlRegex = new RegExp('^(https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?');

@Component({
    selector: 'object-tree',
    template: require('./ObjectTreeComponent.html'),
    styles: [require('../../styles/object-tree-component.scss')],
    directives: [TreeComponent]
})
export class ObjectTreeComponent implements OnChanges {
    @Input()
    model: AbstractProcess;

    private options = {
        treeNodeTemplate: TreeNodeComponent
    };

    private nodes: Array<INode> = [];

    @HostListener('mouseenter')
    private onMouseEnter(event) {
        this.rebuildTree(this.model, this.model);
    }

    private rebuildTree(previousModel, currentModel) {
        this.nodes = this.getNodes(currentModel);
    }

    ngOnChanges(changes: SimpleChanges) {
        var modelChange = changes['model'];

        if (modelChange) {
            this.rebuildTree(modelChange.previousValue, modelChange.currentValue);
        }
    }

    private onToggle(event) {
        event.node.data.isExpanded = event.isExpanded;
    }

    private getNodes(object: any): Array<INode> {
        var nodes: Array<INode>;
        var type = typeof object;

        if (object === null || type === 'undefined' || type === 'function') {
            return null;
        }

        if (object instanceof Array) {
            nodes = this.getNodesForArray(object);
{'fraction_non_alphanumeric': 0.18214607754733994, 'fraction_numerical': 0.004207995190862639, 'mean_word_length': 2.961904761904762, 'pattern_counts': {'":': 0, '<': 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': '3835188', 'n_tokens_mistral': 1008, 'n_tokens_neox': 981, 'n_words': 199}