当前位置: 首页>>代码示例>>Java>>正文


Java IntComparator类代码示例

本文整理汇总了Java中org.apache.flink.api.common.typeutils.base.IntComparator的典型用法代码示例。如果您正苦于以下问题:Java IntComparator类的具体用法?Java IntComparator怎么用?Java IntComparator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntComparator类属于org.apache.flink.api.common.typeutils.base包,在下文中一共展示了IntComparator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: beforeTest

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
	serializer1 = new TupleSerializer<Tuple2<Integer, String>>(
			(Class<Tuple2<Integer, String>>) (Class<?>) Tuple2.class,
			new TypeSerializer<?>[] { IntSerializer.INSTANCE, StringSerializer.INSTANCE });
	serializer2 = new TupleSerializer<Tuple2<Integer, String>>(
			(Class<Tuple2<Integer, String>>) (Class<?>) Tuple2.class,
			new TypeSerializer<?>[] { IntSerializer.INSTANCE, StringSerializer.INSTANCE });
	comparator1 =  new TupleComparator<Tuple2<Integer, String>>(
			new int[]{0},
			new TypeComparator<?>[] { new IntComparator(true) },
			new TypeSerializer<?>[] { IntSerializer.INSTANCE });
	comparator2 =  new TupleComparator<Tuple2<Integer, String>>(
			new int[]{0},
			new TypeComparator<?>[] { new IntComparator(true) },
			new TypeSerializer<?>[] { IntSerializer.INSTANCE });
	pairComparator = new GenericPairComparator<Tuple2<Integer, String>, Tuple2<Integer, String>>(comparator1, comparator2);
	
	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1);
	this.ioManager = new IOManagerAsync();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:NonReusingSortMergeInnerJoinIteratorITCase.java

示例2: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected GenericPairComparator<Tuple3<Integer, String, Double>, Tuple4<Integer, Float, Long, Double>> createComparator(boolean ascending) {
	int[] fields1 = new int[]{0, 2};
	int[] fields2 = new int[]{0, 3};
	TypeComparator[] comps1 = new TypeComparator[]{
			new IntComparator(ascending),
			new DoubleComparator(ascending)
	};
	TypeComparator[] comps2 = new TypeComparator[]{
			new IntComparator(ascending),
			new DoubleComparator(ascending)
	};
	TypeSerializer[] sers1 = new TypeSerializer[]{
			IntSerializer.INSTANCE,
			DoubleSerializer.INSTANCE
	};
	TypeSerializer[] sers2= new TypeSerializer[]{
			IntSerializer.INSTANCE,
			DoubleSerializer.INSTANCE
	};
	TypeComparator<Tuple3<Integer, String, Double>> comp1 = new TupleComparator<Tuple3<Integer, String, Double>>(fields1, comps1, sers1);
	TypeComparator<Tuple4<Integer, Float, Long, Double>> comp2 = new TupleComparator<Tuple4<Integer, Float, Long, Double>>(fields2, comps2, sers2);
	return new GenericPairComparator<Tuple3<Integer, String, Double>, Tuple4<Integer, Float, Long, Double>>(comp1, comp2);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:GenericPairComparatorTest.java

示例3: beforeTest

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
	serializer1 = new TupleSerializer<Tuple2<Integer, String>>(
			(Class<Tuple2<Integer, String>>) (Class<?>) Tuple2.class,
			new TypeSerializer<?>[] { IntSerializer.INSTANCE, StringSerializer.INSTANCE });
	serializer2 = new TupleSerializer<Tuple2<Integer, String>>(
			(Class<Tuple2<Integer, String>>) (Class<?>) Tuple2.class,
			new TypeSerializer<?>[] { IntSerializer.INSTANCE, StringSerializer.INSTANCE });
	comparator1 =  new TupleComparator<Tuple2<Integer, String>>(
			new int[]{0},
			new TypeComparator<?>[] { new IntComparator(true) },
			new TypeSerializer<?>[] { IntSerializer.INSTANCE });
	comparator2 =  new TupleComparator<Tuple2<Integer, String>>(
			new int[]{0},
			new TypeComparator<?>[] { new IntComparator(true) },
			new TypeSerializer<?>[] { IntSerializer.INSTANCE });
	pairComparator = new GenericPairComparator<Tuple2<Integer, String>, Tuple2<Integer, String>>(comparator1, comparator2);

	this.memoryManager = new MemoryManager(MEMORY_SIZE, 1);
	this.ioManager = new IOManagerAsync();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:ReusingSortMergeInnerJoinIteratorITCase.java

示例4: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TupleComparator<Tuple3<Integer, Long, Double>> createComparator(boolean ascending) {
	return new TupleComparator<Tuple3<Integer, Long, Double>>(
			new int[]{0, 1},
			new TypeComparator[]{
				new IntComparator(ascending),
				new LongComparator(ascending)
			},
			new TypeSerializer[]{ IntSerializer.INSTANCE, LongSerializer.INSTANCE });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:TupleComparatorILD2Test.java

示例5: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected TupleComparator<Tuple3<Tuple2<String, Double>, Tuple2<Long, Long>, Tuple2<Integer, Long>>> createComparator(
		boolean ascending) {
	return new TupleComparator<Tuple3<Tuple2<String, Double>, Tuple2<Long, Long>, Tuple2<Integer, Long>>>(
			new int[] { 0, 2 },
			new TypeComparator[] {
					new TupleComparator<Tuple2<String, Double>>(
							new int[] { 0, 1 },
							new TypeComparator[] {
							new StringComparator(ascending),
							new DoubleComparator(ascending) },
							new TypeSerializer[] {
									StringSerializer.INSTANCE,
									DoubleSerializer.INSTANCE }),
					new TupleComparator<Tuple2<Integer, Long>>(
							new int[] {	0, 1 },
							new TypeComparator[] {
							new IntComparator(ascending),
							new LongComparator(ascending) },
							new TypeSerializer[] {
									IntSerializer.INSTANCE,
									LongSerializer.INSTANCE }) },
			new TypeSerializer[] {
					new TupleSerializer<Tuple2<String, Double>>(
							(Class<Tuple2<String, Double>>) (Class<?>) Tuple2.class,
							new TypeSerializer[] {
									StringSerializer.INSTANCE,
									DoubleSerializer.INSTANCE }),
					new TupleSerializer<Tuple2<Long, Long>>(
							(Class<Tuple2<Long, Long>>) (Class<?>) Tuple2.class,
							new TypeSerializer[] {
									LongSerializer.INSTANCE,
									LongSerializer.INSTANCE }),
					new TupleSerializer<Tuple2<Integer, Long>>(
							(Class<Tuple2<Integer, Long>>) (Class<?>) Tuple2.class,
							new TypeSerializer[] {
									IntSerializer.INSTANCE,
									LongSerializer.INSTANCE }) });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:41,代码来源:TupleComparatorTTT2Test.java

示例6: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TupleComparator<Tuple3<Integer, Long, Double>> createComparator(boolean ascending) {
	return new TupleComparator<Tuple3<Integer, Long, Double>>(
			new int[]{2, 0, 1},
			new TypeComparator[]{
				new DoubleComparator(ascending),
				new IntComparator(ascending),
				new LongComparator(ascending)
			},
	new TypeSerializer[]{ IntSerializer.INSTANCE, LongSerializer.INSTANCE, DoubleSerializer.INSTANCE });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:TupleComparatorILDC3Test.java

示例7: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TupleComparator<Tuple3<Integer, String, Double>> createComparator(boolean ascending) {
	return new TupleComparator<Tuple3<Integer, String, Double>>(
			new int[]{0, 1},
			new TypeComparator[]{
				new IntComparator(ascending),
				new StringComparator(ascending)
			},
	new TypeSerializer[]{ IntSerializer.INSTANCE, StringSerializer.INSTANCE, DoubleSerializer.INSTANCE });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:TupleComparatorISD2Test.java

示例8: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TupleComparator<Tuple3<Integer, String, Double>> createComparator(boolean ascending) {
	return new TupleComparator<Tuple3<Integer, String, Double>>(
			new int[]{0, 1, 2},
			new TypeComparator[]{
				new IntComparator(ascending),
				new StringComparator(ascending),
				new DoubleComparator(ascending)
			},
	new TypeSerializer[]{ IntSerializer.INSTANCE, StringSerializer.INSTANCE, DoubleSerializer.INSTANCE });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:TupleComparatorISD3Test.java

示例9: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TupleComparator<Tuple3<Integer, String, Double>> createComparator(boolean ascending) {
	return new TupleComparator<Tuple3<Integer, String, Double>>(
			new int[]{0},
			new TypeComparator[]{ new IntComparator(ascending) },
			new TypeSerializer[]{ IntSerializer.INSTANCE });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:TupleComparatorISD1Test.java

示例10: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TupleComparator<Tuple3<Integer, Long, Double>> createComparator(boolean ascending) {
	return new TupleComparator<Tuple3<Integer, Long, Double>>(
			new int[]{0, 1, 2},
			new TypeComparator[]{
				new IntComparator(ascending),
				new LongComparator(ascending),
				new DoubleComparator(ascending)
			},
	new TypeSerializer[]{ IntSerializer.INSTANCE, LongSerializer.INSTANCE, DoubleSerializer.INSTANCE });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:TupleComparatorILD3Test.java

示例11: testMergeOfTwoStreams

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Test
public void testMergeOfTwoStreams() throws Exception
{
	// iterators
	List<MutableObjectIterator<Tuple2<Integer, String>>> iterators = new ArrayList<>();
	iterators.add(newIterator(new int[] { 1, 2, 4, 5, 10 }, new String[] { "1", "2", "4", "5", "10" }));
	iterators.add(newIterator(new int[] { 3, 6, 7, 10, 12 }, new String[] { "3", "6", "7", "10", "12" }));
	
	final int[] expected = new int[] {1, 2, 3, 4, 5, 6, 7, 10, 10, 12};

	// comparator
	TypeComparator<Integer> comparator = new IntComparator(true);

	// merge iterator
	MutableObjectIterator<Tuple2<Integer, String>> iterator = new MergeIterator<>(iterators, this.comparator);

	// check expected order
	Tuple2<Integer, String> rec1 = new Tuple2<>();
	Tuple2<Integer, String> rec2 = new Tuple2<>();
	int k1 = 0;
	int k2 = 0;
	
	int pos = 1;
	
	Assert.assertTrue((rec1 = iterator.next(rec1)) != null);
	Assert.assertEquals(expected[0], rec1.f0.intValue());
	
	while ((rec2 = iterator.next(rec2)) != null) {
		k1 = rec1.f0;
		k2 = rec2.f0;
		
		Assert.assertTrue(comparator.compare(k1, k2) <= 0);
		Assert.assertEquals(expected[pos++], k2); 
		
		Tuple2<Integer, String> tmp = rec1;
		rec1 = rec2;
		rec2 = tmp;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:40,代码来源:MergeIteratorTest.java

示例12: testMergeOfTenStreams

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Test
public void testMergeOfTenStreams() throws Exception
{
	// iterators
	List<MutableObjectIterator<Tuple2<Integer, String>>> iterators = new ArrayList<>();
	iterators.add(newIterator(new int[] { 1, 2, 17, 23, 23 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 2, 6, 7, 8, 9 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 4, 10, 11, 11, 12 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 3, 6, 7, 10, 12 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 7, 10, 15, 19, 44 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 6, 6, 11, 17, 18 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 1, 2, 4, 5, 10 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 5, 10, 19, 23, 29 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 9, 9, 9, 9, 9 }, new String[] { "A", "B", "C", "D", "E" }));
	iterators.add(newIterator(new int[] { 8, 8, 14, 14, 15 }, new String[] { "A", "B", "C", "D", "E" }));

	// comparator
	TypeComparator<Integer> comparator = new IntComparator(true);

	// merge iterator
	MutableObjectIterator<Tuple2<Integer, String>> iterator = new MergeIterator<>(iterators, this.comparator);

	int elementsFound = 1;
	// check expected order
	Tuple2<Integer, String> rec1 = new Tuple2<>();
	Tuple2<Integer, String> rec2 = new Tuple2<>();
	
	Assert.assertTrue((rec1 = iterator.next(rec1)) != null);
	while ((rec2 = iterator.next(rec2)) != null) {
		elementsFound++;

		Assert.assertTrue(comparator.compare(rec1.f0, rec2.f0) <= 0);
		
		Tuple2<Integer, String> tmp = rec1;
		rec1 = rec2;
		rec2 = tmp;
	}
	
	Assert.assertEquals("Too few elements returned from stream.", 50, elementsFound);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:41,代码来源:MergeIteratorTest.java

示例13: IntPrimitiveArrayComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
public IntPrimitiveArrayComparator(boolean ascending) {
	super(ascending, new IntComparator(ascending));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:4,代码来源:IntPrimitiveArrayComparator.java

示例14: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected TupleComparator<Tuple3<Tuple2<String, Double>, Tuple2<Long, Long>, Tuple2<Integer, Long>>> createComparator(
		boolean ascending) {
	return new TupleComparator<Tuple3<Tuple2<String, Double>, Tuple2<Long, Long>, Tuple2<Integer, Long>>>(
			new int[] { 0, 1, 2 },
			new TypeComparator[] {
					new TupleComparator<Tuple2<String, Double>>(
							new int[] { 0, 1 },
							new TypeComparator[] {
							new StringComparator(ascending),
							new DoubleComparator(ascending) },
							new TypeSerializer[] {
									StringSerializer.INSTANCE,
									DoubleSerializer.INSTANCE }),
					new TupleComparator<Tuple2<Long, Long>>(
							new int[] { 0, 1 },
							new TypeComparator[] {
							new LongComparator(ascending),
							new LongComparator(ascending) },
							new TypeSerializer[] {
									LongSerializer.INSTANCE,
									LongSerializer.INSTANCE }),
					new TupleComparator<Tuple2<Integer, Long>>(
							new int[] {	0, 1 },
							new TypeComparator[] {
							new IntComparator(ascending),
							new LongComparator(ascending) },
							new TypeSerializer[] {
									IntSerializer.INSTANCE,
									LongSerializer.INSTANCE }) },
			new TypeSerializer[] {
					new TupleSerializer<Tuple2<String, Double>>(
							(Class<Tuple2<String, Double>>) (Class<?>) Tuple2.class,
							new TypeSerializer[] {
									StringSerializer.INSTANCE,
									DoubleSerializer.INSTANCE }),
					new TupleSerializer<Tuple2<Long, Long>>(
							(Class<Tuple2<Long, Long>>) (Class<?>) Tuple2.class,
							new TypeSerializer[] {
									LongSerializer.INSTANCE,
									LongSerializer.INSTANCE }),
					new TupleSerializer<Tuple2<Integer, Long>>(
							(Class<Tuple2<Integer, Long>>) (Class<?>) Tuple2.class,
							new TypeSerializer[] {
									IntSerializer.INSTANCE,
									LongSerializer.INSTANCE }) });
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:49,代码来源:TupleComparatorTTT3Test.java

示例15: createComparator

import org.apache.flink.api.common.typeutils.base.IntComparator; //导入依赖的package包/类
@Override
protected TypeComparator<Integer> createComparator(boolean ascending) {
	return new IntComparator(ascending);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:IntComparatorTest.java


注:本文中的org.apache.flink.api.common.typeutils.base.IntComparator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。