public override AnyValue MapText(TextValue value) { if (value.Length() > _maxTextParameterLength) { return(Values.stringValue(value.StringValue().Substring(0, _maxTextParameterLength))); } return(value); }
protected internal virtual TextValue AsUTF8StringValue(TextValue @in) { if (@in is UTF8StringValue) { return(@in); } else { return(utf8Value(@in.StringValue().GetBytes(UTF_8))); } }
private void Encode(string @string) { PropertyBlock block = new PropertyBlock(); TextValue expectedValue = Values.stringValue(@string); _propertyStore.encodeValue(block, KEY_ID, expectedValue); assertEquals(0, block.ValueRecords.Count); Value readValue = block.Type.value(block, _propertyStore); assertEquals(expectedValue, readValue); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldBeAbleToUseAnyQuoteMark() internal virtual void ShouldBeAbleToUseAnyQuoteMark() { // Given TextValue hello = stringValue("(ツ)"); PrettyPrinter printer = new PrettyPrinter("__"); // When hello.WriteTo(printer); // Then assertThat(printer.Value(), equalTo("__(ツ)__")); }
public static BooleanValue Regex(TextValue lhs, TextValue rhs) { string regexString = rhs.StringValue(); try { bool matches = Pattern.compile(regexString).matcher(lhs.StringValue()).matches(); return(matches ? TRUE : FALSE); } catch (PatternSyntaxException e) { throw new InvalidSemanticsException("Invalid Regex: " + e.Message); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void minimalSplitterForSameValueShouldDivideLeftAndRight() internal virtual void MinimalSplitterForSameValueShouldDivideLeftAndRight() { // Given StringLayout layout = new StringLayout(); StringIndexKey left = layout.NewKey(); StringIndexKey right = layout.NewKey(); StringIndexKey minimalSplitter = layout.NewKey(); // keys with same value but different entityId TextValue value = _random.randomValues().nextTextValue(); left.Initialize(1); right.Initialize(2); left.initFromValue(0, value, NEUTRAL); right.initFromValue(0, value, NEUTRAL); // When creating minimal splitter layout.MinimalSplitter(left, right, minimalSplitter); // Then that minimal splitter need to correctly divide left and right assertTrue(layout.Compare(left, minimalSplitter) < 0, "Expected minimal splitter to be strictly greater than left but wasn't for value " + value); assertTrue(layout.Compare(minimalSplitter, right) <= 0, "Expected right to be greater than or equal to minimal splitter but wasn't for value " + value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void minimalSplitterShouldRemoveEntityIdIfPossible() internal virtual void MinimalSplitterShouldRemoveEntityIdIfPossible() { // Given StringLayout layout = new StringLayout(); StringIndexKey left = layout.NewKey(); StringIndexKey right = layout.NewKey(); StringIndexKey minimalSplitter = layout.NewKey(); string @string = _random.nextString(); TextValue leftValue = Values.stringValue(@string); TextValue rightValue = Values.stringValue(@string + _random.randomValues().nextCharRaw()); // keys with unique values left.Initialize(1); left.initFromValue(0, leftValue, NEUTRAL); right.Initialize(2); right.initFromValue(0, rightValue, NEUTRAL); // When creating minimal splitter layout.MinimalSplitter(left, right, minimalSplitter); // Then that minimal splitter should have entity id shaved off assertEquals(NO_ENTITY_ID, minimalSplitter.EntityId, "Expected minimal splitter to have entityId removed when constructed from keys with unique values: " + "left=" + leftValue + ", right=" + rightValue); }
public override Value MapText(TextValue value) { throw new CypherTypeException("Don't know how to treat that as a boolean: " + value, null); }
public static BooleanValue Regex(TextValue text, Pattern pattern) { bool matches = pattern.matcher(text.StringValue()).matches(); return(matches ? TRUE : FALSE); }
internal StringSuffixPredicate(int propertyKeyId, TextValue suffix) : base(propertyKeyId) { //we know utf8 values are coming from the index so optimize for that this.SuffixConflict = AsUTF8StringValue(suffix); }
internal StringContainsPredicate(int propertyKeyId, TextValue contains) : base(propertyKeyId) { //we know utf8 values are coming from the index so optimize for that this.ContainsConflict = AsUTF8StringValue(contains); }
/// <summary> /// Searches the index string values ending with {@code suffix}. /// </summary> /// <param name="propertyKeyId"> the property ID to match. </param> /// <param name="suffix"> the string suffix to search for. </param> /// <returns> an <seealso cref="IndexQuery"/> instance to be used for querying an index. </returns> public static StringSuffixPredicate StringSuffix(int propertyKeyId, TextValue suffix) { return(new StringSuffixPredicate(propertyKeyId, suffix)); }
/// <summary> /// Searches the index for string values containing the exact search string. /// </summary> /// <param name="propertyKeyId"> the property ID to match. </param> /// <param name="contains"> the string to search for. </param> /// <returns> an <seealso cref="IndexQuery"/> instance to be used for querying an index. </returns> public static StringContainsPredicate StringContains(int propertyKeyId, TextValue contains) { return(new StringContainsPredicate(propertyKeyId, contains)); }
/// <summary> /// Searches the index string values starting with {@code prefix}. /// </summary> /// <param name="propertyKeyId"> the property ID to match. </param> /// <param name="prefix"> the string prefix to search for. </param> /// <returns> an <seealso cref="IndexQuery"/> instance to be used for querying an index. </returns> public static StringPrefixPredicate StringPrefix(int propertyKeyId, TextValue prefix) { return(new StringPrefixPredicate(propertyKeyId, prefix)); }