@Override public int compare( Number n1, Number n2 ) { return Values.COMPARATOR.compare( Values.numberValue(n1), Values.numberValue(n2) ); } };
/** * Searches the index for numeric values between {@code from} and {@code to}. * * @param propertyKeyId the property ID to match. * @param from lower bound of the range or null if unbounded * @param fromInclusive the lower bound is inclusive if true. * @param to upper bound of the range or null if unbounded * @param toInclusive the upper bound is inclusive if true. * @return an {@link IndexQuery} instance to be used for querying an index. */ public static RangePredicate<?> range( int propertyKeyId, Number from, boolean fromInclusive, Number to, boolean toInclusive ) { return new NumberRangePredicate( propertyKeyId, from == null ? null : Values.numberValue( from ), fromInclusive, to == null ? null : Values.numberValue( to ), toInclusive ); }
private IndexEntryUpdate<LabelSchemaDescriptor> someUpdate() { return IndexEntryUpdate.add( 0, SchemaDescriptorFactory.forLabel( 0, 0 ), Values.numberValue( 0 ) ); } }
return ((DurationValue) lhs).mul( Values.numberValue( (Number) rhs ) ); return ((DurationValue) rhs).mul( Values.numberValue( (Number) lhs ) );
return ((DurationValue) lhs).div( Values.numberValue( (Number) rhs ) );
@Test public void shouldCallRegisteredFunction() throws Throwable { // Given procs.register( function ); // When Object result = procs.callFunction( new BasicContext(), signature.name(), new AnyValue[] {numberValue( 1337 )} ); // Then assertThat( result , equalTo( Values.of(1337) ) ); }
@Test public void shouldNotAllowCallingNonExistingFunction() throws Throwable { // Expect exception.expect( ProcedureException.class ); exception.expectMessage( "There is no function with the name `org.myproc` registered for this " + "database instance. Please ensure you've spelled the " + "function name correctly and that the function is properly deployed." ); // When procs.callFunction( new BasicContext(), signature.name(), new AnyValue[] {numberValue( 1337 )} ); }
return numberValue( (Number) value );
map( new String[] {"alpha", "beta"}, new AnyValue[] {stringValue( "one" ), numberValue( 2 )} ), NO_VALUE, list( numberValue( 1 ), stringValue( "fine" ), node2 ), stringValue( "hello world" ), stringArray( "hello", "brave", "new", "world" ),
@Override public int compare( Number n1, Number n2 ) { return Values.COMPARATOR.compare( Values.numberValue(n1), Values.numberValue(n2) ); } };
/** * Searches the index for numeric values between {@code from} and {@code to}. * * @param propertyKeyId the property ID to match. * @param from lower bound of the range or null if unbounded * @param fromInclusive the lower bound is inclusive if true. * @param to upper bound of the range or null if unbounded * @param toInclusive the upper bound is inclusive if true. * @return an {@link IndexQuery} instance to be used for querying an index. */ public static RangePredicate<?> range( int propertyKeyId, Number from, boolean fromInclusive, Number to, boolean toInclusive ) { return new NumberRangePredicate( propertyKeyId, from == null ? null : Values.numberValue( from ), fromInclusive, to == null ? null : Values.numberValue( to ), toInclusive ); }
return ((DurationValue) lhs).mul( Values.numberValue( (Number) rhs ) ); return ((DurationValue) rhs).mul( Values.numberValue( (Number) lhs ) );
return ((DurationValue) lhs).div( Values.numberValue( (Number) rhs ) );
return numberValue( (Number) value );