@Override public void copy(@Nonnull MathEntity that) { this.constant.copy(that); if (that instanceof IConstant) { this.description = ((IConstant) that).getDescription(); this.value = ((IConstant) that).getValue(); } if (that instanceof ExtendedConstant) { this.javaString = ((ExtendedConstant) that).javaString; } }
public void copy(@Nonnull MathEntity o) { if (o instanceof IConstant) { final IConstant that = ((IConstant) o); this.name = that.getName(); this.value = that.getValue(); this.description = that.getDescription(); this.system = that.isSystem(); if (that.isIdDefined()) { this.id = that.getId(); } } else { throw new IllegalArgumentException("Trying to make a copy of unsupported type: " + o.getClass()); } }
@Nonnull public static String toString(@Nonnull IConstant constant) { final Double doubleValue = constant.getDoubleValue(); if (doubleValue == null) { final String stringValue = constant.getValue(); if (!Strings.isEmpty(stringValue)) { return constant.getName() + " = " + stringValue; } else { return constant.getName(); } } else { return constant.getName() + " = " + doubleValue; } }
public Builder(@Nonnull IConstant iConstant) { this.name = iConstant.getName(); this.value = iConstant.getValue(); this.system = iConstant.isSystem(); this.description = iConstant.getDescription(); if (iConstant.isIdDefined()) { this.id = iConstant.getId(); } }
public NumericWrapper(@Nonnull Constant constant) { final IConstant constantFromRegistry = JsclMathEngine.getInstance().getConstantsRegistry().get(constant.getName()); if (constantFromRegistry != null) { if (constantFromRegistry.getName().equals(Constants.I.getName())) { content = Complex.I; } else { if (constantFromRegistry.getValue() != null) { final Double value = constantFromRegistry.getDoubleValue(); if (value == null) { throw new ArithmeticException("Constant " + constant.getName() + " has invalid definition: " + constantFromRegistry.getValue()); } else { content = Real.valueOf(value); } } else { throw new ArithmeticException("Could not create numeric wrapper: constant in registry doesn't have specified value: " + constant.getName()); } } } else { throw new ArithmeticException("Could not create numeric wrapper: constant is not registered in constants registry: " + constant.getName()); } }
offset = varName.length(); } else { final String value = var.getValue(); assert value != null;