/** * Returns the spatialSizeUnits {@link UnitDefinition} instance of this {@link Species}. * * <p>Determines the spatial units of this {@link Species}. If the spatial * units have been set explicitly using 'spatialSizeUnits' the * corresponding {@link UnitDefinition} from the {@link Model} to which this * {@link Species} belongs will be returned. Otherwise, the size unit from * the surrounding {@link Compartment} of this {@link Species} will be * returned. If this also fails, {@code null} will be returned.</p> * * @return The {@link UnitDefinition} instance which as the * 'spatialSizeUnits' of this {@link Species} as id or the * size unit of the surrounding {@link Compartment}. * {@code null} if it doesn't exist. * @deprecated Only valid for SBML Level 2 Versions 1 and 2. */ @Deprecated public UnitDefinition getSpatialSizeUnitsInstance() { if (isSetSpatialSizeUnits()) { Model model = getModel(); return model != null ? model .getUnitDefinition(spatialSizeUnitsID) : null; } Compartment compartment = getCompartmentInstance(); return compartment != null ? compartment.getUnitsInstance() : null; }
@Override public boolean check(ValidationContext ctx, Compartment c) { if (c.getSpatialDimensions() == 3 && c.isSetUnits()) { UnitDefinition def = c.getUnitsInstance(); if (def == null) { return false; } boolean isVolume = def.isVariantOfVolume(); if (ctx.getLevel() == 2 && ctx.getVersion() == 1) { return isVolume; } else { boolean isDimensionless = def.isVariantOfDimensionless(); return isDimensionless || isVolume; } } return true; } };
@Override public boolean check(ValidationContext ctx, Compartment c) { if (c.getSpatialDimensions() == 2 && c.isSetUnits()) { UnitDefinition def = c.getUnitsInstance(); if (def == null) { return false; } boolean isArea = def.isVariantOfArea(); // boolean isDimensionless = def.isVariantOfDimensionless(); if (ctx.getLevel() == 2 && ctx.getVersion() == 1) { return isArea; } else { boolean isDimensionless = def.isVariantOfDimensionless(); return isDimensionless || isArea; } } return true; } };
@Override public boolean check(ValidationContext ctx, Compartment c) { if (c.getSpatialDimensions() == 1 && c.isSetUnits()) { UnitDefinition def = c.getUnitsInstance(); if (def == null) { return false; } if (ctx.getLevel() == 2 && ctx.getVersion() == 1) { return def.isVariantOfLength(); } else { boolean isDimensionless = def.isVariantOfDimensionless(); return isDimensionless || def.isVariantOfLength(); } } return true; } };