Пример #1
0
        /// <summary>
        /// Method to remove a feature from a bin
        /// </summary>
        /// <param name="searchFeature"></param>
        /// <returns></returns>
        internal bool Remove(SbnFeature searchFeature)
        {
            if (!Intersects(searchFeature.MinX, searchFeature.MinY, searchFeature.MaxX, searchFeature.MaxY))
            {
                return(false);
            }

            if (FeatureCount > 0)
            {
                var searchBin = FirstBin;
                for (var i = 0; i < FeatureCount; i++)
                {
                    var j = i % 100;
                    if (i > 100 && j == 0)
                    {
                        searchBin = searchBin.Next;
                    }
                    if (searchBin[j].Fid == searchFeature.Fid)
                    {
                        searchBin.RemoveAt(j);
                        return(true);
                    }
                }
            }

            if (Nid < _tree.FirstLeafNodeId)
            {
                return(Child1.Remove(searchFeature) ||
                       Child2.Remove(searchFeature));
            }

            return(false);
        }
Пример #2
0
 public static int Main()
 {
     Console.WriteLine((new Child1() as Base1).Field);
     Child1.Test();
     delegateConstruction();
     return(0);
 }
        public void PopulateFilterIndex(Type type, IDictionary <string, IList <QueryFilterCondition> > index)
        {
            if (Operator != and)
            {
                return;
            }

            if (Argument1 != null)
            {
                Argument1.PopulateFilterIndex(type, index);
            }
            else if (Child1 != null)
            {
                Child1.PopulateFilterIndex(type, index);
            }

            if (Argument2 != null)
            {
                Argument2.PopulateFilterIndex(type, index);
            }
            else if (Child2 != null)
            {
                Child2.PopulateFilterIndex(type, index);
            }
        }
    public override string asString()
    {
        string b = Child1.asString();
        string c = Child2.asString();

        return("(" + b + "~" + c + ")");
    }
Пример #5
0
 private void CreateData(Func <DbContextThenInclude> createContext)
 {
     using (var context = createContext()) {
         context.ResetDatabase();
         Parent parent = new Parent();
         parent.Name = "1";
         Child1 child = new Child1()
         {
             Name = "1"
         };
         parent.ChildCollection.Add(child);
         parent.ChildCollection.Add(new Child1()
         {
             Name = "2"
         });
         child.Child = new Child2()
         {
             Name = "1"
         };
         child.Child.Child = new Child3()
         {
             Name = "1"
         };
         context.Add(parent);
         context.SaveChanges();
     }
 }
    public override float Solve(float n)
    {
        float Left  = Child1.Solve(n);
        float Right = Child2.Solve(Left - n);

        if (Child1.evaluate(Left) - Child2.evaluate(Left) != n)
        {
            if (Child1.evaluate(Right) - Child2.evaluate(Right) != n)
            {
                Right = Child2.Solve(n);
                Left  = Child1.Solve(Right - n);
                if (Child1.evaluate(Left) - Child2.evaluate(Left) != n)
                {
                    if (Child1.evaluate(Right) - Child2.evaluate(Right) != n)
                    {
                        return(float.PositiveInfinity);
                    }
                    return(Right);
                }
                return(Left);
            }
            return(Right);
        }
        return(Left);
    }
Пример #7
0
        /// <exclude/>
        protected override Size ArrangeOverride(Size finalSize)
        {
            UIElement licenseErrorElement = null;

            CheckLicense(ref licenseErrorElement);
            if (licenseErrorElement != null)
            {
                licenseErrorElement.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
                return(finalSize);
            }

            Rect splitterRect;

            GetRects(finalSize, out _child1Rect, out splitterRect, out _child2Rect);

            if (Child1 != null)
            {
                Child1.Arrange(_child1Rect);
            }

            if (SplitterPresenter != null)
            {
                SplitterPresenter.Arrange(splitterRect);
            }

            if (Child2 != null)
            {
                Child2.Arrange(_child2Rect);
            }

            return(finalSize);
        }
Пример #8
0
        public override Card Evaluate(IAiContext context)
        {
            var cardSet = Child1.Evaluate(context);

            return(cardSet
                   .OrderByDescending(c => c.BaseCost).FirstOrDefault());
        }
 // Convert node to string
 public override string ToString()
 {
     return(String.Format(Grouped ? "({0} {1} {2})" : "{0} {1} {2}",
                          Child1.ToString(),
                          Conjunction.ToString().ToUpper(),
                          Child2.ToString()));
 }
Пример #10
0
        /// <summary>
        /// Method to query all the ids of features in this node that intersect the box defined
        /// by <paramref name="minx"/>, <paramref name="miny"/>, <paramref name="maxx"/>
        /// and <paramref name="maxy"/>
        /// </summary>
        /// <param name="minx">The lower x-ordinate</param>
        /// <param name="miny">The lower y-ordinate</param>
        /// <param name="maxx">The upper x-ordinate</param>
        /// <param name="maxy">The upper y-ordinate</param>
        /// <param name="fidList">A list of feature ids to add to</param>
        /// <returns>An enumeration of feature ids</returns>
        internal void QueryFids(byte minx, byte miny, byte maxx, byte maxy, List <uint> fidList)
        {
            if (ContainedBy(minx, miny, maxx, maxy))
            {
                AddAllFidsInNode(fidList);
                return;
            }

            foreach (var feature in this)
            {
                if (feature.Intersects(minx, maxx, miny, maxy))
                {
                    fidList.Add(feature.Fid);
                }
            }

            if (Nid < _tree.FirstLeafNodeId)
            {
                if (Child1.Intersects(minx, miny, maxx, maxy))
                {
                    Child1.QueryFids(minx, miny, maxx, maxy, fidList);
                }
                if (Child2.Intersects(minx, miny, maxx, maxy))
                {
                    Child2.QueryFids(minx, miny, maxx, maxy, fidList);
                }
            }
        }
Пример #11
0
    public override Node differentiate()
    {
        Add_Operator      a1 = new Add_Operator();
        Multiply_Operator m1 = new Multiply_Operator();
        Multiply_Operator m2 = new Multiply_Operator();
        Node c1 = Child1;
        Node c2 = Child2.differentiate();
        Node c3 = Child1.differentiate();
        Node c4 = Child2;

        a1.Child1 = m1;
        m1.Parent = a1;
        a1.Child2 = m2;
        m2.Parent = a1;

        m1.Child1 = c1;
        c1.Parent = m1;
        m1.Child2 = c2;
        c2.Parent = m1;

        m2.Child1 = c3;
        c3.Parent = m2;
        m2.Child2 = c4;
        c4.Parent = m2;

        return(a1);
    }
Пример #12
0
            protected override void OnSizeRequested(ref Gtk.Requisition requisition)
            {
                var size1 = Child1.SizeRequest();
                var size2 = Child2.SizeRequest();

                requisition.Height = Math.Max(size1.Height, size2.Height);
                requisition.Width  = Handler.GetPreferredPanelSize(size1.Width, size2.Width);
            }
Пример #13
0
        public void TestCastFromInterface()
        {
            ITestInt intProp = new Child1(22);
            ITestInt strProp = new Child2(33);

            Trace.WriteLine(string.Format("Child1 cast id:{0} - int prop:{1}", ((Child1)intProp).Id, ((Child1)intProp).IntProperty));
            Trace.WriteLine(string.Format("Child2 cast id:{0} - str prop:{1}", ((Child2)strProp).Id, ((Child2)strProp).StringProperty));
        }
Пример #14
0
            protected override void OnGetPreferredWidthForHeight(int height, out int minimum_width, out int natural_width)
            {
                int min1, width1, min2, width2, sw = Handler.SplitterWidth;

                Child1.GetPreferredWidthForHeight(height, out min1, out width1);
                Child2.GetPreferredWidthForHeight(height, out min2, out width2);
                minimum_width = Handler.GetPreferredPanelSize(min1, min2);
                natural_width = Handler.GetPreferredPanelSize(width1, width2);
            }
Пример #15
0
            protected override void OnGetPreferredHeightForWidth(int width, out int minimum_height, out int natural_height)
            {
                int min1, height1, min2, height2, sw = Handler.SplitterWidth;

                Child1.GetPreferredHeightForWidth(width, out min1, out height1);
                Child2.GetPreferredHeightForWidth(width, out min2, out height2);
                minimum_height = Handler.GetPreferredPanelSize(min1, min2);
                natural_height = Handler.GetPreferredPanelSize(height1, height2);
            }
Пример #16
0
        /// <summary>
        /// function to count all features in this node and all child nodes
        /// </summary>
        /// <returns>The number of features in all this and all child nodes</returns>
        public int CountAllFeatures()
        {
            var res = FeatureCount;

            if (Nid < _tree.FirstLeafNodeId)
            {
                res += Child1.CountAllFeatures() + Child2.CountAllFeatures();
            }
            return(res);
        }
Пример #17
0
        public void TestObjectLiteralFieldImplementingInterface()
        {
            Child1 c = new Child1 {
                Name = "name"
            };
            Parent1 p = c;

            Assert.AreEqual("name", p.Name);
            Assert.AreEqual("name", c.Name);
        }
Пример #18
0
        public override ResponseVotes Evaluate(IAiContext context)
        {
            var vote = context.AvailableResponses
                       .OfType <BuyCardResponse>()
                       .FirstOrDefault(response => (response.Item.Equals(Child1.Evaluate(context))));

            return(vote == null
                       ? new ResponseVotes()
                       : new ResponseVotes().VoteFor(vote, Child2.Evaluate(context)));
        }
Пример #19
0
 public void ThenIncludeBaseTest(Func <DbContextThenInclude> createContext)
 {
     CreateData(createContext);
     using (var context = createContext()) {
         Parent parent = context.Parent.Include(p => p.ChildCollection).ThenInclude(p => p.Child).ThenInclude(p => p.Child).First();
         Assert.AreEqual(2, parent.ChildCollection.Count);
         Child1 child1 = parent.ChildCollection.First(p => p.Name == "1");
         Assert.IsNotNull(child1.Child);
         Assert.IsNotNull(child1.Child.Child);
     }
 }
    public static void Main()
    {
        var c1 = new Child1();
        var c2 = new Child2();

        Test.SetBaseClassValue(c1);
        Test.SetBaseClassValue(c2);
        Console.WriteLine(c1.CreateUser);
        Console.WriteLine(c2.CreateUser);
        Console.ReadLine();
    }
Пример #21
0
        public override void CalcPositionsRecursive(int left, int top, int width, int height)
        {
            //base.CalcPositionsRecursive(left, top, width, height);

            DriverSplitter.Place(left, top, width, height);
            Size2i siz1 = /*Child1.LayoutInfo.Size;*/ (Child1.DriverObject as DriverSplitterPanel).Size;
            Size2i siz2 = /*Child2.LayoutInfo.Size;*/ (Child2.DriverObject as DriverSplitterPanel).Size;

            Child1.CalcPositionsRecursive(0, 0, siz1.Width, siz1.Height);
            Child2.CalcPositionsRecursive(0, 0, siz2.Width, siz2.Height);
        }
    public override Node differentiate()
    {
        Node n  = this;
        Node c1 = Child1.differentiate();
        Node c2 = Child2.differentiate();

        n.Child1  = c1;
        n.Child2  = c2;
        c1.Parent = n;
        c2.Parent = n;
        return(this);
    }
Пример #23
0
        public override bool Evaluate(IAiContext context)
        {
            var cardSet = Child1.Evaluate(context);
            var card    = Child2.Evaluate(context);

            if (cardSet == null || card == null)
            {
                return(false);
            }

            return(cardSet.Contains(card));
        }
Пример #24
0
            public static void Test()
            {
                var o = new Child1();

                o.child = new Child1();
                o.TestMethod();

                Console.WriteLine(((Base1)o).Property);
                Console.WriteLine(o.Property);
                Console.WriteLine(((Base1)o).VirtProp);
                Console.WriteLine(o.VirtProp);
            }
Пример #25
0
        static void Main(string[] args)
        {
            Child1 childObj1 = new Child1();

            childObj1.setbal(120000);//child1 class method
            childObj1.setdata(100, 5, 4500000);

            childObj1.getdata();
            Console.WriteLine("Child have {0} Rs.", childObj1.getbal());

            childObj1.combineBal();
            Console.ReadKey();
        }
Пример #26
0
            public Task ReceiveAsync(IContext context)
            {
                if (context.Message is Started)
                {
                    Child1 = context.Spawn(_child1Props);
                    Child2 = context.Spawn(_child2Props);
                }

                if (context.Message is string)
                {
                    // only tell one child
                    Child1.Tell(context.Message);
                }

                return(Actor.Done);
            }
Пример #27
0
        static void Main(string[] args)
        {
#if iterator
            var calendar = new Calendar();
            var cal      = calendar.Get();
            //var weeks = calendar.GetWeeks();
            Console.WriteLine(cal);

            foreach (var month in cal)
            {
                foreach (var week in month.Weeks)
                {
                    foreach (var date in week.DateTimes)
                    {
                        Console.WriteLine(date.ToString());
                    }
                }
            }
#elif contaractS
            var user = new RegisteredUser();
            user.DoSomthing(1);
#elif generics
            new GenericsSample().Exec();
#elif async
            new AsyncFunctions().Main();
            var single = new SampleAsync().GetSingleAsync();
            Console.WriteLine(single.Result);
            var multi = new SampleAsync().GetMultiAsync();
            Console.WriteLine(multi.Result);
#elif gettersetter
            //var people = new People();
            //people.FirstName = "Taro";
            //people.LastName = "Tanaka";
            //Console.WriteLine(people.FullName);
#elif construct
            var people = new People(age: 5, birthday: DateTime.Now)
            {
                FirstName = "Taro",
                LastName  = "Tanaka"
            };

            var child = new Child1("test", 1);
            Console.WriteLine(child.GetContent());
#elif linq
            new LinqSample().DoSomething();
#endif
        }
Пример #28
0
        public override bool Evaluate(IAiContext context)
        {
            if (Child1 == null || Child2 == null)
            {
                return(false);
            }

            var cardSet1 = Child1.Evaluate(context);
            var cardSet2 = Child2.Evaluate(context);

            if (cardSet1 == null || cardSet2 == null)
            {
                return(false);
            }

            return(Child1.Evaluate(context).IsSupersetOf(Child2.Evaluate(context)));
        }
Пример #29
0
        /// <summary>
        /// Add the child nodes
        /// </summary>
        public void AddChildren()
        {
            if (Nid >= _tree.FirstLeafNodeId)
            {
                return;
            }

            var splitBounds = GetSplitBounds(1);
            var childId     = Nid * 2;

            _tree.Nodes[childId] = new SbnNode(_tree, childId++, splitBounds[0], splitBounds[1], splitBounds[2], splitBounds[3]);
            Child1.AddChildren();

            splitBounds          = GetSplitBounds(2);
            _tree.Nodes[childId] = new SbnNode(_tree, childId, splitBounds[0], splitBounds[1], splitBounds[2], splitBounds[3]);
            Child2.AddChildren();
        }
Пример #30
0
        /// <summary>
        /// Helper method to add all the ids of features in this node and its descendants
        /// </summary>
        /// <returns>An enumeration of feature ids</returns>
        private void AddAllFidsInNode(List <uint> fidList)
        {
            if (FeatureCount > 0)
            {
                var bin = FirstBin;
                while (bin != null)
                {
                    fidList.AddRange(bin.GetAllFidsInBin());
                    bin = bin.Next;
                }
            }

            if (Nid < _tree.FirstLeafNodeId)
            {
                Child1.AddAllFidsInNode(fidList);
                Child2.AddAllFidsInNode(fidList);
            }
        }
Пример #31
0
 public void TestCastFromInterface()
 {
     ITestInt intProp = new Child1(22);
     ITestInt strProp = new Child2(33);
     Console.WriteLine("Child1 cast id:{0} - int prop:{1}", ((Child1)intProp).Id, ((Child1)intProp).IntProperty);
     Console.WriteLine("Child2 cast id:{0} - str prop:{1}", ((Child2)strProp).Id, ((Child2)strProp).StringProperty);
 }