Class UnitParser

java.lang.Object
org.cip4.jdflib.util.UnitParser

public class UnitParser extends Object
class to parse units from strings
  • Constructor Details

    • UnitParser

      public UnitParser()
  • Method Details

    • convertUnits

      public void convertUnits(KElement element, boolean recurse)
      Parameters:
      element -
    • convertUnits

      public void convertUnits(KElement element)
      Parameters:
      element -
    • isUnit

      public boolean isUnit(String key)
      Parameters:
      key -
      Returns:
    • addUnitKey

      public void addUnitKey(String key)
      Parameters:
      key -
    • getFactor

      public double getFactor(String unit)
      get the factor for one of the units to points
      Parameters:
      unit -
      Returns:
    • extractUnits

      public String extractUnits(String key, String val)
      Parameters:
      key - the attribute name to check
      val -
      Returns:
    • getUnitString

      public String getUnitString(String key, UnitParser.eParserUnit pu, String val0, String sep)
    • getUnitString

      public String getUnitString(UnitParser.eParserUnit pu, String val0, String sep)
      extract units if and only if the string has a pattern of "<##>mm" or "<##>cm"or "<##>in" whitespace characters may be placed between the numbers and the units the unit case is ignored
      Parameters:
      val - the string to convert
      Returns:
      the converted unit string
    • extractUnits

      public String extractUnits(String val)
      extract units if and only if the string has a pattern of "<##>mm" or "<##>cm"or "<##>in" whitespace characters may be placed between the numbers and the units the unit case is ignored
      Parameters:
      val - the string to convert
      Returns:
      the converted unit string
    • setPrecision

      public void setPrecision(int precision)
      Setter for precision attribute.
      Parameters:
      precision - the precision to set
    • getNoUnitString

      public String getNoUnitString(UnitParser.eParserUnit unit, double points, String separator)
      getter for unit attribute
      Parameters:
      precision - the precision to set
    • getNoUnitString

      public String getNoUnitString(UnitParser.eParserUnit unit, double points)
    • getPrecision

      public int getPrecision()
      Getter for precision attribute.
      Returns:
      the precision
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: