Esempio n. 1
0
        private void RemoveRelation(SimRelation relation)
        {
            var r = _relations.FirstOrDefault(a => a.Equals(relation)) ?? throw new ArgumentException($"{relation} could not be found on the current graph");

            // Change the state to removed
            r.ChangeState = ChangeState.Removed;
        }
Esempio n. 2
0
        private void UpdateRelation(SimRelation relation)
        {
            // Remove old version
            var removed = _relations.Remove(relation) ? true : throw new ArgumentException($"{relation} could not be found on the current graph");

            // Add new version and change the state to Modified
            relation.ChangeState = ChangeState.Modified;
            _relations.Add(relation);
        }
Esempio n. 3
0
        private void AddRelation(SimRelation relation)
        {
            // Check if relation is already available on the graph
            if (_relations.Contains(relation))
            {
                return;
            }

            // Add nodes
            AddNode(relation.Origin);
            AddNode(relation.Target);

            // Subscribe to this node
            _client?.ChangeTracker.SubscribeToChangeStateEvent(relation);

            // Change state of the relation to Added and add to graph
            relation.ChangeState = ChangeState.Added;
            _relations.Add(relation);
        }