public ADLElement this[string key]
 {
     get
     {
         return(Childs.FirstOrDefault(row => row.Name == key));
     }
 }
Exemplo n.º 2
0
        public MachineBuilder UseMachine()
        {
            var existing = Childs.FirstOrDefault(x => x is MachineBuilder);

            if (null != existing)
            {
                return((MachineBuilder)existing);
            }

            var builder = new MachineBuilder(this);

            Childs.Add(builder);
            return(builder);
        }
 public void Merge(OdataSelectExpand tree)
 {
     if (tree.MemberPath == MemberPath)
     {
         SelectMembers = SelectMembers.Concat(tree.SelectMembers).Distinct().ToList();
         foreach (var child in tree.Childs)
         {
             var selfChild = Childs.FirstOrDefault(x => x.MemberPath == child.MemberPath);
             if (selfChild != null)
             {
                 selfChild.Merge(child);
             }
             else
             {
                 selfChild.Childs.Add(child);
             }
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the path with the specified <paramref name="childPath"/>.
        /// Moves down the tree structure and returns the desired <see cref="Tag"/> instance.
        /// </summary>
        /// <param name="childPath">The path where the child can be found.</param>
        /// <returns>A <see cref="Tag"/> instance or null.</returns>
        public Tag GetChildTagUnderPath(string childPath)
        {
            if (childPath == null)
            {
                return(null);
            }
            if (childPath.Length == 0)
            {
                return(this);
            }
            string[] pathSegments = childPath.Split('.');
            Tag      nextChild    = Childs.FirstOrDefault(c => string.Equals(c.NestedName, pathSegments.First()));

            if (nextChild == null)
            {
                return(null);
            }
            return(nextChild.GetChildTagUnderPath(string.Join(".", pathSegments.Tail())));
        }
Exemplo n.º 5
0
        private HostBuilder FindOrDefineHostBuilder()
        {
            var existing = Childs.FirstOrDefault(x => x is HostBuilder);

            if (null != existing)
            {
                return((HostBuilder)existing);
            }

            var host = new HostBuilder(this);

            Childs.Add(host);

            var hosts = new Hosts().Discover();

            if (hosts.Any(x => x.IsNative))
            {
                return(host.UseNative());
            }

            var h = hosts.FirstOrDefault();

            if (null == h)
            {
                throw new FluentDockerException("Cannot build a container when no host is defined");
            }

            var config = h.GetMachineConfiguration();

            if (null == config)
            {
                throw new FluentDockerException("Cannot build container since no machine configuration and no native is found");
            }

            return(host.UseMachine()
                   .CpuCount(config.CpuCount)
                   .Memory(config.MemorySizeMb)
                   .StorageSize(config.StorageSizeMb)
                   .UseDriver(config.DriverName)
                   .WithName(config.Name).Host());
        }
Exemplo n.º 6
0
 public Node this[string key]
 {
     get
     {
         var res = Childs.FirstOrDefault(item => item.Name == key);
         return(res);
     }
     set
     {
         var node = Childs.FirstOrDefault(item => item.Name == key);
         if (value == node)
         {
             return;
         }
         if (node != null)
         {
             Childs.Remove(node);
         }
         Childs.Add(value);
     }
 }
Exemplo n.º 7
0
 public IDOMElement GetFirstChild(Func <IDOMElement, bool> filter)
 {
     return(Childs.FirstOrDefault(filter));
 }
Exemplo n.º 8
0
 //-----------------------------------------------
 public bool ContainsChild(I2iObjetGraphique child)
 {
     return(Childs.FirstOrDefault(c => c == child) != null);
 }
Exemplo n.º 9
0
 private bool ContainsVisibleColumns(Dictionary <string, BaseColumn> columnsDic)
 {
     return(Childs.FirstOrDefault(
                r => (r.Visible && !r.IsEmptyColumn() && !columnsDic[r.ColumnName].IsCrossColumn) ||
                r.ContainsVisibleColumns(columnsDic)) != null);
 }