forked from itchanges/tddl
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Whoa there!
You have triggered an abuse detection mechanism.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
mengshi.sunmengshi
committed
Feb 18, 2014
1 parent
30325bb
commit 0764aee
Showing
20 changed files
with
565 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
tddl-optimizer/src/main/java/com/taobao/tddl/optimizer/core/datatype/AbstractCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package com.taobao.tddl.optimizer.core.datatype; | ||
|
||
public abstract class AbstractCalculator implements Calculator { | ||
|
||
public abstract Object doAdd(Object v1, Object v2); | ||
|
||
public abstract Object doSub(Object v1, Object v2); | ||
|
||
public abstract Object doMultiply(Object v1, Object v2); | ||
|
||
public abstract Object doDivide(Object v1, Object v2); | ||
|
||
public abstract Object doMod(Object v1, Object v2); | ||
|
||
public abstract Object doAnd(Object v1, Object v2); | ||
|
||
public abstract Object doOr(Object v1, Object v2); | ||
|
||
public abstract Object doXor(Object v1, Object v2); | ||
|
||
public abstract Object doNot(Object v1); | ||
|
||
public abstract Object doBitAnd(Object v1, Object v2); | ||
|
||
public abstract Object doBitOr(Object v1, Object v2); | ||
|
||
public abstract Object doBitXor(Object v1, Object v2); | ||
|
||
public abstract Object doBitNot(Object v1); | ||
|
||
@Override | ||
public Object add(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doAdd(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object sub(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doSub(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object multiply(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doMultiply(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object divide(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doDivide(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object mod(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doMod(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object and(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doAnd(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object or(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doOr(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object xor(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doXor(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object not(Object v1) { | ||
if (v1 == null) return null; | ||
|
||
return this.doNot(v1); | ||
} | ||
|
||
@Override | ||
public Object bitAnd(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doBitAnd(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object bitOr(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doBitOr(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object bitXor(Object v1, Object v2) { | ||
if (v1 == null || v2 == null) return null; | ||
|
||
return this.doBitXor(v1, v2); | ||
} | ||
|
||
@Override | ||
public Object bitNot(Object v1) { | ||
if (v1 == null) return null; | ||
|
||
return this.doBitNot(v1); | ||
} | ||
|
||
} |
Whoa there!
You have triggered an abuse detection mechanism.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.