de.vc.util

## Class Measure.Factory

- java.lang.Object
- - de.vc.util.Measure.Factory

- Enclosing class:
    Measure

      public static class Measure.Factory
      extends java.lang.Object

  The factory creates immutable measure and caches them. Due to speed improvement the cache is disable by default. Use `setEnableCache` to enable the cache, this will safe memory but will also slow down jFO.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Measure` | `create(Measure.Unit unit, double value)` Creates a new measure.
    `static Measure` | `create(java.lang.String rep)` Creates a new measure.
    `static boolean` | `isShareValues()` Checks whether measures are shared.
    `static Measure` | `nullValue()`
    `static Measure` | `nullValue(Measure.Unit preferredUnit)`
    `static void` | `setShareValues(boolean b)` Enables or disables the sharing for measures.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### create

          public static Measure create(java.lang.String rep)

      Creates a new measure. If an equal measure is already in cache (if enabled) the cached measure is returned.
      Parameters:
        `rep` - String representation of measure.
      Returns:
        Immutable meaure.

    - #### create

          public static Measure create(Measure.Unit unit,
                       double value)

      Creates a new measure. If an equal measure is already in cache (if enabled) the cached measure is returned.
      Parameters:
        `unit` - Unit of measure.
        `value` - Value of measure.
      Returns:
        Immutable meaure.

    - #### setShareValues

          public static void setShareValues(boolean b)

      Enables or disables the sharing for measures. Sharing measures reduces memory usage but costs more time and performance.
      Parameters:
        `b` - `true` to enable cache.

    - #### isShareValues

          public static boolean isShareValues()

      Checks whether measures are shared.
      Returns:
        true if measures are shared.

    - #### nullValue

          public static Measure nullValue()

    - #### nullValue

          public static Measure nullValue(Measure.Unit preferredUnit)

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.