Merge pull request #69 from DevFactory/release/collapsable-if-statements-should-be-merged

Code quality fix - Collapsible "if" statements should be merged.
This commit is contained in:
Roman Leventov
2016-02-13 17:54:51 +07:00
3 changed files with 8 additions and 12 deletions
@@ -182,9 +182,8 @@ public class UpdateLock implements InterProcessLock {
return;
case UPDATE_LOCKED:
entry.closeDelayedUpdateChecksum();
if (s.decrementUpdate() == 0) {
if (s.writeZero())
s.segmentHeader.downgradeUpdateToReadLock(s.segmentHeaderAddress);
if (s.decrementUpdate() == 0 && s.writeZero()) {
s.segmentHeader.downgradeUpdateToReadLock(s.segmentHeaderAddress);
}
break;
case WRITE_LOCKED:
@@ -71,11 +71,9 @@ public abstract class HashQuery<K> implements SetEntry<K> {
if (s.nestedContextsLockedOnSameSegment &&
s.rootContextLockedOnThisSegment.latestSameThreadSegmentModCount() !=
s.contextModCount) {
if (ks.keySearchInit()) {
if (ks.searchState == PRESENT) {
if (!hashLookupSearch.checkSlotContainsExpectedKeyAndValue(entry.pos))
hlp.closeHashLookupPos();
}
if (ks.keySearchInit() && ks.searchState == PRESENT &&
!hashLookupSearch.checkSlotContainsExpectedKeyAndValue(entry.pos)) {
hlp.closeHashLookupPos();
}
}
}
@@ -215,10 +215,9 @@ public abstract class MapEntryStages<K, V> extends HashEntryStages<K>
boolean tierHasChanged = allocatedChunks.initEntryAndKeyCopying(
entrySize, valueSizeOffset - keySizeOffset, pos, entrySizeInChunks);
if (tierHasChanged) {
// implicitly inits key search, locating hashLookupPos on the empty slot
if (!ks.searchStateAbsent())
throw new AssertionError();
// implicitly inits key search, locating hashLookupPos on the empty slot
if (tierHasChanged && !ks.searchStateAbsent()) {
throw new AssertionError();
}
initValue(newValue);