/// <summary> /// decorates with polyfacingness if it's not already there /// </summary> /// <typeparam name="T"></typeparam> /// <param name="condition"></param> /// <param name="rootFace"></param> /// <returns></returns> public static PolyfacingConditionDecoration <Tface> Polyfacing <Tface>(this ICondition decorated, Polyface rootFace = null) where Tface : ICondition { Condition.Requires(decorated).IsNotNull(); PolyfacingConditionDecoration <Tface> rv = null; /*Summary: * if we spec a root we are setting that root * if the condition is already polyfacing we use that otherwise build new one * if no root is spec'd we create new polyface */ //if we have polyface in our chain, we return that if (decorated.HasDecoration <PolyfacingConditionDecoration <Tface> >()) { rv = decorated.As <PolyfacingConditionDecoration <Tface> >(); } else { rv = new PolyfacingConditionDecoration <Tface>(decorated, rootFace); } return(rv); }