Beispiel #1
0
 public DependencyNode(Project parent, File file, Project.CodeGroup group)
 {
     File      = file;
     DoCompile = group == Project.c || group == Project.cpp;
     Group     = group;
     Parents.Add(parent);
 }
            /// <summary>
            /// Updates the cost of the vertex using its existing cost plus the
            /// cost to traverse the specified edge. If the search is in simple
            /// path mode, only one path will be accrued.
            /// </summary>
            /// <param name="vertex">The vertex to update.</param>
            /// <param name="edge">The edge through which the vertex is reached.</param>
            /// <param name="cost">The current cost to reach the vertex from the source.</param>
            /// <param name="replace">True to indicate that any accrued edges are not to be cleared.
            /// False to indicate that the edge should be added to the previously accrued edges as they yield the same cost.</param>
            public void UpdateVertex(V vertex, E edge, IWeight cost, bool replace)
            {
                Costs.AddOrSet(vertex, cost);

                if (edge is null)
                {
                    return;
                }

                ISet <E> edges = Parents.GetOrDefault(vertex);

                if (edges is null)
                {
                    edges = new HashSet <E>();
                    Parents.Add(vertex, edges);
                }
                if (replace)
                {
                    edges.Clear();
                }
                if (MaxPaths == AllPaths || edges.Count < MaxPaths)
                {
                    edges.Add(edge);
                }
            }
Beispiel #3
0
        /// <summary>
        /// Merges changes from other RenameResult.
        /// </summary>
        /// <param name="projectItem">ProjectItem associated with CodeElements</param>
        /// <param name="result">Rename operation result.</param>
        public void MergeChanges(ProjectItem projectItem, IRenameResult result)
        {
            if (string.IsNullOrEmpty(result.OldName))
            {
                result.OldName = OldName;
            }

            if (result.Parents != null)
            {
                result.Parents.ForEach(parent => { if (!parents.Contains(parent))
                                                   {
                                                       Parents.Add(parent);
                                                   }
                                       });
            }

            if (result is MultiRenameResult)
            {
                foreach (KeyValuePair <ProjectItem, IRenameResult> item
                         in ((result as MultiRenameResult)).ChangedProjectElements)
                {
                    MergeChanges(item.Key, item.Value);
                }
            }
            else
            {
                if (!changedProjectElements.ContainsKey(projectItem))
                {
                    changedProjectElements.Add(projectItem, result);
                }
            }
        }
Beispiel #4
0
 public void AddParent(Person parent)
 {
     if (!Parents.Contains(parent))
     {
         Parents.Add(parent);
     }
 }
        // NOTE:
        // This region handles parent's Visibility to raise IsOffscreen UIA event.
        // The rule to do so is: IsOffscreen() depends on owner.Visibility and
        // "all its" parents.Visibility, for example, in:
        //
        // - C1
        // -- C2
        // --- C3 // owner
        //
        // If C1.Visibility is Collapsed then C3 IsOffscreen=true, even when
        // their C3.Visibility is Visible.

        private void CacheParents()
        {
            UIElement parent = VisualTreeHelper.GetParent(owner) as UIElement;

            if (cachedParent != parent)
            {
                cachedParent = parent;

                // Removing delegates in older parents
                if (parents != null)
                {
                    foreach (UIElement parentItem in parents)
                    {
                        parentItem.UIAVisibilityChanged -= Parent_UIAVisibilityChanged;
                    }
                    parents.Clear();
                }

                // Caching new parents and listening for their UIAVisibilityChanged
                if (parent != null)
                {
                    Parents.Add(parent);
                    parent.UIAVisibilityChanged += Parent_UIAVisibilityChanged;
                    do
                    {
                        parent = VisualTreeHelper.GetParent(parent) as UIElement;
                        if (parent != null)
                        {
                            parents.Add(parent);                              // At this time parents is not null
                            parent.UIAVisibilityChanged += Parent_UIAVisibilityChanged;
                        }
                    } while (parent != null);
                }
            }
        }
Beispiel #6
0
 private void AddParent(ReadFile readFile)
 {
     if (!Parents.Contains(readFile))
     {
         Parents.Add(readFile);
     }
 }
        public void AddParent(Parent parent)
        {
            bool allreadyExist = false;

            for (int i = 0; i < this.Parents.Count; i++)
            {
                if (this.Parents[i].Name == parent.Name && !string.IsNullOrEmpty(this.Parents[i].Name))
                {
                    this.Parents[i].DateOfBirth = parent.DateOfBirth;
                    allreadyExist = true;
                    break;
                }

                else if (this.Parents[i].DateOfBirth == parent.DateOfBirth && this.Parents[i].DateOfBirth != DateTime.MinValue)
                {
                    this.Parents[i].Name = parent.Name;
                    allreadyExist        = true;
                    break;
                }
            }

            if (!allreadyExist)
            {
                Parents.Add(parent);
            }
        }
        internal DocumentFeeMapping() : base()
        {
            Fields.Add("ImportoNetto", new FieldMapping {
                PropertyName = "Amount"
            });
            Fields.Add("IsPagamento", new FieldMapping {
                PropertyName = "IsFromPayment"
            });

            Parents.Add(
                "IdSpesa",
                new DataRelationMapping
            {
                ParentColumn = "Nome",
                PropertyName = "Name",
                RelationName = "FK_Spese_SpeseDocumenti",
            });

            Parents.Add(
                "IdCausaleIVA",
                new DataRelationMapping
            {
                ParentColumn  = "Codice",
                ChildProperty = "Code",
                PropertyName  = "Vat",
                ChildType     = typeof(Vat),
                RelationName  = "FK_CausaliIVA_SpeseDocumenti"
            });
        }
Beispiel #9
0
        protected void BuildParents()
        {
            var x = 0;

            string relPath;

            while (LocalEntries.TryGetValue("parent." + x, out relPath))
            {
                if (_root != null && !String.IsNullOrEmpty(_root.FullName) && !String.IsNullOrEmpty(relPath))
                {
                    var rootDir = Path.GetDirectoryName(_root.FullName);
                    if (!String.IsNullOrEmpty(rootDir))
                    {
                        var absPath = Path.GetFullPath(Path.Combine(rootDir, relPath));
                        var fi      = new FileInfo(absPath);
                        if (fi.Exists)
                        {
                            var parent = new FileDictionaryTree(fi);
                            Parents.Add(parent);
                        }
                    }
                }
                x++; // increment for the next parent
            }
        }
Beispiel #10
0
        public void AddParent(RevisionGraphRevision parent, out int maxScore)
        {
            // Generate a LaneColor used for rendering
            if (Parents.Any())
            {
                parent.LaneColor = parent.Score;
            }
            else
            {
                if (parent.LaneColor == -1)
                {
                    parent.LaneColor = LaneColor;
                }
            }

            if (IsRelative)
            {
                parent.MakeRelative();
            }

            Parents.Add(parent);
            parent.AddChild(this);

            maxScore = parent.EnsureScoreIsAbove(Score + 1);

            StartSegments.Add(new RevisionGraphSegment(parent, this));
        }
Beispiel #11
0
 /// <summary>
 /// This constructor creates a new instance with exact copies of the original's parents.
 /// But the constructed instance itself contains no initial properties or defaults.
 /// </summary>
 /// <param name="parents"></param>
 public FileDictionaryTree(IEnumerable <FileDictionaryTree> parents)
 {
     foreach (var parent in parents)
     {
         Parents.Add(new FileDictionaryTree(parent));
     }
 }
Beispiel #12
0
 public void AddParent(Guid i_gid)
 {
     if (!Parents.Contains(i_gid))
     {
         Parents.Add(i_gid);
     }
 }
        internal VatMapping()
        {
            Fields.Add("Id", new FieldMapping {
                PropertyName = "UniqueId"
            });
            Fields.Add("Nome", new FieldMapping {
                PropertyName = "Name"
            });
            Fields.Add("Codice", new FieldMapping {
                PropertyName = "Code"
            });
            Fields.Add("Aliquota", new FieldMapping {
                PropertyName = "Rate"
            });
            Fields.Add("Indeducibilità", new FieldMapping {
                PropertyName = "NonDeductible"
            });
            Fields.Add("IsIntracomunitaria", new FieldMapping {
                PropertyName = "IsIntraCommunity"
            });
            Fields.Add("IsSplitPayment", new FieldMapping {
                PropertyName = "IsSplitPayment"
            });

            Parents.Add(
                "Natura",
                new DataRelationMapping
            {
                PropertyName      = "NaturaPA",
                ParentColumn      = "Natura",
                ChildProperty     = "Code",
                UpstreamTransform = (key, row, obj) => PAHelpers.NaturaPA[(string)row[key]],
            });
        }
Beispiel #14
0
 public void AddPrent(Record parent)
 {
     if (!Parents.Any(r => r.Equals(parent)))
     {
         Parents.Add(parent);
     }
 }
        internal BillingAddressMapping()
        {
            Fields.Add("Id", new FieldMapping {
                PropertyName = "UniqueId"
            });
            Fields.Add("RagioneSociale1", new FieldMapping {
                PropertyName = "Name"
            });
            Fields.Add("Indirizzo", new FieldMapping {
                PropertyName = "Street"
            });
            Fields.Add("CodiceFiscale", new FieldMapping {
                PropertyName = "TaxIdentificationNumber"
            });
            Fields.Add("PartitaIVA", new VatIdNumberFieldMapping());
            Fields.Add("Località", new FieldMapping {
                PropertyName = "Town"
            });
            Fields.Add("CAP", new FieldMapping {
                PropertyName = "PostalCode"
            });
            Fields.Add("Provincia", new FieldMapping {
                PropertyName = "StateOrProvince"
            });

            Parents.Add(
                "IdNazione",
                new DataRelationMapping
            {
                PropertyName = "Country",
                ParentColumn = "Nome",
                RelationName = "FK_Nazioni_Anagrafiche",
            }
                );
        }
Beispiel #16
0
    public void UpdateData(string[] data)
    {
        switch (data[1])
        {
        case "company":
            Company = new Company(data[2], data[3], decimal.Parse(data[4]));
            break;

        case "pokemon":
            Pokemon pokemon = new Pokemon(data[2], data[3]);
            Pokemons.Add(pokemon);
            break;

        case "parents":
            Parent parent = new Parent(data[2], data[3]);
            Parents.Add(parent);
            break;

        case "children":
            Children children = new Children(data[2], data[3]);
            Childrens.Add(children);
            break;

        case "car":
            Car = new Car(data[2], int.Parse(data[3]));
            break;
        }
    }
Beispiel #17
0
        /// <summary>
        /// Add parent information.
        /// </summary>
        /// <param name="parentTaxonTreeNode">Parent taxon tree node.</param>
        /// <param name="parentTaxonRelation">Parent taxon tree relation.</param>
        public void AddParent(TaxonTreeNode parentTaxonTreeNode,
                              WebTaxonRelation parentTaxonRelation)
        {
            Int32 parentIndex;

            if (Parents.IsEmpty() ||
                Parents[Parents.Count - 1].SortOrder <= parentTaxonTreeNode.SortOrder)
            {
                // Insert at the end of the lists.
                if (Parents.IsNull())
                {
                    ParentRelations = new List <WebTaxonRelation>();
                    Parents         = new List <TaxonTreeNode>();
                }
                ParentRelations.Add(parentTaxonRelation);
                Parents.Add(parentTaxonTreeNode);
            }
            else
            {
                // Insert into the list.
                for (parentIndex = 0; parentIndex < Parents.Count; parentIndex++)
                {
                    if (parentTaxonTreeNode.SortOrder < Parents[parentIndex].SortOrder)
                    {
                        ParentRelations.Insert(parentIndex, parentTaxonRelation);
                        Parents.Insert(parentIndex, parentTaxonTreeNode);
                        break;
                    }
                }
            }
        }
Beispiel #18
0
 public void AddParent(ParentEntry entry)
 {
     if (Parents.ContainsKey(entry.Id))
     {
         throw new ObjectAlreadyExistsException("Object is already parented by this parent");
     }
     Parents.Add(entry.Id, entry);
 }
Beispiel #19
0
 /// <summary>
 /// This constructor creates a new instance with exact copies of the original's parents.
 /// But the constructed instance itself contains no initial properties or defaults.
 /// </summary>
 public FileDictionaryTree(string name, string fullName, IEnumerable <FileDictionaryTree> parents)
     : this(name, fullName)
 {
     foreach (var parent in parents)
     {
         Parents.Add(new FileDictionaryTree(parent));
     }
 }
Beispiel #20
0
 /// <summary>
 /// This copy constructory creates a new instance that is identical to another instance,
 /// but with its own identity. That is, this is a deep-clone of the original (including
 /// recursive cloning of parents).
 /// Note that the new instance has the same "Name" and "FullName", even though its object identity is unique.
 /// </summary>
 /// <param name="other">The instance to copy.</param>
 public FileDictionaryTree(FileDictionaryTree other)
     : this(other.Name, other.FullName, other.LocalEntries, other.LocalDefaults)
 {
     foreach (var parent in other.Parents)
     {
         Parents.Add(new FileDictionaryTree(parent));
     }
 }
Beispiel #21
0
 public void AddParent(EntitySetHandle parent)
 {
     if (Parents == null)
     {
         Parents = new List <EntitySetHandle>();
     }
     Parents.Add(parent);
 }
 public bool AddParent(DependentItem parent)
 {
     if (Parents.Add(parent))
     {
         Status = ItemStatus.Dependent;
         return(true);
     }
     return(false);
 }
Beispiel #23
0
 /// <summary>
 /// This constructor accepts enumerable initial properties, defaults, and parents with which to create a new instance.
 /// </summary>
 public FileDictionaryTree(string name, string fullName, IEnumerable <KeyValuePair <string, string> > initialProperties,
                           IEnumerable <KeyValuePair <string, string> > defaultProperties,
                           IEnumerable <FileDictionaryTree> parents)
     : this(name, fullName, initialProperties, defaultProperties)
 {
     foreach (var parent in parents)
     {
         Parents.Add(new FileDictionaryTree(parent));
     }
 }
Beispiel #24
0
 /// <summary>
 /// Adds a node to the current node so that it is linked to it.
 /// </summary>
 /// <param name="node">The node to link this one to</param>
 /// <returns>
 ///          True if successfully added to the list that this node links to.
 ///          False if this node already links to that node.
 /// </returns>
 public bool AddLinkedNode(Node node)
 {
     if (!LinksTo.Contains(node))
     {
         LinksTo.Add(node);
         Parents.Add(node);
         return(true);
     }
     return(false);
 }
Beispiel #25
0
 internal void AppendTo(Node parent)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent", "Argument(parent) is null!");
     }
     if (!Parents.Any(p => p.Id.Equals(parent.Id)))
     {
         Parents.Add(parent);
     }
 }
Beispiel #26
0
 //Create a parent with new children
 public void CreateParent()
 {
     Parents.Add(new Parent
     {
         Children = new List <Child>
         {
             new Child(),
             new Child(),
             new Child()
         }
     });
 }
Beispiel #27
0
        /// <summary>
        /// Processes the parent nodes. Since a parent may contain a parent, there may be
        /// a recursive call to self.
        /// </summary>
        /// <param name="reader">XmlTextReader</param>
        /// <param name="listParents">Parents</param>
        private void ProcessParent(XmlTextReader reader, Parents listParents)
        {
            string nodeName = string.Empty;
            bool   bParent  = true;
            Parent p        = new Parent();

            while (bParent && reader.Read())
            {
                nodeName = reader.Name;
                switch (reader.NodeType)
                {
                case XmlNodeType.Text:
                    p.ParentName = reader.Value.Trim();
                    break;

                case XmlNodeType.Element:
                    if (nodeName.Equals("IdentName"))
                    {
                        nodeName = ProcessIdentityNode(reader, p.ListPairedValues);
                    }
                    // Parent containing parent, may also occur after processing the identities
                    if (nodeName.Equals("Parent"))
                    {
                        ProcessParent(reader, p.ListParents);
                    }
                    else if (nodeName.Equals("EndParent"))
                    {
                        // this may occur after processing the identities. Will either be a new parent (above) or finished the parent
                        bParent = false;
                        listParents.Add(p);
                    }
                    break;

                case XmlNodeType.EndElement:
                    bParent = false;
                    listParents.Add(p);
                    break;
                }
            }
        }
        // Internal for testing
        internal async Task CreateParents(IEnumerable <IGrouping <string, ITestResult> > testResultsByParent, CancellationToken cancellationToken)
        {
            // Find the parents that don't exist
            string[] parentsToAdd = testResultsByParent
                                    .Select(x => x.Key)
                                    .Where(x => !Parents.ContainsKey(x))
                                    .ToArray();

            // Batch an add operation and record the new parent IDs
            DateTime startedDate = DateTime.UtcNow;

            if (parentsToAdd.Length > 0)
            {
                string request = "[ " + string.Join(", ", parentsToAdd.Select(x =>
                {
                    Dictionary <string, object> properties = new Dictionary <string, object>
                    {
                        { "testCaseTitle", x },
                        { "automatedTestName", x },
                        { "resultGroupType", "generic" },
                        { "outcome", "Passed" }, // Start with a passed outcome initially
                        { "state", "InProgress" },
                        { "startedDate", startedDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ") },
                        { "automatedTestType", "UnitTest" },
                        { "automatedTestTypeId", "13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" } // This is used in the sample response and also appears in web searches
                    };
                    if (!string.IsNullOrEmpty(Source))
                    {
                        properties.Add("automatedTestStorage", Source);
                    }
                    return(properties.ToJson());
                })) + " ]";
                string responseString = await _apiClient.SendAsync(HttpMethod.Post, TestRunEndpoint, "5.0", request, cancellationToken).ConfigureAwait(false);

                using (StringReader reader = new StringReader(responseString))
                {
                    JsonObject response = JsonDeserializer.Deserialize(reader) as JsonObject;
                    JsonArray  parents  = (JsonArray)response.Value("value");
                    if (parents.Length != parentsToAdd.Length)
                    {
                        throw new Exception("Unexpected number of parents added");
                    }
                    for (int c = 0; c < parents.Length; c++)
                    {
                        int id = ((JsonObject)parents[c]).ValueAsInt("id");
                        Parents.Add(parentsToAdd[c], new TestResultParent(id, startedDate));
                    }
                }
            }
        }
Beispiel #29
0
        public void Bind()
        {
            Parents.Clear();
            _words = Data.Access.GetSemanticTypes();
            foreach (SemanticType type in _words)
            {
                SemanticTypeViewModel parent = new SemanticTypeViewModel(type);

                AddNode(parent);
                if (parent.ParentId == 0)
                {
                    parent.IsExpanded = true;
                    Parents.Add(parent);
                }
            }
        }
        internal void AddParent(int hash)
        {
            if (hash == 0)
            {
                return;
            }

            if (!Parents.ContainsKey(hash))
            {
                Parents.Add(hash, 1);
            }
            else
            {
                Parents[hash]++;
            }
        }