org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator Java Examples

The following examples show how to use org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrimitiveArrayTypeInfo.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new type info for the primitive type array.
 *
 * @param arrayClass The class of the array (such as int[].class)
 * @param serializer The serializer for the array.
 * @param comparatorClass The class of the array comparator
 */
private PrimitiveArrayTypeInfo(Class<T> arrayClass, TypeSerializer<T> serializer, Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass) {
	this.arrayClass = checkNotNull(arrayClass);
	this.serializer = checkNotNull(serializer);
	this.comparatorClass = checkNotNull(comparatorClass);

	checkArgument(
		arrayClass.isArray() && arrayClass.getComponentType().isPrimitive(),
		"Class must represent an array of primitives");
}
 
Example #2
Source File: PrimitiveArrayTypeInfo.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
@PublicEvolving
public PrimitiveArrayComparator<T, ?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	try {
		return comparatorClass.getConstructor(boolean.class).newInstance(sortOrderAscending);
	} catch (Exception e) {
		throw new RuntimeException("Could not initialize primitive " + comparatorClass.getName() + " array comparator.", e);
	}
}
 
Example #3
Source File: PrimitiveArrayTypeInfo.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new type info for the primitive type array.
 *
 * @param arrayClass The class of the array (such as int[].class)
 * @param serializer The serializer for the array.
 * @param comparatorClass The class of the array comparator
 */
private PrimitiveArrayTypeInfo(Class<T> arrayClass, TypeSerializer<T> serializer, Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass) {
	this.arrayClass = checkNotNull(arrayClass);
	this.serializer = checkNotNull(serializer);
	this.comparatorClass = checkNotNull(comparatorClass);

	checkArgument(
		arrayClass.isArray() && arrayClass.getComponentType().isPrimitive(),
		"Class must represent an array of primitives");
}
 
Example #4
Source File: PrimitiveArrayTypeInfo.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
@PublicEvolving
public PrimitiveArrayComparator<T, ?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	try {
		return comparatorClass.getConstructor(boolean.class).newInstance(sortOrderAscending);
	} catch (Exception e) {
		throw new RuntimeException("Could not initialize primitive " + comparatorClass.getName() + " array comparator.", e);
	}
}
 
Example #5
Source File: PrimitiveArrayTypeInfo.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new type info for the primitive type array.
 *
 * @param arrayClass The class of the array (such as int[].class)
 * @param serializer The serializer for the array.
 * @param comparatorClass The class of the array comparator
 */
private PrimitiveArrayTypeInfo(Class<T> arrayClass, TypeSerializer<T> serializer, Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass) {
	this.arrayClass = checkNotNull(arrayClass);
	this.serializer = checkNotNull(serializer);
	this.comparatorClass = checkNotNull(comparatorClass);

	checkArgument(
		arrayClass.isArray() && arrayClass.getComponentType().isPrimitive(),
		"Class must represent an array of primitives");
}
 
Example #6
Source File: PrimitiveArrayTypeInfo.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
@PublicEvolving
public PrimitiveArrayComparator<T, ?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	try {
		return comparatorClass.getConstructor(boolean.class).newInstance(sortOrderAscending);
	} catch (Exception e) {
		throw new RuntimeException("Could not initialize primitive " + comparatorClass.getName() + " array comparator.", e);
	}
}