The TimeScale class is a data management service for a binary tree graph data structure stored in the Neo4j graph database.
Esempio n. 1
0
        public void TimeScaleVertexConstructorTest()
        {
            TimeScale timeScaleTest = new TimeScale();

            List<ITimeScaleVertex> timeScaleVertices = new List<ITimeScaleVertex>();

            // Vertex 1
            timeScaleVertices.Add(
                new TimeScaleVertex(

                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[0]);

            // Vertex 2
            timeScaleVertices.Add(
                new TimeScaleVertex(

                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[1]);

            // Vertex 3
            timeScaleVertices.Add(
                new TimeScaleVertex(

                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[2]);
        }
Esempio n. 2
0
        public void InitializeTimeScaleInstanceTest()
        {
            TimeScale timeScale = new TimeScale();

            Func<ITimeScaleRelationship, List<ITimeScaleVertex>> callback = timeScale.GlobalCallback();

            TimeScaleVertex target = new TimeScaleVertex(callback);

            List<ITimeScaleNode> nodes = new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 0, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 1, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 2, Bit = 1, Interval = 50 } as ITimeScaleNode
                    };

            List<ITimeScaleRelationship> relationships = new List<ITimeScaleRelationship>()
                    {
                        new TimeScaleRelationship() { StartId = 0, EndId = 1 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 0, EndId = 2 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 1, EndId = 3 } as ITimeScaleRelationship,
                    };

            Func<ITimeScaleRelationship, List<ITimeScaleVertex>> callback1 = target.Callback;
            target.InitializeTimeScaleInstance(nodes, relationships, callback1);

            Assert.IsNotNull(target);
        }
Esempio n. 3
0
        public void TimeScaleVertexConstructorTest2()
        {
            TimeScale timeScaleTest = new TimeScale();

            List<ITimeScaleVertex> timeScaleVertices = new List<ITimeScaleVertex>();

            // Vertex 1
            timeScaleVertices.Add(
                new TimeScaleVertex(
                    new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 0, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 1, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 2, Bit = 1, Interval = 50 } as ITimeScaleNode
                    },
                    new List<ITimeScaleRelationship>()
                    {
                        new TimeScaleRelationship() { StartId = 0, EndId = 1 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 0, EndId = 2 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 1, EndId = 3 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 2, EndId = 6 } as ITimeScaleRelationship
                    },
                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[0].Nodes);
            Assert.IsNotNull(timeScaleVertices[0].Relationships);

            // Vertex 2
            timeScaleVertices.Add(
                new TimeScaleVertex(
                    new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 3, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 4, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 5, Bit = 1, Interval = 50 } as ITimeScaleNode
                    },
                    new List<ITimeScaleRelationship>()
                    {
                        new TimeScaleRelationship() { StartId = 3, EndId = 4 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 3, EndId = 5 } as ITimeScaleRelationship
                    },
                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[1].Nodes);
            Assert.IsNotNull(timeScaleVertices[1].Relationships);

            // Vertex 3
            timeScaleVertices.Add(
                new TimeScaleVertex(
                    new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 6, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 7, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 8, Bit = 1, Interval = 50 } as ITimeScaleNode
                    },
                    new List<ITimeScaleRelationship>()
                    {
                        new TimeScaleRelationship() { StartId = 6, EndId = 7 } as ITimeScaleRelationship,
                        new TimeScaleRelationship() { StartId = 6, EndId = 8 } as ITimeScaleRelationship
                    },
                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[2].Nodes);
            Assert.IsNotNull(timeScaleVertices[2].Relationships);
        }
Esempio n. 4
0
        public void TimeScaleVertexConstructorTest1()
        {
            TimeScale timeScaleTest = new TimeScale();

            List<ITimeScaleVertex> timeScaleVertices = new List<ITimeScaleVertex>();

            // Vertex 1
            timeScaleVertices.Add(
                new TimeScaleVertex(
                    new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 0, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 1, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 2, Bit = 1, Interval = 50 } as ITimeScaleNode
                    },
                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[0].Nodes);

            // Vertex 2
            timeScaleVertices.Add(
                new TimeScaleVertex(
                    new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 3, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 4, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 5, Bit = 1, Interval = 50 } as ITimeScaleNode
                    },
                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[1].Nodes);

            // Vertex 3
            timeScaleVertices.Add(
                new TimeScaleVertex(
                    new List<ITimeScaleNode>()
                    {
                        new TimeScaleNode() { NodeId = 6, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 7, Bit = 0, Interval = 50 } as ITimeScaleNode,
                        new TimeScaleNode() { NodeId = 8, Bit = 1, Interval = 50 } as ITimeScaleNode
                    },
                    timeScaleTest.GlobalCallback()
                ));

            Assert.IsNotNull(timeScaleVertices[2].Nodes);
        }