Class A_Register

  • All Implemented Interfaces:
    net.sourceforge.uiq3.calculator.IA_Register, net.sourceforge.uiq3.calculator.IClear, net.sourceforge.uiq3.calculator.IOperation, net.sourceforge.uiq3.calculator.IOwned_Operation, net.sourceforge.uiq3.calculator.IProgrammable_Operation, net.sourceforge.uiq3.IPropertyNotifier, net.sourceforge.uiq3.ITraceable

    public final class A_Register
    extends Op_M
    implements net.sourceforge.uiq3.calculator.IA_Register, net.sourceforge.uiq3.ITraceable, net.sourceforge.uiq3.IPropertyNotifier

    Alpha register (11+3 characters).

    Possible content:

               1111
     01234567890123
    
     ABCDEFGHIJK
     -0.12345678⁻¹²
     -123456789.⁻¹²
     12°34'56.7"
      -12°34'56"
     __DF_ABCDEF
     
    Author:
    "Martin Krischik" «krischik@users.sourceforge.net»
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface net.sourceforge.uiq3.calculator.IA_Register

        net.sourceforge.uiq3.calculator.IA_Register.Mode_Type
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int Alpha_End
      Last Keyboard_Alpha character
      private static int Alpha_Size
      The Casio display holds 11 main characters.
      (package private) static int Alpha_Start
      First Keyboard_Alpha character
      private int arX_Count
      Count the amount of arx # characters.
      private net.sourceforge.uiq3.calculator.ICalculator.DisplayType arX_Mode
      Current display mode Display_Alpha Displays the content of the Alpha register. Display_L Displays the content of the L0 aka X register. Display_Formated Displays the content of the L0 aka X register inside an alpha
      private int Display_Count
      Count the amount of characters inserted to the display.
      static int Display_Size
      display size (alpha and exponent)
      private short @NotNull [] Display_Value
      Alpha Register display Value
      static String DISPLAY_VALUE  
      (package private) static int Exponent_End
      Last Mode_Exponent character
      (package private) static int Exponent_Start
      First Mode_Exponent character
      private static int File_Start
      Start for filename
      (package private) static short @NotNull [] Float_0_Text
      Default text for the numeric display
      private static Logger Logger
      Class logger instance.
      private net.sourceforge.uiq3.calculator.IA_Register.Mode_Type Mode
      alpha register entry mode Mode_Normal normal numeric entry mode Mode_Fraction fraction entry mode Mode_Exponent exponent entry mode Mode_Begin_Alpha begins alpha mode Keyboard_Alpha alpha entry mode
      private static @NotNull String Mode_Error
      Error Message displayed on using the wrong alpha mode!
      (package private) static short @NotNull [] Null_Text
      Default text for the numeric display
      private int Printer_Count
      Count the amount of characters inserted to the printer.
      private static int Printer_Size
      Last Printable character
      private short @Nullable [] Printer_Value
      value of the register for use with printer or tape interface.
      private PropertyChangeSupport propertyChangeSupport
      Handle property changes.
      private int Start_Char
      Limit Alpha text to Start_Char
      private static String TAG
      Class logger tag.
    • Constructor Summary

      Constructors 
      Constructor Description
      A_Register​(@NotNull Calculator Owner)
      Create Keyboard_Alpha Register
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void Add_Negative()
      toggle plus / minus for either mantissa or exponent.
      void Add_Numeric​(short Digit)
      Add a numeric value - this is a non scrolling operation.
      void addPropertyChangeListener​(@NotNull String propertyName, PropertyChangeListener listener)
      Add a PropertyChangeListener for a specific property.
      void addPropertyChangeListener​(PropertyChangeListener listener)
      Add a PropertyChangeListener to the listener list.
      void Clear​(boolean AC)
      Clear content of Register
      void Clear_Display_Value​(int From, int To)
      Clear content of Register
      void Clear_Print_Value()
      Clear content of Register
      void Create_Print_Value()
      Create the optional print value which can be up to 30 characters.
      @NotNull String Debug_String()  
      short @NotNull [] Display​(short Opcode)
      Display operation in program mode.
      int Display_Count()
      Count the amount of characters.
      void Display_Count​(int Char_Count)
      Count the amount of characters.
      void Display_Message​(short @NotNull [] Text)
      Display an informative message until next key is pressed.
      void Execute​(short Opcode)
      Execute virtual CPU command
      short @NotNull [] Filename_Value()
      Get value of the register for use with as filename.
      (package private) int Get_arX_Count()
      Count the amount of arx # characters.
      private short @NotNull [] Get_Display​(net.sourceforge.uiq3.calculator.ICalculator.DisplayType Display_Mode)
      Get Content of Display.
      static net.sourceforge.uiq3.math.Number Get_Numeric_Value​(short[] Decomposed_Text)
      Get value of the register for use with as BCD.
      private void Insert​(short Character)
      Insert a single character
      int Insert​(short @NotNull [] Text)
      Insert content of an String.
      void Insert_X()
      Insert content of L0 aka X register into the string.
      void Limit_Alpha​(int Num_Char)
      Limit Alpha text to Start_Char
      @NotNull net.sourceforge.uiq3.calculator.IA_Register.Mode_Type Mode()
      Get alpha register entry mode
      void Mode​(@NotNull net.sourceforge.uiq3.calculator.IA_Register.Mode_Type Mode)
      Set alpha register entry mode Mode_Normal normal numeric entry mode Mode_Fraction fraction entry mode Mode_Exponent exponent entry mode Mode_Begin_Alpha begins alpha mode Keyboard_Alpha alpha entry mode
      net.sourceforge.uiq3.math.Number Numeric_Value()
      Get value of the register for use with as BCD value.
      short @NotNull [] Print_Value()
      Get value of the register for use with printer or tape interface.
      void Print_Value​(short @NotNull [] Value, int Size)
      Set value of the register for use with printer or tape interface.
      int Printer_Count()
      Count the amount of characters inserted to the printer.
      void Printer_Count​(int Char_Count)
      Count the amount of characters inserted to the printer.
      void removePropertyChangeListener​(@NotNull String propertyName, PropertyChangeListener listener)
      Remove a PropertyChangeListener for a specific property.
      void removePropertyChangeListener​(PropertyChangeListener listener)
      Remove a PropertyChangeListener from the listener list.
      (package private) void Set_File_Type​(short @NotNull [] Value)
      Set_Value of the register - only the display part.
      void Start_Alpha()
      Start a new alpha run.
      void Start_Decimal_Fraction()
      start to enter the part behind the fraction mark point
      void Start_Exponent()
      Start to enter the exponent.
      private static int Start_Of_String​(short @NotNull [] Text)
      find start of data in string.
      @NotNull String toString()
      String representation
      void Trace()
      Trace current value
      short @NotNull [] Value()
      Get value of the register for use with display.
      void Value​(short @NotNull [] Value)
      Set value of the register.
    • Field Detail

      • Alpha_Size

        private static final int Alpha_Size
        The Casio display holds 11 main characters.
      • Logger

        private static final Logger Logger

        Class logger instance.

      • Mode_Error

        @NotNull
        private static final @NotNull String Mode_Error
        Error Message displayed on using the wrong alpha mode!
      • Printer_Size

        private static final int Printer_Size
        Last Printable character
        See Also:
        Constant Field Values
      • TAG

        private static final String TAG

        Class logger tag.

      • Alpha_Start

        static final int Alpha_Start
        First Keyboard_Alpha character
        See Also:
        Constant Field Values
      • Exponent_End

        static final int Exponent_End
        Last Mode_Exponent character
        See Also:
        Constant Field Values
      • Exponent_Start

        static final int Exponent_Start

        First Mode_Exponent character

        See Also:
        Constant Field Values
      • Float_0_Text

        static final short @NotNull [] Float_0_Text
        Default text for the numeric display
      • Null_Text

        static final short @NotNull [] Null_Text
        Default text for the numeric display
      • Alpha_End

        public static final int Alpha_End

        Last Keyboard_Alpha character

        See Also:
        Constant Field Values
      • Display_Size

        public static final int Display_Size
        display size (alpha and exponent)
      • Display_Value

        private final short @NotNull [] Display_Value
        Alpha Register display Value
      • Display_Count

        private int Display_Count

        Count the amount of characters inserted to the display. Grows indefinitely.

      • Mode

        @NotNull
        private net.sourceforge.uiq3.calculator.IA_Register.Mode_Type Mode
        alpha register entry mode
        Mode_Normal
        normal numeric entry mode
        Mode_Fraction
        fraction entry mode
        Mode_Exponent
        exponent entry mode
        Mode_Begin_Alpha
        begins alpha mode
        Keyboard_Alpha
        alpha entry mode
      • Printer_Count

        private int Printer_Count

        Count the amount of characters inserted to the printer. Stops at max printout length.

      • Printer_Value

        private short @Nullable [] Printer_Value

        value of the register for use with printer or tape interface.

      • Start_Char

        private int Start_Char
        Limit Alpha text to Start_Char
      • arX_Count

        private int arX_Count
        Count the amount of arx # characters.
      • arX_Mode

        @NotNull
        private net.sourceforge.uiq3.calculator.ICalculator.DisplayType arX_Mode
        Current display mode
        Display_Alpha
        Displays the content of the Alpha register.
        Display_L
        Displays the content of the L0 aka X register.
        Display_Formated
        Displays the content of the L0 aka X register inside an alpha
      • propertyChangeSupport

        private final PropertyChangeSupport propertyChangeSupport
        Handle property changes.
    • Constructor Detail

      • A_Register

        public A_Register​(@NotNull
                          @NotNull Calculator Owner)
        Create Keyboard_Alpha Register
        Parameters:
        Owner - Calculator
    • Method Detail

      • Get_Numeric_Value

        @NotNull
        public static net.sourceforge.uiq3.math.Number Get_Numeric_Value​(short[] Decomposed_Text)
        Get value of the register for use with as BCD.
        Returns:
        current value
      • Start_Of_String

        private static int Start_Of_String​(short @NotNull [] Text)
        find start of data in string.
        Parameters:
        Text - Text to find begin in.
        Returns:
        position of first non space character
      • addPropertyChangeListener

        public void addPropertyChangeListener​(@NotNull
                                              PropertyChangeListener listener)
        Add a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.
        Specified by:
        addPropertyChangeListener in interface net.sourceforge.uiq3.IPropertyNotifier
        Parameters:
        listener - The PropertyChangeListener to be added
      • addPropertyChangeListener

        public void addPropertyChangeListener​(@NotNull
                                              @NotNull String propertyName,
                                              @NotNull
                                              PropertyChangeListener listener)
        Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property.
        Specified by:
        addPropertyChangeListener in interface net.sourceforge.uiq3.IPropertyNotifier
        Parameters:
        propertyName - The name of the property to listen on.
        listener - The PropertyChangeListener to be added
        Since:
        1.2
      • removePropertyChangeListener

        public void removePropertyChangeListener​(@NotNull
                                                 PropertyChangeListener listener)
        Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. If listener was added more than once to the same event source, it will be notified one less time after being removed. If listener is null, or was never added, no exception is thrown and no action is taken.
        Specified by:
        removePropertyChangeListener in interface net.sourceforge.uiq3.IPropertyNotifier
        Parameters:
        listener - The PropertyChangeListener to be removed
      • removePropertyChangeListener

        public void removePropertyChangeListener​(@NotNull
                                                 @NotNull String propertyName,
                                                 @NotNull
                                                 PropertyChangeListener listener)
        Remove a PropertyChangeListener for a specific property. If `listener` was added more than once to the same event source for the specified property, it will be notified one less time after being removed.
        Specified by:
        removePropertyChangeListener in interface net.sourceforge.uiq3.IPropertyNotifier
        Parameters:
        propertyName - The name of the property that was listened on.
        listener - The PropertyChangeListener to be removed
        Since:
        1.2
      • Add_Negative

        public final void Add_Negative()
        toggle plus / minus for either mantissa or exponent.
        Specified by:
        Add_Negative in interface net.sourceforge.uiq3.calculator.IA_Register
      • Add_Numeric

        public void Add_Numeric​(short Digit)
                         throws net.sourceforge.uiq3.calculator.Error
        Add a numeric value - this is a non scrolling operation.
        Specified by:
        Add_Numeric in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Digit - the digit to add
        Throws:
        Op_Error - something went wrong
        net.sourceforge.uiq3.calculator.Error
      • Clear

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

        public final void Clear_Display_Value​(int From,
                                              int To)
        Clear content of Register
        Specified by:
        Clear_Display_Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        From - First character to clean
        To - Last character to clean
      • Clear_Print_Value

        public final void Clear_Print_Value()
        Clear content of Register
        Specified by:
        Clear_Print_Value in interface net.sourceforge.uiq3.calculator.IA_Register
        See Also:
        IClear.Clear(boolean)
      • Create_Print_Value

        public final void Create_Print_Value()
        Create the optional print value which can be up to 30 characters.
        Specified by:
        Create_Print_Value in interface net.sourceforge.uiq3.calculator.IA_Register
      • Debug_String

        @TestOnly
        @NotNull
        public @NotNull String Debug_String()
        Specified by:
        Debug_String in interface net.sourceforge.uiq3.ITraceable
      • Display

        public final short @NotNull [] Display​(short Opcode)
                                        throws Op_Error
        Display operation in program mode.
        Specified by:
        Display in interface net.sourceforge.uiq3.calculator.IProgrammable_Operation
        Throws:
        Op_Error
        See Also:
        IProgrammable_Operation.Display(short)
      • Display_Count

        public final int Display_Count()
        Count the amount of characters. Grows indefinitely
        Specified by:
        Display_Count in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        amount of characters
      • Display_Count

        public final void Display_Count​(int Char_Count)
        Count the amount of characters. Grows indefinitely.
        Specified by:
        Display_Count in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Char_Count - amount of characters
      • Display_Message

        public final void Display_Message​(short @NotNull [] Text)
        Display an informative message until next key is pressed.
        Specified by:
        Display_Message in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Text - Test to be displayed
      • Execute

        public final void Execute​(short Opcode)
                           throws net.sourceforge.uiq3.calculator.Error
        Execute virtual CPU command
        Specified by:
        Execute in interface net.sourceforge.uiq3.calculator.IOperation
        Overrides:
        Execute in class Op_M
        Parameters:
        Opcode - Virtual CPU Operation to be executed
        Throws:
        Error - general calculator error
        net.sourceforge.uiq3.calculator.Error
        See Also:
        Op_M.Execute(short)
      • Filename_Value

        public final short @NotNull [] Filename_Value()
        Get value of the register for use with as filename.
        Specified by:
        Filename_Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        current value
      • Get_Display

        private final short @NotNull [] Get_Display​(@NotNull
                                                    net.sourceforge.uiq3.calculator.ICalculator.DisplayType Display_Mode)
                                             throws Error,
                                                    IllegalArgumentException

        Get Content of Display.

        Parameters:
        Display_Mode - Last or Current Display mode
        Returns:
        Content of Display
        Throws:
        Error
        IllegalArgumentException
      • Get_arX_Count

        final int Get_arX_Count()
        Count the amount of arx # characters.
        Returns:
        Return amount arX aka # characters
      • Insert

        private void Insert​(short Character)
                     throws Error
        Insert a single character
        Parameters:
        Character - an Character
        Throws:
        Error
      • Insert

        public final int Insert​(short @NotNull [] Text)
                         throws net.sourceforge.uiq3.calculator.Error

        Insert content of an String.

        Specified by:
        Insert in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Text - Text to insert without leading spaces and exponent
        Returns:
        Characters inserted
        Throws:
        net.sourceforge.uiq3.calculator.Error
      • Insert_X

        public void Insert_X()
                      throws net.sourceforge.uiq3.calculator.Error
        Insert content of L0 aka X register into the string.
        Specified by:
        Insert_X in interface net.sourceforge.uiq3.calculator.IA_Register
        Throws:
        net.sourceforge.uiq3.calculator.Error
      • Limit_Alpha

        public final void Limit_Alpha​(int Num_Char)
        Limit Alpha text to Start_Char
        Specified by:
        Limit_Alpha in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Num_Char - max char allowed
      • Mode

        @NotNull
        public final @NotNull net.sourceforge.uiq3.calculator.IA_Register.Mode_Type Mode()
        Get alpha register entry mode
        Specified by:
        Mode in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        Mode_Normal
        normal numeric entry mode
        Mode_Fraction
        fraction entry mode
        Mode_Exponent
        exponent entry mode
        Mode_Begin_Alpha
        begins alpha mode
        Keyboard_Alpha
        alpha entry mode
      • Mode

        public final void Mode​(@NotNull
                               @NotNull net.sourceforge.uiq3.calculator.IA_Register.Mode_Type Mode)
        Set alpha register entry mode
        Mode_Normal
        normal numeric entry mode
        Mode_Fraction
        fraction entry mode
        Mode_Exponent
        exponent entry mode
        Mode_Begin_Alpha
        begins alpha mode
        Keyboard_Alpha
        alpha entry mode
        Specified by:
        Mode in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Mode - new register mode
      • Numeric_Value

        @NotNull
        public final net.sourceforge.uiq3.math.Number Numeric_Value()
                                                             throws Error
        Get value of the register for use with as BCD value.
        Specified by:
        Numeric_Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        current value
        Throws:
        Error - something went wrong
      • Print_Value

        public final short @NotNull [] Print_Value()

        Get value of the register for use with printer or tape interface.

        Specified by:
        Print_Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        current value
      • Print_Value

        public final void Print_Value​(short @NotNull [] Value,
                                      int Size)

        Set value of the register for use with printer or tape interface. Also contains a backup of the alpha string for the append function

        Specified by:
        Print_Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Value - Value
        Size - Characters used
      • Printer_Count

        public final int Printer_Count()

        Count the amount of characters inserted to the printer. Stops at max printout length.

        Specified by:
        Printer_Count in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        amount of characters in print
      • Printer_Count

        public final void Printer_Count​(int Char_Count)

        Count the amount of characters inserted to the printer. Stops at max printout length.

        Specified by:
        Printer_Count in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Char_Count - amount of characters to print
      • Set_File_Type

        void Set_File_Type​(short @NotNull [] Value)
        Set_Value of the register - only the display part.
        Parameters:
        Value - new value
      • Start_Alpha

        public final void Start_Alpha()

        Start a new alpha run. This flag is needed for proper handling of the ; (append) token.

        Specified by:
        Start_Alpha in interface net.sourceforge.uiq3.calculator.IA_Register
      • Start_Decimal_Fraction

        public final void Start_Decimal_Fraction()

        start to enter the part behind the fraction mark point

        Specified by:
        Start_Decimal_Fraction in interface net.sourceforge.uiq3.calculator.IA_Register
      • Start_Exponent

        public final void Start_Exponent()
        Start to enter the exponent.
        Specified by:
        Start_Exponent in interface net.sourceforge.uiq3.calculator.IA_Register
      • Trace

        public void Trace()
        Trace current value
        Specified by:
        Trace in interface net.sourceforge.uiq3.ITraceable
      • Value

        public final short @NotNull [] Value()
        Get value of the register for use with display.
        Specified by:
        Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Returns:
        clone of current value
      • Value

        public final void Value​(short @NotNull [] Value)
        Set value of the register.
        Specified by:
        Value in interface net.sourceforge.uiq3.calculator.IA_Register
        Parameters:
        Value - new value