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); }
public WriteConcern WithW(WValue value) { return((object.Equals(_w, value)) ? this : new Builder(this) { _w = value }.Build()); }
// constructors public Builder(WriteConcern other) { _fsync = other.FSync; _journal = other.Journal; _w = other.W; _wTimeout = other.WTimeout; }
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)); }
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); }
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); }
/// <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); }
public WriteConcern( WValue w, TimeSpan?wTimeout, bool?fsync, bool?journal) { _w = w; _wTimeout = wTimeout; _fsync = fsync; _journal = journal; }
/// <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); }
/// <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."); } }
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(); }
/// <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)); }