package com.jongsoft.harvester.entity;

import org.neo4j.ogm.annotation.*;

@RelationshipEntity(type = "WeightedRelation")
public class WeightedRelation <SOURCE extends Entity, TARGET extends Entity> {
    @GraphId    private Long id;
    @EndNode    private TARGET relatedWith;
    @StartNode  private SOURCE entity;
    @Property   private double weight;

    public WeightedRelation() {
        this.weight = 1;
    }
    
    public WeightedRelation(SOURCE entity, TARGET relatedWith) {
        this();
        this.entity = entity;
        this.relatedWith = relatedWith;
    }

    public SOURCE getEntity() {
        return entity;
    }

    public TARGET getRelatedWith() {
        return relatedWith;
    }

    public double getWeight() {
        return weight;
    }

    public void setEntity(SOURCE entity) {
        this.entity = entity;
    }

    public void setRelatedWith(TARGET relatedWith) {
        this.relatedWith = relatedWith;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

}
