<commit_before>import {Component, Input} from "@angular/core";
import {QueryContainerInterface} from "../../shared/model/queries/interfaces/query-container.interface";
import {QueryContainer} from "../../shared/model/queries/query-container.model";
import {ImageQueryTerm} from "../../shared/model/queries/image-query-term.model";
import {AudioQueryTerm} from "../../shared/model/queries/audio-query-term.model";
import {QueryTermType, QueryTermInterface} from "../../shared/model/queries/interfaces/query-term.interface";

@Component({
    selector: 'query-container',
    template:`
        <md-card style="margin:10px;padding:10px;">
            <md-card-header>
                 <button (click)="toggle('IMAGE')" class="icon-button">
                    <md-icon [attr.class]="containerModel.hasTerm('IMAGE') ? 'material-icons md-primary-250' : 'material-icons md-primary-100'">panorama</md-icon>
                 </button>
                 <div class="spacer-small"></div>
                 <button (click)="toggle('AUDIO')" class="icon-button">
                    <md-icon [attr.class]="containerModel.hasTerm('AUDIO') ? 'material-icons md-primary-250' : 'material-icons md-primary-100'">audiotrack</md-icon>
                 </button>
                 <div class="spacer-flex"></div>
                 <button class="icon-button" (click)="handleRemove()"><md-icon>close</md-icon></button>
            </md-card-header>
            <md-card-content>
                <qt-image *ngIf="containerModel.hasTerm('IMAGE')" [imageTerm]="containerModel.getTerm('IMAGE')"></qt-image>
                <qt-audio *ngIf="containerModel.hasTerm('AUDIO')" [audioTerm]="containerModel.getTerm('AUDIO')"></qt-audio>
            </md-card-content>
        </md-card>
    `
})

export class QueryContainerComponent {
    /* The QueryContainer this QueryContainerComponent is associated to. */
    @Input() containerModel : QueryContainerInterface;

    /* A reference to the lists of QueryContainers (to enable remvoing the container). */
    @Input() inList : QueryContainerInterface[];

    /**
     *
     */
    private handleRemove() {
        let index = this.inList.indexOf(this.containerModel);
        if (index > -1) {
            this.inList.splice(index, 1)
        }
    }

    /**
     *
     * @param type
     */
    private toggle(type: QueryTermType) {
         if (this.containerModel.hasTerm(type)) {
             this.containerModel.removeTerm(type);
         } else {
             this.containerModel.addTerm(type);
         }
    }
}<commit_msg>Integrated 3D QbE capabilities into UI.<commit_after>import {Component, Input} from "@angular/core";
import {QueryContainerInterface} from "../../shared/model/queries/interfaces/query-container.interface";
import {QueryContainer} from "../../shared/model/queries/query-container.model";
import {ImageQueryTerm} from "../../shared/model/queries/image-query-term.model";
import {AudioQueryTerm} from "../../shared/model/queries/audio-query-term.model";
import {QueryTermType, QueryTermInterface} from "../../shared/model/queries/interfaces/query-term.interface";

@Component({
    selector: 'query-container',
    template:`
        <md-card style="margin:10px;padding:10px;">
            <md-card-header>
                 <button (click)="toggle('IMAGE')" class="icon-button">
                    <md-icon [attr.class]="containerModel.hasTerm('IMAGE') ? 'material-icons md-primary-250' : 'material-icons md-primary-100'">panorama</md-icon>
                 </button>
                 <div class="spacer-small"></div>
                 <button (click)="toggle('AUDIO')" class="icon-button">
                    <md-icon [attr.class]="containerModel.hasTerm('AUDIO') ? 'material-icons md-primary-250' : 'material-icons md-primary-100'">audiotrack</md-icon>
                 </button>
                 <div class="spacer-small"></div>
                 <button (click)="toggle('MODEL')" class="icon-button">
                    <md-icon [attr.class]="containerModel.hasTerm('MODEL') ? 'material-icons md-primary-250' : 'material-icons md-primary-100'">3d_rotation</md-icon>
                 </button>
                 <div class="spacer-flex"></div>
                 <button class="icon-button" (click)="handleRemove()"><md-icon>close</md-icon></button>
            </md-card-header>
            <md-card-content>
                <qt-image *ngIf="containerModel.hasTerm('IMAGE')" [imageTerm]="containerModel.getTerm('IMAGE')"></qt-image>
                <qt-audio *ngIf="containerModel.hasTerm('AUDIO')" [audioTerm]="containerModel.getTerm('AUDIO')"></qt-audio>
                <qt-m3d *ngIf="containerModel.hasTerm('MODEL')" [m3dTerm]="containerModel.getTerm('MODEL')"></qt-m3d>
            </md-card-content>
        </md-card>
    `
})

export class QueryContainerComponent {
    /* The QueryContainer this QueryContainerComponent is associated to. */
    @Input() containerModel : QueryContainerInterface;

    /* A reference to the lists of QueryContainers (to enable remvoing the container). */
    @Input() inList : QueryContainerInterface[];

    /**
     *
     */
    private handleRemove() {
        let index = this.inList.indexOf(this.containerModel);
        if (index > -1) {
            this.inList.splice(index, 1)
        }
    }

    /**
     *
     * @param type
     */
    private toggle(type: QueryTermType) {
         if (this.containerModel.hasTerm(type)) {
             this.containerModel.removeTerm(type);
         } else {
             this.containerModel.addTerm(type);
         }
    }
}
{'fraction_non_alphanumeric': 0.16495956873315365, 'fraction_numerical': 0.008445642407906559, 'mean_word_length': 2.556549520766773, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 65, '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': '2646742', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1595, 'n_words': 256}