<commit_before>﻿using System;
using MP = MappingFramework;
using UML=TSF.UmlToolingFramework.UML;
using TSF.UmlToolingFramework.Wrappers.EA;
using System.Collections.Generic;
using System.Linq;

namespace EAAddinFramework.Mapping
{
	/// <summary>
	/// Description of Mapping.
	/// </summary>
	public abstract class Mapping:MP.Mapping
	{
		internal MappingEnd _source;
		internal MappingEnd _target;
		internal MappingLogic _mappingLogic;
		public Mapping(MappingEnd sourceEnd, MappingEnd targetEnd)
		{
			_source = sourceEnd;
			_target = targetEnd;
		}
		public Mapping(MappingEnd sourceEnd, MappingEnd targetEnd, MappingLogic logic):this(sourceEnd,targetEnd)
		{
			_mappingLogic = logic;
		}
		public Mapping(Element sourceElement, Element targetElement,string basepath)
			:this(new MappingEnd(sourceElement,basepath),new MappingEnd(targetElement)){}
		public Mapping(Element sourceElement, Element targetElement,string basepath, ElementWrapper targetRoot)
			:this(new MappingEnd(sourceElement,basepath),new MappingEnd(targetElement,targetRoot)){}
		public Mapping(Element sourceElement, Element targetElement,string basepath,string targetBasePath)
			:this(new MappingEnd(sourceElement,basepath),new MappingEnd(targetElement,targetBasePath)){}
		
		/// <summary>
		/// strips the given path from the element name at the end.
		/// So if the path ends with .ElementName then that part is stripped off
		/// </summary>
		/// <param name="endElement">the element at the end of the mapping</param>
		/// <param name="path">the path string</param>
		/// <returns>the stripped path</returns>
		protected string stripPathFromElementName(Element endElement, string path)
		{
			if (path.EndsWith( "." + endElement.name, StringComparison.InvariantCulture))
			{
				return path.Substring(0,path.Length - (endElement.name.Length +1));
			}
			//else return unchanged
			return path;
		}
		#region Mapping implementation

		public MP.MappingEnd source {
			get {
				return _source;
			}
			set {
				_source = (MappingEnd)value;
			}
		}

		public MP.MappingEnd target {
			get {
				return _target;
			}
			set {
				_target = (MappingEnd)value;
			}
		}

		public abstract void save();
		public abstract MP.MappingLogic mappingLogic {get;set;}


		#endregion
	}
}<commit_msg>added Mapping::ToString<commit_after>﻿using System;
using MP = MappingFramework;
using UML=TSF.UmlToolingFramework.UML;
using TSF.UmlToolingFramework.Wrappers.EA;
using System.Collections.Generic;
using System.Linq;

namespace EAAddinFramework.Mapping
{
	/// <summary>
	/// Description of Mapping.
	/// </summary>
	public abstract class Mapping:MP.Mapping
	{
		internal MappingEnd _source;
		internal MappingEnd _target;
		internal MappingLogic _mappingLogic;
		public Mapping(MappingEnd sourceEnd, MappingEnd targetEnd)
		{
			_source = sourceEnd;
			_target = targetEnd;
		}
		public Mapping(MappingEnd sourceEnd, MappingEnd targetEnd, MappingLogic logic):this(sourceEnd,targetEnd)
		{
			_mappingLogic = logic;
		}
		public Mapping(Element sourceElement, Element targetElement,string basepath)
			:this(new MappingEnd(sourceElement,basepath),new MappingEnd(targetElement)){}
		public Mapping(Element sourceElement, Element targetElement,string basepath, ElementWrapper targetRoot)
			:this(new MappingEnd(sourceElement,basepath),new MappingEnd(targetElement,targetRoot)){}
		public Mapping(Element sourceElement, Element targetElement,string basepath,string targetBasePath)
			:this(new MappingEnd(sourceElement,basepath),new MappingEnd(targetElement,targetBasePath)){}
		
		/// <summary>
		/// strips the given path from the element name at the end.
		/// So if the path ends with .ElementName then that part is stripped off
		/// </summary>
		/// <param name="endElement">the element at the end of the mapping</param>
		/// <param name="path">the path string</param>
		/// <returns>the stripped path</returns>
		protected string stripPathFromElementName(Element endElement, string path)
		{
			if (path.EndsWith( "." + endElement.name, StringComparison.InvariantCulture))
			{
				return path.Substring(0,path.Length - (endElement.name.Length +1));
			}
			//else return unchanged
			return path;
		}
		#region Mapping implementation

		public MP.MappingEnd source {
			get {
				return _source;
			}
			set {
				_source = (MappingEnd)value;
			}
		}

		public MP.MappingEnd target {
			get {
				return _target;
			}
			set {
				_target = (MappingEnd)value;
			}
		}

		public abstract void save();
		public abstract MP.MappingLogic mappingLogic {get;set;}

    public override string ToString() {
      return this.source.fullMappingPath + " - " + this.target.fullMappingPath;
    }

		#endregion
	}
}
{'fraction_non_alphanumeric': 0.10247651579846286, 'fraction_numerical': 0.0008539709649871904, 'mean_word_length': 4.246360582306831, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5610257', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1407, 'n_words': 354}