<commit_before>
import {Injectable} from '@angular/core';
import * as _ from 'lodash';

import {FactoryService} from '../../factory-list/service/factory.service';
import {Factory} from '../../factory-list/model/factory';
import {AppDetail} from '../../factory-app-detail/model/app-detail';
import {AppDependency} from '../../factory-app-detail/model/app-dependency';

@Injectable()
export class AppListService {

    mapFactoryApp = {};
    appTypeList = ['Desktop', 'Web', 'Mobile', 'Wearable'];

    constructor(_factoryService: FactoryService) {
      let factories =  _factoryService.getFactories();
      let chance = new Chance();
      let numApplications: number = chance.integer({min: 5, max: 50});
      let ref = this;
      let appId : number;

      const alphabet = 'ABCDEFGHIJKLMINOPRSTUVWXYZ';

      appId = 1;
      _.forEach(factories, function(factory) {
          var appArray = [];
          _.forEach (_.range(0, numApplications, 1), function(i) {
              let app_name = chance.sentence({words: 3})
              let typeIdx = chance.integer({min: 0, max: ref.appTypeList.length - 1});
              let type = ref.appTypeList[typeIdx];
              let dependencies : Array<AppDependency> = new Array<AppDependency>();
              // generate random data of application dependencies
              let numDependencies = chance.integer({min: 3, max: 50});
              let versionConfig = {min:0, max:15};
              _.forEach(_.range(0, numDependencies, 1), function(i) {
                 let dName = chance.string({pool: alphabet});
                 let dMajor = chance.integer(versionConfig);
                 let dMinor = chance.integer(versionConfig);
                 let dRev = chance.integer(versionConfig);
                 let dVersion = dMajor + '.' + dMinor + '.' + dRev;
                 let dType: string  = '';
                 if (_.isEqual(type, 'Desktop')) {
                   dType = 'DLL';
                 } else if (_.isEqual(type, 'Web')) {
                   dType = 'Jar';
                 } else if (_.isEqual(type, 'Mobile')) {
                   dType = 'Jar';
                 } else if (_.isEqual(type, 'Wearable')) {
                   dType = 'Unknown';
                 }
                 dependencies.push(new AppDependency(dName, dType, dVersion));
              });
              let major = chance.integer(versionConfig);<commit_msg>random number of applications for each factory<commit_after>
import {Injectable} from '@angular/core';
import * as _ from 'lodash';

import {FactoryService} from '../../factory-list/service/factory.service';
import {Factory} from '../../factory-list/model/factory';
import {AppDetail} from '../../factory-app-detail/model/app-detail';
import {AppDependency} from '../../factory-app-detail/model/app-dependency';

@Injectable()
export class AppListService {

    mapFactoryApp = {};
    appTypeList = ['Desktop', 'Web', 'Mobile', 'Wearable'];

    constructor(_factoryService: FactoryService) {
      let factories =  _factoryService.getFactories();
      let chance = new Chance();
      let ref = this;
      let appId : number;

      const alphabet = 'ABCDEFGHIJKLMINOPRSTUVWXYZ';

      appId = 1;
      _.forEach(factories, function(factory) {
          let appArray = [];
          let numApplications: number = chance.integer({min: 5, max: 50});
          _.forEach (_.range(0, numApplications, 1), function(i) {
              let app_name = chance.sentence({words: 3})
              let typeIdx = chance.integer({min: 0, max: ref.appTypeList.length - 1});
              let type = ref.appTypeList[typeIdx];
              let dependencies : Array<AppDependency> = new Array<AppDependency>();
              // generate random data of application dependencies
              let numDependencies = chance.integer({min: 3, max: 50});
              let versionConfig = {min:0, max:15};
              _.forEach(_.range(0, numDependencies, 1), function(i) {
                 let dName = chance.string({pool: alphabet});
                 let dMajor = chance.integer(versionConfig);
                 let dMinor = chance.integer(versionConfig);
                 let dRev = chance.integer(versionConfig);
                 let dVersion = dMajor + '.' + dMinor + '.' + dRev;
                 let dType: string  = '';
                 if (_.isEqual(type, 'Desktop')) {
                   dType = 'DLL';
                 } else if (_.isEqual(type, 'Web')) {
                   dType = 'Jar';
                 } else if (_.isEqual(type, 'Mobile')) {
                   dType = 'Jar';
                 } else if (_.isEqual(type, 'Wearable')) {
                   dType = 'Unknown';
                 }
                 dependencies.push(new AppDependency(dName, dType, dVersion));
              });
              let major = chance.integer(versionConfig);
{'fraction_non_alphanumeric': 0.13569808207877912, 'fraction_numerical': 0.00701175500103114, 'mean_word_length': 2.036944270507201, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6336750', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1286, 'n_words': 327}