package com.knecon.fforesight.service.layoutparser.processor.docstrum.model;

import lombok.Getter;

public class Neighbor {

    @Getter
    private final double distance;
    private Double angle;
    private final Character originCharacter;
    @Getter
    private final Character character;


    public Neighbor(Character neighbor, Character origin) {

        this.distance = neighbor.distance(origin);
        this.character = neighbor;
        this.originCharacter = origin;
    }


    public double getHorizontalDistance() {

        return character.horizontalDistance(originCharacter);
    }


    public double getVerticalDistance() {

        return character.verticalDistance(originCharacter);
    }


    public double getAngle() {

        if (angle != null) {
            return angle;
        }
        return this.character.angle(this.originCharacter);
    }

}