Пример #1
0
 public static ListValue List(params object[] objects)
 {
     AnyValue[] values = new AnyValue[objects.Length];
     for (int i = 0; i < objects.Length; i++)
     {
         values[i] = ToAnyValue(objects[i]);
     }
     return(VirtualValues.List(values));
 }
Пример #2
0
        public virtual ListValue Keys()
        {
            string[] keys = new string[Size()];
            int      i    = 0;

            foreach (string key in KeySet())
            {
                keys[i++] = key;
            }
            return(VirtualValues.FromArray(Values.stringArray(keys)));
        }
Пример #3
0
 public static VirtualValue Map(params object[] keyOrVal)
 {
     Debug.Assert(keyOrVal.Length % 2 == 0);
     string[]   keys   = new string[keyOrVal.Length / 2];
     AnyValue[] values = new AnyValue[keyOrVal.Length / 2];
     for (int i = 0; i < keyOrVal.Length; i += 2)
     {
         keys[i / 2]   = ( string )keyOrVal[i];
         values[i / 2] = ToAnyValue(keyOrVal[i + 1]);
     }
     return(VirtualValues.Map(keys, values));
 }
Пример #4
0
 public static VirtualValue Path(params VirtualValue[] pathElements)
 {
     Debug.Assert(pathElements.Length % 2 == 1);
     NodeValue[]         nodes = new NodeValue[pathElements.Length / 2 + 1];
     RelationshipValue[] rels  = new RelationshipValue[pathElements.Length / 2];
     nodes[0] = ( NodeValue )pathElements[0];
     for (int i = 1; i < pathElements.Length; i += 2)
     {
         rels[i / 2]      = ( RelationshipValue )pathElements[i];
         nodes[i / 2 + 1] = ( NodeValue )pathElements[i + 1];
     }
     return(VirtualValues.Path(nodes, rels));
 }
Пример #5
0
        public virtual ListValue AsList()
        {
            NodeValue[]         nodes         = nodes();
            RelationshipValue[] relationships = relationships();
            int size = nodes.Length + relationships.Length;

            AnyValue[] anyValues = new AnyValue[size];
            for (int i = 0; i < size; i++)
            {
                if (i % 2 == 0)
                {
                    anyValues[i] = nodes[i / 2];
                }
                else
                {
                    anyValues[i] = relationships[i / 2];
                }
            }
            return(VirtualValues.List(anyValues));
        }
Пример #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void pathShouldNotOnlyContainRelationship()
        internal virtual void PathShouldNotOnlyContainRelationship()
        {
            assertThrows(typeof(AssertionError), () => VirtualValues.Path(nodes(), relationships(1L)));
        }
Пример #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void pathShouldHandleNullNodes()
        internal virtual void PathShouldHandleNullNodes()
        {
            assertThrows(typeof(AssertionError), () => VirtualValues.Path(null, relationships(1L)));
        }
Пример #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void pathShouldHandleNullEdge()
        internal virtual void PathShouldHandleNullEdge()
        {
            assertThrows(typeof(AssertionError), () => VirtualValues.Path(nodes(1L), null));
        }
Пример #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void pathShouldContainOneMoreNodeThenEdges()
        internal virtual void PathShouldContainOneMoreNodeThenEdges()
        {
            assertThrows(typeof(Exception), () => VirtualValues.Path(nodes(1L, 2L), relationships()));
        }
Пример #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Parameterized.Parameters(name = "{0}") public static Iterable<WriteTest> data()
        public static IEnumerable <WriteTest> Data()
        {
            return(Arrays.asList(ShouldWrite(VirtualValues.List(booleanValue(false), byteArray(new sbyte[] { 3, 4, 5 }), stringValue("yo")), beginList(3), false, Specials.byteArray(new sbyte[] { 3, 4, 5 }), "yo", endList()), ShouldWrite(VirtualValues.Map(new string[] { "foo", "bar" }, new AnyValue[] { intValue(100), charValue('c') }), beginMap(2), "bar", 'c', "foo", 100, endMap()), ShouldWrite(VirtualValues.Node(1L), writeNodeReference(1L)), ShouldWrite(relationship(2L), writeRelationshipReference(2L)), ShouldWrite(VirtualValues.Path(new NodeValue[] { nodeValue(20L, stringArray("L"), emptyMap()), nodeValue(40L, stringArray("L"), emptyMap()) }, new RelationshipValue[] { relationshipValue(100L, nodeValue(40L, stringArray("L"), emptyMap()), nodeValue(20L, stringArray("L"), emptyMap()), stringValue("T"), emptyMap()) }), writePath(new NodeValue[] { nodeValue(20L, stringArray("L"), emptyMap()), nodeValue(40L, stringArray("L"), emptyMap()) }, new RelationshipValue[] { relationshipValue(100L, nodeValue(40L, stringArray("L"), emptyMap()), nodeValue(20L, stringArray("L"), emptyMap()), stringValue("T"), emptyMap()) })), ShouldWrite(VirtualValues.Map(new string[] { "foo" }, new AnyValue[] { VirtualValues.List(VirtualValues.Map(new string[] { "bar" }, new AnyValue[] { VirtualValues.List() })) }), beginMap(1), "foo", beginList(1), beginMap(1), "bar", beginList(0), endList(), endMap(), endList(), endMap()), ShouldWrite(nodeValue(1337L, stringArray("L1", "L2"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") })), writeNode(1337L, stringArray("L1", "L2"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") }))), ShouldWrite(relationshipValue(1337L, nodeValue(42L, stringArray("L"), emptyMap()), nodeValue(43L, stringArray("L"), emptyMap()), stringValue("T"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") })), writeRelationship(1337L, 42L, 43L, stringValue("T"), map(new string[] { "foo" }, new AnyValue[] { stringValue("foo") })))));
        }
Пример #11
0
 public override ListValue Keys()
 {
     return(VirtualValues.Concat(Map.keys(), VirtualValues.FromArray(Values.stringArray(UpdatedKeys))));
 }