@Override public void setValue(double value) { double dim = getSpatialDimensions(); if (isReadingInProgress() || (dim > 0d) || Double.isNaN(dim)) { super.setValue(value); } else { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Compartment.ERROR_MESSAGE_ZERO_DIM"), "size", getId())); } }
/** * Sets the unit of this Compartment. * A new Unit object will be created base on this kind. * * @param unitKind * @throws IllegalArgumentException * if spatialDimensions = 0. */ @Override public void setUnits(Unit.Kind unitKind) { if (0d == getSpatialDimensions() && !isReadingInProgress()) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Compartment.ERROR_MESSAGE_ZERO_DIM"), "unit kind", getId())); } super.setUnits(unitKind); }
/** * Sets the {@link Unit} of this {@link Compartment}. * * @param unit * @throws IllegalArgumentException * if spatialDimensions = 0. */ @Override public void setUnits(Unit unit) { if (0d == getSpatialDimensions() && !isReadingInProgress()) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Compartment.ERROR_MESSAGE_ZERO_DIM"), "unit", getId())); } super.setUnits(unit); }
return; if (0d == getSpatialDimensions() && !isReadingInProgress()) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Compartment.ERROR_MESSAGE_ZERO_DIM"), "units", if (!isReadingInProgress()) { throw new IllegalArgumentException(MessageFormat.format( JSBML.ILLEGAL_UNIT_EXCEPTION_MSG, units));
/** * Sets the size of this compartment to 'size'. * * @param size * @throws PropertyNotAvailableException * in case of Level < 2. */ public void setSize(double size) { // We need to set the new value before doing the checks Double oldSize = value; value = size; if (!isReadingInProgress() && !checkAttribute(TreeNodeChangeEvent.size)) { value = oldSize; throw new PropertyNotAvailableException(TreeNodeChangeEvent.size, this); } else { // reseting the old size so that we get the proper change event. value = oldSize; setValue(size); } }