Class L_Register

  • All Implemented Interfaces:
    IClear, IL_Register

    public final class L_Register
    extends Object
    implements 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»
    • 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 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
                                                      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
                                                       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
                                                           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 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
                                                     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
                                                            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
                                                           Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
      • Format_Hexadecimal

        public static short @NotNull [] Format_Hexadecimal​(@NotNull
                                                           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
                                                     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
                                                     Number Value)
        Format Value in standard format
        Parameters:
        Value - value to format
        Returns:
        Formated string
      • Format_Round

        static short @NotNull [] Format_Round​(@NotNull
                                              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
                                                    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​(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​(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
                                      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
                                      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 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
                           IL_Register Right)
        Assign one L-Register to another one
        Specified by:
        Assign in interface IL_Register
        Parameters:
        Right - Value to assign
      • Clear

        public void Clear​(boolean AC)
        Clear content of Register
        Specified by:
        Clear in interface 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 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 IL_Register
        Returns:
        Formatted string
        Throws:
        Error
      • Inc_Parenthesis

        public void Inc_Parenthesis()
        Increment parenthesis level (+-×÷ ... )
        Specified by:
        Inc_Parenthesis in interface 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 IL_Register
        Returns:
        parenthesis level (0 ... 3)
      • Parenthesis

        public void Parenthesis​(int Parenthesis)
        Set parenthesis level (+-×÷ ... )
        Specified by:
        Parenthesis in interface 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 IL_Register
      • Value

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

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