<commit_before>package de.factoryfx.factory.log;

import java.util.*;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.*;
import de.factoryfx.factory.FactoryBase;

@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class)
public class FactoryLogEntry {
    public final Class<? extends FactoryBase<?,?>> factoryClass;
    public final String displayText;
    public final List<FactoryLogEntry> children;
    public final List<FactoryLogEntryEvent> events;
    public final long id;

    @JsonCreator
    public FactoryLogEntry(@JsonProperty("factoryClass") Class<? extends FactoryBase<?, ?>> factoryClass, @JsonProperty("displayText") String displayText, @JsonProperty("children") List<FactoryLogEntry> children, @JsonProperty("events") List<FactoryLogEntryEvent> items, @JsonProperty("id")long id) {
        this.factoryClass = factoryClass;
        this.displayText = displayText;
        this.children = children;
        this.events = items;
        this.id = id;
    }
    private static Random random =new Random();
    @SuppressWarnings("unchecked")
    public FactoryLogEntry(FactoryBase<?,?> factoryBase) {
        this((Class<? extends FactoryBase<?, ?>>) factoryBase.getClass(), factoryBase.internal().hasCustomDisplayText()?factoryBase.internal().getDisplayText():"",new ArrayList<>(),new ArrayList<>(), Math.abs(random.nextLong()));
    }

    public boolean hasEvents(){
        for (FactoryLogEntry child: children){
            if (child.hasEvents()){
                return true;
            }
        }
        return !events.isEmpty();
    }

    @JsonIgnore
    public Set<FactoryLogEntry> getListDeep(){
        final HashSet<FactoryLogEntry> items = new HashSet<>();
        collectToDeep(items);
        return items;
    }

    private void collectToDeep(Set<FactoryLogEntry> items){
        if (items.add(this)){
            children.forEach(child -> child.collectToDeep(items));
        }
    }

    public String getFactoryDescription(){
        String result = factoryClass.getSimpleName();
        if (!displayText.isEmpty()) {<commit_msg>start log improved<commit_after>package de.factoryfx.factory.log;

import java.util.*;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.*;
import de.factoryfx.factory.FactoryBase;

@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class)
public class FactoryLogEntry {
    public final Class<? extends FactoryBase<?,?>> factoryClass;
    public final String displayText;
    public final List<FactoryLogEntry> children;
    public final List<FactoryLogEntryEvent> events;
    public final long id;

    @JsonCreator
    public FactoryLogEntry(@JsonProperty("factoryClass") Class<? extends FactoryBase<?, ?>> factoryClass, @JsonProperty("displayText") String displayText, @JsonProperty("children") List<FactoryLogEntry> children, @JsonProperty("events") List<FactoryLogEntryEvent> items, @JsonProperty("id")long id) {
        this.factoryClass = factoryClass;
        this.displayText = displayText;
        this.children = children;
        this.events = items;
        this.id = id;
    }
    private static Random random =new Random();
    @SuppressWarnings("unchecked")
    public FactoryLogEntry(FactoryBase<?,?> factoryBase) {
        this((Class<? extends FactoryBase<?, ?>>) factoryBase.getClass(), factoryBase.internal().hasCustomDisplayText()?factoryBase.internal().getDisplayText():"",new ArrayList<>(),new ArrayList<>(), Math.abs(random.nextLong()));
    }

    public boolean hasEvents(){
        for (FactoryLogEntry child: children){
            if (child.hasEvents()){
                return true;
            }
        }
        return !events.isEmpty();
    }

    @JsonIgnore
    public Set<FactoryLogEntry> getListDeep(){
        final HashSet<FactoryLogEntry> items = new HashSet<>();
        collectToDeep(items);
        return items;
    }

    private void collectToDeep(Set<FactoryLogEntry> items){
        if (items.add(this)){
            children.forEach(child -> child.collectToDeep(items));
        }
    }

    @JsonIgnore
    public String getFactoryDescription(){
        String result = factoryClass.getSimpleName();
        if (!displayText.isEmpty()) {
{'fraction_non_alphanumeric': 0.12067748764996472, 'fraction_numerical': 0.0, 'mean_word_length': 3.6725274725274724, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3633683', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1101, 'n_words': 251}