Skip to content

Commit

Permalink
Don't allow boolean comparables
Browse files Browse the repository at this point in the history
Throw a warning if we get another unknown comparable
  • Loading branch information
mcmonkey4eva committed Sep 21, 2014
1 parent 9ab195d commit fd5e484
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -60,7 +60,7 @@ public static enum Logic {
Bridge bridge = Bridge.FIRST;
Object comparable = null;
Operator operator = Operator.EQUALS;
Object comparedto = (boolean) true;
Object comparedto = "true";
Boolean outcome = null;


Expand Down Expand Up @@ -403,15 +403,20 @@ else if (comparedto.equalsIgnoreCase("boolean"))
}
}

public String log(String str) {
dB.log("Warning: Unknown comparable type: " + str);
return str;
}

@Override
public String toString() {
return (logic != Logic.REGULAR ? "Logic='" + logic.toString() + "', " : "")
+ "Comparable='" + (comparable == null ? "null'" : (comparable instanceof Double ? "Decimal":
comparable instanceof String ? "Element": (comparable instanceof Long ? "Number": comparable.getClass().getSimpleName()))
comparable instanceof String ? "Element": (comparable instanceof Long ? "Number": log(comparable.getClass().getSimpleName())))
+ "(" + ChatColor.AQUA + comparable + ChatColor.WHITE + ")'")
+ ", Operator='" + operator.toString()
+ "', ComparedTo='" + (comparedto == null ? "null'" : (comparedto instanceof Double ? "Decimal":
comparedto instanceof String ? "Element": (comparedto instanceof Long ? "Number": comparedto.getClass().getSimpleName()))
comparedto instanceof String ? "Element": (comparedto instanceof Long ? "Number": log(comparedto.getClass().getSimpleName())))
+ "(" + ChatColor.AQUA + comparedto + ChatColor.WHITE + ")' ")
+ ChatColor.YELLOW + "--> OUTCOME='" + outcome + "'";
}
Expand Down

0 comments on commit fd5e484

Please sign in to comment.