예제 #1
0
        private static BigInteger CreateHashInternal(IModelElement modelElement, Model containingModel)
        {
            var hashCode = new BigInteger(GetDeterministicHashCode(modelElement.GetClass().AbsoluteUri.AbsoluteUri));

            ApplyClass(modelElement, containingModel, modelElement.GetClass(), new HashSet <IClass>(), ref hashCode);
            return(hashCode);
        }
예제 #2
0
        private IModelChange CreateListInsertion(IModelElement element, Uri absoluteUri, string propertyName, int startingIndex, IList newItems, List <Uri> newItemsUris)
        {
            var reference = GetAllReferences(element.GetClass()).First(r => r.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase));

            if (reference.IsContainment)
            {
                return(CreateListInsertionContainment(element, absoluteUri, propertyName, startingIndex, newItems));
            }
            else
            {
                return(CreateListInsertionReference(element, absoluteUri, propertyName, startingIndex, newItemsUris));
            }
        }
예제 #3
0
        private IModelChange CreatePropertyChange(IModelElement element, Uri absoluteUri, string propertyName, object newValue, Uri newValueUri)
        {
            var propertyType = element.GetType().GetProperty(propertyName).PropertyType;

            if (!propertyType.GetInterfaces().Contains(typeof(IModelElement))) // only model elements can be references
            {
                return(CreatePropertyChangeAttribute(propertyType, absoluteUri, propertyName, newValue));
            }
            else if (GetAllReferences(element.GetClass()).Any(a => a.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase))) // a reference
            {
                return(CreatePropertyChangeReference(propertyType, absoluteUri, propertyName, newValueUri));
            }
            else // a recently created model element
            {
                return(CreatePropertyChangeAttribute(propertyType, absoluteUri, propertyName, newValue));
            }
        }