Exemplo n.º 1
0
        private static int WorstCaseLength(AnyValue value)
        {
            if (value.SequenceValue)
            {
                SequenceValue sequenceValue = ( SequenceValue )value;
                if (sequenceValue is TextArray)
                {
                    TextArray textArray = ( TextArray )sequenceValue;
                    int       length    = 0;
                    for (int i = 0; i < textArray.Length(); i++)
                    {
                        length += StringWorstCaseLength(textArray.StringValue(i).Length);
                    }
                    return(length);
                }
                return(sequenceValue.Length() * BIGGEST_STATIC_SIZE);
            }
            else
            {
                switch ((( Value )value).valueGroup().category())
                {
                case TEXT:
                    // For text, which is very dynamic in its nature do a worst-case off of number of characters in it
                    return(StringWorstCaseLength((( TextValue )value).length()));

                default:
                    // For all else then use the biggest possible value for a non-dynamic, non-array value a state can occupy
                    return(BIGGEST_STATIC_SIZE);
                }
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleArrays()
        internal virtual void ShouldHandleArrays()
        {
            // Given
            PrettyPrinter printer = new PrettyPrinter();
            TextArray     array   = Values.stringArray("a", "b", "c");

            // When
            array.WriteTo(printer);

            // Then
            assertThat(printer.Value(), equalTo("[\"a\", \"b\", \"c\"]"));
        }
 public abstract Base MapTextArray(Org.Neo4j.Values.Storable.TextArray value);