Permalink
Browse files

Remove null checks which should never be hit.

  • Loading branch information...
tstevens committed Nov 7, 2011
1 parent 02e96ef commit dfbce434cd87447962c26de94ccf07f4425f7fc7
Showing with 14 additions and 24 deletions.
  1. +14 −24 Formula.java
View
@@ -145,10 +145,7 @@ public void reRankVariables() {
int pSize, nSize, bigger, s;
for (i = shift; i < numVariables; i++) {
hashObj = hashMap.get((int) rankArray[0][i]);
- if (hashObj == null) {
- // rankArray[1][i] = 0; //not sure if good/bad
- continue;
- }
+
pSize = hashObj.posSize();
nSize = hashObj.negSize();
bigger = nSize < pSize ? pSize : nSize;
@@ -256,10 +253,7 @@ public void forwardTrack() {
for (j = 0; j < actualSize; j++) {
key = clause.get(j);
if (key != 0 && (absKey = abs(key)) != var) {
- hashObj = (HashObject) hashMap.get(absKey);
- if (hashObj != null) {
- hashObj.removeClause(clause);
- }
+ hashMap.get(absKey).removeClause(clause);
}
}
}
@@ -402,7 +396,7 @@ private boolean allEmptyKeyMap() {
HashObject tmp;
for (i = shift; i < numVariables; i++) {
tmp = hashMap.get((int) rankArray[0][i]);
- if (tmp != null && (!tmp.posEmpty() || !tmp.negEmpty())) {
+ if (!tmp.posEmpty() || !tmp.negEmpty()) {
return false;
}
}
@@ -418,21 +412,17 @@ private int lengthOneCheck() {
for (k = shift; k < numVariables; k++) {
tmp = hashMap.get((int) rankArray[0][k]);
- if (tmp != null) {
- size = tmp.posSize();
- for (i = 0; i < size; i++) {
- tmpVar = tmp.getP(i).lengthOne();
- if (tmpVar != 0) {
- return k;
- }
- }
- size = tmp.negSize();
- for (i = 0; i < size; i++) {
- tmpVar = tmp.getN(i).lengthOne();
- if (tmpVar != 0) {
- return -k;
- }
- }
+ size = tmp.posSize();
+ for (i = 0; i < size; i++) {
+ tmpVar = tmp.getP(i).lengthOne();
+ if (tmpVar != 0)
+ return k;
+ }
+ size = tmp.negSize();
+ for (i = 0; i < size; i++) {
+ tmpVar = tmp.getN(i).lengthOne();
+ if (tmpVar != 0)
+ return -k;
}
}
return 0;

0 comments on commit dfbce43

Please sign in to comment.