DvQuantity

public class DvQuantity extends EhrDatatype

This class represents a DV_QUANTITY item, according to the definition provided by the OpenEHR Data Type Information Model

Constructors

DvQuantity

public DvQuantity(String path, JSONObject attributes)

Instantiates a new DV_QUANTITY item.

Parameters:
  • path – the path
  • attributes – the attributes

Methods

fromJSON

public void fromJSON(JSONObject content)

getConstraintsInfo

public String getConstraintsInfo()

Gets the constraints info.

Returns:the constraints info

getMagnitude

public double getMagnitude()

Gets the current magnitude value of this datatype.

Returns:the magnitude

getMax

public int getMax()

Gets the maximum value admitted for this DV_QUANTITY item

Returns:the maximum value admitted for this DV_QUANTITY item

getMaxPrecision

public int getMaxPrecision()

Gets the maximum precision (i.e the maximum number of decimal digits admitted for this DV_QUANTITY item)

Returns:the maximum precision

getMin

public int getMin()

Gets the minimum value admitted for this DV_QUANTITY item

Returns:the minimum value admitted for this DV_QUANTITY item

getUnits

public String getUnits()

Gets the unit of measure adopted by this DV_QUANTITY item

Returns:the current unit of measure

getValidityMessage

public String getValidityMessage(double value)

Gets the validity message.

Parameters:
  • value – the value
Returns:

the validity message

isValid

public boolean isValid(double value)

Checks if the value provided as argument is valid for this DV_QUANTITY item or not.

Parameters:
  • value – the value to be checked
Returns:

True, if ithe calue is valid, False otherwise

setAttributes

protected void setAttributes(JSONObject attributes)

setMagnitude

public void setMagnitude(double magnitude)

Sets the magnitude value.

Parameters:
  • magnitude – the new magnitude value
Throws:

setMax

public void setMax(int max)

Sets the maximum value admitted for this DV_QUANTITY item

Parameters:
  • max – the maximum value admitted for this DV_QUANTITY item

setMaxtPrecision

public void setMaxtPrecision(int precision)

Sets the maximum precision (i.e the maximum number of decimal digits admitted for this DV_QUANTITY item)

Parameters:
  • precision – the highest precision

setMin

public void setMin(int min)

Sets the minimum value admitted for this DV_QUANTITY item

Parameters:
  • min – the minimum value admitted for this DV_QUANTITY item

setUnits

public void setUnits(String units)

Sets the unit of measure adopted by this DV_QUANTITY item

Parameters:
  • units – the new unit of measure

toJSON

public JSONObject toJSON()