Java源码示例:org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.UnsignedIntToLongValueWithProperHashCode

示例1
@Test
public void testFromInt() throws Exception {
	TranslateFunction<Integer, LongValueWithProperHashCode> translator = new UnsignedIntToLongValueWithProperHashCode();

	Assert.assertEquals(new LongValueWithProperHashCode(0L),
		translator.translate(0, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode((long) Integer.MAX_VALUE + 1),
		translator.translate(Integer.MIN_VALUE, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedInt.MAX_VERTEX_COUNT - 1),
		translator.translate(-1, longValueWithProperHashCode));
}
 
示例2
@Test
public void testFromInt() throws Exception {
	TranslateFunction<Integer, LongValueWithProperHashCode> translator = new UnsignedIntToLongValueWithProperHashCode();

	Assert.assertEquals(new LongValueWithProperHashCode(0L),
		translator.translate(0, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode((long) Integer.MAX_VALUE + 1),
		translator.translate(Integer.MIN_VALUE, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedInt.MAX_VERTEX_COUNT - 1),
		translator.translate(-1, longValueWithProperHashCode));
}
 
示例3
@Test
public void testFromInt() throws Exception {
	TranslateFunction<Integer, LongValueWithProperHashCode> translator = new UnsignedIntToLongValueWithProperHashCode();

	Assert.assertEquals(new LongValueWithProperHashCode(0L),
		translator.translate(0, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode((long) Integer.MAX_VALUE + 1),
		translator.translate(Integer.MIN_VALUE, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedInt.MAX_VERTEX_COUNT - 1),
		translator.translate(-1, longValueWithProperHashCode));
}