15 std::uint64_t
Update(IList<std::uint64_t>& restriction, IList<std::uint64_t>& substitution)
17 auto constants = _constants;
18 auto indexPartConstant = constants.IndexPart;
19 auto sourcePartConstant = constants.SourcePart;
20 auto targetPartConstant = constants.TargetPart;
21 auto nullConstant = constants.Null;
22 auto itselfConstant = constants.Itself;
23 auto existedLink = nullConstant;
24 auto updatedLink = restriction[indexPartConstant];
25 auto newSource = substitution[sourcePartConstant];
26 auto newTarget = substitution[targetPartConstant];
27 if (newSource != itselfConstant && newTarget != itselfConstant)
29 existedLink = storage.SearchOrDefault(newSource, newTarget);
31 if (existedLink == nullConstant)
33 auto before = storage.GetLink(updatedLink);
34 if (before[sourcePartConstant] != newSource || before[targetPartConstant] != newTarget)
36 storage.Update(updatedLink, newSource == itselfConstant ? updatedLink : newSource,
37 newTarget == itselfConstant ? updatedLink : newTarget);
43 return this->facade().TFacade::MergeAndDelete(updatedLink, existedLink);
48 void Delete(IList<std::uint64_t>& restriction)
50 auto linkIndex = restriction[_constants.IndexPart];
51 storage.EnforceResetValues(linkIndex);
52 this->facade().TFacade::DeleteAllUsages(linkIndex);
53 storage.Delete(linkIndex);