use of org.killbill.billing.util.customfield.ShouldntHappenException in project killbill by killbill.
the class ProxyBlockingStateDao method insertTiedBlockingStatesInTheRightOrder.
private static BlockingState insertTiedBlockingStatesInTheRightOrder(final Collection<BlockingState> result, final BlockingState current, final BlockingState next, final boolean prevBlocked, final boolean currentBlocked, final boolean nextBlocked) {
final BlockingState prev;
if (prevBlocked && currentBlocked && nextBlocked) {
// Tricky use case, bail
return null;
} else if (prevBlocked && currentBlocked && !nextBlocked) {
result.add(next);
result.add(current);
prev = current;
} else if (prevBlocked && !currentBlocked && nextBlocked) {
result.add(current);
result.add(next);
prev = next;
} else if (prevBlocked && !currentBlocked && !nextBlocked) {
// Tricky use case, bail
return null;
} else if (!prevBlocked && currentBlocked && nextBlocked) {
// Tricky use case, bail
return null;
} else if (!prevBlocked && currentBlocked && !nextBlocked) {
result.add(current);
result.add(next);
prev = next;
} else if (!prevBlocked && !currentBlocked && nextBlocked) {
result.add(next);
result.add(current);
prev = current;
} else if (!prevBlocked && !currentBlocked && !nextBlocked) {
// Tricky use case, bail
return null;
} else {
throw new ShouldntHappenException("Marker exception for code clarity");
}
return prev;
}
Aggregations