Skip to content

Commit

Permalink
Rename Types -> Type
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Sep 17, 2018
1 parent 0f97463 commit 75ed2a3
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
Expand Up @@ -618,7 +618,7 @@ public void testIndexSeekRangeWithExistsBySpatialArray() throws Exception
public void testExactMatchOnRandomCompositeValues() throws Exception
{
// given
List<RandomValues.Types> types = testSuite.supportedValueTypes();
List<RandomValues.Type> types = testSuite.supportedValueTypes();
List<IndexEntryUpdate<?>> updates = new ArrayList<>();
Set<ValueTuple> duplicateChecker = new HashSet<>();
for ( long id = 0; id < 10_000; id++ )
Expand Down
Expand Up @@ -57,7 +57,7 @@ public CompositeRandomizedIndexAccessorCompatibility( IndexProviderCompatibility
public void testExactMatchOnRandomCompositeValues() throws Exception
{
// given
List<RandomValues.Types> types = testSuite.supportedValueTypes();
List<RandomValues.Type> types = testSuite.supportedValueTypes();
Collections.shuffle( types, random.random() );
types = types.subList( 0, random.nextInt( 2, types.size() ) );
List<IndexEntryUpdate<?>> updates = new ArrayList<>();
Expand Down
Expand Up @@ -98,15 +98,15 @@ public boolean supportFullValuePrecisionForNumbers()
return true;
}

public List<RandomValues.Types> supportedValueTypes()
public List<RandomValues.Type> supportedValueTypes()
{
List<RandomValues.Types> types = new ArrayList<>( Arrays.asList( RandomValues.Types.values() ) );
List<RandomValues.Type> types = new ArrayList<>( Arrays.asList( RandomValues.Type.values() ) );
if ( !supportsSpatial() )
{
types.remove( RandomValues.Types.CARTESIAN_POINT );
types.remove( RandomValues.Types.CARTESIAN_POINT_3D );
types.remove( RandomValues.Types.GEOGRAPHIC_POINT );
types.remove( RandomValues.Types.GEOGRAPHIC_POINT_3D );
types.remove( RandomValues.Type.CARTESIAN_POINT );
types.remove( RandomValues.Type.CARTESIAN_POINT_3D );
types.remove( RandomValues.Type.GEOGRAPHIC_POINT );
types.remove( RandomValues.Type.GEOGRAPHIC_POINT_3D );
}
return types;
}
Expand Down
Expand Up @@ -56,7 +56,7 @@ public SimpleRandomizedIndexAccessorCompatibility( IndexProviderCompatibilityTes
public void testExactMatchOnRandomValues() throws Exception
{
// given
List<RandomValues.Types> types = testSuite.supportedValueTypes();
List<RandomValues.Type> types = testSuite.supportedValueTypes();
Collections.shuffle( types, random.random() );
types = types.subList( 0, random.nextInt( 2, types.size() ) );

Expand Down
Expand Up @@ -281,7 +281,7 @@ public Value nextValue()
return randoms.nextValue();
}

public Value nextValue( RandomValues.Types type )
public Value nextValue( RandomValues.Type type )
{
return randoms.nextValueOfType( type );
}
Expand Down
Expand Up @@ -74,7 +74,7 @@
*/
public class RandomValues
{
public enum Types
public enum Type
{
BOOLEAN( ValueGroup.NUMBER, BooleanValue.class ),
BYTE( ValueGroup.NUMBER, ByteValue.class ),
Expand Down Expand Up @@ -125,23 +125,23 @@ public enum Types
public final Class<? extends Value> valueClass;
public final boolean arrayType;

Types( ValueGroup valueGroup, Class<? extends Value> valueClass )
Type( ValueGroup valueGroup, Class<? extends Value> valueClass )
{
this( valueGroup, valueClass, false );
}

Types( ValueGroup valueGroup, Class<? extends Value> valueClass, boolean arrayType )
Type( ValueGroup valueGroup, Class<? extends Value> valueClass, boolean arrayType )
{
this.valueGroup = valueGroup;
this.valueClass = valueClass;
this.arrayType = arrayType;
}

static Types[] arrayTypes()
static Type[] arrayTypes()
{
return Arrays.stream( Types.values() )
return Arrays.stream( Type.values() )
.filter( t -> t.arrayType )
.toArray( Types[]::new );
.toArray( Type[]::new );
}
}

Expand Down Expand Up @@ -194,8 +194,8 @@ public int maxCodePoint()
private static final int MAX_ASCII_CODE_POINT = 0x7F;
public static final int MAX_BMP_CODE_POINT = 0xFFFF;
public static final Configuration DEFAULT_CONFIGURATION = new Default();
private static final Types[] ALL_TYPES = Types.values();
private static final Types[] ARRAY_TYPES = Types.arrayTypes();
private static final Type[] ALL_TYPES = Type.values();
private static final Type[] ARRAY_TYPES = Type.arrayTypes();
private static final long NANOS_PER_SECOND = 1_000_000_000L;

private final Generator generator;
Expand Down Expand Up @@ -287,27 +287,27 @@ public Value nextValue()
*
* @see RandomValues
*/
public Value nextValueOfTypes( Types... types )
public Value nextValueOfTypes( Type... types )
{
return nextValueOfType( among( types ) );
}

/**
* Create an array containing all value types, excluding provided types.
*/
public Types[] excluding( Types... types )
public Type[] excluding( Type... types )
{
return Arrays.stream( Types.values() )
return Arrays.stream( Type.values() )
.filter( t -> !ArrayUtils.contains( types, t ) )
.toArray( Types[]::new );
.toArray( Type[]::new );
}

/**
* Returns the next {@link Value} of provided type.
*
* @see RandomValues
*/
public Value nextValueOfType( Types type )
public Value nextValueOfType( Type type )
{
switch ( type )
{
Expand Down
Expand Up @@ -281,10 +281,10 @@ public void nextValue()
@Test
public void nextValueOfTypes()
{
RandomValues.Types[] allTypes = RandomValues.Types.values();
RandomValues.Types[] including = randomValues.selection( allTypes, 1, allTypes.length, false );
RandomValues.Type[] allTypes = RandomValues.Type.values();
RandomValues.Type[] including = randomValues.selection( allTypes, 1, allTypes.length, false );
HashSet<Class<? extends AnyValue>> seen = new HashSet<>();
for ( RandomValues.Types type : including )
for ( RandomValues.Type type : including )
{
seen.add( type.valueClass );
}
Expand All @@ -300,10 +300,10 @@ public void nextValueOfTypes()
@Test
public void excluding()
{
RandomValues.Types[] allTypes = RandomValues.Types.values();
RandomValues.Types[] excluding = randomValues.selection( allTypes, 1, allTypes.length, false );
RandomValues.Types[] including = randomValues.excluding( excluding );
for ( RandomValues.Types excludedType : excluding )
RandomValues.Type[] allTypes = RandomValues.Type.values();
RandomValues.Type[] excluding = randomValues.selection( allTypes, 1, allTypes.length, false );
RandomValues.Type[] including = randomValues.excluding( excluding );
for ( RandomValues.Type excludedType : excluding )
{
if ( ArrayUtils.contains( including, excludedType ) )
{
Expand All @@ -324,9 +324,9 @@ public void nextBasicMultilingualPlaneTextValue()
}
}

private void assertValueAmongTypes( RandomValues.Types[] types, Value value )
private void assertValueAmongTypes( RandomValues.Type[] types, Value value )
{
for ( RandomValues.Types type : types )
for ( RandomValues.Type type : types )
{
if ( type.valueClass.isAssignableFrom( value.getClass() ) )
{
Expand Down

0 comments on commit 75ed2a3

Please sign in to comment.