using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace DataStructures
{
    public class Node<T>
    {
        public Node()
            : this(-1, default(T), PointF.Empty) { }

        public Node(int id)
            : this(id, default(T), PointF.Empty) { }

        public Node(T data)
            : this(-1, data, PointF.Empty) { }

        public Node(int id, PointF location)
            : this(id, default(T), location) { }

        public Node(int id, T data)
            : this(id, data, PointF.Empty) { }

        public Node(int id, T data, PointF location)
        {
            ID = id;
            Data = data;
            Location = location;
            Selected = false;
        }

        public int ID { get; set; }

        public T Data { get; set; }

        public PointF Location { get; set; }

        public bool Selected { get; set; }

        public override string ToString()
        {
            return String.Format("{1} ", ID, Data);
        }

        public float DistanceTo(Node<T> target)
        {
            return (float)Math.Sqrt((Location.X - target.Location.X) * (Location.X - target.Location.X) + (Location.Y - target.Location.Y) * (Location.Y - target.Location.Y));
        }
    }
}
