Пример #1
0
    public bool VisualizeNewInherit(Statement statement)
    {
        string subjectKey   = statement.subjectPredicate._subject;
        string predicateKey = statement.subjectPredicate._predicate;

        string statementKey = GetInheritanceString(statement.subjectPredicate);

        if (!(conceptTable.ContainsKey(subjectKey) && conceptTable.ContainsKey(predicateKey)))
        {
            return(false);
        }

        if (inheritTable.ContainsKey(statementKey))
        {
            return(true);
        }

        Concept subject   = conceptTable[subjectKey];
        Concept predicate = conceptTable[predicateKey];

        GameObject  newInheritanceGO = Instantiate(inheritancePrefab);
        Inheritance newInheritance   = newInheritanceGO.GetComponent <Inheritance>();

        newInheritance.Init(statement.truthValue, subject, predicate);

        if (newInheritance.ConnectsCompoundTerm() && _areCompoundTermsHidden)
        {
            newInheritanceGO.SetActive(false);
        }

        inheritTable.Add(statementKey, newInheritance);

        Debug.Log("MADE INHERIT " + statementKey);
        return(true);
    }
Пример #2
0
        protected override void RequestLoad(DesignService service, DesignBuffer buffer)
        {
            var document = new DilxDocument();

            document.Read(buffer.LoadData());

            Ancestors ancestors;
            IHost     host;
            XDocument ancestor = null;

            if (document.Ancestors.Count >= 1)
            {
                ancestors = document.Ancestors;
                ancestor  = MergeAncestors(ancestors);
                var merge   = XDocument.Load(new StringReader(document.Content));
                var current = new XDocument();
                current.Add(new XElement(ancestor.Root));
                Inheritance.Merge(current, merge);
                host = HostFromDocumentData(current, GetDocumentExpression(buffer));
            }
            else
            {
                host      = HostFromDocumentData(document.Content, GetDocumentExpression(buffer));
                ancestors = null;
            }
            SetDesignHost(host, true);
            UpdateReadOnly(ancestor);
            _ancestors = ancestors;
        }
Пример #3
0
        public Inheritance GetInheritance(PermissionsGetQuery options)
        {
            var inheritance = new Inheritance();

            var spwebUrl = EnsureUrl(options.Url, options.ListId);

            try
            {
                using (var clientContext = new SPContext(spwebUrl, credentials.Get(spwebUrl)))
                {
                    List splist = clientContext.Web.Lists.GetById(options.ListId);
                    var  splistItemCollection = splist.GetItems(options.Id.HasValue ?
                                                                CAMLQueryBuilder.GetItem(options.Id.Value, new string[] { }) :
                                                                CAMLQueryBuilder.GetItem(options.ContentId, new string[] { }));

                    var lazyListItems = clientContext.LoadQuery(splistItemCollection.Include(item => item.HasUniqueRoleAssignments, item => item.Id));
                    clientContext.ExecuteQuery();

                    var splistItem = lazyListItems.First();

                    inheritance.Enabled = !splistItem.HasUniqueRoleAssignments;
                }
            }
            catch (Exception ex)
            {
                string itemId  = options.Id.HasValue ? options.Id.Value.ToString(CultureInfo.InvariantCulture) : options.ContentId.ToString();
                string message = string.Format("An exception of type {0} occurred in the SPPermissionsService.GetInheritance() method for ListId: {1} ItemId: {2}. The exception message is: {3}", ex.GetType(), options.ListId, itemId, ex.Message);
                SPLog.RoleOperationUnavailable(ex, message);

                throw new SPInternalException(message, ex);
            }
            return(inheritance);
        }
Пример #4
0
        /// <summary>
        /// Validates the inheritance by checking the type.
        /// </summary>
        /// <param name="inheritance"></param>
        private void ValidateInheritance(Inheritance inheritance)
        {
            // validate type
            var type = this.ValidateType(inheritance.Name, inheritance.Custom);

            inheritance.Type = type;
        }
 private void AcceptedSingleInheritance(Inheritance inheritance)
 {
     this.accept(new List <Inheritance>()
     {
         inheritance
     });
 }
Пример #6
0
        public bool IsInherited(SPList list, SPListItem listItem)
        {
            var inheritance = new Inheritance();

            Validate(inheritance.Errors, list, listItem);
            if (!inheritance.Errors.Any())
            {
                var permissionsGetOptions = new PermissionsGetOptions(list.Id, listItem.ContentId)
                {
                    Url = list.SPWebUrl
                };
                try
                {
                    inheritance = ClientApi.Permissions.GetInheritance(permissionsGetOptions);
                }
                catch (SPInternalException ex)
                {
                    inheritance.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointPermissionsExtension.Translations.ListItemNotFound)));
                }
                catch (Exception ex)
                {
                    string message = string.Format("An exception of type {0} occurred in the WidgetApi.V1.SharePointPermissions.Get() method for ContentId: {1} ListId: {2}. The exception message is: {3}", ex.GetType(), listItem.ContentId, list.Id, ex.Message);
                    SPLog.UnKnownError(ex, message);
                    inheritance.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointPermissionsExtension.Translations.UnknownError)));
                }
            }
            return(inheritance.Enabled);
        }
Пример #7
0
        internal override void Export(string table)
        {
            var vals = new List <object>
            {
                Name.DBExport(),
                Hf.DBExport(),
                LeaderType.DBExport(LeaderTypes),
                Race.DBExport(),
                Birth.DBExport(true),
                Birth.DBExport(false),
                Death.DBExport(true),
                Death.DBExport(false),
                ReignBegan.DBExport(true),
                Inheritance.DBExport(InheritanceTypes),
                InheritedFromSource.ToString(),
                InheritedFrom.DBExport(),
                Civilization.DBExport(),
                Site.DBExport(),
                Worship == null ? DBNull.Value : Worship.Name.DBExport(),
                WorshipPercent,
                Spouse.DBExport()
            };

            Database.ExportWorldItem(table, vals);
        }
        private static ModelElement CreateModelElementForEFObjectType(EFObject obj, Partition partition)
        {
            ModelElement modelElement = null;
            var t = obj.GetType();
            if (t == typeof(ConceptualEntityModel))
            {
                modelElement = new EntityDesignerViewModel(partition);
            }
            else if (t == typeof(ConceptualEntityType))
            {
                modelElement = new EntityType(partition);
            }
            else if (t == typeof(ConceptualProperty))
            {
                modelElement = new ScalarProperty(partition);
            }
            else if (t == typeof(ComplexConceptualProperty))
            {
                modelElement = new ComplexProperty(partition);
            }
            else if (t == typeof(Association))
            {
                modelElement = new ViewModel.Association(partition);
            }
            else if (t == typeof(EntityTypeBaseType))
            {
                modelElement = new Inheritance(partition);
            }
            else if (t == typeof(NavigationProperty))
            {
                modelElement = new ViewModel.NavigationProperty(partition);
            }

            return modelElement;
        }
        // returns a list containing this inheritance plus all other inheritances having this one as an ancestor
        private List <Inheritance> FindDescendants(Inheritance parent)
        {
            List <Inheritance>    results   = new List <Inheritance>();
            HashSet <Inheritance> resultSet = new HashSet <Inheritance>();

            results.Add(parent);
            resultSet.Add(parent);
            for (int i = 0; i < results.Count; i++)
            {
                Inheritance child      = results[i];
                string      parentName = child.ChildDescriptor.ActivityName;
                if (this.InheritancesByParent.ContainsKey(parentName))
                {
                    foreach (Inheritance descendant in this.InheritancesByParent[parentName])
                    {
                        if (!resultSet.Contains(descendant))
                        {
                            resultSet.Add(descendant);
                            results.Add(descendant);
                        }
                    }
                }
            }
            return(results);
        }
Пример #10
0
                /// <summary>
                /// Check for unrecognized token
                /// </summary>
                private void CheckTokenValid()
                {
                    TypeDeclaration d = declaration;

                    if (!AccessModifier.IsValid(d.accessModifier))
                    {
                        throw new ArgumentException(string.Format("Invalid token '{0}'", d.accessModifier));
                    }
                    if (!OtherKeywords.IsValid(d.staticToken))
                    {
                        throw new ArgumentException(string.Format("Invalid token '{0}'", d.staticToken));
                    }
                    if (!Inheritance.IsValid(d.inheritance))
                    {
                        throw new ArgumentException(string.Format("Invalid token '{0}'", d.inheritance));
                    }
                    if (!OtherKeywords.IsValid(d.partialToken))
                    {
                        throw new ArgumentException(string.Format("Invalid token '{0}'", d.partialToken));
                    }
                    if (!Scope.IsValid(d.scope))
                    {
                        throw new ArgumentException(string.Format("Invalid token '{0}'", d.scope));
                    }
                }
        public IActionResult BuildOpex(Guid guid, [FromBody] Inheritance setting)
        {
            if (guid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }

            _logger.LogInformation("Enter BuildOpex.");

            //database process id
            Guid processId = Guid.NewGuid();

            try
            {
                Task.Run(() =>
                {
                    using (BuildOpexHandler handler = new BuildOpexHandler(_settings, _eventHub, _preingestCollection))
                    {
                        handler.Logger = _logger;
                        handler.SetSessionGuid(guid);
                        handler.InheritanceSetting = setting;
                        processId = handler.AddProcessAction(processId, typeof(BuildOpexHandler).Name, String.Format("Build Opex with collection ID: {0}", guid), String.Concat(typeof(BuildOpexHandler).Name, ".json"));
                        _logger.LogInformation("Execute handler ({0}) with GUID {1}.", typeof(BuildOpexHandler).Name, guid.ToString());
                        handler.Execute();
                    }
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(BuildOpexHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(BuildOpexHandler).Name));
            }
            _logger.LogInformation("Exit BuildOpex.");
            return(new JsonResult(new { Message = String.Format("Build Opex started."), SessionId = guid, ActionId = processId }));
        }
Пример #12
0
        private bool IsInheritanceTurnedOnForThisProperty(string propertyName)
        {
            var inheritType          = Inheritance.GetType();
            var inheritPropertyInfo  = inheritType.GetProperty(propertyName);
            var inheritPropertyValue = inheritPropertyInfo != null && Convert.ToBoolean(inheritPropertyInfo.GetValue(Inheritance, null));

            return(inheritPropertyValue);
        }
Пример #13
0
        static void Main(string[] args)
        {
            Inheritance has = new Inheritance();


            Console.WriteLine(has.Info());
            Console.WriteLine(has.ExtendInfo());
        }
Пример #14
0
        public ActionResult ViewReports()
        {
            Inheritance inh    = new Inheritance();
            var         supID  = Session["supID"];
            var         result = inh.db.supListProject(Convert.ToInt16(supID)).ToList();

            return(View(result));
        }
Пример #15
0
 static void Main(string[] args)
 {
     Inheritance.Example();
     NestedTypes.Example();
     Polymorphism.Example();
     Polymorphism.VirtualExamples();
     NewMethodHierarchy.NewMethods.Example();
 }
Пример #16
0
        public virtual ConnectionInfo Clone()
        {
            var newConnectionInfo = new ConnectionInfo();

            newConnectionInfo.CopyFrom(this);
            newConnectionInfo.Inheritance        = Inheritance.Clone();
            newConnectionInfo.Inheritance.Parent = newConnectionInfo;
            return(newConnectionInfo);
        }
Пример #17
0
        public virtual ConnectionInfo Clone()
        {
            var newConnectionInfo = new ConnectionInfo();

            newConnectionInfo.CopyFrom(this);
            newConnectionInfo.ConstantID  = MiscTools.CreateConstantID();
            newConnectionInfo.Inheritance = Inheritance.Clone();
            return(newConnectionInfo);
        }
Пример #18
0
        public void RemoveParent()
        {
            if (Parent is RootNodeInfo)
            {
                Inheritance.EnableInheritance();
            }

            Parent?.RemoveChild(this);
        }
Пример #19
0
 public virtual void SetParent(ContainerInfo newParent)
 {
     RemoveParent();
     newParent?.AddChild(this);
     if (newParent is RootNodeInfo)
     {
         Inheritance.DisableInheritance();
     }
 }
Пример #20
0
        private static void RunInheritanceExample()
        {
            InheritanceBase IB = new InheritanceBase();

            IB.PrintMessage("base class!");
            Inheritance I = new Inheritance();

            I.PrintMessage("child class!");
        }
Пример #21
0
        protected void ResolveDependencies(Inheritance inheritance)
        {
            if (this.domainDeclaredInheritances.Contains(inheritance) || this.InheritancesToPush.Contains(inheritance))
            {
                return;
            }

            this.inheritancesToPush.Add(inheritance);
        }
        private void LinkWithInheritance(FAMIX.Type subClass, FAMIX.Type superClass)
        {
            Inheritance inheritance = CreateNewAssociation <Inheritance>(typeof(FAMIX.Inheritance).FullName);

            inheritance.subclass   = subClass;
            inheritance.superclass = superClass;
            superClass.AddSubInheritance(inheritance);
            subClass.AddSuperInheritance(inheritance);
        }
Пример #23
0
        public StudyPage()
        {
            InitializeComponent();

            #region AnimationsInit
            Task.WhenAll(
                CSharpDef.FadeTo(0, 1),
                definitions.FadeTo(0, 1),
                progLang.FadeTo(0, 1),
                OOP.FadeTo(0, 1),
                DotNETFramework.FadeTo(0, 1),
                clr.FadeTo(0, 1),
                cls.FadeTo(0, 1),
                cts.FadeTo(0, 1),
                MSIL.FadeTo(0, 1),
                JIT.FadeTo(0, 1),
                Compiler.FadeTo(0, 1),
                SourceCode.FadeTo(0, 1),
                ExecutableCode.FadeTo(0, 1),
                boxview1.FadeTo(0, 1),
                generalProgTerms.FadeTo(0, 1),
                Variables.FadeTo(0, 1),
                DataType.FadeTo(0, 1),
                Keywords.FadeTo(0, 1),
                Operators.FadeTo(0, 1),
                Expression.FadeTo(0, 1),
                TypeCasting.FadeTo(0, 1),
                Arrays.FadeTo(0, 1),
                Function.FadeTo(0, 1),
                Class.FadeTo(0, 1),
                Object.FadeTo(0, 1),
                Constructor.FadeTo(0, 1),
                Destructor.FadeTo(0, 1),
                Namespaces.FadeTo(0, 1),
                Exceptions.FadeTo(0, 1),
                ExceptionHandling.FadeTo(0, 1),
                boxview2.FadeTo(0, 1),
                oopProgTerms.FadeTo(0, 1),
                Inheritance.FadeTo(0, 1),
                BaseClass.FadeTo(0, 1),
                DerivedClass.FadeTo(0, 1),
                AbstractClass.FadeTo(0, 1),
                MultilevelInheritance.FadeTo(0, 1),
                HierarchicalInheritance.FadeTo(0, 1),
                SingleInheritance.FadeTo(0, 1),
                Interface.FadeTo(0, 1),
                Polymorphism.FadeTo(0, 1),
                Overriding.FadeTo(0, 1),
                Encapsulation.FadeTo(0, 1),
                Abstraction.FadeTo(0, 1),
                Overloading.FadeTo(0, 1));
            #endregion


            // App.adCounter = 0;
        }
Пример #24
0
        public void TestDominantProbability()
        {
            float expected = 0.783333361f;

            Rational result = Inheritance.dominantProbability(2, 2, 2);

            Assert.That(
                (float)result.Numerator / result.Denominator,
                Is.EqualTo(expected));
        }
Пример #25
0
        private static void DominantProbability(IDictionary <string, ValueObject> args)
        {
            uint hd = (uint)args ["<hd>"].AsInt;
            uint h  = (uint)args ["<h>"].AsInt;
            uint hr = (uint)args ["<hr>"].AsInt;

            var prob = Inheritance.dominantProbability(hd, h, hr);

            Console.WriteLine((float)prob.Numerator / prob.Denominator);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PushDownInheritance" /> class.
        /// </summary>
        /// <param name="repository">Push down to this repository.</param>
        /// <param name="inheritanceToPush">The inheritance to push.</param>
        /// <exception cref="System.ArgumentException">Inheritance is already in domain</exception>
        internal PushDownInheritance(Repository repository, Inheritance inheritanceToPush)
            : base(repository)
        {
            if (repository.Domain.Equals(inheritanceToPush.DomainWhereDeclaredInheritance))
            {
                throw new ArgumentException("Inheritance is already in domain", "inheritanceToPush");
            }

            this.ResolveDependencies(inheritanceToPush);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InheritValueAttribute"/> class.
        /// </summary>
        /// <param name="inheritance">The type of inheritance.</param>
        /// <param name="ancestorType">The type of the ancestor to inherit from.</param>
        /// <param name="propertyName">The name of the property to get from the ancestor.</param>
        public InheritValueAttribute(Inheritance inheritance, Type ancestorType, string propertyName)
        {
            if (inheritance == Inheritance.AncestorType)
            {
                ArgValidator.Create(ancestorType, "ancestorType").IsNotNull();
            }

            this.AncestorPropertyName = propertyName;
            this.AncestorType         = ancestorType;
            this.Inheritance          = inheritance;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InheritValueAttribute"/> class.
        /// </summary>
        /// <param name="inheritance">The type of inheritance.</param>
        /// <param name="ancestorType">The type of the ancestor to inherit from.</param>
        /// <param name="propertyName">The name of the property to get from the ancestor.</param>
        public InheritValueAttribute(Inheritance inheritance, Type ancestorType, string propertyName)
        {
            if (inheritance == Inheritance.AncestorType)
            {
                ArgValidator.Create(ancestorType, "ancestorType").IsNotNull();
            }

            this.AncestorPropertyName = propertyName;
            this.AncestorType = ancestorType;
            this.Inheritance = inheritance;
        }
        public PushDownInheritanceWizard(Repository repository, Inheritance inheritance)
        {
            this.InitializeComponent();

            this.repository  = repository;
            this.inheritance = inheritance;

            this.namespaceTextBox.Text = inheritance.ToString();

            this.pushDown = this.repository.PushDown(this.inheritance);
            this.dependencyRichTextBox.UpdateDependencies(this.pushDown);
        }
Пример #30
0
        public static void AddInheritance(ModelClass baseClass, ModelClass entity)
        {
            var inheritance = new Inheritance(baseClass, entity);
            var baseClassPrimarykeyField = entity.Baseclass.Fields.Single(f => f.IsPrimaryKey);

            //The derived class primary key will be the same as the base class's.
            //However, if the derived class has its own different primary key, link them. (Untested)
            var derivedClassPrimarykeyField = entity.Fields.Find(f => f.IsPrimaryKey);

            inheritance.BaseClassPrimaryKeyColumn    = baseClassPrimarykeyField.ColumnName;
            inheritance.DerivedClassPrimaryKeyColumn = derivedClassPrimarykeyField == null ? baseClassPrimarykeyField.ColumnName : derivedClassPrimarykeyField.ColumnName;
        }
Пример #31
0
        /// <summary>
        /// Resolves all dependent meta objects for this object type.
        /// </summary>
        /// <param name="inheritance">The inheritance to resolve dependencies for.</param>
        protected void ResolveDependencies(Inheritance inheritance)
        {
            if (this.inheritancesToPull.Contains(inheritance) || this.superDomains.Contains(inheritance.DomainWhereDeclaredInheritance))
            {
                return;
            }

            this.inheritancesToPull.Add(inheritance);

            this.ResolveDependencies(inheritance.Subtype);
            this.ResolveDependencies(inheritance.Supertype);
        }
Пример #32
0
 public void Expand(Dictionary <string, ApiReferenceBuildOutput> references, string[] supportedLanguages)
 {
     if (!_isExpanded)
     {
         Inheritance = Inheritance?.Select(i => ApiBuildOutputUtility.GetReferenceViewModel(i.Uid, references, supportedLanguages)).ToList();
         Syntax?.Expand(references, supportedLanguages);
         SeeAlsos?.ForEach(e => e.Expand(references, supportedLanguages));
         Sees?.ForEach(e => e.Expand(references, supportedLanguages));
         Exceptions?.ForEach(e => e.Expand(references, supportedLanguages));
         _isExpanded = true;
     }
 }
        internal static ModelElement CreateConnectorModelElementForEFObjectType(EFObject obj, ModelElement end1, ModelElement end2)
        {
            ModelElement modelElement = null;
            var t = obj.GetType();
            var et1 = end1 as EntityType;
            var et2 = end2 as EntityType;
            if (t == typeof(Association))
            {
                Debug.Assert(et1 != null && et2 != null, "Unexpected end type for Association model element");
                modelElement = new ViewModel.Association(et1, et2);
            }
            else if (t == typeof(EntityTypeBaseType))
            {
                Debug.Assert(et1 != null && et2 != null, "Unexpected end type for Inheritance model element");
                modelElement = new Inheritance(et1, et2);
            }

            return modelElement;
        }
Пример #34
0
 internal InheritanceAdd(Inheritance inheritance, ConceptualEntityType baseEntity, ConceptualEntityType derivedEntity)
 {
     _inheritance = inheritance;
     _baseEntity = baseEntity;
     _derivedEntity = derivedEntity;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InheritValueAttribute"/> class.
 /// </summary>
 /// <param name="inheritance">The type of inheritance.</param>
 public InheritValueAttribute(Inheritance inheritance)
     : this(inheritance, null)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InheritValueAttribute"/> class.
 /// </summary>
 /// <param name="inheritance">The type of inheritance.</param>
 /// <param name="ancestorType">The type of the ancestor to inherit from.</param>
 public InheritValueAttribute(Inheritance inheritance, Type ancestorType)
     : this(inheritance, ancestorType, null)
 {
 }
	public static int test() {
		var obj = new Inheritance();
		return obj.method();
	}
Пример #38
0
 internal InheritanceDelete(Inheritance inheritance)
     : base(inheritance)
 {
 }
Пример #39
0
		public bool Load(Session session, Inheritance inheritance)
		{
			int left = int.MaxValue;
			int right = int.MinValue;
			int top = int.MaxValue;
			int bottom = int.MinValue;
			foreach (Tile tile in session.tiles)
			{
				if (session.selection.Contains(tile.X, tile.Y) ^ inheritance == Inheritance.Crop)
					continue;

				Tile clone = new Tile(tile);

				tiles.Add(clone);

				left = Math.Min(left, clone.X);
				right = Math.Max(right, clone.X + tile.Width);
				top = Math.Min(top, clone.Y);
				bottom = Math.Max(bottom, clone.Y + tile.Height);

				if (tile == session.chosen)
					chosen = clone;
			}

			foreach (Tile tile in tiles)
			{ 
				tile.X -= left;
				tile.Y -= top;
			}

			Init(right - left, bottom - top);

			return tiles.Count > 0;
		}
 protected InheritanceModelChange(Inheritance inheritance)
 {
     _inheritance = inheritance;
 }