Java Code Examples for org.apache.flink.types.LongValue#getValue()

The following examples show how to use org.apache.flink.types.LongValue#getValue() . 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: LongValueArray.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public boolean add(LongValue value) {
	int newPosition = position + 1;

	if (newPosition > data.length) {
		if (isBounded) {
			return false;
		} else {
			ensureCapacity(newPosition);
		}
	}

	data[position] = value.getValue();
	position = newPosition;

	return true;
}
 
Example 2
Source File: GraphKeyTypeTransform.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Byte translate(LongValue value, Byte reuse)
		throws Exception {
	long l = value.getValue();

	if (l < 0 || l >= MAX_VERTEX_COUNT) {
		throw new IllegalArgumentException("Cannot cast long value " + value + " to byte.");
	}

	return (byte) (l & (MAX_VERTEX_COUNT - 1));
}
 
Example 3
Source File: SerializingLongReceiver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void readRecords(long lastExpectedRecord) throws Exception {
	LOG.debug("readRecords(lastExpectedRecord = {})", lastExpectedRecord);
	final LongValue value = new LongValue();

	while (running && reader.next(value)) {
		final long ts = value.getValue();
		if (ts == lastExpectedRecord) {
			expectedRecordCounter++;
			if (expectedRecordCounter == expectedRepetitionsOfExpectedRecord) {
				break;
			}
		}
	}
}
 
Example 4
Source File: GraphKeyTypeTransform.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Integer translate(LongValue value, Integer reuse)
		throws Exception {
	long l = value.getValue();

	if (l < 0 || l >= MAX_VERTEX_COUNT) {
		throw new IllegalArgumentException("Cannot cast long value " + value + " to integer.");
	}

	return (int) (l & (MAX_VERTEX_COUNT - 1));
}
 
Example 5
Source File: WorksetEmptyConvergenceCriterion.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isConverged(int iteration, LongValue value) {

	long updatedElements = value.getValue();

	if (log.isInfoEnabled()) {
		log.info("[" + updatedElements + "] elements updated in the solutionset in iteration [" + iteration + "]");
	}

	return updatedElements == 0;
}
 
Example 6
Source File: GraphKeyTypeTransform.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Short translate(LongValue value, Short reuse)
		throws Exception {
	long l = value.getValue();

	if (l < 0 || l >= MAX_VERTEX_COUNT) {
		throw new IllegalArgumentException("Cannot cast long value " + value + " to short.");
	}

	return (short) (l & (MAX_VERTEX_COUNT - 1));
}
 
Example 7
Source File: BulkIterationBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isConverged(int iteration, LongValue countAggregate) {
	long count = countAggregate.getValue();

	if (log.isInfoEnabled()) {
		log.info("Termination criterion stats in iteration [" + iteration + "]: " + count);
	}

	return count == 0;
}
 
Example 8
Source File: SerializingLongReceiver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void readRecords(long lastExpectedRecord) throws Exception {
	LOG.debug("readRecords(lastExpectedRecord = {})", lastExpectedRecord);
	final LongValue value = new LongValue();

	while (running && reader.next(value)) {
		final long ts = value.getValue();
		if (ts == lastExpectedRecord) {
			expectedRecordCounter++;
			if (expectedRecordCounter == expectedRepetitionsOfExpectedRecord) {
				break;
			}
		}
	}
}
 
Example 9
Source File: GraphKeyTypeTransform.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public Integer translate(LongValue value, Integer reuse)
		throws Exception {
	long l = value.getValue();

	if (l < 0 || l >= MAX_VERTEX_COUNT) {
		throw new IllegalArgumentException("Cannot cast long value " + value + " to integer.");
	}

	return (int) (l & (MAX_VERTEX_COUNT - 1));
}
 
Example 10
Source File: GSAPageRank.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public Double edgeJoin(Double edgeValue, LongValue inputValue) {
	return edgeValue / (double) inputValue.getValue();
}
 
Example 11
Source File: ValueSummaryAggregator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected Long getValue(LongValue value) {
	return value.getValue();
}
 
Example 12
Source File: LongSumAggregator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void aggregate(LongValue element) {
	sum += element.getValue();
}
 
Example 13
Source File: BulkIterationBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void aggregate(LongValue count) {
	this.count += count.getValue();
}
 
Example 14
Source File: GraphKeyTypeTransform.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Long translate(LongValue value, Long reuse)
		throws Exception {
	return value.getValue();
}
 
Example 15
Source File: LongSumAggregator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void aggregate(LongValue element) {
	sum += element.getValue();
}
 
Example 16
Source File: AggregatorConvergenceITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, LongValue value) {
	return value.getValue() < this.threshold;
}
 
Example 17
Source File: AggregatorsITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, LongValue value) {
	return value.getValue() > this.value;
}
 
Example 18
Source File: AggregatorConvergenceITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, LongValue value) {
	return value.getValue() < this.threshold;
}
 
Example 19
Source File: LongZeroConvergence.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Returns true, if the aggregator value is zero, false otherwise.
 * 
 * @param iteration The number of the iteration superstep. Ignored in this case.
 * @param value The aggregator value, which is compared to zero.
 * @return True, if the aggregator value is zero, false otherwise.
 */
@Override
public boolean isConverged(int iteration, LongValue value) {
	return value.getValue() == 0;
}
 
Example 20
Source File: LongZeroConvergence.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Returns true, if the aggregator value is zero, false otherwise.
 * 
 * @param iteration The number of the iteration superstep. Ignored in this case.
 * @param value The aggregator value, which is compared to zero.
 * @return True, if the aggregator value is zero, false otherwise.
 */
@Override
public boolean isConverged(int iteration, LongValue value) {
	return value.getValue() == 0;
}