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

namespace Matching
{
    public class EdgeLabelDistanceEditionAC : Label
    {
        /// <summary>
        /// List of the GXL attributes of the GraphComponent associated with this label
        /// </summary>
        public List<AttributeGXL> attributesGXL;
        public double EdgeCost;
        /// <summary>
        /// Constructor. Initialize the list of GXL attributes
        /// </summary>
        public EdgeLabelDistanceEditionAC()
        {
            attributesGXL = new List<AttributeGXL>();
            EdgeCost = 1;
        }

        /// <summary>
        /// Getter and Setter of the GXL attributes list
        /// </summary>
        /// <param name="value">Set --> GXL attributes list</param>
        /// <returns>get --> GXL attributes list</returns>
        public List<AttributeGXL> AttributesGXL
        {
            get
            {
                return attributesGXL;
            }
            set
            {
                attributesGXL = value;
            }
        }

        /// <summary>
        /// Convert an attributes list to a string
        /// </summary>
        /// <returns> A string that contains the list of attributes</returns>
        #region implemented abstract members of Graphs.Label
        public override string toString()
        {
            string s = "" + Id + ";";
            foreach (AttributeGXL att in this.AttributesGXL)
            {
                s += att.Name + "=" + att.Value + ";";
            }
            return s;
        }

        /// <summary>
        /// Method to calculating the cost between two NodeLabelDistanceEditionAC
        /// </summary>
        /// <param name="label">LabelDistanceEditionto compare</param>
        public override double dissimilarity(Label label)
        {
            if (label is EdgeLabelDistanceEditionAC)
            {

                //la suppression
                if (label.Id == ConstantsAC.EPS_ID)
                {
                    return EdgeCost;
                }
               
                //l'insertion
                if (this.Id == ConstantsAC.EPS_ID)
                {
                    return EdgeCost;
                }
               
                //la substitution
                    return 0;
                
               
                

            }
            return 0;


        }

        public override List<AttributeGXL> toAttributes()
        {
            return this.AttributesGXL;
        }

        public override void fromAttributes(List<AttributeGXL> attributes)
        {
            this.AttributesGXL = attributes;
        }

        #endregion
    }
}
