| 3 | import buildcraft.lib.expression.GenericExpressionCompiler; |
| 4 | |
| 5 | public enum ArgType { |
| 6 | LONG, |
| 7 | DOUBLE, |
| 8 | BOOL, |
| 9 | STRING; |
| 10 | |
| 11 | public boolean canCastTo(ArgType other) { |
| 12 | boolean ans = canCastTo0(other); |
| 13 | if (ans) { |
| 14 | GenericExpressionCompiler.debugPrintln("Can cast from " + this + " to " + other); |
| 15 | } else { |
| 16 | GenericExpressionCompiler.debugPrintln("NO CASTING FROM " + this + " TO " + other + " EVER!"); |
| 17 | } |
| 18 | return ans; |
| 19 | } |
| 20 | |
| 21 | private boolean canCastTo0(ArgType other) { |
| 22 | if (this == other) { |
| 23 | return true; |
| 24 | } |
| 25 | switch (this) { |
| 26 | case BOOL: |
| 27 | return other == ArgType.STRING; |
| 28 | case DOUBLE: |
| 29 | return other == ArgType.STRING; |
| 30 | case LONG: |
| 31 | return other == ArgType.DOUBLE || other == ArgType.STRING; |
| 32 | case STRING: |
| 33 | default: |
| 34 | return false; |
| 35 | } |
| 36 | } |
| 37 | } |
nothing calls this directly
no outgoing calls
no test coverage detected