lojix/power_model/src/main/com/thesett/aima/attribute/impl/BigDecimalTypeImpl.java
public static Type createInstance(String name, int precision, int scale, String min, String max)
    {
        synchronized (DECIMAL_TYPES)
        {
            // Add the newly created type to the map of all types.
            BigDecimalTypeImpl newType = new BigDecimalTypeImpl(name, precision, scale, min, max);

            // Ensure that the named type does not already exist, unless it has an identical definition already, in which
            // case the old definition can be re-used and the new one discarded.
            BigDecimalTypeImpl oldType = DECIMAL_TYPES.get(name);

            if ((oldType != null) && !oldType.equals(newType))
            {
                throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined.");
            }
            else if ((oldType != null) && oldType.equals(newType))
            {
                return oldType;
            }
            else
            {
                DECIMAL_TYPES.put(name, newType);

                return newType;
            }
        }
    }
public static Type createInstance(String name, int precision, int scale, String min, String max)
    {
        synchronized (DECIMAL_TYPES)
        {
            // Add the newly created type to the map of all types.
            BigDecimalTypeImpl newType = new BigDecimalTypeImpl(name, precision, scale, min, max);

            // Ensure that the named type does not already exist, unless it has an identical definition already, in which
            // case the old definition can be re-used and the new one discarded.
            BigDecimalTypeImpl oldType = DECIMAL_TYPES.get(name);

            if ((oldType != null) && !oldType.equals(newType))
            {
                throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined.");
            }
            else if ((oldType != null) && oldType.equals(newType))
            {
                return oldType;
            }
            else
            {
                DECIMAL_TYPES.put(name, newType);

                return newType;
            }
        }
    }
public static Type createInstance ( String name , int precision , int scale , String min , String max ) { synchronized ( DECIMAL_TYPES ) { // Add the newly created type to the map of all types. BigDecimalTypeImpl newType = new BigDecimalTypeImpl ( name , precision , scale , min , max ) ; // Ensure that the named type does not already exist, unless it has an identical definition already, in which // case the old definition can be re-used and the new one discarded. BigDecimalTypeImpl oldType = DECIMAL_TYPES . get ( name ) ; if ( ( oldType != null ) && ! oldType . equals ( newType ) ) { throw new IllegalArgumentException ( "The type '" + name + "' already exists and cannot be redefined." ) ; } else if ( ( oldType != null ) && oldType . equals ( newType ) ) { return oldType ; } else { DECIMAL_TYPES . put ( name , newType ) ; return newType ; } } }
Creates a new decimal type with the specified name, if it does not already exist.

@param  name      The name of the decimal type to create.
@param  precision The precision of the decimal type.
@param  scale     The scale of the decimal type.

@return A new decimal type.

@throws IllegalArgumentException If the named type already exists.
Creates a new decimal type with the specified name if it does not already exist .