public GroupableFluentModelImpl(GroupableFluentModelInterface mInterface)
 {
     this.Interface = mInterface;
 }
Ejemplo n.º 2
0
        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));
                }
            });
        }