Class L_Register

  • All Implemented Interfaces:
    net.sourceforge.uiq3.calculator.IClear, net.sourceforge.uiq3.calculator.IL_Register

    public final class L_Register
    extends Object
    implements net.sourceforge.uiq3.calculator.IL_Register
    L-Register need addition information to convert in-fix to post-fix. Note that Internally all calculators are UPN calculators.
    Author:
    "Martin Krischik" «krischik@users.sourceforge.net»
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  L_Register.Operation_Type
      infix operations and there level
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static int Base_N_Binary
      Base for binary
      (package private) static int Base_N_Decimal
      Base for Decimal
      (package private) static int Base_N_Hexadecimal
      Base for Hexadecimal
      (package private) static int Base_N_Octal
      Base for Octal
      (package private) static int Display_Precision
      on FX-603P the display precision is always 10 event with the display not being able to show more
      private static int Internal_Precision
      The Casio had an internal precision of 12 digits - BCDFloat are approximately 18 digits.
      private static Logger Logger
      class logger instance
      static int Max_Exponent
      Maximum supported Exponent + 1
      private L_Register.Operation_Type Operation
      Operation requested after this number was entered.
      private Calculator Owner  
      private int Parenthesis
      Parenthesis opened before this number was entered - max is 3.
      private static int Small_Display_Precision
      i.E. 0.001 is displayed as 1.*10³
      private static String TAG
      class logger tag.
      private static int[] Ten_Power
      powers of 10 needed to move the decimal point for Format_Engineering.
      private static long Two_Power_15
      ±1¹⁵
      private static long Two_Power_31
      2³¹
      private net.sourceforge.uiq3.math.Number Value
      Value of the register for BCD Calculations
    • Constructor Summary

      Constructors 
      Constructor Description
      L_Register​(Calculator Owner)
      Assign one L-Register to another one
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void Assign​(@NotNull L_Register Right)
      Assign one L-Register to another one
      void Assign​(net.sourceforge.uiq3.calculator.IL_Register Right)
      Assign one L-Register to another one
      void Clear​(boolean AC)
      Clear content of Register
      (package private) void Dec_Parenthesis()
      Decrement parenthesis level (+-×÷ ... )
      @org.jetbrains.annotations.NotNull short[] Format()
      Format in standard format.
      static short @NotNull [] Format_Binary​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      private static int Format_Decimal​(short[] Text, long Value, int Index)
      format a decimal integer and add it ot the given alpha sting.
      static short @NotNull [] Format_Decimal​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      static short @NotNull [] Format_Engineering​(net.sourceforge.uiq3.math.Number Value, int Offset)
      Format Value in standard format
      (package private) static short @NotNull [] Format_Fixed​(@NotNull net.sourceforge.uiq3.math.BCDFloat Value, int Digits)
      Format Value in standard format
      static short @NotNull [] Format_Float​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      static short @NotNull [] Format_Fraction_ABC​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      static short @NotNull [] Format_Fraction_DC​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      static short @NotNull [] Format_Hexadecimal​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      static short @NotNull [] Format_Octal​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      @org.jetbrains.annotations.NotNull short[] Format_Print()
      Format in printer format
      static short @NotNull [] Format_Print​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      (package private) static short @NotNull [] Format_Round​(net.sourceforge.uiq3.math.Number Value, int Digits)
      Format Value in standard format
      static @NotNull String Format_Serial​(net.sourceforge.uiq3.math.Number Value)
      Format Value for use with Serial port
      private static String Format_Serial_Float​(net.sourceforge.uiq3.math.BCDFloat Value)
      Format Fraction Value for use with Serial port
      private static String Format_Serial_Fraction​(net.sourceforge.uiq3.math.BCDFraction Value)
      Format Fraction Value for use with Serial port
      private static long Get_16bit​(net.sourceforge.uiq3.math.Number Value)
      Converts a signed long into an 16 unsigned integer
      private static long Get_32bit​(net.sourceforge.uiq3.math.Number Value)
      Converts a signed long into an 32 unsigned integer
      void Inc_Parenthesis()
      Increment parenthesis level (+-×÷ ... )
      (package private) boolean Is_Finite()
      check value is normal real
      L_Register.Operation_Type Operation()
      Get operation (+-×÷ ... )
      void Operation​(L_Register.Operation_Type Operation)
      Set operation (+-×÷ ... )
      int Parenthesis()
      Get parenthesis level (+-×÷ ... )
      void Parenthesis​(int Parenthesis)
      Set parenthesis level (+-×÷ ... )
      static net.sourceforge.uiq3.math.Number Parse_Serial​(String Text)
      parse a text representing a number
      void Set_NaN()
      Set value of the register to NaN
      String toString()
      Convert object to string representation
      net.sourceforge.uiq3.math.Number Value()
      Temp_Value of the register.
      void Value​(net.sourceforge.uiq3.math.Number Value)
      Set value of the register.
    • Field Detail

      • Base_N_Hexadecimal

        static final int Base_N_Hexadecimal
        Base for Hexadecimal
        See Also:
        Constant Field Values
      • Display_Precision

        static final int Display_Precision
        on FX-603P the display precision is always 10 event with the display not being able to show more
      • Internal_Precision

        private static final int Internal_Precision
        The Casio had an internal precision of 12 digits - BCDFloat are approximately 18 digits.
      • Logger

        private static final Logger Logger
        class logger instance
      • Max_Exponent

        public static final int Max_Exponent
        Maximum supported Exponent + 1
      • Small_Display_Precision

        private static final int Small_Display_Precision
        i.E. 0.001 is displayed as 1.*10³
      • TAG

        private static final String TAG
        class logger tag.
      • Ten_Power

        private static int[] Ten_Power
        powers of 10 needed to move the decimal point for Format_Engineering.
      • Parenthesis

        private int Parenthesis
        Parenthesis opened before this number was entered - max is 3.
      • Value

        private net.sourceforge.uiq3.math.Number Value
        Value of the register for BCD Calculations
    • Constructor Detail

      • L_Register

        public L_Register​(Calculator Owner)
        Assign one L-Register to another one
        Parameters:
        Owner - the Owner of this L-Register
    • Method Detail

      • Format_Binary

        public static short @NotNull [] Format_Binary​(@NotNull
                                                      net.sourceforge.uiq3.math.Number Value)
                                               throws Error
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formatted string
        Throws:
        Error
      • Format_Decimal

        public static short @NotNull [] Format_Decimal​(@NotNull
                                                       net.sourceforge.uiq3.math.Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formatted string
      • Format_Decimal

        private static int Format_Decimal​(short[] Text,
                                          long Value,
                                          int Index)

        format a decimal integer and add it ot the given alpha sting.

        Parameters:
        Text - string to add the decimal to
        Value - value to add
        Index - index where the lest significant digit is added
        Returns:
        index of next free character (most significant digits + 1)
      • Format_Engineering

        public static short @NotNull [] Format_Engineering​(@NotNull
                                                           net.sourceforge.uiq3.math.Number Value,
                                                           int Offset)
        Format Value in standard format
        Parameters:
        Value - value to format
        Offset - Eng offset 0 no offset, 1 next lager 3 divisor, -1 next smaller 3 divisor
        Returns:
        Formatted string
      • Format_Fixed

        static short @NotNull [] Format_Fixed​(@NotNull
                                              @NotNull net.sourceforge.uiq3.math.BCDFloat Value,
                                              int Digits)
        Format Value in standard format
        Parameters:
        Value - value to format
        Digits - digits after the .
        Returns:
        Formatted string
      • Format_Float

        public static short @NotNull [] Format_Float​(@NotNull
                                                     net.sourceforge.uiq3.math.Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
      • Format_Fraction_ABC

        public static short @NotNull [] Format_Fraction_ABC​(@NotNull
                                                            net.sourceforge.uiq3.math.Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
      • Format_Fraction_DC

        public static short @NotNull [] Format_Fraction_DC​(@NotNull
                                                           net.sourceforge.uiq3.math.Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
      • Format_Hexadecimal

        public static short @NotNull [] Format_Hexadecimal​(@NotNull
                                                           net.sourceforge.uiq3.math.Number Value)
                                                    throws Error
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
        Throws:
        Error
      • Format_Octal

        public static short @NotNull [] Format_Octal​(@NotNull
                                                     net.sourceforge.uiq3.math.Number Value)
                                              throws Error
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
        Throws:
        Error
      • Format_Print

        public static short @NotNull [] Format_Print​(@NotNull
                                                     net.sourceforge.uiq3.math.Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
      • Format_Round

        static short @NotNull [] Format_Round​(@NotNull
                                              net.sourceforge.uiq3.math.Number Value,
                                              int Digits)
        Format Value in standard format
        Parameters:
        Value - value to format
        Digits - Digits to display
        Returns:
        Formatted string
      • Format_Serial

        @NotNull
        public static @NotNull String Format_Serial​(@NotNull
                                                    net.sourceforge.uiq3.math.Number Value)
        Format Value for use with Serial port
        Parameters:
        Value - value to format
        Returns:
        Formatted string
      • Format_Serial_Float

        private static String Format_Serial_Float​(net.sourceforge.uiq3.math.BCDFloat Value)
        Format Fraction Value for use with Serial port
        Parameters:
        Value - value to format
        Returns:
        Formatted string
      • Format_Serial_Fraction

        private static String Format_Serial_Fraction​(net.sourceforge.uiq3.math.BCDFraction Value)
        Format Fraction Value for use with Serial port
        Parameters:
        Value - value to format
        Returns:
        Formatted string
      • Get_16bit

        private static long Get_16bit​(@NotNull
                                      net.sourceforge.uiq3.math.Number Value)
                               throws Error

        Converts a signed long into an 16 unsigned integer

        Parameters:
        Value - signed long
        Returns:
        unsigned 16 bit
        Throws:
        Error - value does not fit into 16 bit
      • Get_32bit

        private static long Get_32bit​(@NotNull
                                      net.sourceforge.uiq3.math.Number Value)
                               throws Error

        Converts a signed long into an 32 unsigned integer

        Parameters:
        Value - signed long
        Returns:
        unsigned 32 bit
        Throws:
        Error - value does not fit into 32 bit
      • Parse_Serial

        public static net.sourceforge.uiq3.math.Number Parse_Serial​(String Text)

        parse a text representing a number

        Parameters:
        Text - text to parse
        Returns:
        number contained.
      • Assign

        public void Assign​(@NotNull
                           @NotNull L_Register Right)
        Assign one L-Register to another one
        Parameters:
        Right - Value to assign
      • Assign

        public void Assign​(@NotNull
                           net.sourceforge.uiq3.calculator.IL_Register Right)
        Assign one L-Register to another one
        Specified by:
        Assign in interface net.sourceforge.uiq3.calculator.IL_Register
        Parameters:
        Right - Value to assign
      • Clear

        public void Clear​(boolean AC)
        Clear content of Register
        Specified by:
        Clear in interface net.sourceforge.uiq3.calculator.IClear
        Parameters:
        AC - true when AC (all clear) is requested.
        See Also:
        IClear.Clear(boolean)
      • Dec_Parenthesis

        void Dec_Parenthesis()
        Decrement parenthesis level (+-×÷ ... )
      • Format

        @NotNull
        public final @org.jetbrains.annotations.NotNull short[] Format()
                                                                throws Error
        Format in standard format.
        Specified by:
        Format in interface net.sourceforge.uiq3.calculator.IL_Register
        Returns:
        Formatted string
        Throws:
        Error
      • Format_Print

        @NotNull
        public final @org.jetbrains.annotations.NotNull short[] Format_Print()
                                                                      throws Error
        Format in printer format
        Specified by:
        Format_Print in interface net.sourceforge.uiq3.calculator.IL_Register
        Returns:
        Formatted string
        Throws:
        Error
      • Inc_Parenthesis

        public void Inc_Parenthesis()
        Increment parenthesis level (+-×÷ ... )
        Specified by:
        Inc_Parenthesis in interface net.sourceforge.uiq3.calculator.IL_Register
      • Is_Finite

        boolean Is_Finite()

        check value is normal real

        Returns:
        true when value is normal real
      • Operation

        public void Operation​(L_Register.Operation_Type Operation)
        Set operation (+-×÷ ... )
        Parameters:
        Operation - Mathematical operation
      • Parenthesis

        public int Parenthesis()
        Get parenthesis level (+-×÷ ... )
        Specified by:
        Parenthesis in interface net.sourceforge.uiq3.calculator.IL_Register
        Returns:
        parenthesis level (0 ... 3)
      • Parenthesis

        public void Parenthesis​(int Parenthesis)
        Set parenthesis level (+-×÷ ... )
        Specified by:
        Parenthesis in interface net.sourceforge.uiq3.calculator.IL_Register
        Parameters:
        Parenthesis - level (0 ... 3)
      • Set_NaN

        public void Set_NaN()
        Set value of the register to NaN
        Specified by:
        Set_NaN in interface net.sourceforge.uiq3.calculator.IL_Register
      • Value

        @NotNull
        public final net.sourceforge.uiq3.math.Number Value()
        Temp_Value of the register.
        Specified by:
        Value in interface net.sourceforge.uiq3.calculator.IL_Register
        Returns:
        current value
      • Value

        public void Value​(@NotNull
                          net.sourceforge.uiq3.math.Number Value)
                   throws Error
        Set value of the register.
        Specified by:
        Value in interface net.sourceforge.uiq3.calculator.IL_Register
        Parameters:
        Value - Value to set.
        Throws:
        Error - number is large or NaN not a value executable for the FX-602P Simulator