Java Code Examples for org.apache.flink.api.common.typeutils.base.ShortValueComparator

The following examples show how to use org.apache.flink.api.common.typeutils.base.ShortValueComparator. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: ValueTypeInfo.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@PublicEvolving
public TypeComparator<T> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	if (!isKeyType()) {
		throw new RuntimeException("The type " + type.getName() + " is not Comparable.");
	}

	if (BooleanValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new BooleanValueComparator(sortOrderAscending);
	}
	else if (ByteValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ByteValueComparator(sortOrderAscending);
	}
	else if (CharValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CharValueComparator(sortOrderAscending);
	}
	else if (DoubleValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new DoubleValueComparator(sortOrderAscending);
	}
	else if (FloatValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new FloatValueComparator(sortOrderAscending);
	}
	else if (IntValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new IntValueComparator(sortOrderAscending);
	}
	else if (LongValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new LongValueComparator(sortOrderAscending);
	}
	else if (NullValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) NullValueComparator.getInstance();
	}
	else if (ShortValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ShortValueComparator(sortOrderAscending);
	}
	else if (StringValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new StringValueComparator(sortOrderAscending);
	}
	else if (CopyableValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CopyableValueComparator(sortOrderAscending, type);
	}
	else {
		return (TypeComparator<T>) new ValueComparator(sortOrderAscending, type);
	}
}
 
Example 2
Source Project: flink   Source File: ValueTypeInfo.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@PublicEvolving
public TypeComparator<T> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	if (!isKeyType()) {
		throw new RuntimeException("The type " + type.getName() + " is not Comparable.");
	}

	if (BooleanValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new BooleanValueComparator(sortOrderAscending);
	}
	else if (ByteValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ByteValueComparator(sortOrderAscending);
	}
	else if (CharValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CharValueComparator(sortOrderAscending);
	}
	else if (DoubleValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new DoubleValueComparator(sortOrderAscending);
	}
	else if (FloatValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new FloatValueComparator(sortOrderAscending);
	}
	else if (IntValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new IntValueComparator(sortOrderAscending);
	}
	else if (LongValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new LongValueComparator(sortOrderAscending);
	}
	else if (NullValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) NullValueComparator.getInstance();
	}
	else if (ShortValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ShortValueComparator(sortOrderAscending);
	}
	else if (StringValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new StringValueComparator(sortOrderAscending);
	}
	else if (CopyableValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CopyableValueComparator(sortOrderAscending, type);
	}
	else {
		return (TypeComparator<T>) new ValueComparator(sortOrderAscending, type);
	}
}
 
Example 3
Source Project: flink   Source File: ValueTypeInfo.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@PublicEvolving
public TypeComparator<T> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
	if (!isKeyType()) {
		throw new RuntimeException("The type " + type.getName() + " is not Comparable.");
	}

	if (BooleanValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new BooleanValueComparator(sortOrderAscending);
	}
	else if (ByteValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ByteValueComparator(sortOrderAscending);
	}
	else if (CharValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CharValueComparator(sortOrderAscending);
	}
	else if (DoubleValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new DoubleValueComparator(sortOrderAscending);
	}
	else if (FloatValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new FloatValueComparator(sortOrderAscending);
	}
	else if (IntValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new IntValueComparator(sortOrderAscending);
	}
	else if (LongValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new LongValueComparator(sortOrderAscending);
	}
	else if (NullValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) NullValueComparator.getInstance();
	}
	else if (ShortValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new ShortValueComparator(sortOrderAscending);
	}
	else if (StringValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new StringValueComparator(sortOrderAscending);
	}
	else if (CopyableValue.class.isAssignableFrom(type)) {
		return (TypeComparator<T>) new CopyableValueComparator(sortOrderAscending, type);
	}
	else {
		return (TypeComparator<T>) new ValueComparator(sortOrderAscending, type);
	}
}