private void SpecializeFluentModels() { HashSet <string> seenModels = new HashSet <string>(); // Promotes the general fluent models to top-level-groupable vs top-level-non-groupable nested child vs other. // // Specialize the GROUPABLEMODEL // this.GroupableFluentModels = this.Select(kv => kv.Value) .SelectMany(fluentMethodGropList => fluentMethodGropList) .Where(group => group.Type == MethodGroupType.GroupableTopLevel) .Select(group => new GroupableFluentModelInterface(group.StandardFluentModel)) .Distinct(CreatableUpdatableModel.EqualityComparer <GroupableFluentModelInterface>()); this.GroupableFluentModels.ForEach(m => seenModels.Add(m.JavaInterfaceName)); // Specialize the NESTEDFLUENTMODEL // this.NestedFluentModels = this.Select(kv => kv.Value) .SelectMany(fluentMethodGropList => fluentMethodGropList) .Where(group => group.Type == MethodGroupType.Nested) .Select(group => new NestedFluentModelInterface(group.StandardFluentModel)) .Distinct(CreatableUpdatableModel.EqualityComparer <NestedFluentModelInterface>()); this.NestedFluentModels.ForEach(m => seenModels.Add(m.JavaInterfaceName)); // Specialize the TOP-LEVEL NONGROUPABLEMODEL // this.NonGroupableTopLevelFluentModels = this.Select(kv => kv.Value) .SelectMany(fluentMethodGropList => fluentMethodGropList) .Where(group => group.Type == MethodGroupType.NonGroupableTopLevel) .Select(group => new NonGroupableTopLevelFluentModelInterface(group.StandardFluentModel)) .Distinct(CreatableUpdatableModel.EqualityComparer <NonGroupableTopLevelFluentModelInterface>()); NonGroupableTopLevelFluentModels.ForEach(m => seenModels.Add(m.JavaInterfaceName)); // Specialize wrappable READONLYMODEL // this.ReadonlyFluentModels = this.Select(kv => kv.Value) .SelectMany(fluentMethodGropList => fluentMethodGropList) .SelectMany(group => group.OtherMethods.OtherFluentModels) .OfType <WrappableFluentModel>() .Distinct(WrappableFluentModel.EqualityComparer()) .Where(fluentModel => !seenModels.Contains(fluentModel.JavaInterfaceName)) .Select(fluentModel => new ReadOnlyFluentModelInterface(fluentModel, this, this.ManagerName)); }
private void SpecializeFluentModels() { HashSet <string> topLevelAndNestedModelNames = new HashSet <string>(); // Promotes the general fluent models to top-level-groupable vs top-level-non-groupable nested child vs other. // // Specialize the GROUPABLEMODEL // this.GroupableFluentModels = this.Select(kv => kv.Value) .SelectMany(fmg => fmg) .Where(fmg => fmg.StandardFluentModel != null) .Where(fmg => fmg.IsGroupableTopLevel) .Select(fmg => new GroupableFluentModelInterface(fmg.StandardFluentModel, fmg)) .Distinct(GroupableFluentModelInterface.EqualityComparer()); this.GroupableFluentModels.ForEach(m => topLevelAndNestedModelNames.Add(m.JavaInterfaceName)); // Specialize the NESTEDFLUENTMODEL // this.NestedFluentModels = this.Select(kv => kv.Value) .SelectMany(fmg => fmg) .Where(fmg => fmg.StandardFluentModel != null) .Where(fmg => fmg.IsNested) .Select(fmg => new NestedFluentModelInterface(fmg.StandardFluentModel, fmg)) .Distinct(NestedFluentModelInterface.EqualityComparer()); this.NestedFluentModels.ForEach(m => topLevelAndNestedModelNames.Add(m.JavaInterfaceName)); // Specialize the TOP-LEVEL NONGROUPABLEMODEL // this.NonGroupableTopLevelFluentModels = this.Select(kv => kv.Value) .SelectMany(fmg => fmg) .Where(fmg => fmg.StandardFluentModel != null) .Where(fmg => fmg.IsNonGroupableTopLevel) .Select(fmg => new NonGroupableTopLevelFluentModelInterface(fmg.StandardFluentModel, fmg)) .Distinct(NonGroupableTopLevelFluentModelInterface.EqualityComparer()); NonGroupableTopLevelFluentModels.ForEach(m => topLevelAndNestedModelNames.Add(m.JavaInterfaceName)); // Specialize the READONLYMODEL // this.ReadonlyFluentModels = this.Select(kv => kv.Value) .SelectMany(fmg => fmg) .SelectMany(fmg => fmg.OtherMethods.OtherFluentModels) .Where(m => !(m is PrimtiveFluentModel)) .Distinct(FluentModel.EqualityComparer()) .Where(fluentModel => !topLevelAndNestedModelNames.Contains(fluentModel.JavaInterfaceName)) .Select(fluentModel => new ReadOnlyFluentModelInterface(fluentModel, this.ManagerTypeName)); // Not groupable or nested method group // this.ActionOrChildAccessorOnlyMethodGroups = new Dictionary <string, ActionOrChildAccessorOnlyMethodGroupImpl>(); this.Select(kv => kv.Value) .SelectMany(fmg => fmg) .Where(fmg => fmg.StandardFluentModel == null) .ForEach(fmg => { if (!ActionOrChildAccessorOnlyMethodGroups.ContainsKey(fmg.JavaInterfaceName)) { ActionOrChildAccessorOnlyMethodGroups.Add(fmg.JavaInterfaceName, new ActionOrChildAccessorOnlyMethodGroupImpl(fmg)); } }); }