final String inputTupleHash = stormTupleRcv.getString(2); // Hash Tuple
// / now processing
if (_firstEmitterIndex.equals(inputComponentIndex)) {
if (_currentRelationPointer == 1) { // it is the right tuple
// send right away
_collector.emit(new Values(inputComponentIndex, MyUtilities.stringToTuple(
inputTupleString, _conf), inputTupleHash));
_currentCount++;
_relation1Count++;
// LOG.info("Emitting 1: ("+_relation1Count+","+_relation2Count+")");
// now check if a switch should happen
if ((_currentCount == _currentAccCount) && (!_isSecondFinished)) {
_currentRelationPointer = 2;
_currentCount = 0;
_currentAccCountALL = _relation1Count * _multFactor;
_currentAccCount = _currentAccCountALL - _relation2Count;
}
} else { // it is the other tuple
bufferedTuplesRel1.add(new BufferedTuple(inputComponentIndex, inputTupleString,
inputTupleHash));
// emit a buffered tuple from the second relation if exists
if (!bufferedTuplesRel2.isEmpty()) {
final BufferedTuple bufTup = bufferedTuplesRel2.removeFirst();
_collector
.emit(new Values(bufTup.get_componentName(), MyUtilities.stringToTuple(
bufTup.get_tupleString(), _conf), bufTup.get_tupleHash()));
_currentCount++;
_relation2Count++;
// LOG.info("Emitting 2: ("+_relation1Count+","+_relation2Count+")");
// now check if a switch should happen
if ((_currentCount == _currentAccCount) && (!_isFirstFinished)) {
_currentRelationPointer = 1;
_currentCount = 0;
_currentAccCountALL = _relation2Count * _multFactor;
_currentAccCount = _currentAccCountALL - _relation1Count;
}
}
}
} else if (_secondEmitterIndex.equals(inputComponentIndex))
if (_currentRelationPointer == 2) {
// send right away
_collector.emit(new Values(inputComponentIndex, MyUtilities.stringToTuple(
inputTupleString, _conf), inputTupleHash));
_currentCount++;
_relation2Count++;
// LOG.info("Emitting 2: ("+_relation1Count+","+_relation2Count+")");
// now check if a switch should happen
if ((_currentCount == _currentAccCount) && (!_isFirstFinished)) {
_currentRelationPointer = 1;
_currentCount = 0;
_currentAccCountALL = _relation2Count * _multFactor;
_currentAccCount = _currentAccCountALL - _relation1Count;
}
} else { // it is the other tuple
bufferedTuplesRel2.add(new BufferedTuple(inputComponentIndex, inputTupleString,
inputTupleHash));
// emit a buffered tuple from the second relation if exists
if (!bufferedTuplesRel1.isEmpty()) {
final BufferedTuple bufTup = bufferedTuplesRel1.removeFirst();
_collector
.emit(new Values(bufTup.get_componentName(), MyUtilities.stringToTuple(
bufTup.get_tupleString(), _conf), bufTup.get_tupleHash()));
_currentCount++;
_relation1Count++;
// LOG.info("Emitting 1: ("+_relation1Count+","+_relation2Count+")");
// now check if a switch should happen