本文整理了Java中org.neo4j.values.storable.ValueComparator
类的一些代码示例,展示了ValueComparator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ValueComparator
类的具体详情如下:
包路径:org.neo4j.values.storable.ValueComparator
类名称:ValueComparator
[英]Comparator for values. Usable for sorting values, for example during index range scans.
[中]值的比较器。可用于排序值,例如在索引范围扫描期间。
代码示例来源:origin: neo4j/neo4j
@Override
public boolean acceptsValue( Value value )
{
if ( value == null || value == NO_VALUE )
{
return false;
}
if ( value.valueGroup() == valueGroup )
{
if ( from != null )
{
int compare = Values.COMPARATOR.compare( value, from );
if ( compare <0 || !fromInclusive && compare == 0 )
{
return false;
}
}
if ( to != null )
{
int compare = Values.COMPARATOR.compare( value, to );
return compare <= 0 && (toInclusive || compare != 0);
}
return true;
}
return false;
}
代码示例来源:origin: neo4j/neo4j
return valueComparator.ternaryCompare( (Value) v1, (Value) v2 );
return Comparison.from( valueComparator.compare( (Value) v1, (Value) v2 ) );
代码示例来源:origin: neo4j/neo4j
Arrays.sort( expectedValues, Values.COMPARATOR.reversed() );
代码示例来源:origin: org.neo4j/neo4j-values
return valueComparator.ternaryCompare( (Value) v1, (Value) v2 );
return Comparison.from( valueComparator.compare( (Value) v1, (Value) v2 ) );
代码示例来源:origin: neo4j/neo4j
private Value pickSmaller( Value value1, Value value2 )
{
return COMPARATOR.compare( value1, value2 ) <0 ? value1 : value2;
}
代码示例来源:origin: neo4j/neo4j
@Override
public int compare( Object o1, Object o2 )
{
return Values.COMPARATOR.compare( Values.of(o1), Values.of(o2) );
}
};
代码示例来源:origin: neo4j/neo4j
@Override
public int compare( Object o1, Object o2 )
{
return Values.COMPARATOR.compare( Values.of(o1), Values.of(o2) );
}
};
代码示例来源:origin: neo4j/neo4j
@Override
public int compare( Number n1, Number n2 )
{
return Values.COMPARATOR.compare( Values.numberValue(n1), Values.numberValue(n2) );
}
};
代码示例来源:origin: neo4j/neo4j
void next( Sink sink )
{
int c = 0;
if ( valuesFromA != null && valuesFromB != null )
{
checkArgument( valuesFromA.length == valuesFromB.length,
"Expected index and txState values to have same dimensions, but got %d values from index and %d from txState",
valuesFromB.length, valuesFromA.length );
for ( int i = 0; c == 0 && i
c = Values.COMPARATOR.compare( valuesFromA[i], valuesFromB[i] );
}
}
if ( nextFromB == -1 || Integer.signum( c ) == indexOrder )
{
sink.acceptSortedMergeJoin( nextFromA, valuesFromA );
nextFromA = -1;
valuesFromA = null;
}
else
{
sink.acceptSortedMergeJoin( nextFromB, valuesFromB );
nextFromB = -1;
valuesFromB = null;
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public int compareValueTo( ZonedDateTimeIndexKey other )
{
int compare = Long.compare( epochSecondUTC, other.epochSecondUTC );
if ( compare == 0 )
{
compare = Integer.compare( nanoOfSecond, other.nanoOfSecond );
if ( compare == 0 &&
// We need to check validity upfront without throwing exceptions, because the PageCursor might give garbage bytes
TimeZones.validZoneOffset( zoneOffsetSeconds ) &&
TimeZones.validZoneOffset( other.zoneOffsetSeconds ) )
{
if ( zoneOffsetSeconds != other.zoneOffsetSeconds ||
zoneId != other.zoneId )
{
// In the rare case of comparing the same instant in different time zones, we settle for
// mapping to values and comparing using the general values comparator.
compare = Values.COMPARATOR.compare( asValue(), other.asValue() );
}
}
}
return compare;
}
代码示例来源:origin: neo4j/neo4j
static int compare(
long this_long0, long this_long1, long this_long2, long this_long3,
long that_long0, long that_long1, long that_long2, long that_long3 )
{
int compare = Long.compare( this_long0, that_long0 );
if ( compare == 0 )
{
compare = Integer.compare( (int) this_long1, (int) that_long1 );
if ( compare == 0 &&
// We need to check validity upfront without throwing exceptions, because the PageCursor might give garbage bytes
TimeZones.validZoneOffset( (int) this_long3 ) &&
TimeZones.validZoneOffset( (int) that_long3 ) )
{
// In the rare case of comparing the same instant in different time zones, we settle for
// mapping to values and comparing using the general values comparator.
compare = Values.COMPARATOR.compare(
asValue( this_long0, this_long1, this_long2, this_long3 ),
asValue( that_long0, that_long1, that_long2, that_long3 ) );
}
}
return compare;
}
代码示例来源:origin: neo4j/neo4j
private void assertLessThanOrEqualTo( Value[] o1, Value[] o2 )
{
if ( o1 == null || o2 == null )
{
return;
}
int length = Math.min( o1.length, o2.length );
for ( int i = 0; i
int compare = Values.COMPARATOR.compare( o1[i], o2[i] );
assertThat( "expected less than or equal to but was " + Arrays.toString( o1 ) + " and " + Arrays.toString( o2 ),
compare, lessThanOrEqualTo( 0 ) );
if ( compare != 0 )
{
return;
}
}
}
代码示例来源:origin: neo4j/neo4j
int compareIndexedPropertyValue( KEY key1, KEY key2 )
{
return Values.COMPARATOR.compare( key1.asValues()[0], key2.asValues()[0] );
}
代码示例来源:origin: neo4j/neo4j
@Disabled // only runnable it JVM supports East-Saskatchewan
public void shouldCompareRenamedTimeZonesByZoneNumber()
{
int cmp = Values.COMPARATOR.compare( datetime( 10000, 100, ZoneId.of( "Canada/Saskatchewan" ) ),
datetime( 10000, 100, ZoneId.of( "Canada/East-Saskatchewan" ) ) );
assertEquals( 0, cmp, "East-Saskatchewan and Saskatchewan are the same place" );
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldHaveSameCompareResultsAsValueCompare()
{
// given
List
List
// when
for ( int i = 0; i
Value value1 = values.get( i );
NumberIndexKey numberIndexKey1 = numberIndexKeys.get( i );
for ( int j = 0; j
// then
Value value2 = values.get( j );
NumberIndexKey numberIndexKey2 = numberIndexKeys.get( j );
assertEquals( Values.COMPARATOR.compare( value1, value2 ),
layout.compare( numberIndexKey1, numberIndexKey2 ) );
assertEquals( Values.COMPARATOR.compare( value2, value1 ),
layout.compare( numberIndexKey2, numberIndexKey1 ) );
}
}
}
代码示例来源:origin: neo4j/neo4j
private void assertFoundNodesInOrder( NodeValueIndexCursor node, IndexOrder indexOrder )
{
Value currentValue = null;
while ( node.next() )
{
long nodeReference = node.nodeReference();
Value storedValue = getPropertyValueFromStore( nodeReference );
if ( currentValue != null )
{
switch ( indexOrder )
{
case ASCENDING:
assertTrue( "Requested ordering " + indexOrder + " was not respected.",
Values.COMPARATOR.compare( currentValue, storedValue ) <= 0 );
break;
case DESCENDING:
assertTrue( "Requested ordering " + indexOrder + " was not respected.",
Values.COMPARATOR.compare( currentValue, storedValue ) >= 0 );
break;
case NONE:
// Don't verify
break;
default:
throw new UnsupportedOperationException( "Can not verify ordering for " + indexOrder );
}
}
currentValue = storedValue;
}
}
代码示例来源:origin: neo4j/neo4j
private void assertResultsInOrder( List
{
Comparator
: ( a, b ) -> Values.COMPARATOR.compare( b.other(), a.other() );
expected.sort( comparator );
Iterator
while ( cursor.next() && expectedRows.hasNext() )
{
Pair
assertThat( cursor.nodeReference(), equalTo( expectedRow.first() ) );
for ( int i = 0; i
Value value = cursor.propertyValue( i );
assertThat( value, equalTo( expectedRow.other() ) );
}
}
assertFalse( expectedRows.hasNext() );
assertFalse( cursor.next() );
}
代码示例来源:origin: neo4j/neo4j
vj.writeTo( keyJ );
int expected = Integer.signum( Values.COMPARATOR.compare( vi, vj ) );
assertEquals( format( "comparing %s and %s", vi, vj ), expected, Integer.signum( i - j ) );
assertEquals( format( "comparing %s and %s", vi, vj ), expected, Integer.signum( keyI.compareValueTo( keyJ ) ) );
代码示例来源:origin: neo4j/neo4j
@ParameterizedTest
@MethodSource( "validComparableValueGenerators" )
void mustProduceValidMinimalSplitters( ValueGenerator valueGenerator )
{
// Given
Value value1 = valueGenerator.next();
Value value2;
do
{
value2 = valueGenerator.next();
}
while ( COMPARATOR.compare( value1, value2 ) == 0 );
// When
Value left = pickSmaller( value1, value2 );
Value right = left == value1 ? value2 : value1;
// Then
assertValidMinimalSplitter( left, right );
}
代码示例来源:origin: neo4j/neo4j
List
updateAndCommit( updates );
TreeSet
sortedValues.addAll( updates );
Value from = random.randomValues().nextValueOfType( type );
Value to = random.randomValues().nextValueOfType( type );
if ( Values.COMPARATOR.compare( from, to ) > 0 )