/// <summary> /// If the result is empty, format the fragment of text describing the error. /// </summary> /// <returns>The error fragment.</returns> public string FormatErrorMessageFragment() { if (ErrorMessage != null) { return(ErrorMessage); } string message; if (Remainder.IsAtEnd) { message = "unexpected end of input"; } else { var next = Remainder.ConsumeToken().Value; var appearance = Presentation.FormatAppearance(next.Kind, next.ToStringValue()); message = $"unexpected {appearance}"; } if (Expectations != null) { var expected = Friendly.List(Expectations); message += $", expected {expected}"; } return(message); }
public override void Visit(Remainder node) { ulong left = thread.Pop().Read().GetAsInt().Value; ulong right = thread.Pop().Read().GetAsInt().Value; PushInteger(left % right); }
public void CalculateTest() { ITwoArgumentsCalculator calculator = new Remainder(); double result = calculator.Calculate(4, 2); Assert.AreEqual(0, result); }
public static void Main(string[] args) { Declarevar dv = new Declarevar(); dv.Declaringvar(); Sum s = new Sum(); Difference d = new Difference(); Product p = new Product(); Quotient t = new Quotient(); Remainder r = new Remainder(); Input ip = new Input(); ip.getInput(); s.AcceptSum(); d.getDifference(); p.getProduct(); t.getQuotient(); r.getRemainder(); System.Console.WriteLine("Sum\t\t:\t\t " + Declarevar.Sum); System.Console.WriteLine("Difference\t:\t\t " + Declarevar.Difference); System.Console.WriteLine("Product\t\t:\t\t " + Declarevar.Product); System.Console.WriteLine("Quotient\t:\t\t " + Declarevar.Quotient); System.Console.WriteLine("Remainder\t:\t\t " + Declarevar.Remainder); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Исходные полиномы"); Console.WriteLine(P.ToString()); Console.WriteLine(P2.ToString()); Polinome.Polinome NewP = P; Console.WriteLine("Умножение"); NewP.Mul(P2); Console.WriteLine(NewP.ToString()); NewP = P; Console.WriteLine("Сложение"); NewP.Add(P2); Console.WriteLine(NewP.ToString()); NewP = P; Console.WriteLine("Вычитание"); NewP.Sub(P2); Console.WriteLine(NewP.ToString()); NewP = P; NewP.Div(P2, out Polinome.Polinome Remainder); Console.WriteLine("Деление"); Console.WriteLine(NewP.ToString()); Console.WriteLine("Остаток от деления"); Console.WriteLine(Remainder.ToString()); for (; ;) { ; } }
public override bool Equals(object obj) { var other = obj as FormControl; if (other == null || !(MinorVersion == other.MinorVersion && MajorVersion == other.MajorVersion && Equals(PropMask, other.PropMask) && Equals(BackColor, other.BackColor) && Equals(ForeColor, other.ForeColor) && NextAvailableId == other.NextAvailableId && Equals(BooleanProperties, other.BooleanProperties) && BorderStyle == other.BorderStyle && MousePointer == other.MousePointer && Equals(ScrollBars, other.ScrollBars) && GroupCount == other.GroupCount && Cycle == other.Cycle && SpecialEffect == other.SpecialEffect && Equals(BorderColor, other.BorderColor) && Zoom == other.Zoom && PictureAlignment == other.PictureAlignment && PictureSizeMode == other.PictureSizeMode && ShapeCookie == other.ShapeCookie && DrawBuffer == other.DrawBuffer && Equals(DisplayedSize, other.DisplayedSize) && Equals(LogicalSize, other.LogicalSize) && Equals(ScrollPosition, other.ScrollPosition) && string.Equals(Caption, other.Caption) && MouseIcon.SequenceEqual(other.MouseIcon) && FontIsStdFont == other.FontIsStdFont && Picture.SequenceEqual(other.Picture) && Equals(FontTextProps, other.FontTextProps) && Equals(FontStdFont, other.FontStdFont) && Sites.SequenceEqual(other.Sites) && Remainder.SequenceEqual(other.Remainder))) { return(false); } if (SiteClassInfos.Count != other.SiteClassInfos.Count) { return(false); } return(!SiteClassInfos.Where((t, i) => !t.SequenceEqual(other.SiteClassInfos[i])).Any()); }
/// <summary> /// If the result is empty, format the fragment of text describing the error. /// </summary> /// <returns>The error fragment.</returns> public string FormatErrorMessageFragment() { if (ErrorMessage != null) { return(ErrorMessage); } string message; if (Remainder.IsAtEnd) { message = "unexpected end of input"; } else { var next = Remainder.ConsumeChar().Value; message = $"unexpected `{next}`"; } if (Expectations != null) { var expected = Friendly.List(Expectations); message += $", expected {expected}"; } return(message); }
private void Awake() { // 判断实例是否已经退出 if (instance == null) { // 如何没有,实例化this instance = this; } //如果已经实例化,但不是this else if (instance != this) { // 销毁对象 Destroy(gameObject); } // 当正在重新加载场景时,设置this不被销毁 //DontDestroyOnLoad(gameObject); // 获取访问主菜单脚本的引用 mainMenu = GetComponent <MainMenu>(); // 获取存档文件菜单脚本引用 saveFileMenu = GetComponent <SaveFilesMenu>(); // 获取访问Dialogue脚本的引用 dialogue = GetComponent <Dialogue>(); // 获取访问Battle脚本的引用 battle = GetComponent <Battle>(); // 获取访问Remainder脚本引用 remainder = GetComponent <Remainder>(); playerMenu = GetComponent <PlayerMenu>(); CurrentState = UIState.Default; }
public async Task <ActionResult <Remainder> > PostRemainder(Remainder remainder) { remainder.UserID = UserID; await _context.CreateRemainder(remainder); return(CreatedAtAction("GetRemainder", new { id = remainder.RemainderId }, remainder)); }
public void PossibleToRemainderValidParameters(double a, double b, double expected) { Remainder calc = new Remainder(); double actual = calc.ApplyTo(a, b); Assert.Equal(expected, actual); }
public async Task <bool> CreateRemainder(Remainder rem) { rem.UpdatedOn = DateTime.Now; noteDb.Add(rem); int ret = await noteDb.SaveChangesAsync(); return(ret > 0 ? true : false); }
protected override void Execute(CodeActivityContext context) { int quotient = Dividend.Get(context) / Divisor.Get(context); int remainder = Dividend.Get(context) % Divisor.Get(context); Result.Set(context, quotient); Remainder.Set(context, remainder); }
public void Delete(int id) { Remainder remainder = _ctx.Remainders.Find(id); _ctx.Remainders.Remove(remainder); _ctx.SaveChanges(); }
public void Put(int id, [FromBody] string text) { Remainder remainder = _ctx.Remainders.Find(id); remainder.Text = text; _ctx.SaveChanges(); }
//<expr-mul><--<Rem>// public string Visit(Remainder node) { var sb = new StringBuilder(); sb.Append(Visit((dynamic)node[0]) + "\n"); sb.Append(Visit((dynamic)node[1]) + "\n"); sb.Append("\t\trem\n"); return(sb.ToString()); }
/// <summary> /// Consumes the next character, if it equals <code>c</code>. /// </summary> /// <returns>Wether the character was equal to <code>c</code> (and thus has been deleted)</returns> public bool ConsumeNext(string str) { if (Remainder.StartsWith(str)) { m_pos += str.Length; return(true); } return(false); }
private void btn_add_soldrem_Click(object sender, EventArgs e) { if (0 == (int)cb_addrem_store_id.SelectedValue) { MessageBox.Show("გთხოვთ მონიშნოთ საწყობი!", "შეცდომა"); return; } info addrem_res = info.niy(); switch (AddRemMode) { case AddRemainderItemMode.BoughtZed: if (ValidateAddRemFields()) { Remainder RemToAdd = new Remainder(cmb_select_remainder.SelectedItem.ToString(), ClientIdent, ZedIdent, PieceCount, PackCapacity, PieceCount, PiecePrice, PiecePrice, RemSellPrice, RemSellPrice, (int)cb_addrem_store_id.SelectedValue); addrem_res = ProductInfo_Main_Form.conn.sOpAddRemainder(RemToAdd); } else { addrem_res.errcode = 1; addrem_res.details = "გთხოვთ შეავსოთ ყველა ველი!"; } break; case AddRemainderItemMode.SoldZed: if (ValidateAddRemFields()) { Remainder RemToSell = new Remainder(cmb_select_remainder.SelectedItem.ToString(), ClientIdent, "", PieceCount, PackCapacity, PieceCount, 0.0m, 0.0m, PiecePrice, PiecePrice, (int)cb_addrem_store_id.SelectedValue); addrem_res = ProductInfo_Main_Form.conn.sOpSellRemainder(RemToSell, SellOrderID); } else { addrem_res.errcode = 1; addrem_res.details = "გთხოვთ შეავსოთ ყველა ველი!"; } break; case AddRemainderItemMode.SellOrder: if (ValidateAddRemFields()) { Remainder RemToSell = new Remainder(cmb_select_remainder.SelectedItem.ToString(), ClientIdent, "", PieceCount, PackCapacity, PieceCount, 0.0m, 0.0m, PiecePrice, PiecePrice, (int)cb_addrem_store_id.SelectedValue); addrem_res = ProductInfo_Main_Form.conn.sOpSellRemainder(RemToSell, SellOrderID); } else { addrem_res.errcode = 1; addrem_res.details = "გთხოვთ შეავსოთ ყველა ველი!"; } break; } MessageBox.Show(addrem_res.details, addrem_res.errcode.ToString()); if (0 == addrem_res.errcode) { this.Close(); } }
public void Calcpr( double firstElement, double secondElement, double expected) { var calculator = new Remainder(); var actualResult = calculator.Calculate(firstElement, secondElement); Assert.AreEqual(expected, actualResult, 0.01); }
public int UpdateRemainder(Employee employee, float remainder) { Remainder _remainder = new Remainder { remainder = remainder, paymentDate = DateTime.Now, }; databaseContext.Remainders.Add(_remainder); return(databaseContext.SaveChanges()); }
public void Evaluate_NumberAndNumber_ReturnsNumber() { var left = new Number(5.75); var right = new Number(1.5); var expression = new Remainder(left, right); var result = expression.EvaluateWithData(); Assert.AreEqual(1.25, result); }
public void Evaluate_IntegerAndInteger_ReturnsInteger() { var left = new Integer(5); var right = new Integer(3); var expression = new Remainder(left, right); var result = expression.EvaluateWithData(); Assert.AreEqual(2, result); }
protected bool Equals(TabStripControl other) { return(Accelerators.SequenceEqual(other.Accelerators) && Equals(BackColor, other.BackColor) && Equals(ForeColor, other.ForeColor) && Items.SequenceEqual(other.Items) && ListIndex == other.ListIndex && MajorVersion == other.MajorVersion && MinorVersion == other.MinorVersion && MouseIcon.SequenceEqual(other.MouseIcon) && MousePointer == other.MousePointer && Equals(PropMask, other.PropMask) && Remainder.SequenceEqual(other.Remainder) && Equals(Size, other.Size) && TabData == other.TabData && TabFixedHeight == other.TabFixedHeight && TabFixedWidth == other.TabFixedWidth && TabNames.SequenceEqual(other.TabNames) && TabOrientation == other.TabOrientation && TabsAllocated == other.TabsAllocated && TabStyle == other.TabStyle && Tags.SequenceEqual(other.Tags) && Equals(TextProps, other.TextProps) && TipStrings.SequenceEqual(other.TipStrings) && VariousPropertyBits == other.VariousPropertyBits); }
public void Post([FromBody] string text) { Remainder remainder = new Remainder(); remainder.Text = text; remainder.TimeToWork = ToDateSQLite(DateTime.Now); remainder.Priority = Priority.A; _ctx.Remainders.Add(remainder); _ctx.SaveChanges(); }
protected virtual Expression OnVisit(Remainder expression) { var left = OnVisit(expression.Left); var right = OnVisit(expression.Right); if (left != expression.Left || right != expression.Right) { return(CopyTrivia(new Remainder(left, right, expression.Type), expression)); } return(expression); }
//protected override void CacheMetadata(NativeActivityMetadata metadata) //{ // metadata.AddChild(this.Body); // if (this.Variables != null) // { // metadata.SetVariablesCollection(this.Variables); // } // var runtimeArguments = new Collection<RuntimeArgument>(); // runtimeArguments.Add(new RuntimeArgument("Dividend", typeof(int), ArgumentDirection.In)); // runtimeArguments.Add(new RuntimeArgument("Divisor", typeof(int), ArgumentDirection.In)); // metadata.Bind(this.Dividend, runtimeArguments[0]); // metadata.Bind(this.Divisor, runtimeArguments[1]); // metadata.SetArgumentsCollection(runtimeArguments); // metadata.AddImplementationChild(Body); //} protected override void Execute(NativeActivityContext context) { int dividend = Dividend.Get(context); int divisor = Divisor.Get(context); int quotient = dividend / divisor; int remainder = dividend % divisor; decimal result = (decimal)dividend / (decimal)divisor; Quotient.Set(context, quotient); Remainder.Set(context, remainder); Result.Set(context, result); }
protected bool Equals(MorphDataControl other) { return(MinorVersion == other.MinorVersion && MajorVersion == other.MajorVersion && Equals(PropMask, other.PropMask) && Equals(ForeColor, other.ForeColor) && Equals(BackColor, other.BackColor) && VariousPropertyBits == other.VariousPropertyBits && string.Equals(Caption, other.Caption) && PicturePosition == other.PicturePosition && MousePointer == other.MousePointer && string.Equals(Accelerator, other.Accelerator) && Equals(Size, other.Size) && Picture.SequenceEqual(other.Picture) && MouseIcon.SequenceEqual(other.MouseIcon) && Equals(TextProps, other.TextProps) && MaxLength == other.MaxLength && BorderStyle == other.BorderStyle && Equals(ScrollBars, other.ScrollBars) && DisplayStyle == other.DisplayStyle && string.Equals(PasswordChar, other.PasswordChar) && ListWidth == other.ListWidth && BoundColumn == other.BoundColumn && TextColumn == other.TextColumn && ColumnCount == other.ColumnCount && ListRows == other.ListRows && ColumnInfoCount == other.ColumnInfoCount && MatchEntry == other.MatchEntry && ListStyle == other.ListStyle && ShowDropButtonWhen == other.ShowDropButtonWhen && DropButtonStyle == other.DropButtonStyle && MultiSelect == other.MultiSelect && Equals(BorderColor, other.BorderColor) && SpecialEffect == other.SpecialEffect && string.Equals(Value, other.Value) && string.Equals(GroupName, other.GroupName) && Remainder.SequenceEqual(other.Remainder)); }
public IEnumerable <string> Get() { var remainders = _ctx.Remainders.Select(r => r.Text).ToArray(); Remainder remainder = new Remainder(); remainder.Text = "Купть слона"; remainder.TimeToWork = ToDateSQLite(DateTime.Now); remainder.Priority = Priority.A; _ctx.Remainders.Add(remainder); _ctx.SaveChanges(); return(remainders); }
public async Task <IActionResult> PutRemainder(int id, Remainder remainder) { if (id != remainder.RemainderId) { return(BadRequest()); } var retremainder = await _context.UpdateRemainder(remainder); if (retremainder == null) { return(NotFound()); } return(CreatedAtAction("GetRemainder", new { id = retremainder.RemainderId }, retremainder)); }
public async Task <Remainder> UpdateRemainder(Remainder remainder) { var ret = await noteDb.Remainders.FindAsync(remainder.RemainderId); if (ret == null) { return(null); } ret.Name = remainder.Name; ret.Description = remainder.Description; ret.UpdatedOn = DateTime.Now; await noteDb.SaveChangesAsync(); return(remainder); }
public static IEnumerable <int[]> PartitionIntoPossibleParts(int Total, int Parts) { if (Parts == 1) { yield return(new int[] { Total }); yield break; } for (var i = 0; i <= Total; i++) { foreach (var Remainder in PartitionIntoPossibleParts(Total - i, Parts - 1)) { yield return(Remainder.Select(x => x).Append(i).ToArray()); } } }
public void Visit(Remainder rem) { Visit(rem, OpCodes.Rem); }
public void Visit(Remainder rem) { rem.Left.Accept(this); _sb.Append("%"); rem.Right.Accept(this); }
public void Visit(Remainder rem) { // Nothing to do here... }
public void Visit(Remainder rem) { ResultIsIntAndBothOperandsMustBeInt(rem); }