Add() public method

public Add ( Object obj ) : void
obj Object
return void
        public static void Main()
        {
            LinkedList<int> testList = new LinkedList<int>();

            for (int i = 0; i < 10; i++)
            {
                testList.Add(i);
            }

            foreach (var number in testList)
            {
                Console.Write(number + ", ");
            }
            Console.WriteLine("Count={0}", testList.Count);

            testList.Remove(9);
            foreach (var number in testList)
            {
                Console.Write(number + ", ");
            }
            Console.WriteLine("Count={0}", testList.Count);

            testList.Add(1);
            foreach (var number in testList)
            {
                Console.Write(number + ", ");
            }
            Console.WriteLine("Count={0}", testList.Count);

            Console.WriteLine("First index of 1={0}", testList.FirstIndexOf(1));
            Console.WriteLine("Last index of 1={0}", testList.LastIndexOf(1));
        }
 public void Init()
 {
     _list = new LinkedList<int>();
     _list.Add(3);
     _list.Add(4);
     _list.Add(5);
 }
Exemplo n.º 3
0
        public static bool GenericTest3()
        {
            var list = new LinkedList<int>();

            list.Add(10);
            list.Add(20);

            return list.First.value == 10;
        }
        public void InvalidIndexRemoveTest()
        {
            LinkedList<int> list = new LinkedList<int>();
            list.Add(4);
            list.Add(14);
            list.Add(666);

            bool isRemoved = list.RemoveAt(5);
        }
Exemplo n.º 5
0
 public void ItShouldBeAbleToAddAndGetIndex()
 {
     LinkedList<object> list = new LinkedList<object>();
     list.Add('a');
     list.Add('b');
     object expected = 'a';
     object actual = list[0];
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 6
0
 static void Main()
 {
     LinkedList<int> ll = new LinkedList<int>();
     ll.Add(55);
     ll.Add(23);
     ll.Add(43);
     ll.Add(33);
     ll.Add(-12);
 }
Exemplo n.º 7
0
        public void InvalidSetTest()
        {
            LinkedList<string> list = new LinkedList<string>();
            list.Add("Pesho");
            list.Add("Gosho");
            list.Add("Lili");

            list[4] = "Robin";
        }
Exemplo n.º 8
0
        public void InvalidGetTest()
        {
            LinkedList<string> list = new LinkedList<string>();
            list.Add("Pesho");
            list.Add("Gosho");
            list.Add("Lili");

            string invalidName = list[4];
        }
Exemplo n.º 9
0
        public void GetMiddleElementTest()
        {
            LinkedList<string> list = new LinkedList<string>();
            list.Add("Pesho");
            list.Add("Gosho");
            list.Add("Robin");

            Assert.AreEqual("Gosho", list[list.Count / 2]);
        }
Exemplo n.º 10
0
        public static bool GenericTest4()
        {
            var list = new LinkedList<int>();

            list.Add(10);
            list.Add(20);
            list.Add(30);

            return list.First.value == 10 && list.Last.value == 30 && list.Find(20).value == 20;
        }
Exemplo n.º 11
0
        public void GetLastFromMultipleElementsTest()
        {
            LinkedList<string> list = new LinkedList<string>();
            list.Add("Pesho");
            list.Add("Gosho");
            list.Add("Lili");
            list.Add("Robin");

            Assert.AreEqual("Robin", list[list.Count - 1]);
        }
        public void IndexOfFirstElementOfMultipleTest()
        {
            LinkedList<int> list = new LinkedList<int>();
            list.Add(0);
            list.Add(15);
            list.Add(1);

            int index = list.IndexOf(0);

            Assert.AreEqual(0, index);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            LinkedList List = new LinkedList();
            List.Add(new Node("Payam"));
            List.Add(new Node("Pouria"));
            List.Add(new Node(30));

            List.Display();

            Console.ReadLine();
        }
Exemplo n.º 14
0
    public static void Main()
    {
        LinkedList<int> list = new LinkedList<int>();

        list.Add(new ListItem<int>(6));
        list.Add(new ListItem<int>(5));
        list.Add(new ListItem<int>(7));
        list.Add(new ListItem<int>(4));

        list.PrintAll();
    }
Exemplo n.º 15
0
        public void AddTwoElementsTest()
        {
            LinkedList<string> list = new LinkedList<string>();

            list.Add("Pesho");
            list.Add("Gosho");

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual("Pesho", list.First);
            Assert.AreEqual("Gosho", list.Last);
        }
Exemplo n.º 16
0
        public static void Main(string[] args)
        {
            LinkedList list = new LinkedList();
            list.Add(new Node("1"));
            list.Add(new Node("2"));
            list.Add(new Node("3"));
            list.Add(new Node("4"));

            list.PrintNodes();
            Console.ReadKey();
        }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            LinkedList<int> numbers = new LinkedList<int>();
            numbers.Add(5);
            numbers.Add(6);
            numbers.Add(7);

            foreach (var number in numbers)
            {
                Console.WriteLine(number);
            }
        }
Exemplo n.º 18
0
        public static bool GenericTest5()
        {
            var list = new LinkedList<int>();

            list.Add(30);
            list.Add(10);
            list.Add(30);
            list.Add(20);
            list.Add(30);

            return list.FindLast(30) == list.Last;
        }
        public void RemoveLastElementTest()
        {
            LinkedList<double> list = new LinkedList<double>();
            list.Add(12.25);
            list.Add(12.44);

            bool isRemoved = list.Remove(12.44);

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(12.25, list.First);
            Assert.AreEqual(12.25, list.Last);
            Assert.IsTrue(isRemoved);
        }
        public void RemoveNonExistingElementTest()
        {
            LinkedList<double> list = new LinkedList<double>();
            list.Add(12.25);
            list.Add(12.44);

            bool isRemoved = list.Remove(12.55);

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(12.25, list.First);
            Assert.AreEqual(12.44, list.Last);
            Assert.IsFalse(isRemoved);
        }
        public void RemoveLastFromTwoElementsTest()
        {
            LinkedList<int> list = new LinkedList<int>();
            list.Add(666);
            list.Add(55);

            bool isRemoved = list.RemoveAt(list.Count - 1);

            Assert.IsTrue(isRemoved);
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(666, list.First);
            Assert.AreEqual(666, list.Last);
        }
Exemplo n.º 22
0
 public void ItShouldBeAbleToClear()
 {
     LinkedList<object> list = new LinkedList<object>();
     list.Add('a');
     list.Add('b');
     list.Add('c');
     list.Add('d');
     list.Add('e');
     list.Clear();
     object expected = 0;
     object actual = list.Count;
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 23
0
 public void ItShouldBeAbleToInsert()
 {
     LinkedList<object> list = new LinkedList<object>();
     list.Add('a');
     list.Add('b');
     list.Add('c');
     list.Add('d');
     list.Add('e');
     list.Insert('f',2);
     object expected = 'f';
     object actual = list[2];
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 24
0
 public void ItShouldBeAbleToRemoveAtIndex()
 {
     LinkedList<object> list = new LinkedList<object>();
     list.Add('a');
     list.Add('b');
     list.Add('c');
     list.Add('d');
     list.Add('e');
     list.RemoveAt(2);
     object expected = 'd';
     object actual = list[2];
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 25
0
		private void CreateTable()
		{
			var application = Mvx.Resolve<IApplicationService>();
			var vm = (SettingsViewModel)ViewModel;
			var currentAccount = application.Account;

            var showOrganizationsInEvents = new BooleanElement("Show Teams under Events", currentAccount.ShowTeamEvents);
            showOrganizationsInEvents.Changed.Subscribe(e =>
			{ 
				currentAccount.ShowTeamEvents = e;
				application.Accounts.Update(currentAccount);
			});

            var showOrganizations = new BooleanElement("List Teams & Groups in Menu", currentAccount.ExpandTeamsAndGroups);
            showOrganizations.Changed.Subscribe(x =>
            {
				currentAccount.ExpandTeamsAndGroups = x;
				application.Accounts.Update(currentAccount);
			});

            var repoDescriptions = new BooleanElement("Show Repo Descriptions", currentAccount.RepositoryDescriptionInList);
            repoDescriptions.Changed.Subscribe(e =>
			{ 
				currentAccount.RepositoryDescriptionInList = e;
				application.Accounts.Update(currentAccount);
			});

            var startupView = new ButtonElement("Startup View", vm.DefaultStartupViewName);
            startupView.Clicked.BindCommand(vm.GoToDefaultStartupViewCommand);

            var sourceCommand = new ButtonElement("Source Code");
            sourceCommand.Clicked.Subscribe(_ => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://github.com/thedillonb/CodeBucket")));

            var twitter = new StringElement("Follow On Twitter");
            twitter.Clicked.Subscribe(_ => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://twitter.com/Codebucketapp")));

            var rate = new StringElement("Rate This App");
            rate.Clicked.Subscribe(_ => UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/us/app/codebucket/id551531422?mt=8")));

			//Assign the root
            ICollection<Section> root = new LinkedList<Section>();
            root.Add(new Section());
            root.Add(new Section { showOrganizationsInEvents, showOrganizations, repoDescriptions, startupView });
            root.Add(new Section(String.Empty, "Thank you for downloading. Enjoy!")
            {
                sourceCommand, twitter, rate,
                new StringElement("App Version", NSBundle.MainBundle.InfoDictionary.ValueForKey(new NSString("CFBundleVersion")).ToString())
            });
            Root.Reset(root);

		}
Exemplo n.º 26
0
        public void MethodUnderTest_TestedBehavior_ExpectedResult()
        {
            var nodeList = new LinkedList<object>();
            nodeList.Add(new ListNode<object>(1));
            nodeList.Add(new ListNode<object>(2));
            nodeList.Add(new ListNode<object>(3));
            nodeList.Add(new ListNode<object>(4));
            nodeList.Add(new ListNode<object>(5));
            nodeList.Add(new ListNode<object>(6));
            nodeList.Add(new ListNode<object>("d"));
            nodeList.Add(new ListNode<object>("g"));
            nodeList.AddAfter(3, new ListNode<object>("B"));
            nodeList.AddAfter("g", new ListNode<object>("uber"));

            Console.WriteLine(nodeList.Tail);


            Console.WriteLine("The list has {0} elements!", nodeList.ListSize);
            nodeList.Traverse();
            nodeList.Reverse();
            nodeList.Traverse();

            Assert.That(nodeList.ListSize, Is.EqualTo(10));
            Assert.That(nodeList.Contains("g"), Is.True);

            nodeList.Remove("d");
            nodeList.Remove("g");

            Assert.That(nodeList.ListSize, Is.EqualTo(8));
            Assert.That(nodeList.Contains("g"), Is.False);

            nodeList.Reverse();
            nodeList.Traverse();
        }
Exemplo n.º 27
0
        public void TestAdd()
        {
            LinkedList<int> liste = new LinkedList<int>();
            liste.Add(1);
            liste.Add(2);
            liste.Add(3);

            int ii = 1;
            foreach (int i in liste)
            {
                Assert.AreEqual(ii++, i, "Add Method inserted a wrong result.");
            }
            Assert.AreEqual(1, liste.First, "First Value is incorrect.");
            Assert.AreEqual(3, liste.Last, "Last Value is incorrect.");
        }
Exemplo n.º 28
0
        public static void Main(string[] args)
        {
            LinkedList<int> linked = new LinkedList<int>();

            linked.Add (1);
            linked.Add (2);
            linked.Add (3);
            linked.Add (4);
            linked.Add (10);

            var v = linked.Find (2);

            int count = linked.Count;
            Console.WriteLine ("Number of Nodes: {0}",count);
        }
 public void LinkedListRemoveAtHeadSizeOne()
 {
     LinkedList<int> l = new LinkedList<int>();
     l.Add(20);
     l.RemoveAt(0);
     Assert.AreEqual(0, l.Size());
 }
        public void RemoveFirstFromMultipleElementsTest()
        {
            LinkedList<int> list = new LinkedList<int>();
            list.Add(666);
            list.Add(1561);
            list.Add(6151);
            list.Add(4);
            list.Add(55);

            bool isRemoved = list.RemoveAt(0);

            Assert.IsTrue(isRemoved);
            Assert.AreEqual(4, list.Count);
            Assert.AreEqual(1561, list.First);
            Assert.AreEqual(55, list.Last);
        }
Exemplo n.º 31
0
        public virtual IEnumerable <ICollection <T> > Flux <T>(
            IEnumerable <T> source,
            int min,
            int max)
        {
            if (source == null)
            {
                yield break;
            }

            const byte
                zero = 0,
                one  = 1;

            if (min < one)
            {
                yield break;
            }

            if (min > max)
            {
                yield break;
            }

            var maxExclusive = max + one;

            if (max == int.MaxValue)
            {
                maxExclusive = max;
            }

            using (var e = source.GetEnumerator())
            {
                int indexer  = zero;
                T   nextItem = default;

chunk:
                ICollection <T> currentChunk = new LinkedList <T>();
                if (indexer > zero)
                {
                    currentChunk.Add(nextItem);
                }

                var nextChunkSize = this.rng?.Next(min, maxExclusive);
                while (indexer < nextChunkSize && e.MoveNext())
                {
                    currentChunk.Add(e.Current);
                    ++indexer;
                }

                yield return(currentChunk);

                if (!e.MoveNext())
                {
                    yield break;
                }

                nextItem = e.Current;
                indexer  = one;
                goto chunk;
            }
        }
Exemplo n.º 32
0
        public override void Move()
        {
            int width     = App.Instance.GraphicsDevice.Viewport.Width;
            int height    = App.Instance.GraphicsDevice.Viewport.Height;
            int radius    = (int)Math.Round(Constants.MAIN_TURRET_RADIUS);
            int oldregion = region;

            region = 0;
            //region will store the area that the invader is in, using the same system as the Cohen-Sutherland
            //algorithm for clipping an edge against a rectangle
            if (Location.X < width / 2 - radius)
            {
                region |= 0x1;
            }
            if (Location.X > width / 2 + radius)
            {
                region |= 0x2;
            }
            if (Location.Y < height / 2 - radius)
            {
                region |= 0x8;
            }
            if (Location.Y > height / 2 + radius)
            {
                region |= 0x4;
            }
            //if the region changed to a side region, then move closer to the tower, in the style of a space invader.
            if (region != oldregion && isAPowerOf2(region))
            {
                Vector2 direction = (Location - App.Instance.Model.Tower.Location);
                direction.Normalize();
                Location -= direction * 20;
                #region Minions
                ICollection <IGenerator> minionsWave = new LinkedList <IGenerator>();
                Vector2        parallel = Vector2.Transform(direction, Matrix.CreateRotationZ((float)Math.PI / 2));
                PointGenerator left     = new PointGenerator(Location + (60 * parallel), 1);
                left.EnemyType   = Generator.EnemyType.Regular;
                left.Frequency   = 1;
                left.EnemyHealth = 1;
                left.EnemySize   = 10;
                minionsWave.Add(left);

                PointGenerator centreright = new PointGenerator(Location + (30 * parallel), 1);
                centreright.EnemyType   = Generator.EnemyType.Regular;
                centreright.Frequency   = 1;
                centreright.EnemyHealth = 1;
                centreright.EnemySize   = 10;
                minionsWave.Add(centreright);

                PointGenerator centreleft = new PointGenerator(Location, 1);
                centreleft.EnemyType   = Generator.EnemyType.Regular;
                centreleft.Frequency   = 1;
                centreleft.EnemyHealth = 1;
                centreleft.EnemySize   = 10;
                minionsWave.Add(centreleft);

                PointGenerator right = new PointGenerator(Location - (30 * parallel), 1);
                right.EnemyType   = Generator.EnemyType.Regular;
                right.Frequency   = 1;
                right.EnemyHealth = 1;
                right.EnemySize   = 10;
                minionsWave.Add(right);
                App.Instance.Model.Spawner.RequestWave(minionsWave);
                #endregion
            }

            //Set direction of velocity based on the region the invader is in.
            Vector2 dir = Vector2.Zero;
            if (isAPowerOf2(region))
            {
                //region is a side, not a corner: Move orthogonally to the tower.
                switch (region)
                {
                case 1: dir = new Vector2(0, -1); break; //left side

                case 2: dir = new Vector2(0, 1); break;  //right side

                case 4: dir = new Vector2(-1, 0); break; //bottom side

                case 8: dir = new Vector2(1, 0); break;  //top side
                }
                Acceleration = Vector2.Zero;
            }
            else
            {
                //region is a corner (or is the centre, but invader would be destroyed were it within the tower)
                //so move in a circular motion clockwise, to reach the next side region
                float xMod = (region & 0x2) != 0 ? radius : -radius;
                float yMod = (region & 0x4) != 0 ? radius : -radius;
                dir = Location - (App.Instance.Model.Tower.Location + new Vector2(xMod, yMod));
                dir.Normalize();
                Acceleration = -speed * dir;
                dir          = Vector2.Transform(dir, Matrix.CreateRotationZ((float)(Math.PI / 2)));
            }
            //Set velocity
            Velocity = speed * dir;
            base.Move();
        }
Exemplo n.º 33
0
        public override void run(string format, string[] args)
        {
            base.run(format, args);

            ChunkerModel model = (new ChunkerModelLoader()).load(@params.Model);

            IList <EvaluationMonitor <ChunkSample> > listeners = new LinkedList <EvaluationMonitor <ChunkSample> >();
            ChunkerDetailedFMeasureListener          detailedFMeasureListener = null;

            if (@params.Misclassified.Value)
            {
                listeners.Add(new ChunkEvaluationErrorListener());
            }
            if (@params.DetailedF.Value)
            {
                detailedFMeasureListener = new ChunkerDetailedFMeasureListener();
                listeners.Add(detailedFMeasureListener);
            }

            ChunkerEvaluator evaluator = new ChunkerEvaluator(new ChunkerME(model, ChunkerME.DEFAULT_BEAM_SIZE), listeners.ToArray());

            PerformanceMonitor monitor = new PerformanceMonitor("sent");

            ObjectStream <ChunkSample> measuredSampleStream = new ObjectStreamAnonymousInnerClassHelper(this, monitor);

            monitor.startAndPrintThroughput();

            try
            {
                evaluator.evaluate(measuredSampleStream);
            }
            catch (IOException e)
            {
                Console.Error.WriteLine("failed");
                throw new TerminateToolException(-1, "IO error while reading test data: " + e.Message, e);
            }
            finally
            {
                try
                {
                    measuredSampleStream.close();
                }
                catch (IOException)
                {
                    // sorry that this can fail
                }
            }

            monitor.stopAndPrintFinalResult();

            Console.WriteLine();

            if (detailedFMeasureListener == null)
            {
                Console.WriteLine(evaluator.FMeasure);
            }
            else
            {
                Console.WriteLine(detailedFMeasureListener.ToString());
            }
        }
Exemplo n.º 34
0
        private void CollectCssDeclarations(INode rootNode, ResourceResolver resourceResolver)
        {
            this.css = new CssStyleSheet();
            LinkedList <INode> q = new LinkedList <INode>();

            if (rootNode != null)
            {
                q.Add(rootNode);
            }
            while (!q.IsEmpty())
            {
                INode currentNode = q.JRemoveFirst();
                if (currentNode is IElementNode)
                {
                    IElementNode headChildElement = (IElementNode)currentNode;
                    if (SvgConstants.Tags.STYLE.Equals(headChildElement.Name()))
                    {
                        //XML parser will parse style tag contents as text nodes
                        if (!currentNode.ChildNodes().IsEmpty() && (currentNode.ChildNodes()[0] is IDataNode || currentNode.ChildNodes
                                                                        ()[0] is ITextNode))
                        {
                            String styleData;
                            if (currentNode.ChildNodes()[0] is IDataNode)
                            {
                                styleData = ((IDataNode)currentNode.ChildNodes()[0]).GetWholeData();
                            }
                            else
                            {
                                styleData = ((ITextNode)currentNode.ChildNodes()[0]).WholeText();
                            }
                            CssStyleSheet styleSheet = CssStyleSheetParser.Parse(styleData);
                            //TODO (DEVSIX-2263): media query wrap
                            //styleSheet = wrapStyleSheetInMediaQueryIfNecessary(headChildElement, styleSheet);
                            this.css.AppendCssStyleSheet(styleSheet);
                        }
                    }
                    else
                    {
                        if (CssUtils.IsStyleSheetLink(headChildElement))
                        {
                            String styleSheetUri = headChildElement.GetAttribute(SvgConstants.Attributes.HREF);
                            try {
                                using (Stream stream = resourceResolver.RetrieveResourceAsInputStream(styleSheetUri)) {
                                    if (stream != null)
                                    {
                                        CssStyleSheet styleSheet = CssStyleSheetParser.Parse(stream, resourceResolver.ResolveAgainstBaseUri(styleSheetUri
                                                                                                                                            ).ToExternalForm());
                                        this.css.AppendCssStyleSheet(styleSheet);
                                    }
                                }
                            }
                            catch (Exception exc) {
                                ILog logger = LogManager.GetLogger(typeof(iText.Svg.Css.Impl.SvgStyleResolver));
                                logger.Error(iText.StyledXmlParser.LogMessageConstant.UNABLE_TO_PROCESS_EXTERNAL_CSS_FILE, exc);
                            }
                        }
                    }
                }
                foreach (INode child in currentNode.ChildNodes())
                {
                    if (child is IElementNode)
                    {
                        q.Add(child);
                    }
                }
            }
        }
Exemplo n.º 35
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSimple()
        public virtual void TestSimple()
        {
            ClockCacheTest <int, string> cache      = new ClockCacheTest <int, string>("TestCache", 3);
            IDictionary <string, int>    valueToKey = new Dictionary <string, int>();
            IDictionary <int, string>    keyToValue = new Dictionary <int, string>();

            string s1   = "1";
            int?   key1 = 1;

            valueToKey[s1]   = key1.Value;
            keyToValue[key1] = s1;

            string s2   = "2";
            int?   key2 = 2;

            valueToKey[s2]   = key2.Value;
            keyToValue[key2] = s2;

            string s3   = "3";
            int?   key3 = 3;

            valueToKey[s3]   = key3.Value;
            keyToValue[key3] = s3;

            string s4   = "4";
            int?   key4 = 4;

            valueToKey[s4]   = key4.Value;
            keyToValue[key4] = s4;

            string s5   = "5";
            int?   key5 = 5;

            valueToKey[s5]   = key5.Value;
            keyToValue[key5] = s5;

            IList <int> cleanedElements  = new LinkedList <int>();
            IList <int> existingElements = new LinkedList <int>();

            cache.Put(key1, s1);
            cache.Put(key2, s2);
            cache.Put(key3, s3);
            assertNull(cache.LastCleanedElement);

            string fromKey2 = cache.Get(key2);

            assertEquals(s2, fromKey2);
            string fromKey1 = cache.Get(key1);

            assertEquals(s1, fromKey1);
            string fromKey3 = cache.Get(key3);

            assertEquals(s3, fromKey3);

            cache.Put(key4, s4);
            assertNotEquals(s4, cache.LastCleanedElement);
            cleanedElements.Add(valueToKey[cache.LastCleanedElement]);
            existingElements.RemoveAt(valueToKey[cache.LastCleanedElement]);

            cache.Put(key5, s5);
            assertNotEquals(s4, cache.LastCleanedElement);
            assertNotEquals(s5, cache.LastCleanedElement);
            cleanedElements.Add(valueToKey[cache.LastCleanedElement]);
            existingElements.RemoveAt(valueToKey[cache.LastCleanedElement]);

            int size = cache.Size();

            assertEquals(3, size);
            foreach (int?key in cleanedElements)
            {
                assertNull(cache.Get(key));
            }
            foreach (int?key in existingElements)
            {
                assertEquals(keyToValue[key], cache.Get(key));
            }
            cache.Clear();
            assertEquals(0, cache.Size());
            foreach (int?key in keyToValue.Keys)
            {
                assertNull(cache.Get(key));
            }
        }
Exemplo n.º 36
0
        /// <summary>
        /// Triggered on the animation loop.
        /// </summary>
        private bool OnTick()
        {
            // Check state
            if (Game.State == GameState.Started)
            {
                Game.State = GameState.InProgress;
            }

            if (lastState != Game.State)
            {
                // Check for game over
                if (Game.State == GameState.Completed)
                {
                    // Wipe everything
                    sprites.Clear();

                    // Add game over screen
                    AddGameOver();
                }

                // Save the state
                lastState = Game.State;
            }

            // Update the sprites
            sprites.Update();

            // Remove any completed animations
            LinkedList <BurntSprite> list = new LinkedList <BurntSprite>();

            foreach (ISprite sprite in sprites)
            {
                BurntSprite bs = sprite as BurntSprite;

                if (bs != null && bs.CanRemove)
                {
                    list.Add(bs);
                }
            }

            foreach (BurntSprite bs in list)
            {
                sprites.Remove(bs);
            }

            // Render the pane
            viewport.FireQueueDraw(this);

            // Handle the tick updating
            tickCount++;

            if (tickCount % 100 == 0)
            {
                int    fps  = (int)Game.Config.FramesPerSecond;
                double diff = (DateTime.UtcNow.Ticks - start) / 10000000.0;
                double efps = exposeCount / diff;
                double tfps = tickCount / diff;
                Console.WriteLine(
                    "FPS: Exposed {0:N1} FPS ({3:N1}%), " + "Ticks {1:N1} FPS ({4:N1}%), " +
                    "Maximum {2:N0} FPS",
                    efps,
                    tfps,
                    fps,
                    efps * 100 / fps,
                    tfps * 100 / fps);
                start       = DateTime.UtcNow.Ticks;
                exposeCount = tickCount = 0;
            }

            // Re-request the animation
            Timeout.Add(1000 / Game.Config.FramesPerSecond, OnTick);
            return(false);
        }
Exemplo n.º 37
0
        public DataSet GetSPCControlChartData(byte[] baData, bool isATT)
        {
            DataSet ds = new DataSet();

            string strWhere = string.Empty;
            string strSQL   = string.Empty;

            try
            {
                LinkedList llstData      = new LinkedList();
                LinkedList llstCondition = new LinkedList();
                llstData.SetSerialData(baData);

                if (isATT)
                {
                    strSQL =
                        @"SELECT  dts.rawid,
						    mms.spc_model_name,
						    to_char(dts.spc_start_dtts,'yyyy-MM-dd') AS WORKDATE ,
						    mcms.rawid as model_config_rawid,
						    mcms.param_alias,                            
						    mcms.main_yn,                                                
						    mcoms.default_chart_list,
						    nvl(mcoms.RESTRICT_SAMPLE_DAYS,0) RESTRICT_SAMPLE_DAYS,       
						    nvl(mcoms.RESTRICT_SAMPLE_COUNT,0) RESTRICT_SAMPLE_COUNT,
						    nvl(mcoms.RESTRICT_SAMPLE_HOURS,0) RESTRICT_SAMPLE_HOURS, 
						    dts.file_data ,
						    amp.area,
						    dts.toggle
				    FROM  model_config_att_mst_spc mcms
					     ,model_att_mst_spc mms
					     ,model_config_opt_att_mst_spc mcoms
					     ,data_trx_spc dts 
					     ,AREA_MST_PP amp
				    WHERE mcms.model_rawid=mms.rawid
				    {0}                             
				    AND mcoms.model_config_rawid = mcms.rawid 
				    AND mcms.rawid=dts.model_config_rawid                      
				    AND  (
					     (dts.spc_start_dtts >=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3') AND dts.spc_start_dtts<=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')) OR
					     (dts.spc_end_dtts>=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3') AND dts.spc_end_dtts<=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3'))
					    )
				    AND mms.AREA_RAWID=AMP.RAWID     
				    ORDER BY dts.spc_start_dtts"                ;
                }
                else
                {
                    strSQL =
                        @"SELECT  dts.rawid,
                            mms.spc_model_name,
                            to_char(dts.spc_start_dtts,'yyyy-MM-dd') AS WORKDATE ,
                            mcms.rawid as model_config_rawid,
                            mcms.param_alias,
                            NVL (mcms.complex_yn, 'N') AS complex_yn,  
                            mcms.main_yn,                                                
                            mcoms.default_chart_list,
                            nvl(mcoms.RESTRICT_SAMPLE_DAYS,0) RESTRICT_SAMPLE_DAYS,       
                            nvl(mcoms.RESTRICT_SAMPLE_COUNT,0) RESTRICT_SAMPLE_COUNT,
                            nvl(mcoms.RESTRICT_SAMPLE_HOURS,0) RESTRICT_SAMPLE_HOURS, 
                            dts.file_data ,
                            amp.area,
                            dts.toggle,
                            dts.sample_count
                    FROM  model_config_mst_spc mcms
                         ,model_mst_spc mms
                         ,model_config_opt_mst_spc mcoms
                         ,data_trx_spc dts 
                         ,AREA_MST_PP amp
                    WHERE mcms.model_rawid=mms.rawid
                    {0}                             
                    AND mcoms.model_config_rawid = mcms.rawid 
                    AND mcms.rawid=dts.model_config_rawid                      
                    AND  (
                         (dts.spc_start_dtts >=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3') AND dts.spc_start_dtts<=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')) OR
                         (dts.spc_end_dtts>=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3') AND dts.spc_end_dtts<=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3'))
                        )
                    AND mms.AREA_RAWID=AMP.RAWID     
                    ORDER BY dts.spc_start_dtts";
                }

                if (llstData[Definition.DynamicCondition_Condition_key.AREA] != null)
                {
                    strWhere += string.Format(" AND amp.AREA  IN ({0})", llstData[Definition.DynamicCondition_Condition_key.AREA].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD] != null)
                {
                    strWhere += string.Format(" AND mcms.PARAM_TYPE_CD   = '{0}'", llstData[Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID] != null)
                {
                    strWhere += string.Format(" AND mcms.rawid  IN ({0})", llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString());
                }


                if (llstData[Definition.DynamicCondition_Condition_key.START_DTTS] != null)
                {
                    llstCondition.Add("START_DTTS", llstData[Definition.DynamicCondition_Condition_key.START_DTTS].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.END_DTTS] != null)
                {
                    llstCondition.Add("END_DTTS", llstData[Definition.DynamicCondition_Condition_key.END_DTTS].ToString());
                }


                ds = base.Query(string.Format(strSQL, strWhere), llstCondition);
            }
            catch
            {
            }

            return(ds);
        }
Exemplo n.º 38
0
        public override LinkedList GetParameter(LinkedList ll)
        {
            if (this._Initialization == null)
            {
            }

            string[] arrProductID = new string[this.bChkProduct.chkBox.CheckedItems.Count];
            string[] arrEQPValue  = new string[this.bchkEqpID.chkBox.CheckedItems.Count];



            for (int i = 0; i < this.bchkEqpID.chkBox.CheckedItems.Count; i++)
            {
                arrEQPValue[i] = bchkEqpID.chkBox.CheckedItems[i].ToString();
            }

            for (int i = 0; i < this.bChkProduct.chkBox.CheckedItems.Count; i++)
            {
                arrProductID[i] = bChkProduct.chkBox.CheckedItems[i].ToString();
            }



            GetModelConfigRawID();

            ll.Add(Definition.DynamicCondition_Search_key.OPERATION, DynamicDefinition.DynamicConditionSetting(this.sOperationID, this.sOperationID));
            ll.Add(Definition.DynamicCondition_Search_key.PARAM, DynamicDefinition.DynamicConditionSetting(this.sParamItem, this.sParamItem));
            ll.Add(Definition.DynamicCondition_Search_key.PRODUCT, DynamicDefinition.DynamicConditionSetting(arrProductID, arrProductID));
            ll.Add(Definition.DynamicCondition_Search_key.EQP_ID, DynamicDefinition.DynamicConditionSetting(arrEQPValue, arrEQPValue));
            if (lstModelConfigRawID.Count > 0)
            {
                ll.Add(Definition.DynamicCondition_Search_key.SPC_MODEL_CONFIG_RAWID, DynamicDefinition.DynamicConditionSetting(lstModelConfigRawID.ToArray(), lstModelConfigRawID.ToArray()));
            }

            ll.Add(Definition.DynamicCondition_Search_key.DATETIME_PERIOD, DynamicDefinition.DynamicConditionSetting(this.dateCondition1.DateType, this.dateCondition1.DateType));
            ll.Add(Definition.DynamicCondition_Search_key.DATETIME_FROM, this.dateCondition1.GetDateTimeSelectedValue("F"));
            ll.Add(Definition.DynamicCondition_Search_key.DATETIME_TO, this.dateCondition1.GetDateTimeSelectedValue("T"));
            ll.Add(Definition.DynamicCondition_Search_key.RESTRICT_SAMPLE_COUNT, DynamicDefinition.DynamicConditionSetting(this.restrict_sample_count.ToString(), this.restrict_sample_count.ToString()));
            ll.Add(Definition.DynamicCondition_Search_key.RESTRICT_SAMPLE_DAYS, DynamicDefinition.DynamicConditionSetting(this.restrict_sample_days.ToString(), this.restrict_sample_days.ToString()));

            if (_condition[Definition.DynamicCondition_Search_key.SEARCH_COUNT] != null)
            {
                iSearch = 1;
                ll.Add(Definition.DynamicCondition_Search_key.SEARCH_COUNT, DynamicDefinition.DynamicConditionSetting(iSearch.ToString(), iSearch.ToString()));
                return(ll);
            }

            ll.Add(Definition.DynamicCondition_Search_key.SEARCH_COUNT, DynamicDefinition.DynamicConditionSetting(iSearch.ToString(), iSearch.ToString()));
            _condition.Add(Definition.DynamicCondition_Search_key.SEARCH_COUNT, DynamicDefinition.DynamicConditionSetting(iSearch.ToString(), iSearch.ToString()));

            return(ll);
        }
Exemplo n.º 39
0
        private void PROC_BindOperation()
        {
            llstData.Clear();
            llstData.Add(Definition.DynamicCondition_Condition_key.LINE_RAWID, this.sLineRawid);
            llstData.Add(Definition.DynamicCondition_Condition_key.AREA_RAWID, this.sAreaRawid);
            if (!string.IsNullOrEmpty(this.sEqpModel))
            {
                llstData.Add(Definition.DynamicCondition_Condition_key.EQP_MODEL, this.sEqpModel);
            }

            llstData.Add(Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD, this.sParamType);
            DataSet ds = this._wsSPC.GetSPCOperation(llstData.GetSerialData());

            this.bcboOperation.Text = null;
            this.bcboOperation.Items.Clear();
            this._llstOperation.Clear();
            string sSelected = string.Empty;

            if (!DataUtil.IsNullOrEmptyDataSet(ds))
            {
                string sValue = string.Empty;
                string sKey   = string.Empty;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    sKey   = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.OPERATION_ID].ToString();
                    sValue = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.CODE_DESCRIPTION].ToString();

                    if (sKey == Definition.VARIABLE.STAR)
                    {
                        continue;
                    }
                    if (!this.bcboOperation.Items.Contains(sValue))
                    {
                        this.bcboOperation.Items.Add(sValue);
                        this._llstOperation.Add(sValue, sKey);

                        if (sKey == this.sOperationID)
                        {
                            this.bcboOperation.SelectedIndex = this.bcboOperation.Items.Count - 1;
                        }
                    }
                }

                if (this.bcboOperation.SelectedIndex == -1)
                {
                    this.bcboOperation.SelectedIndex = 0;
                }
            }
        }
Exemplo n.º 40
0
        /// <summary>
        /// It resolve dynamic resources
        /// </summary>
        /// <param name="resourceValue">Value of resource</param>
        /// <param name="descriptors">Array of descriptors</param>
        /// <returns>ServiceException</returns>
        public static String Resolve(String resourceValue, IDescriptor[] descriptors)
        {
            if (resourceValue == null)
            {
                return(resourceValue);
            }

            if (resourceValue.Contains(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFER_REFERENCE))
            {
                //Find {}
                int openingCurlyBracketIndex = resourceValue.IndexOf(Constants.RESOURCE_SPACE) + 1;

                int singleClosingCurlyBracketIndex = resourceValue.IndexOf(Constants.RESOURCE_CLOSE_CURLY_BRACKET);
                int doubleClosingCurlyBracketIndex = resourceValue.IndexOf(Constants.RESOURCE_CLOSE_CURLY_BRACKET + Constants.RESOURCE_CLOSE_CURLY_BRACKET);

                String resourceKey;

                if (doubleClosingCurlyBracketIndex != -1)
                {
                    resourceKey = resourceValue.Substring(openingCurlyBracketIndex, doubleClosingCurlyBracketIndex + 1);
                    int slashIndex = resourceKey.LastIndexOf(Constants.RESOURCE_SLASH);

                    //Find {-
                    String resourceClass = resourceKey.Substring(0, resourceKey.Substring(0, slashIndex).LastIndexOf(Constants.RESOURCE_DOT));
                    String resourceAPI   = resourceKey.Substring(resourceKey.Substring(0, slashIndex).LastIndexOf(Constants.RESOURCE_DOT) + 1, resourceKey.Substring(0, slashIndex).Length);

                    ICollection <Type>   resourceAPIParameterTypes = new LinkedList <Type>();
                    ICollection <String> resourceAPIParameters     = new LinkedList <String>();


                    //Find -}}
                    String apiParameters = resourceKey.Substring(slashIndex + 1, resourceKey.LastIndexOf(Constants.RESOURCE_CLOSE_CURLY_BRACKET) + 1);

                    //Resolve all API parameters
                    String[] apiParameterTokenizer = Regex.Split(apiParameters, Constants.RESOURCE_COMMA);

                    for (int i = 0; i < apiParameterTokenizer.Length; i++)
                    {
                        String apiParameter = apiParameterTokenizer[i];

                        resourceAPIParameterTypes.Add(typeof(String));
                        resourceAPIParameters.Add(Resolve(apiParameter, descriptors));
                    }


                    int    count             = 0;
                    Type[] apiParameterTypes = new Type[resourceAPIParameters.Count];
                    foreach (Type resourceAPIParameterType in resourceAPIParameterTypes)
                    {
                        apiParameterTypes[count++] = resourceAPIParameterType;
                    }


                    Object classObject   = ClassUtils.CreateClassInstance(resourceClass);
                    String resolvedValue = null;
                    try
                    {
                        resolvedValue = (String)ClassUtils.InvokeMethod(classObject, resourceAPI, apiParameterTypes, resourceAPIParameters.ToArray());
                    }
                    catch (SiminovException se)
                    {
                        Log.Error(typeof(ResourceUtils).Name, "Resolve", "SiminovException caught while invoking method, RESOURCE-API: " + resourceAPI + ", " + se.Message);
                        throw new ServiceException(typeof(ResourceUtils).Name, "Resolve", se.GetMessage());
                    }


                    return(Resolve(resolvedValue, descriptors));
                }
                else
                {
                    resourceKey = resourceValue.Substring(openingCurlyBracketIndex, singleClosingCurlyBracketIndex);
                    int dotIndex = resourceKey.LastIndexOf(Constants.RESOURCE_DOT);

                    String resourceClass = resourceKey.Substring(0, dotIndex);

                    String resourceAPI = resourceKey.Substring(resourceKey.LastIndexOf(Constants.RESOURCE_DOT) + 1, resourceKey.Length);

                    Object classObject = ClassUtils.CreateClassInstance(resourceClass);
                    String value       = null;
                    try
                    {
                        value = (String)ClassUtils.GetValue(classObject, resourceAPI);
                    }
                    catch (SiminovException se)
                    {
                        Log.Error(typeof(ResourceUtils).Name, "resolve", "SiminovException caught while getting values, RESOURCE-API: " + resourceAPI + ", " + se.GetMessage());
                        throw new ServiceException(typeof(ResourceUtils).Name, "resolve", se.GetMessage());
                    }


                    String resolvedValue = resourceValue.Replace(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFER_REFERENCE + Constants.RESOURCE_SPACE + resourceKey + Constants.RESOURCE_CLOSE_CURLY_BRACKET, value);
                    return(Resolve(resolvedValue, descriptors));
                }
            }
            else if (resourceValue.Contains(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_SELF_REFERENCE))
            {
                String key   = resourceValue.Substring(resourceValue.IndexOf(Constants.RESOURCE_SPACE) + 1, resourceValue.IndexOf(Constants.RESOURCE_CLOSE_CURLY_BRACKET));
                String value = null;


                foreach (IDescriptor descriptor in descriptors)
                {
                    if (descriptor.ContainProperty(key))
                    {
                        value = descriptor.GetProperty(key);
                        break;
                    }
                }

                return(Resolve(value, descriptors));
            }
            else if (resourceValue.Contains(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFERENCE))
            {
                String key   = resourceValue.Substring(resourceValue.IndexOf(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFERENCE) + (Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFERENCE).Length + 1, resourceValue.IndexOf(Constants.RESOURCE_CLOSE_CURLY_BRACKET) - (resourceValue.IndexOf(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFERENCE) + (Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFERENCE).Length + 1));
                String value = null;

                foreach (IDescriptor descriptor in descriptors)
                {
                    if (descriptor.ContainProperty(key))
                    {
                        value = descriptor.GetProperty(key);
                        break;
                    }
                }


                String resolvedValue = resourceValue.Replace(Constants.RESOURCE_OPEN_CURLY_BRACKET + Constants.RESOURCE_REFERENCE + " " + key + Constants.RESOURCE_CLOSE_CURLY_BRACKET, value);
                return(Resolve(resolvedValue, descriptors));
            }

            return(resourceValue);
        }
Exemplo n.º 41
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="device"></param>
 public void Add(IDevice device)
 {
     spinLock.Enter();
     devices.Add(device);
     spinLock.Exit();
 }
Exemplo n.º 42
0
 public void Add(IEventQueue queue)
 {
     _queues.Add(queue);
 }
Exemplo n.º 43
0
        public void Render()
        {
            var model    = ViewModel.Repository;
            var branches = ViewModel.Branches?.Count ?? 0;

            if (model == null)
            {
                return;
            }

            _stargazers.Text = model.StargazersCount.ToString();
            _watchers.Text   = model.SubscribersCount.ToString();
            _forks.Text      = model.ForksCount.ToString();

            Title = model.Name;
            ICollection <Section> sections = new LinkedList <Section>();

            sections.Add(new Section {
                _split
            });
            var sec1 = new Section();

            //Calculate the best representation of the size
            string size;

            if (model.Size / 1024f < 1)
            {
                size = string.Format("{0:0.##}KB", model.Size);
            }
            else if ((model.Size / 1024f / 1024f) < 1)
            {
                size = string.Format("{0:0.##}MB", model.Size / 1024f);
            }
            else
            {
                size = string.Format("{0:0.##}GB", model.Size / 1024f / 1024f);
            }

            _split1.Button1.Text = model.Private ? "Private" : "Public";
            _split1.Button2.Text = model.Language ?? "N/A";
            sec1.Add(_split1);

            _split2.Button1.Text = model.OpenIssues + (model.OpenIssues == 1 ? " Issue" : " Issues");
            _split2.Button2.Text = branches + (branches == 1 ? " Branch" : " Branches");
            sec1.Add(_split2);

            _split3.Button1.Text = (model.CreatedAt).ToString("MM/dd/yy");
            _split3.Button2.Text = size;
            sec1.Add(_split3);

            _ownerElement.Value = model.Owner.Login;
            sec1.Add(_ownerElement);

            if (model.Parent != null)
            {
                sec1.Add(_forkElement.Value);
            }

            var sec2 = new Section {
                _eventsElement
            };

            if (model.HasIssues)
            {
                sec2.Add(_issuesElement.Value);
            }

            if (ViewModel.Readme != null)
            {
                sec2.Add(_readmeElement.Value);
            }

            sections.Add(sec1);
            sections.Add(sec2);
            sections.Add(new Section {
                _commitsElement, _pullRequestsElement, _sourceElement
            });

            if (!string.IsNullOrEmpty(model.Homepage))
            {
                sections.Add(new Section {
                    _websiteElement.Value
                });
            }

            Root.Reset(sections);
        }
Exemplo n.º 44
0
        public DataSet GetSPCControlChartToDayData(byte[] baData, bool isATT)
        {
            DataSet ds = new DataSet();

            string strWhere       = string.Empty;
            string strSQL         = string.Empty;
            string strDataList    = string.Empty;
            string strContextList = string.Empty;

            try
            {
                LinkedList llstData      = new LinkedList();
                LinkedList llstCondition = new LinkedList();

                llstData.Add("PROPERTY", "TEMP_TRX_COL_CNT");
                strSQL = " SELECT PROPERTY_VALUE FROM CONFIG_PROPERTY_MST_PP WHERE PROPERTY_NAME = :PROPERTY ";
                DataSet dsTemp = base.Query(strSQL, llstData);

                if (dsTemp != null && dsTemp.Tables != null && dsTemp.Tables[0].Rows.Count > 0)
                {
                    try
                    {
                        int idxTemp = Convert.ToInt32(dsTemp.Tables[0].Rows[0][0].ToString());

                        if (idxTemp > 1)
                        {
                            strDataList    = "dtts.data_list,";
                            strContextList = "dtts.context_list,";

                            for (int i = 1; i < idxTemp; i++)
                            {
                                strDataList    += "dtts.data_list" + i.ToString() + ",";
                                strContextList += "dtts.context_list" + i.ToString() + ",";
                            }
                        }
                        else
                        {
                            strDataList    = "dtts.data_list,";
                            strContextList = "dtts.context_list,";
                        }
                    }
                    catch
                    {
                        strDataList    = "dtts.data_list,";
                        strContextList = "dtts.context_list,";
                    }
                }
                else
                {
                    strDataList    = "dtts.data_list,";
                    strContextList = "dtts.context_list,";
                }

                llstData.Clear();
                strSQL = "";

                llstData.SetSerialData(baData);

                if (isATT)
                {
                    strSQL =
                        @"SELECT   /*+ INDEX(dtts IDX_DATA_TEMP_TRX_SPC_PK)*/
					        mms.spc_model_name,
					        to_char(dtts.spc_data_dtts,'yyyy-MM-dd') AS WORKDATE,
					        mcms.rawid as model_config_rawid,
					        mcms.param_alias,  
					        mcms.main_yn,                                                        
					        mcoms.default_chart_list,
					        nvl(mcoms.RESTRICT_SAMPLE_DAYS,0) RESTRICT_SAMPLE_DAYS,
					        nvl(mcoms.RESTRICT_SAMPLE_COUNT,0) RESTRICT_SAMPLE_COUNT,
					        nvl(mcoms.RESTRICT_SAMPLE_HOURS,0) RESTRICT_SAMPLE_HOURS, 
					        to_char(dtts.spc_data_dtts, 'yyyy-mm-dd hh24:mi:ss.ddd') as TIME,      
					        {0} 
					        {1}
					        amp.area,
					        NVL(dtts.toggle_yn, 'N') toggle_yn
			        FROM  data_temp_trx_spc dtts 
				         ,model_config_att_mst_spc mcms
				         ,model_config_opt_att_mst_spc mcoms                     
				         ,model_att_mst_spc mms 
				         ,AREA_MST_PP amp
			        WHERE dtts.spc_data_dtts >=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
			        AND dtts.spc_data_dtts <=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
			        {2}
			        AND dtts.model_config_rawid = mcms.rawid                               
			        AND mcms.model_rawid=mms.rawid                
			        AND mcoms.model_config_rawid = mcms.rawid                 
			        AND mms.AREA_RAWID=AMP.RAWID     
			          "            ;
                }
                else
                {
                    strSQL =
                        @"SELECT   /*+ INDEX(dtts IDX_DATA_TEMP_TRX_SPC_PK)*/
                            mms.spc_model_name,
                            to_char(dtts.spc_data_dtts,'yyyy-MM-dd') AS WORKDATE,
                            mcms.rawid as model_config_rawid,
                            mcms.param_alias,
                            mcms.param_type_cd,
                            NVL (mcms.complex_yn, 'N') AS complex_yn,   
                            mcms.main_yn,                                                        
                            mcoms.default_chart_list,
                            nvl(mcoms.RESTRICT_SAMPLE_DAYS,0) RESTRICT_SAMPLE_DAYS,
                            nvl(mcoms.RESTRICT_SAMPLE_COUNT,0) RESTRICT_SAMPLE_COUNT,
                            nvl(mcoms.RESTRICT_SAMPLE_HOURS,0) RESTRICT_SAMPLE_HOURS, 
                            to_char(dtts.spc_data_dtts, 'yyyy-mm-dd hh24:mi:ss.ddd') as TIME,      
                            {0} 
                            {1}
                            amp.area,
                            NVL(dtts.toggle_yn, 'N') toggle_yn
                    FROM  data_temp_trx_spc dtts 
                         ,model_config_mst_spc mcms
                         ,model_config_opt_mst_spc mcoms                     
                         ,model_mst_spc mms 
                         ,AREA_MST_PP amp
                    WHERE dtts.spc_data_dtts >=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
                    AND dtts.spc_data_dtts <=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
                    {2}
                    AND dtts.model_config_rawid = mcms.rawid                               
                    AND mcms.model_rawid=mms.rawid                
                    AND mcoms.model_config_rawid = mcms.rawid                 
                    AND mms.AREA_RAWID=AMP.RAWID     
                      ";
                }

                if (llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID] != null)
                {
                    if (llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString().Split(',').Length > 1)
                    {
                        strWhere = string.Format(" AND dtts.model_config_rawid  IN ({0})", llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString());
                    }
                    else
                    {
                        strWhere = " AND dtts.model_config_rawid  = :model_config_rawid ";
                        llstCondition.Add("model_config_rawid", llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString());
                    }
                }

                if (llstData[Definition.DynamicCondition_Condition_key.START_DTTS] != null)
                {
                    llstCondition.Add("START_DTTS", llstData[Definition.DynamicCondition_Condition_key.START_DTTS].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.END_DTTS] != null)
                {
                    llstCondition.Add("END_DTTS", llstData[Definition.DynamicCondition_Condition_key.END_DTTS].ToString());
                }

                ds = base.Query(string.Format(strSQL, strContextList, strDataList, strWhere), llstCondition);
            }
            catch (Exception ex)
            {
            }

            return(ds);
        }
Exemplo n.º 45
0
        static void Main(string[] args)
        {
            Console.WriteLine("*********Create new list*************");
            var list = new LinkedList <string>()
            {
                "item1", "item2", "item3"
            };

            foreach (var element in list)
            {
                Console.Write($"{element} ");
            }

            Console.WriteLine("\n****Added item4****");
            list.Add("item4");
            foreach (var element in list)
            {
                Console.Write($"{element} ");
            }

            Console.WriteLine("\n****Added item0 to the begining****");
            list.AddAt("item0", 0);
            foreach (var element in list)
            {
                Console.Write($"{element} ");
            }

            Console.WriteLine("\n****Removed first item0 ****");
            list.RemoveAt(0);
            foreach (var element in list)
            {
                Console.Write($"{element} ");
            }

            Console.WriteLine("\n****Removed item2 ****");

            list.Remove("item2");
            foreach (var element in list)
            {
                Console.Write($"{element} ");
            }
            Console.WriteLine("\n****Element and their position****");
            for (int i = 0; i < list.Length; i++)
            {
                Console.WriteLine($"{list.ElementAt(i)} at {i} position ");
            }

            Console.WriteLine("*********Create new hash table*************");

            var hashtable = new HashTable(5);

            hashtable.Add("1", "testString1");
            hashtable.Add("2", "testString2");
            hashtable.Add("3", "testString3");

            for (int i = 0; i < hashtable.Size; i++)
            {
                Console.WriteLine(hashtable[i]);
            }

            Console.WriteLine($"Hashtable contains '2' key - {hashtable.Contains("2")}");
            Console.WriteLine($"Hashtable contains '4' key - {hashtable.Contains("4")}");

            object value;
            var    result = hashtable.TryGet("1", out value);

            Console.WriteLine($"Hashtable contains '1' key - {hashtable.Contains("4")} with {value} value");

            Console.ReadKey();
        }
Exemplo n.º 46
0
        protected override void DrawChartWithRawSeriesInfo()
        {
            SeriesInfo   si        = null;
            ChartUtility chartUtil = new ChartUtility();
            DataTable    dtTemp    = new DataTable();
            ArrayList    arrTemp   = new ArrayList();
            Type         tempType  = null;
            LinkedList   lnkList   = new LinkedList();

            if (this.dtDataSource.Rows.Count == 0)
            {
                return;
            }

            for (int i = 0; i < this.dtDataSource.Columns.Count; i++)
            {
                string seriesName     = this.dtDataSource.Columns[i].ColumnName;
                string seriesNameTemp = this.dtDataSource.Columns[i].ColumnName.Split('^')[0];

                if (seriesName == CommonChart.COLUMN_NAME_SEQ_INDEX)
                {
                    tempType = this.dtDataSource.Rows[0][i].GetType();
                }
                else if (lstRawColumn.Contains(seriesName))
                {
                    if (dtTemp.Columns.Contains(seriesNameTemp))
                    {
                        continue;
                    }
                    else if (!lnkList.Contains(seriesNameTemp))
                    {
                        dtTemp = new DataTable();
                        dtTemp.Columns.Add(CommonChart.COLUMN_NAME_SEQ_INDEX, tempType);
                        for (int k = 0; k < this.dtDataSource.Rows.Count; k++)
                        {
                            if (this.dtDataSource.Rows[k][i] != null && this.dtDataSource.Rows[k][i].ToString().Length > 0)
                            {
                                dtTemp.Columns.Add(seriesNameTemp, this.dtDataSource.Rows[k][i].GetType());
                                break;
                            }
                        }
                        lnkList.Add(seriesNameTemp, dtTemp.Clone());
                        arrTemp.Add(seriesNameTemp);
                    }
                }
            }

            if (lnkList.Count > 0)
            {
                for (int i = 0; i < arrTemp.Count; i++)
                {
                    DataRow   dr = null;
                    DataTable dt = new DataTable();
                    dt = ((DataTable)lnkList[arrTemp[i].ToString()]).Clone();
                    if (dt.Columns.Count > 1)
                    {
                        string sTempColumnName = dt.Columns[1].ColumnName;

                        for (int j = 0; j < this.dtDataSource.Rows.Count; j++)
                        {
                            for (int k = 0; k < this.dtDataSource.Columns.Count; k++)
                            {
                                if (this.dtDataSource.Columns[k].ColumnName.Split('^')[0] == sTempColumnName)
                                {
                                    if (this.dtDataSource.Rows[j][k] != null && this.dtDataSource.Rows[j][k].ToString().Length > 0)
                                    {
                                        dr    = dt.NewRow();
                                        dr[0] = dtDataSource.Rows[j][CommonChart.COLUMN_NAME_SEQ_INDEX];;
                                        dr[1] = dtDataSource.Rows[j][k];
                                        dt.Rows.Add(dr);
                                    }
                                }
                            }
                        }
                        lnkList.Remove(arrTemp[i].ToString());
                        lnkList.Add(arrTemp[i].ToString(), dt);
                    }
                }

                int jcolor = 0;

                for (int i = 0; i < arrTemp.Count; i++)
                {
                    si             = new SeriesInfo(typeof(Line), arrTemp[i].ToString(), ((DataTable)lnkList[arrTemp[i].ToString()]), CommonChart.COLUMN_NAME_SEQ_INDEX, arrTemp[i].ToString());
                    si.SeriesColor = chartUtil.GetSeriesColor(i);
                    if (si.SeriesColor == Color.Red || si.SeriesColor == Color.Black)
                    {
                        jcolor++;
                        si.SeriesColor = chartUtil.GetSeriesColor(jcolor);
                    }
                    this.DrawChart(si);
                    jcolor++;
                }
            }
            //si = new SeriesInfo(typeof(Line), seriesName, this.dtDataSource, CommonChart.COLUMN_NAME_SEQ_INDEX, seriesName);


            //switch (seriesName)
            //{
            //    case Definition.CHART_COLUMN.UCL: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.UCL); break;
            //    case Definition.CHART_COLUMN.LCL: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.LCL); break;
            //    case Definition.CHART_COLUMN.LSL: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.LSL); break;
            //    case Definition.CHART_COLUMN.USL: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.USL); break;
            //    case Definition.CHART_COLUMN.MIN: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.MIN); break;
            //    case Definition.CHART_COLUMN.MAX: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.MAX); break;
            //    case Definition.CHART_COLUMN.TARGET: si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.TARGET); break;
            //    default:
            //        if ((seriesName == Definition.CHART_COLUMN.RAW)
            //           || (seriesName == Definition.CHART_COLUMN.STDDEV)
            //           || (seriesName == Definition.CHART_COLUMN.AVG)
            //           || (seriesName == Definition.CHART_COLUMN.RANGE)
            //           || (seriesName == Definition.CHART_COLUMN.MA)
            //           || (seriesName == Definition.CHART_COLUMN.MSD)
            //           || (seriesName == Definition.CHART_COLUMN.MEAN)
            //           || (seriesName == Definition.CHART_COLUMN.EWMAMEAN)
            //           || (seriesName == Definition.CHART_COLUMN.EWMARANGE)
            //           || (seriesName == Definition.CHART_COLUMN.EWMASTDDEV))
            //        {
            //            si.SeriesColor = chartUtil.GetSeriesColor((int)ChartUtility.CHAERT_SERIES_COLOR.AVG);
            //        }
            //        else
            //            si.SeriesColor = chartUtil.GetSeriesColor(iCount++);

            //        break;
            //}
            //this.DrawChart(si);
            //}
        }
Exemplo n.º 47
0
        public virtual VideoMode[] GetLWJGLModeList()
        {
            VideoMode[] modes;
            try
            {
                modes = Display.GetAvailableDisplayModes();
            }
            catch (LWJGLException e)
            {
                Com.Println(e.GetMessage());
                return(new VideoMode[0]);
            }

            LinkedList l = new LinkedList();

            l.Add(oldDisplayMode);
            for (int i = 0; i < modes.length; i++)
            {
                VideoMode m = modes[i];
                if (m.GetBitsPerPixel() != oldDisplayMode.GetBitsPerPixel())
                {
                    continue;
                }
                if (m.GetFrequency() > Math.Max(60, oldDisplayMode.GetFrequency()))
                {
                    continue;
                }
                if (m.GetHeight() < 240 || m.GetWidth() < 320)
                {
                    continue;
                }
                if (m.GetHeight() > oldDisplayMode.GetHeight() || m.GetWidth() > oldDisplayMode.GetWidth())
                {
                    continue;
                }
                int       j  = 0;
                VideoMode ml = null;
                for (j = 0; j < l.Size(); j++)
                {
                    ml = (VideoMode)l.Get(j);
                    if (ml.GetWidth() > m.GetWidth())
                    {
                        break;
                    }
                    if (ml.GetWidth() == m.GetWidth() && ml.GetHeight() >= m.GetHeight())
                    {
                        break;
                    }
                }

                if (j == l.Size())
                {
                    l.AddLast(m);
                }
                else if (ml.GetWidth() > m.GetWidth() || ml.GetHeight() > m.GetHeight())
                {
                    l.Add(j, m);
                }
                else if (m.GetFrequency() > ml.GetFrequency())
                {
                    l.Remove(j);
                    l.Add(j, m);
                }
            }

            VideoMode[] ma = new VideoMode[l.Size()];
            l.ToArray(ma);
            return(ma);
        }
Exemplo n.º 48
0
        private void AddSubModuleNode(TreeNode tnCurrent, string rawid)
        {
            try
            {
                if (rawid == this.EqpID)
                {
                    return;
                }

                LinkedList llstData = new LinkedList();

                llstData.Add(Definition.DynamicCondition_Condition_key.LINE_RAWID, this.LineRawid);
                llstData.Add(Definition.DynamicCondition_Condition_key.AREA_RAWID, this.AreaRawid);
                llstData.Add(Definition.DynamicCondition_Condition_key.EQP_ID, this.EqpID);
                llstData.Add(Definition.DynamicCondition_Condition_key.DCP_ID, this.DcpID);
                llstData.Add(Definition.DynamicCondition_Condition_key.MODULE_ID, rawid);

                byte[]  baData = llstData.GetSerialData();
                DataSet ds     = _wsSPC.GetSubModuleByEQP(baData);

                if (ds == null || ds.Tables.Count <= 0)
                {
                    return;
                }

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string sRawid          = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.RAWID].ToString();
                    string sModule         = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.ALIAS].ToString();
                    string sModuleID       = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.MODULE_ID].ToString();
                    string sParentModuleID = ds.Tables[0].Rows[i]["parent_moduleid"].ToString();
                    string sLevel          = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.MODULE_LEVEL].ToString();

                    BTreeNode btn = TreeDCUtil.CreateBTreeNode(Definition.DynamicCondition_Search_key.MODULE + "_" + sLevel, sModuleID, sModule);
                    btn.IsVisibleCheckBox = this.IsShowCheck;
                    btn.IsFolder          = false;
                    btn.IsVisibleNodeType = true;
                    btn.ImageIndexList.Add((int)ImageLoader.TREE_IMAGE_INDEX.MODULE);
                    btn.ImageIndex = (int)ImageLoader.TREE_IMAGE_INDEX.MODULE;

                    DCValueOfTree dcValue = TreeDCUtil.GetDCValue(btn);
                    dcValue.AdditionalValue.Add(Definition.DynamicCondition_Search_key.ADDTIONALVALUEDATA, sRawid);


                    if (this.IsLastNode)
                    {
                        llstData[Definition.DynamicCondition_Condition_key.MODULE_ID] = sModuleID;
                        byte[]  data        = llstData.GetSerialData();
                        DataSet dsSubModule = _wsSPC.GetSubModuleByEQP(data);
                        if (dsSubModule != null && dsSubModule.Tables.Count > 0 && dsSubModule.Tables[0].Rows.Count > 0)
                        {
                            btn.Nodes.Add(BTreeView.CreateDummyNode());
                        }
                    }
                    else
                    {
                        btn.Nodes.Add(BTreeView.CreateDummyNode());
                    }

                    tnCurrent.Nodes.Add(btn);
                }
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPName, ex);
            }
        }
Exemplo n.º 49
0
        public void Main()
        {
            // Construct hashed array list using collection initializer
            var list = new LinkedList <int> {
                2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59
            };

            // Chose from list
            list.Choose();

            var array = new int[list.Count];

            // Copy list to array
            list.CopyTo(array, 0);

            // Add item to the end of list
            list.Add(61);

            // Add range to list
            array = new[] { 67, 71, 73, 79, 83 };
            list.AddRange(array);

            // Check if list contains an item
            list.Contains(list.Choose());

            // Check if list contains all items in enumerable
            list.ContainsRange(array);

            // Count all occuerence of an item
            list.CountDuplicates(list.Choose());

            // Find an item in list
            var itemToFind = list.Last;

            list.Find(ref itemToFind);

            // Return all occurence of an item
            list.FindDuplicates(itemToFind);

            // Remove within range
            list.RemoveIndexRange(0, 3);

            var range = new[] { list.First, list.Last };

            // Remove all items in enumerable from list
            list.RemoveRange(range);

            // Retain all items in enumarable from list
            list.RetainRange(list.ToArray());

            var lastItem = list.Last;

            // Find last index of an item
            list.LastIndexOf(lastItem);

            // Insert at the end of list
            list.InsertLast(100);

            // Insert at the beginning of list
            list.InsertFirst(-100);

            // Reverse list
            list.Reverse();

            // Shuffle list
            list.Shuffle();

            // Sort list
            list.Sort();

            // Check if list is sorted
            var isSorted = list.IsSorted();

            // Print all items in list by indexer
            var index = 0;

            foreach (var item in list)
            {
                Console.WriteLine($"list[{index++}] = {item}");
            }

            // Clear list
            list.Clear();
        }
Exemplo n.º 50
0
 public void LinkedListAddTest()
 {
     list.Add(243);
 }
Exemplo n.º 51
0
 public void AddElementLinkedList()
 {
     list.Add(56);
     list.Add(30);
     list.Add(70);
 }
Exemplo n.º 52
0
        public virtual void Sort <T>(
            T[] array,
            long left,
            long right)
            where T : IComparable
        {
            if (array == null)
            {
                return;
            }

            if (left < zero)
            {
                return;
            }

            if (right < zero)
            {
                return;
            }

            if (left >= right)
            {
                return;
            }

            if (left > array.Length - one)
            {
                return;
            }

            if (right > array.Length - one)
            {
                return;
            }

            ICollection <long> closedRights
                = new LinkedList <long>();

beginSort:
            long lowIndex = left, highIndex = right;
            long pivotIndex;

            checked
            {
                pivotIndex = left + right;
            }

            pivotIndex >>= one;
            var pivot = array[pivotIndex];

            while (lowIndex <= highIndex)
            {
                while (array[lowIndex].CompareTo(pivot) < zero)
                {
                    ++lowIndex;
                }

                while (array[highIndex].CompareTo(pivot) > zero)
                {
                    --highIndex;
                }

                if (lowIndex > highIndex)
                {
                    break;
                }

                var lowSwap = array[lowIndex];
                array[lowIndex]  = array[highIndex];
                array[highIndex] = lowSwap;

                ++lowIndex;
                --highIndex;
            }

            if (left < highIndex)
            {
                closedRights.Add(right);
                right = highIndex;
                goto beginSort;
            }

            if (lowIndex < right)
            {
                left = lowIndex;
                goto beginSort;
            }

            foreach (var closedRight in closedRights)
            {
                if (lowIndex >= closedRight)
                {
                    continue;
                }

                left  = lowIndex;
                right = closedRight;
                closedRights.Remove(closedRight);
                goto beginSort;
            }
        }
Exemplo n.º 53
0
        private void CreateMenuRoot()
        {
            var username = ViewModel.Account.Username;

            Title = username;
            ICollection <Section> sections = new LinkedList <Section>();

            sections.Add(new Section
            {
                new MenuElement("Profile", () => ViewModel.GoToProfileCommand.Execute(null), Octicon.Person.ToImage()),
                (_notifications = new MenuElement("Notifications", () => ViewModel.GoToNotificationsCommand.Execute(null), Octicon.Inbox.ToImage())
                {
                    NotificationNumber = ViewModel.Notifications
                }),
                new MenuElement("News", () => ViewModel.GoToNewsCommand.Execute(null), Octicon.RadioTower.ToImage()),
                new MenuElement("Issues", () => ViewModel.GoToMyIssuesCommand.Execute(null), Octicon.IssueOpened.ToImage())
            });

            Uri avatarUri;

            Uri.TryCreate(ViewModel.Account.AvatarUrl, UriKind.Absolute, out avatarUri);

            var eventsSection = new Section {
                HeaderView = new MenuSectionView("Events")
            };

            eventsSection.Add(new MenuElement(username, () => ViewModel.GoToMyEvents.Execute(null), Octicon.Rss.ToImage(), avatarUri));
            if (ViewModel.Organizations != null && ViewModel.Account.ShowOrganizationsInEvents)
            {
                foreach (var org in ViewModel.Organizations)
                {
                    Uri.TryCreate(org.AvatarUrl, UriKind.Absolute, out avatarUri);
                    eventsSection.Add(new MenuElement(org.Login, () => ViewModel.GoToOrganizationEventsCommand.Execute(org.Login), Octicon.Rss.ToImage(), avatarUri));
                }
            }
            sections.Add(eventsSection);

            var repoSection = new Section()
            {
                HeaderView = new MenuSectionView("Repositories")
            };

            repoSection.Add(new MenuElement("Owned", GoToOwnedRepositories, Octicon.Repo.ToImage()));
            repoSection.Add(new MenuElement("Starred", GoToStarredRepositories, Octicon.Star.ToImage()));
            repoSection.Add(new MenuElement("Trending", GoToTrendingRepositories, Octicon.Pulse.ToImage()));
            repoSection.Add(new MenuElement("Search", GoToSearch, Octicon.Search.ToImage()));
            sections.Add(repoSection);

            if (ViewModel.PinnedRepositories.Any())
            {
                _favoriteRepoSection = new Section {
                    HeaderView = new MenuSectionView("Favorite Repositories")
                };
                foreach (var pinnedRepository in ViewModel.PinnedRepositories)
                {
                    var element = new PinnedRepoElement(pinnedRepository);
                    element.Clicked.Subscribe(_ => GoToRepository(pinnedRepository.Owner, pinnedRepository.Name));
                    _favoriteRepoSection.Add(element);
                }

                sections.Add(_favoriteRepoSection);
            }
            else
            {
                _favoriteRepoSection = null;
            }

            var orgSection = new Section()
            {
                HeaderView = new MenuSectionView("Organizations")
            };

            if (ViewModel.Organizations != null && ViewModel.Account.ExpandOrganizations)
            {
                foreach (var org in ViewModel.Organizations)
                {
                    Uri.TryCreate(org.AvatarUrl, UriKind.Absolute, out avatarUri);
                    orgSection.Add(new MenuElement(org.Login, () => ViewModel.GoToOrganizationCommand.Execute(org.Login), Images.Avatar, avatarUri));
                }
            }
            else
            {
                orgSection.Add(new MenuElement("Organizations", () => ViewModel.GoToOrganizationsCommand.Execute(null), Octicon.Organization.ToImage()));
            }

            //There should be atleast 1 thing...
            if (orgSection.Elements.Count > 0)
            {
                sections.Add(orgSection);
            }

            var gistsSection = new Section()
            {
                HeaderView = new MenuSectionView("Gists")
            };

            gistsSection.Add(new MenuElement("My Gists", GoToOwnedGists, Octicon.Gist.ToImage()));
            gistsSection.Add(new MenuElement("Starred", GoToStarredGists, Octicon.Star.ToImage()));
            gistsSection.Add(new MenuElement("Public", GoToPublicGists, Octicon.Globe.ToImage()));
            sections.Add(gistsSection);
//
            var infoSection = new Section()
            {
                HeaderView = new MenuSectionView("Info & Preferences")
            };

            sections.Add(infoSection);
            infoSection.Add(new MenuElement("Settings", () => ViewModel.GoToSettingsCommand.Execute(null), Octicon.Gear.ToImage()));

            if (ViewModel.ShouldShowUpgrades)
            {
                infoSection.Add(new MenuElement("Upgrades", GoToUpgrades, Octicon.Lock.ToImage()));
            }

            infoSection.Add(new MenuElement("Feedback & Support", GoToSupport, Octicon.CommentDiscussion.ToImage()));
            infoSection.Add(new MenuElement("Accounts", ProfileButtonClicked, Octicon.Person.ToImage()));

            Root.Reset(sections);
        }
Exemplo n.º 54
0
        public DataSet GetSPCChartViewSumTempData(byte[] baData, bool isATT)
        {
            DataSet ds = new DataSet();

            string strWhere = string.Empty;
            string strSQL   = string.Empty;

            try
            {
                LinkedList llstData      = new LinkedList();
                LinkedList llstCondition = new LinkedList();
                llstData.SetSerialData(baData);

                if (isATT)
                {
                    strSQL =
                        @"SELECT   
					        mms.spc_model_name,
					        to_char(dstts.spc_data_dtts,'yyyy-MM-dd') AS WORKDATE,
					        mcms.rawid as model_config_rawid,
					        mcms.param_alias, 
					        mcms.main_yn,                                                        
					        mcoms.default_chart_list,
					        nvl(mcoms.RESTRICT_SAMPLE_DAYS,0) RESTRICT_SAMPLE_DAYS,
					        nvl(mcoms.RESTRICT_SAMPLE_COUNT,0) RESTRICT_SAMPLE_COUNT,
					        nvl(mcoms.RESTRICT_SAMPLE_HOURS, 0) RESTRICT_SAMPLE_HOURS,  
					        to_char(dstts.spc_data_dtts, 'yyyy-mm-dd hh24:mi:ss.ddd') as TIME,      
					        dstts.context_list, 
					        dstts.param_value data_list,
					        dstts.raw_ocap_list raw_ocap_list,
					        amp.area, '' toggle_yn, '' ocap_rawid
			        FROM  data_sum_tmp_trx_spc dstts 
				         ,model_config_att_mst_spc mcms
				         ,model_config_opt_att_mst_spc mcoms                     
				         ,model_att_mst_spc mms 
				         ,AREA_MST_PP amp
			        WHERE dstts.spc_data_dtts >=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
			        AND dstts.spc_data_dtts <=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
			        {0}
			        AND dstts.model_config_rawid = mcms.rawid                               
			        AND mcms.model_rawid=mms.rawid                
			        AND mcoms.model_config_rawid = mcms.rawid                 
			        AND mms.AREA_RAWID=AMP.RAWID     
			          "            ;
                }
                else
                {
                    strSQL =
                        @"SELECT   
                            mms.spc_model_name,
                            to_char(dstts.spc_data_dtts,'yyyy-MM-dd') AS WORKDATE,
                            mcms.rawid as model_config_rawid,
                            mcms.param_alias,
                            mcms.param_type_cd,
                            NVL (mcms.complex_yn, 'N') AS complex_yn,   
                            mcms.main_yn,                                                        
                            mcoms.default_chart_list,
                            nvl(mcoms.RESTRICT_SAMPLE_DAYS,0) RESTRICT_SAMPLE_DAYS,
                            nvl(mcoms.RESTRICT_SAMPLE_COUNT,0) RESTRICT_SAMPLE_COUNT,
                            nvl(mcoms.RESTRICT_SAMPLE_HOURS, 0) RESTRICT_SAMPLE_HOURS,  
                            to_char(dstts.spc_data_dtts, 'yyyy-mm-dd hh24:mi:ss.ddd') as TIME,      
                            dstts.context_list, 
                            dstts.param_value data_list,
                            dstts.raw_ocap_list raw_ocap_list,
                            amp.area, '' toggle_yn, '' ocap_rawid
                    FROM  data_sum_tmp_trx_spc dstts 
                            ,model_config_mst_spc mcms
                            ,model_config_opt_mst_spc mcoms                     
                            ,model_mst_spc mms 
                            ,AREA_MST_PP amp
                    WHERE dstts.spc_data_dtts >=TO_TIMESTAMP(:START_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
                    AND dstts.spc_data_dtts <=TO_TIMESTAMP(:END_DTTS,'yyyy-MM-dd HH24:MI:SS.FF3')
                    {0}
                    AND dstts.model_config_rawid = mcms.rawid                               
                    AND mcms.model_rawid=mms.rawid                
                    AND mcoms.model_config_rawid = mcms.rawid                 
                    AND mms.AREA_RAWID=AMP.RAWID     
                        ";
                }

                if (llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID] != null)
                {
                    if (llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString().Split(',').Length > 1)
                    {
                        strWhere = string.Format(" AND dstts.model_config_rawid  IN ({0})", llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString());
                    }
                    else
                    {
                        strWhere = " AND dstts.model_config_rawid  = :model_config_rawid ";
                        llstCondition.Add("model_config_rawid", llstData[Definition.DynamicCondition_Condition_key.MODEL_CONFIG_RAWID].ToString());
                    }
                }

                if (llstData[Definition.DynamicCondition_Condition_key.START_DTTS] != null)
                {
                    llstCondition.Add("START_DTTS", llstData[Definition.DynamicCondition_Condition_key.START_DTTS].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.END_DTTS] != null)
                {
                    llstCondition.Add("END_DTTS", llstData[Definition.DynamicCondition_Condition_key.END_DTTS].ToString());
                }

                ds = base.Query(string.Format(strSQL, strWhere), llstCondition);
            }
            catch (Exception ex)
            {
            }

            return(ds);
        }
Exemplo n.º 55
0
        public void Run()
        {
            // Options for the users to pick from
            Console.WriteLine();
            Console.WriteLine("Choose any of the following options");
            Console.WriteLine("1. Press 1 to Add values");
            Console.WriteLine("2. Press 2 to Remove");
            Console.WriteLine("3. Press 3 to Search");
            Console.WriteLine("4. Press 4 to get the Index of a value");       // Menu for users to pick from
            Console.WriteLine("5. Press 5 to Check for a value if it exists");
            Console.WriteLine("6. Press 6 to Check if the linkedList isEmpty");
            Console.WriteLine("7. Press 7 to get the Size of the linkedList");
            Console.WriteLine("8. Press 8 to  InsertAt a particular index");
            Console.WriteLine("9. Press 9 to Display the LinkedList");
            Console.WriteLine("Press q to go to the main menu");

            Console.WriteLine();
            var option = Console.ReadLine(); // Storing the option selected by the user

            Console.WriteLine();
            if (option == "1")
            {
                Console.WriteLine();
                Console.WriteLine("Enter values separate values with commas");
                Console.WriteLine();
                var values = Console.ReadLine().Split(",");
                foreach (var item in values)
                {
                    linkedList.Add(item); // Adds an item to the linkedList via the add method
                }
            }
            if (option == "2")
            {
                Console.WriteLine("Enter value you want to remove");
                string value = Console.ReadLine(); // Gets the value to be removed from the user
                linkedList.Remove(value);          // Calling the remove method of the linked-list class to remove a value
            }
            if (option == "3")
            {
                Console.WriteLine("Enter value you want to search for");
                string value = Console.ReadLine(); // Gets the value to be search for from the user
                linkedList.Search(value);          // Calling the search method of the linked-list class and passing the value to be search for
            }
            if (option == "4")
            {
                Console.WriteLine("Enter the value you want the index of");
                string value = Console.ReadLine();                              // Gets the value from the user
                Console.WriteLine("The index is " + linkedList.IndexOf(value)); // Return the Index using the indexOf method of the linked-list class
            }
            if (option == "5")
            {
                Console.WriteLine("Enter value you want to check for"); // Gets the value to be checked for from the user
                string value = Console.ReadLine();
                Console.WriteLine(linkedList.Check(value));             // Returns the value to be checked for if its exist
            }
            if (option == "6")
            {
                Console.WriteLine(linkedList.isEmpty()); // Returns a boolean if the linked-list is empty via the isEmpty method of the linked-list class
            }
            if (option == "7")
            {
                Console.WriteLine("Size is " + linkedList.Size()); // Returns the size of the linked-list
            }
            if (option == "8")
            {
                Console.WriteLine("Enter index followed by the value you want to insert separate value with commas");
                string[] values = Console.ReadLine().Split(",");      // Gets the index and the value from the user
                linkedList.InsertAt(int.Parse(values[0]), values[1]); /*** Sends the first index and the second index of
                                                                       * the values array into the insertAt method of
                                                                       * the linked list class ***/
            }
            if (option == "9")
            {
                Console.WriteLine(linkedList.Print()); // Print all the values in the linked list
            }
            if (option == "q")
            {
                Program.StartProgram(); // Restarts the program
            }
        }
Exemplo n.º 56
0
        public DataSet GetSPCSpecAndRuleOfHistory(string modelConfigRawID, string[] versions, bool isATT)
        {
            DataSet dsReturn = new DataSet();
            DataSet temp     = new DataSet();

            string modelMstTblName          = string.Empty;
            string modelConfigMstTblName    = string.Empty;
            string modelConfigMsthTblName   = string.Empty;
            string modelRuleMstTblName      = string.Empty;
            string modelRuleMsthTblName     = string.Empty;
            string modelAutoCalcMstTblname  = string.Empty;
            string modelAutoCalcMsthTblName = string.Empty;

            if (isATT)
            {
                modelMstTblName          = TABLE.MODEL_ATT_MST_SPC;
                modelConfigMstTblName    = TABLE.MODEL_CONFIG_ATT_MST_SPC;
                modelConfigMsthTblName   = TABLE.MODEL_CONFIG_ATT_MSTH_SPC;
                modelRuleMstTblName      = TABLE.MODEL_RULE_ATT_MST_SPC;
                modelRuleMsthTblName     = TABLE.MODEL_RULE_ATT_MSTH_SPC;
                modelAutoCalcMstTblname  = TABLE.MODEL_AUTOCALC_ATT_MST_SPC;
                modelAutoCalcMsthTblName = TABLE.MODEL_AUTOCALC_ATT_MSTH_SPC;
            }
            else
            {
                modelMstTblName          = TABLE.MODEL_MST_SPC;
                modelConfigMstTblName    = TABLE.MODEL_CONFIG_MST_SPC;
                modelConfigMsthTblName   = TABLE.MODEL_CONFIG_MSTH_SPC;
                modelRuleMstTblName      = TABLE.MODEL_RULE_MST_SPC;
                modelRuleMsthTblName     = TABLE.MODEL_RULE_MSTH_SPC;
                modelAutoCalcMstTblname  = TABLE.MODEL_AUTOCALC_MST_SPC;
                modelAutoCalcMsthTblName = TABLE.MODEL_AUTOCALC_MSTH_SPC;
            }

            //KBLEE, 2014.08 refactoring 전에 전역변수였음, start
            string modelConfigMsthSpcQuery =
                "SELECT * " +
                " FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                "       FROM " + modelConfigMsthTblName + " a " +
                "       WHERE Rawid = :RAWID " +
                "       AND version = :VERSION) " +
                " WHERE RNK = 1 ";

            string modelRuleMsthSpcQuery =
                "SELECT * " +
                " FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                "       FROM " + modelRuleMsthTblName + " a " +
                "       WHERE model_config_rawid = :RAWID " +
                "       AND version = :VERSION) " +
                " WHERE RNK = 1 ";

            string modelAutocalcMsthSpcQuery =
                "SELECT * " +
                " FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                "       FROM " + modelAutoCalcMsthTblName + " a " +
                "       WHERE model_config_rawid = :RAWID " +
                "       AND version = :VERSION) " +
                " WHERE RNK = 1 ";

            string ChartVWSpcQuery =
                "SELECT mcms.rawid as CHART_ID, mst.SPC_MODEL_NAME, mcms.MAIN_YN, history.VERSION " +
                " FROM " + modelMstTblName + " mst, " + modelConfigMstTblName + " mcms, " +
                "      (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                "       FROM " + modelConfigMsthTblName + " a " +
                "       WHERE rawid = :RAWID " +
                "       AND version = :VERSION) history " +
                " WHERE mst.RAWID = mcms.MODEL_RAWID AND history.rawid = mcms.rawid AND (mcms.rawid = :RAWID) ";

            //KBLEE, 2014.08 refactoring 전에 전역변수였음, end

            // CHART_VW_SPC
            foreach (string s in versions)
            {
                LinkedList llWhereFieldData = new LinkedList();
                llWhereFieldData.Add("RAWID", modelConfigRawID);
                llWhereFieldData.Add("VERSION", s);

                temp = this.Query(ChartVWSpcQuery, llWhereFieldData);
                temp.Tables[0].TableName = TABLE.CHART_VW_SPC;
                dsReturn.Merge(temp);
            }

            // MODEL_CONFIG_MSTH_SPC
            foreach (string s in versions)
            {
                LinkedList llWhereFieldData = new LinkedList();
                llWhereFieldData.Add("RAWID", modelConfigRawID);
                llWhereFieldData.Add("VERSION", s);

                temp = this.Query(modelConfigMsthSpcQuery, llWhereFieldData);
                temp.Tables[0].TableName = modelConfigMstTblName;
                dsReturn.Merge(temp);
            }

            // MODEL_RULE_MSTH_SPC
            foreach (string s in versions)
            {
                LinkedList llWhereFieldData = new LinkedList();
                llWhereFieldData.Add("RAWID", modelConfigRawID);
                llWhereFieldData.Add("VERSION", s);

                temp = this.Query(modelRuleMsthSpcQuery, llWhereFieldData);
                temp.Tables[0].TableName = modelRuleMstTblName;
                dsReturn.Merge(temp);
            }

            // MODEL_AUTOCALC_MST_SPC
            foreach (string s in versions)
            {
                LinkedList llWhereFieldData = new LinkedList();
                llWhereFieldData.Add("RAWID", modelConfigRawID);
                llWhereFieldData.Add("VERSION", s);

                temp = this.Query(modelAutocalcMsthSpcQuery, llWhereFieldData);
                temp.Tables[0].TableName = modelAutoCalcMstTblname;
                dsReturn.Merge(temp);
            }

            return(dsReturn);
        }
Exemplo n.º 57
0
        private void AddModuleNode(TreeNode tnCurrent, string dcpRawid)
        {
            try
            {
                if (tnCurrent.Nodes.Count > 0)
                {
                    return;
                }

                LinkedList llstData = new LinkedList();

                llstData.Add(Definition.DynamicCondition_Condition_key.LINE_RAWID, this.LineRawid);
                llstData.Add(Definition.DynamicCondition_Condition_key.AREA_RAWID, this.AreaRawid);
                llstData.Add(Definition.DynamicCondition_Condition_key.EQP_ID, this.EqpID);
                llstData.Add(Definition.DynamicCondition_Condition_key.DCP_ID, this.DcpID);
                llstData.Add(Definition.DynamicCondition_Condition_key.MODULE_ID, this.EqpID);

                byte[]  baData = llstData.GetSerialData();
                DataSet ds     = _wsSPC.GetModuleByEQP(baData);

                if (ds == null || ds.Tables.Count <= 0)
                {
                    return;
                }

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string sModule         = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.ALIAS].ToString();
                    string sModuleID       = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.MODULE_ID].ToString();
                    string sParentModuleID = ds.Tables[0].Rows[i]["parent_moduleid"].ToString();
                    string sRawID          = ds.Tables[0].Rows[i][Definition.DynamicCondition_Condition_key.RAWID].ToString();

                    if (sParentModuleID == string.Empty)
                    {
                        _sMainModuleRawid = sModuleID;
                    }

                    BTreeNode btn = TreeDCUtil.CreateBTreeNode(Definition.DynamicCondition_Search_key.MODULE, sModuleID, sModule);
                    btn.IsVisibleCheckBox = this.IsShowCheck;
                    btn.IsFolder          = false;
                    btn.IsVisibleNodeType = true;
                    btn.ImageIndexList.Add((int)ImageLoader.TREE_IMAGE_INDEX.MODULE);
                    btn.ImageIndex = (int)ImageLoader.TREE_IMAGE_INDEX.MODULE;
                    DCValueOfTree dcValue = TreeDCUtil.GetDCValue(btn);
                    dcValue.AdditionalValue.Add(Definition.DynamicCondition_Search_key.ADDTIONALVALUEDATA, sRawID);
                    dcValue.Tag = sModuleID;

                    if (this.IsLastNode)
                    {
                        if (_sMainModuleRawid != sModule)
                        {
                            if (llstData.Contains(Definition.DynamicCondition_Condition_key.MODULE_ID))
                            {
                                llstData[Definition.DynamicCondition_Condition_key.MODULE_ID] = sModuleID;
                            }
                            else
                            {
                                llstData.Add(Definition.DynamicCondition_Condition_key.MODULE_ID, sModuleID);
                            }

                            byte[]  data        = llstData.GetSerialData();
                            DataSet dsSubModule = _wsSPC.GetSubModuleByEQP(data);
                            if (dsSubModule.Tables.Count > 0 && dsSubModule.Tables[0].Rows.Count > 0)
                            {
                                btn.Nodes.Add(BTreeView.CreateDummyNode());
                            }
                        }
                    }
                    else
                    {
                        btn.Nodes.Add(BTreeView.CreateDummyNode());
                    }

                    tnCurrent.Nodes.Add(btn);
                }
            }
            catch (Exception ex)
            {
                EESUtil.DebugLog(ex);
            }
        }
Exemplo n.º 58
0
        public DataSet GetSPCModelVersionData(string modelConfigRawid, string version, bool isATT)
        {
            DataSet dsReturn = new DataSet();

            DataSet       dsTemp        = null;
            StringBuilder sb            = new StringBuilder();
            LinkedList    llstCondition = new LinkedList();

            string modelMstTblName          = string.Empty;
            string modelConfigMstTblName    = string.Empty;
            string modelConfigMsthTblName   = string.Empty;
            string modelConfigOptMstTblname = string.Empty;
            string modelContextMstTblname   = string.Empty;
            string modelRuleMstTblName      = string.Empty;
            string modelRuleMsthTblName     = string.Empty;
            string modelRuleOptMstTblName   = string.Empty;
            string modelRuleOptMsthTblName  = string.Empty;
            string modelAutoCalcMstTblname  = string.Empty;
            string modelAutoCalcMsthTblName = string.Empty;
            string ruleMstTblName           = string.Empty;
            string ruleOptMstTblName        = string.Empty;

            if (isATT)
            {
                modelMstTblName          = TABLE.MODEL_ATT_MST_SPC;
                modelConfigMstTblName    = TABLE.MODEL_CONFIG_ATT_MST_SPC;
                modelConfigMsthTblName   = TABLE.MODEL_CONFIG_ATT_MSTH_SPC;
                modelConfigOptMstTblname = TABLE.MODEL_CONFIG_OPT_ATT_MST_SPC;
                modelContextMstTblname   = TABLE.MODEL_CONTEXT_ATT_MST_SPC;
                modelRuleMstTblName      = TABLE.MODEL_RULE_ATT_MST_SPC;
                modelRuleMsthTblName     = TABLE.MODEL_RULE_ATT_MSTH_SPC;
                modelRuleOptMstTblName   = TABLE.MODEL_RULE_OPT_ATT_MST_SPC;
                modelRuleOptMsthTblName  = TABLE.MODEL_RULE_OPT_ATT_MSTH_SPC;
                modelAutoCalcMstTblname  = TABLE.MODEL_AUTOCALC_ATT_MST_SPC;
                modelAutoCalcMsthTblName = TABLE.MODEL_AUTOCALC_ATT_MSTH_SPC;
                ruleMstTblName           = TABLE.RULE_ATT_MST_SPC;
                ruleOptMstTblName        = TABLE.RULE_OPT_ATT_MST_SPC;
            }
            else
            {
                modelMstTblName          = TABLE.MODEL_MST_SPC;
                modelConfigMstTblName    = TABLE.MODEL_CONFIG_MST_SPC;
                modelConfigMsthTblName   = TABLE.MODEL_CONFIG_MSTH_SPC;
                modelConfigOptMstTblname = TABLE.MODEL_CONFIG_OPT_MST_SPC;
                modelContextMstTblname   = TABLE.MODEL_CONTEXT_MST_SPC;
                modelRuleMstTblName      = TABLE.MODEL_RULE_MST_SPC;
                modelRuleMsthTblName     = TABLE.MODEL_RULE_MSTH_SPC;
                modelRuleOptMstTblName   = TABLE.MODEL_RULE_OPT_MST_SPC;
                modelRuleOptMsthTblName  = TABLE.MODEL_RULE_OPT_MSTH_SPC;
                modelAutoCalcMstTblname  = TABLE.MODEL_AUTOCALC_MST_SPC;
                modelAutoCalcMsthTblName = TABLE.MODEL_AUTOCALC_MSTH_SPC;
                ruleMstTblName           = TABLE.RULE_MST_SPC;
                ruleOptMstTblName        = TABLE.RULE_OPT_MST_SPC;
            }

            try
            {
                llstCondition.Add("MODEL_CONFIG_RAWID", modelConfigRawid);
                llstCondition.Add("VERSION", version);

                //#00. MODEL_MST_SPC
                string query =
                    "SELECT * " +
                    " FROM " + modelMstTblName +
                    " WHERE RAWID IN (SELECT MODEL_RAWID " +
                    "                 FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                    "                       FROM " + modelConfigMsthTblName + " a " +
                    "                       WHERE Rawid = :MODEL_CONFIG_RAWID " +
                    "                       AND version = :VERSION) " +
                    "                 WHERE RNK = 1) ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = dsTemp.Tables[0].Copy();
                    dtConfig.TableName = modelMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }


                //#01. MODEL_CONFIG_MST_SPC

                //2009-12-07 bskwon 수정
                if (isATT)
                {
                    query =
                        "SELECT mcms.* " +
                        " FROM (SELECT * FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "       FROM MODEL_CONFIG_ATT_MSTH_SPC a " +
                        "       WHERE Rawid = :MODEL_CONFIG_RAWID " +
                        "       AND version = :VERSION) " +
                        " WHERE RNK = 1) mcms " +
                        " ORDER BY mcms.RAWID";
                }
                else
                {
                    query =
                        "SELECT mcms.*, B.NAME AS PARAM_TYPE, cc.name as MANAGE_TYPE_NAME " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONFIG_MSTH_SPC a " +
                        "             WHERE Rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1) mcms " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY = 'SPC_PARAM_TYPE') B " +
                        "                   ON mcms.PARAM_TYPE_CD = B.CODE " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY='SPC_MANAGE_TYPE') cc " +
                        "                   ON mcms.manage_type_cd = cc.code " +
                        " ORDER BY mcms.RAWID";
                }

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfig = dsTemp.Tables[0].Copy();
                    dtConfig.TableName = modelConfigMstTblName;

                    dsReturn.Tables.Add(dtConfig);
                }


                //#02. MODEL_CONFIG_OPT_MST_SPC
                if (isATT)
                {
                    query =
                        "SELECT A.* " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONFIG_OPT_ATT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1) A ";
                }
                else
                {
                    query =
                        "SELECT A.*, B.NAME AS SPC_PARAM_CATEGORY, C.NAME AS SPC_PRIORITY " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONFIG_OPT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1) A " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY = 'SPC_PARAM_CATEGORY') B " +
                        "                   ON (A.SPC_PARAM_CATEGORY_CD = B.CODE) " +
                        "       LEFT OUTER JOIN (SELECT CODE, NAME " +
                        "                        FROM CODE_MST_PP WHERE CATEGORY = 'SPC_PRIOTIRY') C " +
                        "                   ON (A.SPC_PRIORITY_CD = C.CODE) ";
                }

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtConfigOPT = dsTemp.Tables[0].Copy();
                    dtConfigOPT.TableName = modelConfigOptMstTblname;

                    dsReturn.Tables.Add(dtConfigOPT);
                }


                //#03. MODEL_CONTEXT_MST_SPC
                if (isATT)
                {
                    query =
                        "SELECT mcms.* " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONTEXT_ATT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1 ) mcms " +
                        " ORDER BY mcms.KEY_ORDER ASC ";
                }
                else
                {
                    query =
                        "SELECT mcms.*, aa.name as context_key_name " +
                        " FROM (SELECT * " +
                        "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                        "             FROM MODEL_CONTEXT_MSTH_SPC a " +
                        "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                        "             AND version = :VERSION) " +
                        "       WHERE RNK = 1 ) mcms, " +
                        "      (SELECT CODE,NAME " +
                        "       FROM code_mst_pp " +
                        "       WHERE category='CONTEXT_TYPE' " +
                        "             UNION SELECT CODE,NAME " +
                        "             FROM code_mst_pp " +
                        "             WHERE category='SPC_CONTEXT_TYPE') AA " +
                        " WHERE mcms.context_key = aa.code " +
                        " ORDER BY mcms.KEY_ORDER ASC ";
                }

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtContext = dsTemp.Tables[0].Copy();
                    dtContext.TableName = modelContextMstTblname;

                    dsReturn.Tables.Add(dtContext);
                }

                //#04. MODEL_RULE_MST_SPC
                query =
                    "SELECT A.*, B.DESCRIPTION, " +
                    "       DECODE(A.USE_MAIN_SPEC_YN,'Y','True','N','False','True') AS USE_MAIN_SPEC, " +
                    "       '' AS RULE_OPTION, '' AS RULE_OPTION_DATA " +
                    " FROM (SELECT * " +
                    "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                    "             FROM " + modelRuleMsthTblName + " a " +
                    "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                    "             AND version = :VERSION ) " +
                    "       WHERE RNK = 1) A " +
                    "       LEFT OUTER JOIN " + ruleMstTblName + " B " +
                    "                   ON A.SPC_RULE_NO = B.SPC_RULE_NO ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtRule = dsTemp.Tables[0].Copy();
                    dtRule.TableName = modelRuleMstTblName;

                    dsReturn.Tables.Add(dtRule);
                }

                //#05. MODEL_RULE_OPT_MST_SPC
                query =
                    "SELECT b.*, c.option_name, c.description, a.spc_rule_no " +
                    " FROM (SELECT * " +
                    "       FROM (SELECT RANK () OVER (PARTITION BY VERSION ORDER BY input_dtts) rnk, aa.* " +
                    "             FROM " + modelRuleMsthTblName + " aa " +
                    "             WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                    "             AND VERSION = :VERSION) " +
                    "       WHERE rnk = 1) a " +
                    "       LEFT OUTER JOIN (SELECT * " +
                    "                        FROM (SELECT RANK () OVER (PARTITION BY VERSION ORDER BY input_dtts) rnk, aaa.* " +
                    "                              FROM " + modelRuleOptMsthTblName + " aaa " +
                    "                              WHERE model_rule_rawid IN (SELECT DISTINCT rawid " +
                    "                                                         FROM " + modelRuleMsthTblName +
                    "                                                         WHERE model_config_rawid = :MODEL_CONFIG_RAWID " +
                    "                                                         AND VERSION = :VERSION) " +
                    "                              AND VERSION = :VERSION) " +
                    "                        WHERE rnk = 1) b " +
                    "                  ON (a.rawid = b.model_rule_rawid AND b.VERSION = :VERSION) " +
                    "       LEFT OUTER JOIN (SELECT a.rawid AS rule_rawid, a.spc_rule_no, " +
                    "                               b.rule_option_no, b.option_name, b.description " +
                    "                        FROM " + ruleMstTblName + " a " +
                    "                             LEFT OUTER JOIN " + ruleOptMstTblName + " b " +
                    "                                        ON (a.rawid = b.rule_rawid) ) c " +
                    "                  ON (a.spc_rule_no = c.spc_rule_no " +
                    "                      AND b.rule_option_no = c.rule_option_no) " +
                    " ORDER BY b.rawid ASC ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtRuleOPT = dsTemp.Tables[0].Copy();
                    dtRuleOPT.TableName = modelRuleOptMstTblName;

                    dsReturn.Tables.Add(dtRuleOPT);
                }

                //#06. MODEL_AUTOCALC_MST_SPC
                query =
                    "SELECT * " +
                    " FROM (SELECT * " +
                    "       FROM (SELECT rank () over(partition by version order by input_dtts) RNK, a.* " +
                    "             FROM " + modelAutoCalcMsthTblName + " a " +
                    "             WHERE model_config_rawid = :model_config_rawid " +
                    "             AND version = :version) " +
                    "       WHERE RNK = 1) ";

                dsTemp = this.Query(query, llstCondition);

                if (base.ErrorMessage.Length > 0)
                {
                    DSUtil.SetResult(dsReturn, 0, "", base.ErrorMessage);
                    return(dsReturn);
                }
                else
                {
                    DataTable dtAutoCalc = dsTemp.Tables[0].Copy();
                    dtAutoCalc.TableName = modelAutoCalcMstTblname;

                    dsReturn.Tables.Add(dtAutoCalc);
                }
            }
            catch (Exception ex)
            {
                BISTel.PeakPerformance.Client.CommonLibrary.LogHandler.ExceptionLogWrite(Definition.APPLICATION_NAME, new string[] { ex.Message, ex.Source, ex.StackTrace });
            }
            finally
            {
                //resource 해제
                if (dsTemp != null)
                {
                    dsTemp.Dispose();
                    dsTemp = null;
                }

                llstCondition.Clear();
                llstCondition = null;
            }

            return(dsReturn);
        }
Exemplo n.º 59
0
        public DataSet GetSPCModelConfigSearch(byte[] baData)
        {
            DataSet ds = new DataSet();

            string        strSQL      = string.Empty;
            string        strMAIN_YN  = string.Empty;
            string        strSQLWhere = string.Empty;
            string        sWhere      = string.Empty;
            StringBuilder sb          = null;

            try
            {
                LinkedList llstData       = new LinkedList();
                LinkedList whereFieldData = new LinkedList();
                llstData.SetSerialData(baData);
                sb = new StringBuilder();

                //=============================================================================================

                if (llstData[Definition.DynamicCondition_Condition_key.LINE_RAWID] != null)
                {
                    sWhere += " AND mms.LOCATION_RAWID=:LINE_RAWID ";
                    whereFieldData.Add(Definition.DynamicCondition_Condition_key.LINE_RAWID, llstData[Definition.DynamicCondition_Condition_key.LINE_RAWID].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD] != null)
                {
                    sWhere += " AND mcms.PARAM_TYPE_CD=:PARAM_TYPE_CD ";
                    whereFieldData.Add(Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD, llstData[Definition.DynamicCondition_Condition_key.PARAM_TYPE_CD].ToString());
                }


                if (llstData[Definition.DynamicCondition_Condition_key.AREA_RAWID] != null)
                {
                    sWhere += string.Format(" AND mms.AREA_RAWID in ({0}) ", llstData[Definition.DynamicCondition_Condition_key.AREA_RAWID].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.EQP_MODEL] != null)
                {
                    sWhere += string.Format(" AND mms.EQP_MODEL in ({0}) ", llstData[Definition.DynamicCondition_Condition_key.EQP_MODEL].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.SPC_MODEL_RAWID] != null)
                {
                    sWhere += string.Format(" AND mms.model_rawid in ({0}) ", llstData[Definition.DynamicCondition_Condition_key.SPC_MODEL_RAWID].ToString());
                }


                if (llstData[Definition.DynamicCondition_Condition_key.PARAM_ALIAS] != null)
                {
                    sWhere += string.Format(" AND mcms.PARAM_ALIAS in ({0}) ", llstData[Definition.DynamicCondition_Condition_key.PARAM_ALIAS].ToString());
                }


                if (llstData[Definition.DynamicCondition_Condition_key.MAIN_YN] != null)
                {
                    sWhere += string.Format(" AND mcms.MAIN_YN ='{0}' ", llstData[Definition.DynamicCondition_Condition_key.MAIN_YN].ToString());
                }

                strSQLWhere = @" AND mcms.rawid in (SELECT model_config_rawid FROM MODEL_CONTEXT_MST_SPC 
                                 WHERE context_value in ({0}))";

                if (llstData[Definition.DynamicCondition_Condition_key.EQP_ID] != null)
                {
                    sWhere += string.Format(strSQLWhere, llstData[Definition.DynamicCondition_Condition_key.EQP_ID].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.OPERATION_ID] != null)
                {
                    sWhere += string.Format(strSQLWhere, llstData[Definition.DynamicCondition_Condition_key.OPERATION_ID].ToString());
                }

                if (llstData[Definition.DynamicCondition_Condition_key.PRODUCT_ID] != null)
                {
                    sWhere += string.Format(strSQLWhere, llstData[Definition.DynamicCondition_Condition_key.PRODUCT_ID].ToString());
                }

                strSQL = string.Format(@" SELECT distinct 
                             mcms.model_rawid
                            ,mms.spc_model_name
                            ,mcms.param_alias
                            ,mcms.MAIN_YN
                            ,mcms.COMPLEX_YN
                            ,mcms.rawid as model_config_rawid                                                                                                              
                            ,mcoms.RESTRICT_SAMPLE_DAYS
                            ,mcoms.RESTRICT_SAMPLE_COUNT
                            ,mcoms.DEFAULT_CHART_LIST                                                    
                    FROM MODEL_MST_SPC mms
                        , MODEL_CONFIG_MST_SPC mcms                        
                        , MODEL_CONFIG_OPT_MST_SPC mcoms
                    WHERE MMS.RAWID = MCMS.MODEL_RAWID                                                                    
                    AND mcms.rawid=mcoms.model_config_rawid  
                    {0}                    
                    ", sWhere);

                ds = base.Query(string.Format(strSQL, sb.ToString()), whereFieldData);
            }
            catch (Exception ex)
            {
            }

            return(ds);
        }
Exemplo n.º 60
0
        /// <summary>Handles CORS pre-flight request.</summary>
        /// <param name="request">
        /// The
        /// <see cref="Javax.Servlet.Http.IHttpServletRequest"/>
        /// object.
        /// </param>
        /// <param name="response">
        /// The
        /// <see cref="Javax.Servlet.Http.IHttpServletResponse"/>
        /// object.
        /// </param>
        /// <param name="filterChain">
        /// The
        /// <see cref="Javax.Servlet.IFilterChain"/>
        /// object.
        /// </param>
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Javax.Servlet.ServletException"/>
        public void HandlePreflightCORS(IHttpServletRequest request, IHttpServletResponse response, IFilterChain filterChain)
        {
            CORSFilter.CORSRequestType requestType = CheckRequestType(request);
            if (requestType != CORSFilter.CORSRequestType.PreFlight)
            {
                throw new ArgumentException("Expects a HttpServletRequest object of type " + CORSFilter.CORSRequestType.PreFlight.ToString().ToLower());
            }
            string origin = request.GetHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.RequestHeaderOrigin);

            // Section 6.2.2
            if (!IsOriginAllowed(origin))
            {
                HandleInvalidCORS(request, response, filterChain);
                return;
            }
            // Section 6.2.3
            string accessControlRequestMethod = request.GetHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.RequestHeaderAccessControlRequestMethod);

            if (accessControlRequestMethod == null || (!HttpMethods.Contains(accessControlRequestMethod.Trim())))
            {
                HandleInvalidCORS(request, response, filterChain);
                return;
            }
            else
            {
                accessControlRequestMethod = accessControlRequestMethod.Trim();
            }
            // Section 6.2.4
            string         accessControlRequestHeadersHeader = request.GetHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.RequestHeaderAccessControlRequestHeaders);
            IList <string> accessControlRequestHeaders       = new LinkedList <string>();

            if (accessControlRequestHeadersHeader != null && !accessControlRequestHeadersHeader.Trim().IsEmpty())
            {
                string[] headers = accessControlRequestHeadersHeader.Trim().Split(",");
                foreach (string header in headers)
                {
                    accessControlRequestHeaders.Add(header.Trim().ToLower());
                }
            }
            // Section 6.2.5
            if (!allowedHttpMethods.Contains(accessControlRequestMethod))
            {
                HandleInvalidCORS(request, response, filterChain);
                return;
            }
            // Section 6.2.6
            if (!accessControlRequestHeaders.IsEmpty())
            {
                foreach (string header in accessControlRequestHeaders)
                {
                    if (!allowedHttpHeaders.Contains(header))
                    {
                        HandleInvalidCORS(request, response, filterChain);
                        return;
                    }
                }
            }
            // Section 6.2.7
            if (supportsCredentials)
            {
                response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlAllowOrigin, origin);
                response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlAllowCredentials, "true");
            }
            else
            {
                if (anyOriginAllowed)
                {
                    response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlAllowOrigin, "*");
                }
                else
                {
                    response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlAllowOrigin, origin);
                }
            }
            // Section 6.2.8
            if (preflightMaxAge > 0)
            {
                response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlMaxAge, preflightMaxAge.ToString());
            }
            // Section 6.2.9
            response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlAllowMethods, accessControlRequestMethod);
            // Section 6.2.10
            if ((allowedHttpHeaders != null) && (!allowedHttpHeaders.IsEmpty()))
            {
                response.AddHeader(Edu.Stanford.Nlp.Naturalli.Demo.CORSFilter.ResponseHeaderAccessControlAllowHeaders, Join(allowedHttpHeaders, ","));
            }
        }