public override string ToPresentation(CharacteristicSet set) { var values = set. GetValues(). Where(c => !c.IsDefault). Select(c => c.GetDisplayId() + EqualsSeparator + CharacteristicPresenter.ToPresentation(c)); return(string.Join(Separator, values)); }
public ICharacteristic <T> Mutate(CharacteristicSet set) { var generic = set.Get(Id); if (generic != null) { if (generic.IsDefault) { return(Create(Id)); } var value = generic.ObjectValue; if (value is T) { return(Mutate((T)value)); } throw new InvalidOperationException($"CharacteristicSet contains an element with id = {Id} but the value isn't an instance of {typeof(T).Name}"); } return(this); }
public static bool AllAreDefaults(this CharacteristicSet set) => set.GetValues().All(c => c.IsDefault);
public override string ToPresentation(CharacteristicSet set) { var values = set.GetValues().Where(c => !c.IsDefault).Select(c => CharacteristicPresenter.ToPresentation(c)); return("new CharacteristicSet(" + string.Join(Separator, values) + ")"); }
public abstract string ToPresentation(CharacteristicSet set);