/// <summary>
        /// Constructs a class to manage parsing from double precition floating point numbers to string
        /// representation of a number according to current settings of the calculator. Passing
        /// pointer to calculator to get current setting of the calculator.
        /// </summary>
        public Back_Parser_Fascede(Number_Notation _Number_Notation, sbyte _numeral_system_Type, string _comma_Type)
        {
            Number_Notation = _Number_Notation;

            numeral_system_Type = _numeral_system_Type;

            comma_Type = _comma_Type;
        }
        /// <summary>
        /// Returns given number in given positonal numeral system.
        /// </summary>
        private string Positional_Numeral_System(double number, Number_Notation Number_Notation, sbyte numeral_System_Type, string comma_Type)
        {
            Double_Precition_Decomposer Decomposer = new Double_Precition_Decomposer(number);

            IBack_Parser Back_Parser = Construnct_Positional_Back_Parser(numeral_System_Type, Decomposer);

            return((Decomposer.Is_Negative ? "-" : String.Empty) +
                   Return_Notation_Selector(Back_Parser, Number_Notation, comma_Type));
        }
 /// <summary>
 /// Constructs new Options class reading and setting resorcess for MainWindow .
 /// </summary>
 public Options_Storage(Calculator_Mode calculator_Mode, Calculation_Method calculation_Method,
                        double intitial_Height, double intial_Width, Number_Notation number_Notation, string comma_Type,
                        Font_Size_Type font_Size_Type, Colour_Palette_Type colour_Palette_Type, sbyte numeral_System_Code, Languages current_Language)
     : this(calculator_Mode, calculation_Method, intitial_Height, intial_Width, number_Notation, font_Size_Type, colour_Palette_Type)
 {
     Comma_Type          = comma_Type;
     Numeral_System_Code = numeral_System_Code;
     Current_Language    = current_Language;
     //set_language
 }
Пример #4
0
        private void Number_Notation_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Remove_Obsolete_Command <Change_Number_Notation_Option_Command>();

            Number_Notation New_Number_Notation = (Number_Notation)Number_Notation_List_ComboBox.SelectedIndex;

            if (New_Number_Notation != Options_Provider.Number_Notation)
            {
                Option_Change_Command_List.Add(new Change_Number_Notation_Option_Command(New_Number_Notation));
            }
        }
        private Number_Notation_List_Item Set_Current_Number_Notation_In_ComboBox(Number_Notation current_Number_Notation)
        {
            foreach (Number_Notation_List_Item item in Number_Notation_List_Items_List)
            {
                if (item.Number_Notation == current_Number_Notation)
                {
                    return(item);
                }
            }

            return(null);
        }
 public Options_Storage(Calculator_Mode calculator_Mode, Calculation_Method calculation_Method,
                        double intitial_Height, double intial_Width, Number_Notation number_Notation,
                        Font_Size_Type font_Size_Type, Colour_Palette_Type colour_Palette_Type)
 {
     Calculator_Mode     = calculator_Mode;
     Calculation_Method  = calculation_Method;
     Initial_Height      = intitial_Height;
     Initial_Width       = intial_Width;
     Number_Notation     = number_Notation;
     Font_Size_Type      = font_Size_Type;
     Colour_Palette_Type = colour_Palette_Type;
 }
        /// <summary>
        /// According to given numeral select proper method to return given number to string
        /// representation of a number.
        /// </summary>
        private string Numeral_System_Selector(double number, Number_Notation Number_Notation, sbyte numeral_System_Type, string comma_Type)
        {
            if (numeral_System_Type > 1)
            {
                return(Positional_Numeral_System(number, Number_Notation, numeral_System_Type, comma_Type));
            }
            else
            {
                switch (numeral_System_Type)
                {
                case 1:
                    return(Unary_Numeral_System(number));

                case -2:
                    return(Negabinary_Numeral_System(number));

                case -3:
                    return(Balanced_Ternary_Numeral_System(number));

                default:
                    throw new NotImplementedException();
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Constructs item for given Number_Notation.
        /// </summary>
        internal Number_Notation_List_Item(IStandard_Messages_Translate Standard_Messages, Number_Notation _Number_Notation)
        {
            Number_Notation = _Number_Notation;

            Number_Notation_Name = Standard_Messages.Translate(Number_Notation.ToString() + "_Notation");
        }
Пример #9
0
 /// <summary>
 /// Constructs new Factory for getting Back_Parser_Fascede.
 /// </summary>
 internal Back_Parser_Factory(Number_Notation number_Notation, sbyte numeral_System_Type, string comma_Type)
 {
     Back_Parser_Fascede = new Back_Parser_Fascede(number_Notation, numeral_System_Type, comma_Type);
 }
Пример #10
0
 /// <summary>
 /// Constructs new Factory for getting Back_Parser_Fascede for test not requiring a comma sign.
 /// </summary>
 internal Back_Parser_Factory(Number_Notation number_Notation,
                              sbyte numeral_System_Type) : this(number_Notation, numeral_System_Type, String.Empty)
 {
 }
Пример #11
0
 public void Set_Number_Notation(Number_Notation new_Number_Notation)
 {
     Number_Notation = new_Number_Notation;
 }
Пример #12
0
 /// <summary>
 /// Constructs new command for changing number notation in Options class.
 /// </summary>
 public Change_Number_Notation_Option_Command(Number_Notation number_Notation_To_Change)
 {
     Number_Notation_To_Change = number_Notation_To_Change;
 }
        /// <summary>
        /// Constructs new Number_Notation_List_Context for given OptionsWindow.
        /// </summary>
        internal Number_Notation_List_Context(IStandard_Messages_Translate Standard_Messages, Number_Notation Number_Notation)
        {
            Number_Notation_List_Items_List = Set_Number_Notation_List_Items(Standard_Messages);

            Number_Notation_List_ComboBox_SelectedItem =
                Set_Current_Number_Notation_In_ComboBox(Number_Notation);
        }