Class CoreTypeFcns


  • public abstract class CoreTypeFcns
    extends Object
    • Constructor Detail

      • CoreTypeFcns

        public CoreTypeFcns()
    • Method Detail

      • attributeConvert

        public static Object attributeConvert​(DapType type,
                                              Object value)
        Force an attribute value (typically string) to match a given basetype
        Parameters:
        type - expected type
        value - actual value
        Returns:
        the value as made to conform to the expected type
      • getJavaSize

        public static int getJavaSize​(TypeSort atomtype)
      • forceRange

        public static long forceRange​(TypeSort basetype,
                                      long value)
        Force a numeric value to be in a specified range Only defined for simple integers (ValueClass LONG) WARNING: unsigned values are forced into the signed size, but the proper bit pattern is maintained. The term "force" means that if the value is outside the typed min/max values, it is pegged to the min or max value depending on the sign. Note that truncation is not used.
        Parameters:
        basetype - the type to force value to in range
        value - the value to force
        Returns:
        forced value
        Throws:
        ConversionException - if forcing is not possible
      • minmax

        protected static long minmax​(long value,
                                     long min,
                                     long max)
        Peg a value to either the min or max depending on sign.
        Parameters:
        value - the value to peg
        min - peg to this if value is < min
        max - peg to this if value is > max
        Returns:
        pegg'ed value
      • createVector

        public static Object createVector​(TypeSort type,
                                          long count)