예제 #1
0
        public static IValue ParseValue(string text, int sectionCharIndex, ParsingStatus status)
        {
            if (text.Length < 2 || text[0] != '=' || text[text.Length - 1] != '=')
            {
                return(null);
            }

            var expressionValue = WValue.ParseValue(text.Substring(1, text.Length - 2), sectionCharIndex + 1, status);

            if (expressionValue == null)
            {
                return(null);
            }

            var literalMagnitude = expressionValue.GetMagnitude(status.LocationCounter);
            var literalSign      = expressionValue.GetSign(status.LocationCounter);

            int count = 0;
            var name  = GetName(literalSign, literalMagnitude, count);

            while (status.Symbols[name] != null)
            {
                count++;
                name = GetName(literalSign, literalMagnitude, count);
            }

            SymbolBase literalConstantSymbol = new LiteralConstantSymbol(literalSign, literalMagnitude, name);

            status.Symbols.Add(literalConstantSymbol);
            return(literalConstantSymbol);
        }
예제 #2
0
 public WriteConcern WithW(WValue value)
 {
     return((object.Equals(_w, value)) ? this : new Builder(this)
     {
         _w = value
     }.Build());
 }
예제 #3
0
 // constructors
 public Builder(WriteConcern other)
 {
     _fsync    = other.FSync;
     _journal  = other.Journal;
     _w        = other.W;
     _wTimeout = other.WTimeout;
 }
예제 #4
0
        public override string ToString()
        {
            string str = "";

            str += "&idserver=\"" + IDServer.ToString() + "\"";

            if (IDUser != -1)
            {
                str += "&iduser=\"" + IDUser.ToString() + "\"";
            }
            if (WValue != 0)
            {
                str += "&weight=\"" + WValue.ToString() + "\"";
            }
            if (WeightDate != null)
            {
                str += "&weightdate=\"" + WeightDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }
            if (InsertDate != null)
            {
                str += "&insertdate=\"" + InsertDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }
            if (UpdateDate != null)
            {
                str += "&updatedate=\"" + UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }

            return(str.Substring(1));
        }
예제 #5
0
        protected override MutableObject Mutate(MutableObject mutable)
        {
            QuaternionTarget.SetValue(new Quaternion(
                                          XValue.GetFirstValue(mutable),
                                          YValue.GetFirstValue(mutable),
                                          ZValue.GetFirstValue(mutable),
                                          WValue.GetFirstValue(mutable)), mutable);

            return(mutable);
        }
예제 #6
0
        public VectorSlider(PropertyInfo prop, object owner, float min = 0, float max = 1, NodeType type = NodeType.Float4, bool isInt = false)
        {
            InitializeComponent();
            property      = prop;
            propertyOwner = owner;
            this.min      = min;
            this.max      = max;

            switch (type)
            {
            case NodeType.Float2:
                ZView.Visibility = Visibility.Collapsed;
                WView.Visibility = Visibility.Collapsed;
                break;

            case NodeType.Float3:
                ZView.Visibility = Visibility.Visible;
                WView.Visibility = Visibility.Collapsed;
                break;

            case NodeType.Float4:
                ZView.Visibility = Visibility.Visible;
                WView.Visibility = Visibility.Visible;
                break;
            }

            object b = prop.GetValue(owner);

            if (b == null)
            {
                pc = new VectorPropertyContainer(new MVector());
            }
            else
            {
                MVector vec = (MVector)b;
                pc = new VectorPropertyContainer(vec);
            }

            pc.OnUpdate += Pc_OnUpdate;

            var xprop = pc.GetType().GetProperty("XProp");
            var yprop = pc.GetType().GetProperty("YProp");
            var zprop = pc.GetType().GetProperty("ZProp");
            var wprop = pc.GetType().GetProperty("WProp");

            XValue.IsInt = isInt;
            YValue.IsInt = isInt;
            ZValue.IsInt = isInt;
            WValue.IsInt = isInt;

            XValue.Set(min, max, xprop, pc);
            YValue.Set(min, max, yprop, pc);
            ZValue.Set(min, max, zprop, pc);
            WValue.Set(min, max, wprop, pc);
        }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WriteConcern"/> class.
 /// </summary>
 /// <param name="w">The w value.</param>
 /// <param name="wTimeout">The wtimeout value.</param>
 /// <param name="fsync">The fsync value .</param>
 /// <param name="journal">The journal value.</param>
 public WriteConcern(
     Optional <WValue> w           = default(Optional <WValue>),
     Optional <TimeSpan?> wTimeout = default(Optional <TimeSpan?>),
     Optional <bool?> fsync        = default(Optional <bool?>),
     Optional <bool?> journal      = default(Optional <bool?>))
 {
     _w        = w.WithDefault(null);
     _wTimeout = Ensure.IsNullOrGreaterThanZero(wTimeout.WithDefault(null), "wTimeout");
     _fsync    = fsync.WithDefault(null);
     _journal  = journal.WithDefault(null);
 }
예제 #8
0
 public WriteConcern(
     WValue w,
     TimeSpan?wTimeout,
     bool?fsync,
     bool?journal)
 {
     _w        = w;
     _wTimeout = wTimeout;
     _fsync    = fsync;
     _journal  = journal;
 }
예제 #9
0
파일: Parser.cs 프로젝트: arlm/MixEmul
        /// <summary>
        /// This method is used to handle instructions targeted at the assembler itself.
        /// </summary>
        static bool HandleAssemblyInstruction(string opField, string addressField, SymbolBase symbol, ParsingStatus status)
        {
            IValue expression;

            status.LineSection = LineSection.AddressField;
            switch (opField)
            {
            case "EQU":
                // set value of the instruction symbol (first field) to the value of the expression that is in the address field
                if (symbol != null)
                {
                    expression = WValue.ParseValue(addressField, 0, status);

                    if (!expression.IsValueDefined(status.LocationCounter))
                    {
                        status.ReportParsingError(0, addressField.Length, "expression value is undefined");
                        return(true);
                    }

                    symbol.SetValue(expression.GetSign(status.LocationCounter), expression.GetMagnitude(status.LocationCounter));
                }

                return(true);

            case "ORIG":
                // set the location counter to the value of the expression that is in the address field
                expression = WValue.ParseValue(addressField, 0, status);

                if (!expression.IsValueDefined(status.LocationCounter))
                {
                    status.ReportParsingError(0, addressField.Length, "expression value is undefined");
                    return(true);
                }

                status.LocationCounter = (int)expression.GetValue(status.LocationCounter);

                return(true);

            case "CON":
            case "ALF":
                // these instructions set the value of the memory word at the location counter, which is actually a loader instruction.
                // However, during assembly these memory words must be skipped, which is why we increase the location counter.
                status.LocationCounter++;

                return(true);
            }

            return(false);
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WriteConcern"/> class.
        /// </summary>
        /// <param name="w">The w value.</param>
        /// <param name="wTimeout">The wtimeout value.</param>
        /// <param name="fsync">The fsync value .</param>
        /// <param name="journal">The journal value.</param>
        public WriteConcern(
            Optional <WValue> w           = default(Optional <WValue>),
            Optional <TimeSpan?> wTimeout = default(Optional <TimeSpan?>),
            Optional <bool?> fsync        = default(Optional <bool?>),
            Optional <bool?> journal      = default(Optional <bool?>))
        {
            _w        = w.WithDefault(null);
            _wTimeout = Ensure.IsNullOrGreaterThanZero(wTimeout.WithDefault(null), "wTimeout");
            _fsync    = fsync.WithDefault(null);
            _journal  = journal.WithDefault(null);

            if (_w != null && w.Value.Equals(0) && _journal.HasValue && journal.Value.Equals(true))
            {
                throw new MongoConfigurationException("This write concern is not valid.");
            }
        }
예제 #11
0
        private void UpdateAxisAngleSettings(object sender, EventArgs e)
        {
            //Clear prior values
            myprocTransformGroup.Children.Clear();
            WValue.Clear();
            XValue.Clear();
            YValue.Clear();
            ZValue.Clear();

            //<SnippetQuaternionView3DN4>
            //Read new settings
            Double angle = System.Convert.ToDouble(AngleValue.Text);

            try
            {
                Double xaxis = System.Convert.ToDouble(XAxisValue.Text);
                Double yaxis = System.Convert.ToDouble(YAxisValue.Text);
                Double zaxis = System.Convert.ToDouble(ZAxisValue.Text);

                endQuaternion = new Quaternion(new Vector3D(xaxis, yaxis, zaxis), angle);
            }
            catch
            {
                XAxisValue.Text = "Axis must be nonzero Vector3D";
                YAxisValue.Text = "Axis must be nonzero Vector3D";
                ZAxisValue.Text = "Axis must be nonzero Vector3D";
            }

            endRotation.Quaternion = endQuaternion;
            //</SnippetQuaternionView3DN4>

            //Update quaternion display
            WValue.Text = endQuaternion.W.ToString();
            XValue.Text = endQuaternion.X.ToString();
            YValue.Text = endQuaternion.Y.ToString();
            ZValue.Text = endQuaternion.Z.ToString();

            //build in some if clauses to determine the animation method to call
            startAnimation();
        }
예제 #12
0
        /// <summary>
        /// Creates an instance of this class by parsing the address field of a loader instruction.
        /// </summary>
        /// <param name="instruction">LoaderInstruction to parse the address field for. This method will throw an exception if this parameter is of a different instruction type.</param>
        /// <param name="addressField">The address field to parse.</param>
        /// <param name="status">ParsingStatus object reflecting the current state of the parse process</param>
        /// <returns></returns>
        public static IInstructionParameters ParseAddressField(InstructionBase instruction, string addressField, ParsingStatus status)
        {
            if (!(instruction is LoaderInstruction))
            {
                throw new ArgumentException("instruction must be a LoaderInstruction", nameof(instruction));
            }

            var    loaderInstruction = (LoaderInstruction)instruction;
            IValue address           = loaderInstruction.Alphanumeric ? CharacterConstantValue.ParseValue(addressField, 0, status) : WValue.ParseValue(addressField, 0, status);

            if (address == null)
            {
                status.ReportParsingError(0, addressField.Length, "unable to parse value");
                return(null);
            }

            return(new LoaderInstructionParameters(address, addressField.Length));
        }