Exemplo n.º 1
0
        public void testBasicFutureFilter()
        {
            var _Names	= new List<String>() { "marko", "povel", "peter", "josh" };
            var _Pipe1	= new FutureFilterPipe<String>(new IdentityPipe<String>());
            _Pipe1.SetSourceCollection(_Names);

            var _Counter = 0;
            while (_Pipe1.MoveNext())
            {
                _Counter++;
            }

            Assert.AreEqual(4, _Counter);
        }
Exemplo n.º 2
0
        public void testAdvancedFutureFilter()
        {
            var _Names = new List<String>() { "marko", "povel", "peter", "josh" };
            var _Pipe  = new FutureFilterPipe<String>(new CollectionFilterPipe<String>(new List<String>() { "marko", "povel" }, ComparisonFilter.EQUAL));
            _Pipe.SetSourceCollection(_Names);

            var _Counter = 0;
            while (_Pipe.MoveNext())
            {
                _Counter++;
                var _Name = _Pipe.Current;
                Assert.IsTrue(_Name.Equals("peter") || _Name.Equals("josh"));
            }

            Assert.AreEqual(2, _Counter);
        }
Exemplo n.º 3
0
        public void testGraphFutureFilter()
        {
            var _Graph 				= TinkerGraphFactory.CreateTinkerGraph();
            var _Marko 				= _Graph.VertexById(1);

            var _OutEPipe 			= new OutEdgesPipe<UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object>();

            var _InVPipe 			= new InVertexPipe<UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object>();

            var _PropertyFilterPipe = new VertexPropertyFilterPipe<UInt64, Int64, String, String, Object,
                                                                   UInt64, Int64, String, String, Object,
                                                                   UInt64, Int64, String, String, Object,
                                                                   UInt64, Int64, String, String, Object>("name", v => v.Equals("lop"));

            var _FutureFilterPipe = new FutureFilterPipe<IGenericPropertyEdge<UInt64, Int64, String, String, Object,
                                                                              UInt64, Int64, String, String, Object,
                                                                              UInt64, Int64, String, String, Object,
                                                                              UInt64, Int64, String, String, Object>>(

                                          new Pipeline<IGenericPropertyEdge<UInt64, Int64, String, String, Object,
                                                                            UInt64, Int64, String, String, Object,
                                                                            UInt64, Int64, String, String, Object,
                                                                            UInt64, Int64, String, String, Object>,

                                                       IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                                              UInt64, Int64, String, String, Object,
                                                                              UInt64, Int64, String, String, Object,
                                                                              UInt64, Int64, String, String, Object>>(_InVPipe, _PropertyFilterPipe));

            var _Pipeline = new Pipeline<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object>,

                                                   IGenericPropertyEdge<UInt64, Int64, String, String, Object,
                                                                        UInt64, Int64, String, String, Object,
                                                                        UInt64, Int64, String, String, Object,
                                                                        UInt64, Int64, String, String, Object>>(_OutEPipe, _FutureFilterPipe);

            _Pipeline.SetSourceCollection(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                                          UInt64, Int64, String, String, Object,
                                                                          UInt64, Int64, String, String, Object,
                                                                          UInt64, Int64, String, String, Object>>() { _Marko });

            int _Counter = 0;
            while (_Pipeline.MoveNext())
            {
                _Counter++;
                Assert.AreEqual(9, _Pipeline.Current.Id);
            }

            Assert.AreEqual(1, _Counter);
        }