> + .trimResults()
> + .omitEmptyStrings()
> + .withKeyValueSeparator('=')
> + .split(hardwareSpec);
> + if (!specValues.containsKey("ram") ||
> !specValues.containsKey("cores")) {
> + throw new IllegalArgumentException(String.format("Omitted keys on
> hardwareId: %s. Please set number " +
> + "of cores and ram amount.", hardwareId));
> + }
> + spec.ram = Integer.parseInt(specValues.get("ram"));
> + spec.cores = Double.parseDouble(specValues.get("cores"));
> + return spec;
> + }
> +
> + public static AutomaticHardwareIdSpec
> automaticHardwareIdSpecBuilder(double cores, int ram) {
> + AutomaticHardwareIdSpec spec = new AutomaticHardwareIdSpec();
> + if (cores == 0 || ram == 0) {
> It's only checking that the user has specified both values (they are
> primitives).
What would we get here if one of the values was *not* specified? Wouldn't we
see the same default value here? Also, equality checking of floating-point
values is a little tricky, because depending on the system you can get things
like `a/2 - a/2 != 0` due to rounding issues.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/984/files/55c696c2ba870e202cfb8e42734e66bb31aab7b4#r74047558