using System;
using System.Collections.Generic;

namespace Graphs
{
	public class GenericLabel : Label
	{
		public GenericLabel ()
		{
			attributesGXL = new List<AttributeGXL>();
		}

		public List<AttributeGXL> attributesGXL;

		public List<AttributeGXL> AttributesGXL 
        {
			get {return attributesGXL;}
			set {attributesGXL = value;}
		}

		#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;
		}

		public override double dissimilarity (Label label)
		{
			if (label is GenericLabel) {
			
				bool isequal = true;

				foreach (AttributeGXL att1 in this.AttributesGXL) {
					isequal = false;
					foreach (AttributeGXL att2 in ((GenericLabel)label).AttributesGXL) {
						if (att1.Compare (att2) == true) {
							isequal = true;
						}
					}
					if (isequal == false) {
						return 1;
					}

				}
				return 0;
			}
			return 1;

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

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


		/*public override GenericLabel copy ()
		{
			GenericLabel GL = new GenericLabel();
			foreach(AttributeGXL att in this.AttributesGXL){
				AttributeGXL attcopy =new AttributeGXL();
				attcopy.Name = att.Name;
				attcopy.Type = att.Type;
				attcopy.Value=att.Value;
				GL.AttributesGXL.Add(attcopy);
			}
			GL.Id = this.Id;

			return GL;
		}*/
		#endregion


	}
}

