public override float Run <T>(Dictionary <string, float> variables, CommandExecutor <T> executor, Dictionary <string, BoardFluid> dropPositions) { float result = NumberBlock.Run(variables, executor, dropPositions); switch (RoundType) { case RoundOPTypes.ROUND: return((float)Math.Round(result)); case RoundOPTypes.ROUNDDOWN: return((float)Math.Floor(result)); case RoundOPTypes.ROUNDUP: return((float)Math.Ceiling(result)); default: throw new InternalRuntimeException("Failed to parse the round operator type. Type: " + RoundType.ToString()); } }
public static string RoundOpTypeToString(RoundOPTypes type) { switch (type) { case RoundOPTypes.ROUND: return("ROUND"); case RoundOPTypes.ROUNDDOWN: return("ROUNDDOWN"); case RoundOPTypes.ROUNDUP: return("ROUNDUP"); default: throw new InternalParseException("Failed to parse the round operator type. Type: " + type.ToString()); } }