Пример #1
0
        /// <summary>
        /// Convert value represented by type and raw bits to corresponding <seealso cref="NumberValue"/>. If type is not <seealso cref="BYTE"/>, <seealso cref="SHORT"/>,
        /// <seealso cref="INT"/>, <seealso cref="LONG"/>, <seealso cref="FLOAT"/> or <seealso cref="DOUBLE"/>, the raw bits will be interpreted as a long.
        /// </summary>
        /// <param name="rawBits"> Raw bits of value </param>
        /// <param name="type"> Type of value </param>
        /// <returns> <seealso cref="NumberValue"/> with type and value given by provided raw bits and type. </returns>
        internal static NumberValue AsNumberValue(long rawBits, sbyte type)
        {
            switch (type)
            {
            case BYTE:
                return(Values.byteValue(( sbyte )rawBits));

            case SHORT:
                return(Values.shortValue(( short )rawBits));

            case INT:
                return(Values.intValue(( int )rawBits));

            case LONG:
                return(Values.longValue(rawBits));

            case FLOAT:
                return(Values.floatValue(Float.intBitsToFloat(( int )rawBits)));

            case DOUBLE:
                return(Values.doubleValue(Double.longBitsToDouble(rawBits)));

            default:
                // If type is not recognized, interpret as long.
                return(Values.longValue(rawBits));
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.bolt.runtime.BoltStateMachineState processRunMessage(org.neo4j.bolt.v3.messaging.request.RunMessage message, org.neo4j.bolt.runtime.StateMachineContext context) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        private BoltStateMachineState ProcessRunMessage(RunMessage message, StateMachineContext context)
        {
            long start = context.Clock().millis();
            StatementProcessor statementProcessor = context.ConnectionState().StatementProcessor;
            StatementMetadata  statementMetadata  = statementProcessor.Run(message.Statement(), message.Params());
            long end = context.Clock().millis();

            context.ConnectionState().onMetadata(FIELDS_KEY, stringArray(statementMetadata.FieldNames()));
            context.ConnectionState().onMetadata(FIRST_RECORD_AVAILABLE_KEY, Values.longValue(end - start));
            return(_streamingState);
        }
Пример #3
0
 private LongValue ReadLong()
 {
     if (PropertyBlock.valueIsInlined(CurrentBlock()))
     {
         return(Values.longValue(( long )(( ulong )PropertyBlock.fetchLong(CurrentBlock()) >> 1)));
     }
     else
     {
         return(Values.longValue(Blocks[_block + 1]));
     }
 }
Пример #4
0
        internal RelationshipReference RelationshipReference = VirtualValues.relationship(11L);            // Should equal relationshipProxyValue when converted

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotTouchValuesThatDoNotNeedConversion()
        public virtual void ShouldNotTouchValuesThatDoNotNeedConversion()
        {
            // Given
            ListValue nodeList         = VirtualValues.list(NodeProxyValue, DirectNodeValue);
            ListValue relationshipList = VirtualValues.list(RelationshipProxyValue, DirectRelationshipValue);
            MapValue  nodeMap          = VirtualValues.map(new string[] { "a", "b" }, new AnyValue[] { NodeProxyValue, DirectNodeValue });
            MapValue  relationshipMap  = VirtualValues.map(new string[] { "a", "b" }, new AnyValue[] { RelationshipProxyValue, DirectRelationshipValue });

            // Verify
            VerifyDoesNotTouchValue(NodeProxyValue);
            VerifyDoesNotTouchValue(RelationshipProxyValue);
            VerifyDoesNotTouchValue(DirectNodeValue);
            VerifyDoesNotTouchValue(DirectRelationshipValue);
            VerifyDoesNotTouchValue(nodeList);
            VerifyDoesNotTouchValue(relationshipList);
            VerifyDoesNotTouchValue(nodeMap);
            VerifyDoesNotTouchValue(relationshipMap);

            // This is not an exhaustive test since the other cases are very uninteresting...
            VerifyDoesNotTouchValue(Values.booleanValue(false));
            VerifyDoesNotTouchValue(Values.stringValue("Hello"));
            VerifyDoesNotTouchValue(Values.longValue(42L));
            // ...
        }