<commit_before>﻿using System;
using System.Xml.Serialization;

namespace eZet.EveLib.Modules.Models.Character {
    [Serializable]
    [XmlRoot("result", IsNullable = false)]
    public class AssetList {
        [XmlElement("rowset")]
        public EveOnlineRowCollection<Item> Items { get; set; }

        [Serializable]
        [XmlRoot("row")]
        public class Item {
            [XmlAttribute("itemID")]
            public long ItemId { get; set; }

            [XmlAttribute("locationID")]
            public long LocationId { get; set; }<commit_msg>Added a simple Flatten function to AssetList.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;

namespace eZet.EveLib.Modules.Models.Character {
    [Serializable]
    [XmlRoot("result", IsNullable = false)]
    public class AssetList {


        [XmlElement("rowset")]
        public EveOnlineRowCollection<Item> Items { get; set; }

        public ICollection<Item> Flatten() {
            return flatten(Items);
        }

        private ICollection<Item> flatten(ICollection<Item> items) {
            var list = new List<Item>();
            var stack = new Stack<Item>(items);
            while (stack.Count > 0) {
                var current = stack.Pop();
                list.Add(current);
                foreach (var child in current.Items)
                    stack.Push(child);
            }
            return list;
        }
        
        [Serializable]
        [XmlRoot("row")]
        public class Item {
            [XmlAttribute("itemID")]
            public long ItemId { get; set; }

            [XmlAttribute("locationID")]
            public long LocationId { get; set; }
{'fraction_non_alphanumeric': 0.1091753774680604, 'fraction_numerical': 0.0005807200929152149, 'mean_word_length': 2.1101083032490973, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 11, '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': '2131720', 'n_tokens_mistral': 468, 'n_tokens_neox': 454, 'n_words': 114}