Skip to content

Commit

Permalink
Fixed another compilation problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
avitorovic committed Nov 13, 2013
1 parent 75f112b commit 03adb8f
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/plan_runner/thetajoin/indexes/BalancedBinaryTreeIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,34 +99,38 @@ public TIntArrayList getValuesWithOutOperator(KeyType key, KeyType... keys) {
}

private KeyType performOperation(KeyType k, KeyType diff, boolean isInverse) {
KeyType result = null;
if (k instanceof Double) {
final Double kd = (Double) k;
Double diffd = (Double) diff;
// workaround for some compilers
Comparable<?> tmpK = k;
Comparable<?> tmpDiff = diff;
Comparable<?> result = null;

if (tmpK instanceof Double) {
final Double kd = (Double) tmpK;
Double diffd = (Double) tmpDiff;
if (isInverse)
diffd = -1 * diffd;
final Double resultd = kd + diffd;
result = (KeyType) resultd;
} else if (k instanceof Integer) {
final Integer kd = (Integer) k;
Integer diffd = (Integer) diff;
result = resultd;
} else if (tmpK instanceof Integer) {
final Integer kd = (Integer) tmpK;
Integer diffd = (Integer) tmpDiff;
if (isInverse)
diffd = -1 * diffd;
final Integer resultd = kd + diffd;
result = (KeyType) resultd;
} else if (k instanceof Date) {
final Date kd = (Date) k;
Integer diffd = (Integer) diff;
result = resultd;
} else if (tmpK instanceof Date) {
final Date kd = (Date) tmpK;
Integer diffd = (Integer) tmpDiff;
if (isInverse)
diffd = -1 * diffd;
final Calendar c = Calendar.getInstance();
c.setTime(kd);
c.add(Calendar.DAY_OF_MONTH, diffd);
result = (KeyType) c.getTime();
result = c.getTime();
} else
LOG.info("Operation in B+Tree not supported for underlying datatype");
LOG.info("Operation in BalancedBinaryTree not supported for underlying datatype");

return result;
return (KeyType)result;
}

@Override
Expand Down

0 comments on commit 03adb8f

Please sign in to comment.