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»
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int Base_N_Decimal  
      private static Logger Logger
      Class logger instance.
      static int Max_Exponent
      Maximum supported Exponent + 1
      private static int Negative_Display_Precision
      Minus 2 for the dot and the negative sign max negative precision.
      private int Operation
      Operation requested after this number was entered.
      (package private) static int Operation_Constant
      Level 7: constant operation stored
      (package private) static int Operation_Division
      Level 3: Operation division
      (package private) static int Operation_Equal
      Level 6: Equal operation finish all calculations on stack
      (package private) static int Operation_Minus
      Level 4: Operation minus
      (package private) static int Operation_Multiplication
      Level 3: Operation multiplication
      (package private) static int Operation_Nop
      Level 7: no operation stored
      (package private) static int Operation_P_Close
      Level 5: Close operation finish all calculations on stack ()
      (package private) static int Operation_P_Open
      Level 0: Operation ) of
      (package private) static int Operation_P_To_R
      Level 1: Operation Polar to Rectangular
      (package private) static int Operation_Percent
      Level 6: Operation % of
      (package private) static int Operation_Plus
      Level 4: Operation plus
      (package private) static int Operation_Power
      Level 2: Operation Power of
      (package private) static int Operation_R_To_P
      Level 1: Operation Rectangular to Polar
      (package private) static int Operation_Root
      Level 2: Operation Root of
      private int Parenthesis
      Parenthesis opened before this number was entered - max is 3.
      (package private) static int Positive_Display_Precision
      Minus 1 for the dot gives max positive precision.
      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 @NotNull [] Ten_Power
      powers of 10 needed to move the decimal point for Format_Engineering.
      private net.sourceforge.uiq3.math.Number Value
      Value of the register.
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) 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 (+-×÷ ... )
      short @NotNull [] Format()
      Format in standard format.
      static short @NotNull [] Format​(net.sourceforge.uiq3.math.Number Value)
      Format Value in standard format
      static short @NotNull [] Format_Engineering​(net.sourceforge.uiq3.math.Number Value, @Nullable Integer 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
      short @NotNull [] 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
      void Inc_Parenthesis()
      Increment parenthesis level (+-×÷ ... )
      (package private) int Operation()
      Get operation (+-×÷ ... )
      void Operation​(int Operation)
      Set operation (+-×÷ ... )
      int Parenthesis()
      Get parenthesis level (+-×÷ ... )
      void Parenthesis​(int Parenthesis)
      Set parenthesis level (+-×÷ ... )
      void Set_NaN()
      Set value of the register to NaN
      (package private) void Set_Value​(@org.jetbrains.annotations.NotNull short @NotNull [] Text)
      Set_Value of the register.
      @NotNull String toString()  
      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

      • Logger

        private static final Logger Logger

        Class logger instance.

      • Negative_Display_Precision

        private static final int Negative_Display_Precision
        Minus 2 for the dot and the negative sign max negative precision.
        See Also:
        Constant Field Values
      • Small_Display_Precision

        private static final int Small_Display_Precision
        i.E. 0.001 is displayed as 1.*10³
        See Also:
        Constant Field Values
      • TAG

        private static final String TAG
        Class logger tag.
      • Ten_Power

        private static final int @NotNull [] Ten_Power
        powers of 10 needed to move the decimal point for Format_Engineering.
      • Operation_Constant

        static final int Operation_Constant
        Level 7: constant operation stored
        See Also:
        Constant Field Values
      • Operation_Division

        static final int Operation_Division
        Level 3: Operation division
        See Also:
        Constant Field Values
      • Operation_Equal

        static final int Operation_Equal
        Level 6: Equal operation finish all calculations on stack
        See Also:
        Constant Field Values
      • Operation_Minus

        static final int Operation_Minus
        Level 4: Operation minus
        See Also:
        Constant Field Values
      • Operation_Multiplication

        static final int Operation_Multiplication
        Level 3: Operation multiplication
        See Also:
        Constant Field Values
      • Operation_Nop

        static final int Operation_Nop
        Level 7: no operation stored
        See Also:
        Constant Field Values
      • Operation_P_Close

        static final int Operation_P_Close
        Level 5: Close operation finish all calculations on stack ()
        See Also:
        Constant Field Values
      • Operation_P_Open

        static final int Operation_P_Open
        Level 0: Operation ) of
        See Also:
        Constant Field Values
      • Operation_P_To_R

        static final int Operation_P_To_R
        Level 1: Operation Polar to Rectangular
        See Also:
        Constant Field Values
      • Operation_Percent

        static final int Operation_Percent
        Level 6: Operation % of
        See Also:
        Constant Field Values
      • Max_Exponent

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

        static final int Operation_Plus
        Level 4: Operation plus
        See Also:
        Constant Field Values
      • Operation_Power

        static final int Operation_Power
        Level 2: Operation Power of
        See Also:
        Constant Field Values
      • Operation_R_To_P

        static final int Operation_R_To_P
        Level 1: Operation Rectangular to Polar
        See Also:
        Constant Field Values
      • Operation_Root

        static final int Operation_Root
        Level 2: Operation Root of
        See Also:
        Constant Field Values
      • Positive_Display_Precision

        static final int Positive_Display_Precision
        Minus 1 for the dot gives max positive precision.
        See Also:
        Constant Field Values
      • Operation

        private int Operation
        Operation requested after this number was entered.
      • Parenthesis

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

        @NotNull
        private net.sourceforge.uiq3.math.Number Value
        Value of the register.
    • Constructor Detail

      • L_Register

        public L_Register()
        Assign one L-Register to another one
    • Method Detail

      • Format

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

        public static short @NotNull [] Format_Engineering​(@NotNull
                                                           net.sourceforge.uiq3.math.Number Value,
                                                           @Nullable
                                                           @Nullable Integer Offset)
        Format Value in standard format
        Parameters:
        Value - value to format
        Offset - Eng offset null no offset, 0 same 3 divisor, 1 next larger 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_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:
        Formatted 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
      • Assign

        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

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

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

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

        int Operation()
        Get operation (+-×÷ ... )
        Returns:
        current operation
      • Operation

        public void Operation​(int 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
      • Set_Value

        void Set_Value​(@NotNull
                       @org.jetbrains.annotations.NotNull short @NotNull [] Text)
                throws Error
        Set_Value of the register.
        Parameters:
        Text - text with new value
        Throws:
        Error - value out of range
      • 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
      • toString

        @NotNull
        @TestOnly
        public @NotNull String toString()
        Overrides:
        toString in class Object