<commit_before>import * as mongoose from "mongoose";
import { RepositoryDocument } from "./documents/RepositoryDocument";
import { IEntity } from "./IEntity";
import { AbstractEntity } from "./AbstractEntity";

/**
 * IRepositoryEntity interface. Describes custom functionality for
 * Rpository mongoose documents.
 * @author <NAME> <<EMAIL>>
 */
export interface IRepositoryEntity extends IEntity<RepositoryDocument> {
    /** Gets Repository GitHub id. */
    id: number;
    /** Gets Repository name. */
    name: string;
}

/**
 * Repository Entity.
 * @author <NAME> <<EMAIL>>
 */
export class RepositoryEntity extends AbstractEntity<RepositoryDocument> implements IRepositoryEntity {

    /** @inheritdoc */
    public get id(): number {
        return this.document.id;
    }

    /** @inheritdoc */
    public get name(): string {
        return this.document.name;
    }

    /**
     * Transforms raw data to IRepositoryEntity.
     * @param data  raw data.
     * @returns a repository entity.
     */
    public static toEntity(data: any): IRepositoryEntity {
        if (data) {
            let entity: IRepositoryEntity = new RepositoryEntity(<RepositoryDocument>data);
            return entity;
        }
        return null;
    }

    /**
     * Transforms raw data to IRepositoryEntity array.
     * @param data  raw data.
     * @returns an array of repository entities.
     */
    public static toEntityArray(data: any[]): IRepositoryEntity[] {
        let entityArray: IRepositoryEntity[] = [];
        if (data.length > 0) {
            data.map((jsonObject) => {
                let entity: IRepositoryEntity = this.toEntity(jsonObject);
                entityArray.push(entity);<commit_msg>updated repository entity comments #72.<commit_after>import * as mongoose from "mongoose";
import { RepositoryDocument } from "./documents/RepositoryDocument";
import { IEntity } from "./IEntity";
import { AbstractEntity } from "./AbstractEntity";

/**
 * IRepositoryEntity interface. Describes custom functionality for
 * Rpository mongoose documents.
 * 
 * @author <NAME> <<EMAIL>[at]<EMAIL>>
 */
export interface IRepositoryEntity extends IEntity<RepositoryDocument> {
    
    /** Gets Repository GitHub id. */
    id: number;

    /** Gets Repository name. */
    name: string;

}

/**
 * Repository Entity.
 * 
 * @author <NAME> <<EMAIL>[at]<EMAIL>>
 */
export class RepositoryEntity extends AbstractEntity<RepositoryDocument> implements IRepositoryEntity {

    /**
     * Gets Repository GitHub id.
     * 
     * @returns repository id.
     */
    public get id(): number {
        return this.document.id;
    }

    /**
     * Gets Repository name.
     * 
     * @returns repository name.
     */
    public get name(): string {
        return this.document.name;
    }

    /**
     * Transforms raw data to IRepositoryEntity.
     * 
     * @param data  raw data.
     * @returns a repository entity.
     */
    public static toEntity(data: any): IRepositoryEntity {
        if (data) {
            let entity: IRepositoryEntity = new RepositoryEntity(<RepositoryDocument>data);
            return entity;
        }
        return null;
    }

    /**
     * Transforms raw data to IRepositoryEntity array.
     * 
     * @param data  raw data.
     * @returns an array of repository entities.
     */
    public static toEntityArray(data: any[]): IRepositoryEntity[] {
        let entityArray: IRepositoryEntity[] = [];
        if (data.length > 0) {
            data.map((jsonObject) => {
                let entity: IRepositoryEntity = this.toEntity(jsonObject);
                entityArray.push(entity);
{'fraction_non_alphanumeric': 0.11373626373626373, 'fraction_numerical': 0.001098901098901099, 'mean_word_length': 2.5349514563106794, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, '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': '4135484', 'n_tokens_mistral': 985, 'n_tokens_neox': 961, 'n_words': 280}