@Override public boolean check(ValidationContext ctx, Parameter p) { return p.isSetUnits(); } };
for (int i = 0; i < model.getParameterCount(); i++) { Parameter parameter = model.getParameter(i); if (parameter.isSetUnits() && !parameter.isSetUnitsInstance()) { logger.warn(MessageFormat.format(
@Override public boolean check(ValidationContext ctx, Parameter p) { return p.isSetUnits(); } };
/** * Creates a new {@link ExplicitRule} * * @param parameter * @param math */ public ExplicitRule(Parameter parameter, ASTNode math) { this((Variable) parameter, math); if (parameter.isSetUnits()) { unitsID = new String(parameter.getUnits()); } else { unitsID = null; } }
@Override public boolean check(ValidationContext ctx, AssignmentRule r) { Variable var = r.getVariableInstance(); if (var != null && var instanceof Parameter && ((Parameter) var).isSetUnits()) { // check that unit from rule are equivalent to the parameter unit boolean check = ValidationTools.haveEquivalentUnits(ctx, r, var); if (!check) { // System.out.println("DEBUG - 10513 - have non equivalent units"); } return check; } return true; } };
@Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetValue()) { attributes.put("value", StringTools.toString(Locale.ENGLISH, getValue())); } if (isSetUnits()) { attributes.put("units", getUnits()); } if (isSetConstant() && (getLevel() > 1)) { attributes.put("constant", Boolean.toString(getConstant())); } return attributes; }
@Override public boolean check(ValidationContext ctx, Parameter p) { if (p.isSetUnits()) { String units = p.getUnits(); Model m = p.getModel(); if (! (Unit.isUnitKind(units, ctx.getLevel(), ctx.getVersion()) || Unit.isPredefined(units, ctx.getLevel()) || (m != null && m.getUnitDefinition(units) != null))) { ValidationConstraint.logError(ctx, CORE_20701, p, p.getId(), p.getUnits()); return false; } } return true; } };