Java Code Examples for org.apache.flink.graph.asm.translate.TranslateFunction

The following examples show how to use org.apache.flink.graph.asm.translate.TranslateFunction. 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   Source File: TertiaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicTertiaryResult<>();
	}

	K vertexId0 = this.getVertexId0();
	K vertexId1 = this.getVertexId1();
	K vertexId2 = this.getVertexId2();

	TertiaryResult<T> translatable = (TertiaryResult<T>) reuse;
	TertiaryResult<T> translated = (TertiaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));
	translated.setVertexId1(translator.translate(this.getVertexId1(), translatable.getVertexId1()));
	translated.setVertexId2(translator.translate(this.getVertexId2(), translatable.getVertexId2()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);
	this.setVertexId1(vertexId1);
	this.setVertexId2(vertexId2);

	return reuse;
}
 
Example 2
Source Project: Flink-CEPplus   Source File: BinaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicBinaryResult<>();
	}

	K vertexId0 = this.getVertexId0();
	K vertexId1 = this.getVertexId1();

	BinaryResult<T> translatable = (BinaryResult<T>) reuse;
	BinaryResult<T> translated = (BinaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));
	translated.setVertexId1(translator.translate(this.getVertexId1(), translatable.getVertexId1()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);
	this.setVertexId1(vertexId1);

	return reuse;
}
 
Example 3
Source Project: Flink-CEPplus   Source File: UnaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicUnaryResult<>();
	}

	K vertexId0 = this.getVertexId0();

	UnaryResult<T> translatable = (UnaryResult<T>) reuse;
	UnaryResult<T> translated = (UnaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);

	return reuse;
}
 
Example 4
Source Project: flink   Source File: UnaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicUnaryResult<>();
	}

	K vertexId0 = this.getVertexId0();

	UnaryResult<T> translatable = (UnaryResult<T>) reuse;
	UnaryResult<T> translated = (UnaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);

	return reuse;
}
 
Example 5
Source Project: flink   Source File: TertiaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicTertiaryResult<>();
	}

	K vertexId0 = this.getVertexId0();
	K vertexId1 = this.getVertexId1();
	K vertexId2 = this.getVertexId2();

	TertiaryResult<T> translatable = (TertiaryResult<T>) reuse;
	TertiaryResult<T> translated = (TertiaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));
	translated.setVertexId1(translator.translate(this.getVertexId1(), translatable.getVertexId1()));
	translated.setVertexId2(translator.translate(this.getVertexId2(), translatable.getVertexId2()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);
	this.setVertexId1(vertexId1);
	this.setVertexId2(vertexId2);

	return reuse;
}
 
Example 6
Source Project: flink   Source File: BinaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicBinaryResult<>();
	}

	K vertexId0 = this.getVertexId0();
	K vertexId1 = this.getVertexId1();

	BinaryResult<T> translatable = (BinaryResult<T>) reuse;
	BinaryResult<T> translated = (BinaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));
	translated.setVertexId1(translator.translate(this.getVertexId1(), translatable.getVertexId1()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);
	this.setVertexId1(vertexId1);

	return reuse;
}
 
Example 7
Source Project: flink   Source File: UnaryResultBase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> TranslatableResult<T> translate(TranslateFunction<K, T> translator, TranslatableResult<T> reuse, Collector<TranslatableResult<T>> out)
		throws Exception {
	if (reuse == null) {
		reuse = new BasicUnaryResult<>();
	}

	K vertexId0 = this.getVertexId0();

	UnaryResult<T> translatable = (UnaryResult<T>) reuse;
	UnaryResult<T> translated = (UnaryResult<T>) this;

	translated.setVertexId0(translator.translate(this.getVertexId0(), translatable.getVertexId0()));

	out.collect((TranslatableResult<T>) translated);

	this.setVertexId0(vertexId0);

	return reuse;
}
 
Example 8
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToByteValue() throws Exception {
	TranslateFunction<LongValue, ByteValue> translator = new LongValueToUnsignedByteValue();

	Assert.assertEquals(new ByteValue((byte) 0),
		translator.translate(new LongValue(0L), byteValue));

	Assert.assertEquals(new ByteValue(Byte.MIN_VALUE),
		translator.translate(new LongValue(Byte.MAX_VALUE + 1), byteValue));

	Assert.assertEquals(new ByteValue((byte) -1),
		translator.translate(new LongValue(LongValueToUnsignedByteValue.MAX_VERTEX_COUNT - 1), byteValue));
}
 
Example 9
Source Project: flink   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToFloat() throws Exception {
	TranslateFunction<LongValue, Float> translator = new LongValueToUnsignedFloat();

	Assert.assertEquals(Float.valueOf(Float.intBitsToFloat(0)),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Float.valueOf(Float.intBitsToFloat(Integer.MIN_VALUE)),
		translator.translate(new LongValue((long) Integer.MAX_VALUE + 1), null));

	Assert.assertEquals(Float.valueOf(Float.intBitsToFloat(-1)),
		translator.translate(new LongValue(LongValueToUnsignedFloat.MAX_VERTEX_COUNT - 1), null));
}
 
Example 10
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToByte() throws Exception {
	TranslateFunction<LongValue, Byte> translator = new LongValueToUnsignedByte();

	Assert.assertEquals(Byte.valueOf((byte) 0),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Byte.valueOf(Byte.MIN_VALUE),
		translator.translate(new LongValue((long) Byte.MAX_VALUE + 1), null));

	Assert.assertEquals(Byte.valueOf((byte) -1),
		translator.translate(new LongValue(LongValueToUnsignedByte.MAX_VERTEX_COUNT - 1), null));
}
 
Example 11
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromByte() throws Exception {
	TranslateFunction<Byte, LongValueWithProperHashCode> translator = new UnsignedByteToLongValueWithProperHashCode();

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

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

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedByte.MAX_VERTEX_COUNT - 1),
		translator.translate((byte) -1, longValueWithProperHashCode));
}
 
Example 12
Source Project: flink   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromDouble() throws Exception {
	TranslateFunction<Double, LongValueWithProperHashCode> translator = new DoubleToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate(Double.longBitsToDouble(Long.MIN_VALUE), longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate(Double.longBitsToDouble(Long.MAX_VALUE), longValueWithProperHashCode));
}
 
Example 13
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromShortValue() throws Exception {
	TranslateFunction<ShortValue, LongValueWithProperHashCode> translator = new UnsignedShortValueToLongValueWithProperHashCode();

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

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

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedShortValue.MAX_VERTEX_COUNT - 1),
		translator.translate(new ShortValue((short) -1), longValueWithProperHashCode));
}
 
Example 14
Source Project: flink   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToDoubleValue() throws Exception {
	TranslateFunction<LongValue, DoubleValue> translator = new LongValueToDoubleValue();

	Assert.assertEquals(new DoubleValue(Double.longBitsToDouble(0L)),
		translator.translate(new LongValue(0L), doubleValue));

	Assert.assertEquals(new DoubleValue(Double.longBitsToDouble(Long.MIN_VALUE)),
		translator.translate(new LongValue(Long.MIN_VALUE), doubleValue));

	Assert.assertEquals(new DoubleValue(Double.longBitsToDouble(Long.MAX_VALUE)),
		translator.translate(new LongValue(Long.MAX_VALUE), doubleValue));
}
 
Example 15
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromShort() throws Exception {
	TranslateFunction<Short, LongValueWithProperHashCode> translator = new UnsignedShortToLongValueWithProperHashCode();

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

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

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1),
		translator.translate((short) -1, longValueWithProperHashCode));
}
 
Example 16
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToCharValue() throws Exception {
	TranslateFunction<LongValue, CharValue> translator = new LongValueToCharValue();

	Assert.assertEquals(new CharValue((char) 0),
		translator.translate(new LongValue(0L), charValue));

	Assert.assertEquals(new CharValue(Character.MAX_VALUE),
		translator.translate(new LongValue(LongValueToCharValue.MAX_VERTEX_COUNT - 1), charValue));
}
 
Example 17
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToInt() throws Exception {
	TranslateFunction<LongValue, Integer> translator = new LongValueToUnsignedInt();

	Assert.assertEquals(Integer.valueOf(0),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Integer.valueOf(Integer.MIN_VALUE),
		translator.translate(new LongValue((long) Integer.MAX_VALUE + 1), null));

	Assert.assertEquals(Integer.valueOf(-1),
		translator.translate(new LongValue(LongValueToUnsignedInt.MAX_VERTEX_COUNT - 1), null));
}
 
Example 18
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example 19
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromLongValue() throws Exception {
	TranslateFunction<LongValue, LongValueWithProperHashCode> translator = new LongValueToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate(new LongValue(Long.MIN_VALUE), longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate(new LongValue(Long.MAX_VALUE), longValueWithProperHashCode));
}
 
Example 20
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testLongValueToLongTranslation() throws Exception {
	TranslateFunction<LongValue, Long> translator = new LongValueToLong();

	Assert.assertEquals(Long.valueOf(0L),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Long.valueOf(Long.MIN_VALUE),
		translator.translate(new LongValue(Long.MIN_VALUE), null));

	Assert.assertEquals(Long.valueOf(Long.MAX_VALUE),
		translator.translate(new LongValue(Long.MAX_VALUE), null));
}
 
Example 21
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToFloatValue() throws Exception {
	TranslateFunction<LongValue, FloatValue> translator = new LongValueToUnsignedFloatValue();

	Assert.assertEquals(new FloatValue(Float.intBitsToFloat(0)),
		translator.translate(new LongValue(0L), floatValue));

	Assert.assertEquals(new FloatValue(Float.intBitsToFloat(Integer.MIN_VALUE)),
		translator.translate(new LongValue((long) Integer.MAX_VALUE + 1), floatValue));

	Assert.assertEquals(new FloatValue(Float.intBitsToFloat(-1)),
		translator.translate(new LongValue(LongValueToUnsignedFloatValue.MAX_VERTEX_COUNT - 1), floatValue));
}
 
Example 22
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromFloatValue() throws Exception {
	TranslateFunction<FloatValue, LongValueWithProperHashCode> translator = new UnsignedFloatValueToLongValueWithProperHashCode();

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

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

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedFloatValue.MAX_VERTEX_COUNT - 1),
		translator.translate(new FloatValue(Float.intBitsToFloat(-1)), longValueWithProperHashCode));
}
 
Example 23
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToFloat() throws Exception {
	TranslateFunction<LongValue, Float> translator = new LongValueToUnsignedFloat();

	Assert.assertEquals(Float.valueOf(Float.intBitsToFloat(0)),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Float.valueOf(Float.intBitsToFloat(Integer.MIN_VALUE)),
		translator.translate(new LongValue((long) Integer.MAX_VALUE + 1), null));

	Assert.assertEquals(Float.valueOf(Float.intBitsToFloat(-1)),
		translator.translate(new LongValue(LongValueToUnsignedFloat.MAX_VERTEX_COUNT - 1), null));
}
 
Example 24
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromFloat() throws Exception {
	TranslateFunction<Float, LongValueWithProperHashCode> translator = new UnsignedFloatToLongValueWithProperHashCode();

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

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

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedFloat.MAX_VERTEX_COUNT - 1),
		translator.translate(Float.intBitsToFloat(-1), longValueWithProperHashCode));
}
 
Example 25
Source Project: flink   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromStringValue() throws Exception {
	TranslateFunction<StringValue, LongValueWithProperHashCode> translator = new StringValueToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate(new StringValue("-9223372036854775808"), longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate(new StringValue("9223372036854775807"), longValueWithProperHashCode));
}
 
Example 26
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromDoubleValue() throws Exception {
	TranslateFunction<DoubleValue, LongValueWithProperHashCode> translator = new DoubleValueToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate(new DoubleValue(Double.longBitsToDouble(Long.MIN_VALUE)), longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate(new DoubleValue(Double.longBitsToDouble(Long.MAX_VALUE)), longValueWithProperHashCode));
}
 
Example 27
Source Project: flink   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromString() throws Exception {
	TranslateFunction<String, LongValueWithProperHashCode> translator = new StringToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate("-9223372036854775808", longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate("9223372036854775807", longValueWithProperHashCode));
}
 
Example 28
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromDouble() throws Exception {
	TranslateFunction<Double, LongValueWithProperHashCode> translator = new DoubleToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate(Double.longBitsToDouble(Long.MIN_VALUE), longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate(Double.longBitsToDouble(Long.MAX_VALUE), longValueWithProperHashCode));
}
 
Example 29
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFromStringValue() throws Exception {
	TranslateFunction<StringValue, LongValueWithProperHashCode> translator = new StringValueToLongValueWithProperHashCode();

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

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MIN_VALUE),
		translator.translate(new StringValue("-9223372036854775808"), longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Long.MAX_VALUE),
		translator.translate(new StringValue("9223372036854775807"), longValueWithProperHashCode));
}
 
Example 30
Source Project: Flink-CEPplus   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testLongValueToStringTranslation() throws Exception {
	TranslateFunction<LongValue, String> translator = new LongValueToString();

	Assert.assertEquals("0",
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals("-9223372036854775808",
		translator.translate(new LongValue(Long.MIN_VALUE), null));

	Assert.assertEquals("9223372036854775807",
		translator.translate(new LongValue(Long.MAX_VALUE), null));
}