MCPcopy Create free account
hub / github.com/BuildCraft/BuildCraft / ArgType

Enum ArgType

common/buildcraft/lib/expression/api/ArgType.java:5–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import buildcraft.lib.expression.GenericExpressionCompiler;
4
5public 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected