<commit_before>﻿using System;
using System.Text;
using Eplan.EplApi.DataModel;
using Eplan.EplApi.DataModel.E3D;

namespace Suplanus.Sepla.Objects
{
  /// <summary>
  /// LocationIdentifier
  /// </summary>
  [Serializable]
  public class LocationIdentifier : ILocationIdentifier
  {
    public bool Equals(LocationIdentifier obj)
    {
      if (ToString().Equals(obj.ToString()))
      {
        return true;
      }
      else
      {
        return false;
      }
      
    }

    public LocationIdentifier()
    {

    }

    public void SetFromPage(Page page)
    {
      this.FunctionAssignment = GetPageProperty(page.Properties.DESIGNATION_FULLFUNCTIONALASSIGNMENT);
      this.PlaceOfInstallation = GetPageProperty(page.Properties.DESIGNATION_FULLPLACEOFINSTALLATION);
      this.Plant = GetPageProperty(page.Properties.DESIGNATION_FULLPLANT);
      this.Location = GetPageProperty(page.Properties.DESIGNATION_FULLLOCATION);
      this.UserDefinied = GetPageProperty(page.Properties.DESIGNATION_FULLUSERDEFINED);
      this.DocType = GetPageProperty(page.Properties.DESIGNATION_FULLDOCTYPE);
    }

    public void SetFromFunction(Function function)
    {
      this.FunctionAssignment = GetPageProperty(function.Properties.DESIGNATION_FULLFUNCTIONALASSIGNMENT);
      this.PlaceOfInstallation = GetPageProperty(function.Properties.DESIGNATION_FULLPLACEOFINSTALLATION);
      this.Plant = GetPageProperty(function.Properties.DESIGNATION_FULLPLANT);
      this.Location = GetPageProperty(function.Properties.DESIGNATION_FULLLOCATION);
      this.UserDefinied = GetPageProperty(function.Properties.DESIGNATION_FULLUSERDEFINED);
      this.DocType = GetPageProperty(function.Properties.DESIGNATION_FULLDOCTYPE);
    }

    public void SetFromInstallationSpace(InstallationSpace installationSpace)
    {
      this.FunctionAssignment = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLFUNCTIONALASSIGNMENT);
      this.PlaceOfInstallation = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLPLACEOFINSTALLATION);
      this.Plant = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLPLANT);
      this.Location = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLLOCATION);
      this.UserDefinied = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLUSERDEFINED);
    }

    private string GetPageProperty(PropertyValue propertyValue)
    {
      if (!propertyValue.IsEmpty)
      {
        return propertyValue;
      }
      return null;
    }

    /// <summary>
    /// FunctionalAssignment ==
    /// </summary>
    public virtual string FunctionAssignment { get; set; }

    /// <summary><commit_msg>No doctype in EPLAN 2.9<commit_after>﻿using System;
using System.Text;
using Eplan.EplApi.DataModel;
using Eplan.EplApi.DataModel.E3D;
using Suplanus.Sepla.Application;

namespace Suplanus.Sepla.Objects
{
  /// <summary>
  /// LocationIdentifier
  /// </summary>
  [Serializable]
  public class LocationIdentifier : ILocationIdentifier
  {
    public bool Equals(LocationIdentifier obj)
    {
      if (ToString().Equals(obj.ToString()))
      {
        return true;
      }
      else
      {
        return false;
      }
      
    }

    public LocationIdentifier()
    {

    }

    public void SetFromPage(Page page)
    {
      this.FunctionAssignment = GetPageProperty(page.Properties.DESIGNATION_FULLFUNCTIONALASSIGNMENT);
      this.PlaceOfInstallation = GetPageProperty(page.Properties.DESIGNATION_FULLPLACEOFINSTALLATION);
      this.Plant = GetPageProperty(page.Properties.DESIGNATION_FULLPLANT);
      this.Location = GetPageProperty(page.Properties.DESIGNATION_FULLLOCATION);
      this.UserDefinied = GetPageProperty(page.Properties.DESIGNATION_FULLUSERDEFINED);
      this.DocType = GetPageProperty(page.Properties.DESIGNATION_FULLDOCTYPE);
    }

    public void SetFromFunction(Function function)
    {
      this.FunctionAssignment = GetPageProperty(function.Properties.DESIGNATION_FULLFUNCTIONALASSIGNMENT);
      this.PlaceOfInstallation = GetPageProperty(function.Properties.DESIGNATION_FULLPLACEOFINSTALLATION);
      this.Plant = GetPageProperty(function.Properties.DESIGNATION_FULLPLANT);
      this.Location = GetPageProperty(function.Properties.DESIGNATION_FULLLOCATION);
      this.UserDefinied = GetPageProperty(function.Properties.DESIGNATION_FULLUSERDEFINED);
      if (EplanApplicationInfo.GetActiveEplanVersion()>=290)
      {
        this.DocType = GetPageProperty(function.Properties[1520]); // DESIGNATION_FULLDOCTYPE
      }
    }

    public void SetFromInstallationSpace(InstallationSpace installationSpace)
    {
      this.FunctionAssignment = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLFUNCTIONALASSIGNMENT);
      this.PlaceOfInstallation = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLPLACEOFINSTALLATION);
      this.Plant = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLPLANT);
      this.Location = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLLOCATION);
      this.UserDefinied = GetPageProperty(installationSpace.Properties.DESIGNATION_FULLUSERDEFINED);
    }

    private string GetPageProperty(PropertyValue propertyValue)
    {
      if (!propertyValue.IsEmpty)
      {
        return propertyValue;
      }
      return null;
    }

    /// <summary>
    /// FunctionalAssignment ==
    /// </summary>
    public virtual string FunctionAssignment { get; set; }

    /// <summary>
{'fraction_non_alphanumeric': 0.08601756954612005, 'fraction_numerical': 0.002013177159590044, 'mean_word_length': 3.9323104693140793, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, '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': '4253829', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1521, 'n_words': 202}