/// <summary>
 /// Assigns the values of the metric parts using special values (e.g. number of components in the context)
 /// </summary>
 /// <param name="context">The structuring context including the constraint</param>
 internal void AssignSpecialMetricValues(GKOStructuringContext context)
 {
     foreach (var part in this.RelationParts)
     {
         if (part is MetricRelationPart)
         {
             MetricRelationPart asMetricPart = part as MetricRelationPart;
             if (asMetricPart.IsSpecialValue)
             {
                 asMetricPart.AssignFromSpecialValue(context);
             }
         }
     }
 }
        /// <summary>
        /// Assigns the right value according to the context. If no special value is assigned no action will be performed
        /// </summary>
        /// <param name="context">The structured component which is the context of the relation parts</param>
        public void AssignFromSpecialValue(GKOStructuringContext context)
        {
            switch ((SpecialMetricValue)value)
            {
            case SpecialMetricValue.ComponentsCount:
                value = context.Components.Count;
                break;

            case SpecialMetricValue.ComponentsCountPlusOne:
                value = context.Components.Count + 1;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
 /// <summary>
 /// Assigns the values of the metric parts using special values (e.g. number of components in the context)
 /// </summary>
 /// <param name="context">The structuring context including the constraint tree</param>
 internal void AssignSpecialMetricValues(GKOStructuringContext context)
 {
     if (!this.IsCombination)
     {
         // If the constraint tree holds constraints then assign their metric values
         foreach (var constraint in this.ConfigurationConstraints)
         {
             constraint.AssignSpecialMetricValues(context);
         }
     }
     else
     {
         // Else the constraint tree has branches and assign the metric special part for each of them
         foreach (var branch in this.ConstraintBranches)
         {
             branch.AssignSpecialMetricValues(context);
         }
     }
 }
 public QualitativeSolution GetQualitativeSolution(GKOStructuringContext structuredComponent, RelationFamily calculus)
 {
     return(QualitativeStructure.SingleOrDefault(x => x.StructuredComponent.Id == structuredComponent.Id && x.StructuringCalculus.Name == calculus.Name));
 }