package org.texttechnologylab.project.gruppe_05_1.domain.nlp;

import java.util.Objects;
import java.util.StringJoiner;

public class Pos {
    String  posValue;       // ART, NN...
    String  coarseValue;    // PROPN...
    int     begin;
    int     end;
    String  coveredText;

    // Am Dateiende stehen beispiele für mögliche Werte


    public Pos() {
    }

    public Pos(String posValue, String coarseValue, int begin, int end, String coveredText) {
        this.posValue = posValue;
        this.coarseValue = coarseValue;
        this.begin = begin;
        this.end = end;
        this.coveredText = coveredText;
    }

    public String getPosValue() {
        return posValue;
    }

    public void setPosValue(String posValue) {
        this.posValue = posValue;
    }

    public String getCoarseValue() {
        return coarseValue;
    }

    public void setCoarseValue(String coarseValue) {
        this.coarseValue = coarseValue;
    }

    public int getBegin() {
        return begin;
    }

    public void setBegin(int begin) {
        this.begin = begin;
    }

    public int getEnd() {
        return end;
    }

    public void setEnd(int end) {
        this.end = end;
    }

    public String getCoveredText() {
        return coveredText;
    }

    public void setCoveredText(String coveredText) {
        this.coveredText = coveredText;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Pos pos)) return false;
        return begin == pos.begin && end == pos.end && Objects.equals(posValue, pos.posValue) && Objects.equals(coarseValue, pos.coarseValue) && Objects.equals(coveredText, pos.coveredText);
    }

    @Override
    public int hashCode() {
        return Objects.hash(posValue, coarseValue, begin, end, coveredText);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", Pos.class.getSimpleName() + "[", "]")
                .add("posValue='" + posValue + "'")
                .add("coarseValue='" + coarseValue + "'")
                .add("begin=" + begin)
                .add("end=" + end)
                .add("coveredText='" + coveredText + "'")
                .toString();
    }

    /* Beispielswerte:

    MyPos{posValue='ART', coarseValue='DET', begin=0, end=3, coveredText='Die'},
    MyPos{posValue='NN', coarseValue='NOUN', begin=4, end=8, coveredText='Idee'},
    MyPos{posValue='APPR', coarseValue='ADP', begin=9, end=12, coveredText='von'},
    MyPos{posValue='NE', coarseValue='PROPN', begin=13, end=16, coveredText='Joe'},
    MyPos{posValue='NN', coarseValue='PROPN', begin=17, end=22, coveredText='Biden'},
    MyPos{posValue='APPR', coarseValue='ADP', begin=23, end=26, coveredText='aus'},
    MyPos{posValue='NE', coarseValue='PROPN', begin=27, end=36, coveredText='Bucharest'},
    MyPos{posValue='$,', coarseValue='PUNCT', begin=36, end=37, coveredText=','},
    MyPos{posValue='NE', coarseValue='PROPN', begin=38, end=46, coveredText='Rumänien'},
    MyPos{posValue='$,', coarseValue='PUNCT', begin=46, end=47, coveredText=','},
    MyPos{posValue='VVFIN', coarseValue='VERB', begin=48, end=53, coveredText='finde'},
    MyPos{posValue='PPER', coarseValue='PRON', begin=54, end=57, coveredText='ich'},
    MyPos{posValue='ADJD', coarseValue='ADV', begin=58, end=61, coveredText='gut'},
    MyPos{posValue='$.', coarseValue='PUNCT', begin=61, end=62, coveredText='.'},
    MyPos{posValue='ART', coarseValue='DET', begin=63, end=66, coveredText='Den'},
    MyPos{posValue='NN', coarseValue='NOUN', begin=67, end=76, coveredText='Vorschlag'},
    MyPos{posValue='APPR', coarseValue='ADP', begin=77, end=80, coveredText='von'},
    MyPos{posValue='NE', coarseValue='PROPN', begin=81, end=87, coveredText='Donald'},
    MyPos{posValue='NE', coarseValue='PROPN', begin=88, end=93, coveredText='Trump'},
    MyPos{posValue='APPR', coarseValue='ADP', begin=94, end=97, coveredText='aus'},
    MyPos{posValue='NE', coarseValue='PROPN', begin=98, end=108, coveredText='Frankreich'},
    MyPos{posValue='VVFIN', coarseValue='VERB', begin=109, end=114, coveredText='finde'},
    MyPos{posValue='PPER', coarseValue='PRON', begin=115, end=118, coveredText='ich'},
    MyPos{posValue='ADV', coarseValue='ADV', begin=119, end=126, coveredText='weniger'},
    MyPos{posValue='ADJD', coarseValue='ADV', begin=127, end=130, coveredText='gut'},
    MyPos{posValue='$.', coarseValue='PUNCT', begin=130, end=131, coveredText='.'}],
     */
}
