public void Quick_sort_array() { // Arrange int[] newArray = new[] { 23, 75, 4, 45, 76 }; // Act int[] result = Quick.quickSort(newArray); //Assert Assert.Equal(new int[] { 4, 23, 45, 75, 76 }, result); }
public UCWarehouseDifferentiate() : base("v_warehouse_differentiate", "分仓库数量金额表") { InitializeComponent(); dgvReport.ColumnHeadersHeight = 40; dgvReport.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; Quick quick = new Quick(); quick.BindParts(txtcPartsCode); txtcPartsCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcPartsCode_DataBacked); }
public UCPaperDetail() : base("v_paper_detail", "账面库存明细表") { InitializeComponent(); dgvReport.ColumnHeadersHeight = 40; dgvReport.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; Quick quick = new Quick(); quick.BindParts(txtcPartsCode); txtcPartsCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcPartsCode_DataBacked); }
public static void AlignBlocks() { try { var options = new PromptEntityOptions("\nSelect polyline: "); options.SetRejectMessage("Objet non valide."); options.AddAllowedClass(typeof(Polyline), true); var result = Quick.Editor.GetEntity(options); if (result.Status != PromptStatus.OK) { return; } var lineId = result.ObjectId; var sel = Quick.GetImpliedOrSelect(); if (result.Status != PromptStatus.OK) { return; } var db = lineId.Database; foreach (var blockId in sel.GetObjectIds()) { using (var trans = db.TransactionManager.StartTransaction()) { try { var line = trans.GetObject(lineId, OpenMode.ForRead) as Polyline; var blockRef = trans.GetObject(blockId, OpenMode.ForWrite) as BlockReference; if (blockRef == null) { continue; } var blockpos = blockRef.Position; // better use the center point, instead min/max var pointOverLine = line.GetClosestPointTo(blockRef.Position, false); //var vectorto = pointOverLine.GetVectorTo(blockRef.Position); //var ang = vectorto.AngleOnPlane() blockRef.Position = pointOverLine; // move // assuming a well behaved 2D block aligned with XY //Vector3d lineDirection = line.GetFirstDerivative(pointOverLine); //double angleToRotate = Vector3d.XAxis.GetAngleTo(lineDirection, Vector3d.ZAxis); //angel between block to the nearest point var b2near = blockpos.Convert2d(new Plane()).GetVectorTo(pointOverLine.Convert2d(new Plane())).Angle *Rad2Deg; //var pos1 = Math.Atan2(blockpos.Y - pointOverLine.Y, pointOverLine.X - blockpos.X) * Rad2Deg; //var angeltoblock = lineDirection.GetAngleTo(blockRef.Position.GetAsVector())*Rad2Deg; blockRef.Rotation = (b2near - 90) * Deg2Rad; //-90 to convert to block plane (0 is downwards). trans.Commit(); } catch (Exception ex) { Quick.WriteLine(ex.Message + "\n" + ex.StackTrace); } } } Quick.SetSelected(sel); } catch (Exception ex) { Quick.WriteLine(ex.Message + "\n" + ex.StackTrace); } }
public UCActualSummariz() : base("v_actual_summariz", "实际库存汇总表") { InitializeComponent(); dgvReport.ColumnHeadersHeight = 40; dgvReport.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; Quick quick = new Quick(); quick.BindParts(txtcPartsCode); txtcPartsCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcPartsCode_DataBacked); }
public UCReceivableAbove() : base("v_receivable_above", "应收款超信用额度报表") { InitializeComponent(); colYingShou.DefaultCellStyle = styleMoney; colEDu.DefaultCellStyle = styleMoney; colChao.DefaultCellStyle = styleMoney; dtEndDate.Value = DateTime.Now; Quick qCust = new Quick(); qCust.BindCustomer(txtcCust_code); txtcCust_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); }
public string sort() { Sorts.ISort sortingStrat; if (sortStrategy == MainForm.SortStrategy.Bubble) { sortingStrat = new Bubble(); } else { sortingStrat = new Quick(); } return(sortingStrat.Sort(inputText)); }
public UCPayableAbove() : base("v_payable_above", "应付款超信用额度报表") { InitializeComponent(); colChao.DefaultCellStyle = styleMoney; colEDu.DefaultCellStyle = styleMoney; colYingFu.DefaultCellStyle = styleMoney; dtEndDate.Value = DateTime.Now; Quick qSupp = new Quick(); qSupp.BindSupplier(txtcSup_code); txtcSup_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcSup_code_DataBacked); }
private void LoadBt() { // Get customer from session Customer customer = (Customer)Net.GetSession("customer"); // Show the buttons status if (customer != null) { // Make buttons visible btnAddToWishlist.Visible = true; if (artpiece.IsForSale) { btnAddToCart.Visible = true; } WishedArtDao dao = new WishedArtDao(); wish = dao.GetSpecific(customer.Id, Net.GetQueryStr("id")); // If wish already exists, show Added to Wishlist if (wish != null) { btnAddToWishlist.Text = "ADDED TO WISHLIST"; } bool found = false; List <Order_Artwork> oaList = (List <Order_Artwork>)Net.GetSession("oaList"); if (oaList != null) { // Loop through order list in session to see if this artpiece already added to cart foreach (Order_Artwork oa in oaList) { if (oa.ArtpieceId.ToLower() == Net.GetQueryStr("id").ToLower()) { found = true; } Quick.Print(oa.ArtpieceId.ToLower() + " == " + Net.GetQueryStr("id")); } } if (found) { btnAddToCart.Text = "ADDED TO CART"; } else { btnAddToCart.Text = "ADD TO CART"; } } }
public UCPayableDetail() : base("v_payable_detail", "应付账款明细表") { InitializeComponent(); colBenQi.DefaultCellStyle = styleMoney; colShangYe.DefaultCellStyle = styleMoney; colYingFu.DefaultCellStyle = styleMoney; colXianJin.DefaultCellStyle = styleMoney; colQiMo.DefaultCellStyle = styleMoney; Quick qSupp = new Quick(); qSupp.BindSupplier(txtcSup_code); txtcSup_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcSup_code_DataBacked); }
public UCSaleDaily() : base("v_sale_daily_report", "销售日报表") { InitializeComponent(); colNum.DefaultCellStyle = styleNum; colPayment.DefaultCellStyle = styleMoney; colTax.DefaultCellStyle = styleMoney; colMoney.DefaultCellStyle = styleMoney; Quick qParts = new Quick(); qParts.BindParts(txtcparts_code); txtcparts_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
public UCReceivableDetail() : base("v_receivable_detail", "应收账款明细表") { InitializeComponent(); colBenQiFaSheng.DefaultCellStyle = styleMoney; colQiMo.DefaultCellStyle = styleMoney; colShangYe.DefaultCellStyle = styleMoney; colShouKuan.DefaultCellStyle = styleMoney; colXianJin.DefaultCellStyle = styleMoney; Quick qCust = new Quick(); qCust.BindCustomer(txtcCust_code); txtcCust_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); }
void InternalTest(int[] nums1, int[] nums2, int[] expected) { int[] actual = IntersectionOfTwoArraysII.Intersect(nums1, nums2); Assert.Equal <int>(expected.Length, actual.Length); //the order does not matter Quick.Sort(expected); Quick.Sort(actual); for (int i = 0; i < actual.Length; i++) { Assert.Equal <int>(expected[i], actual[i]); } }
//[MethodName_StateUnderTest_ExpectedBehavior] public void Sort_OneItem_IsSorted() { IComparable[] unsortedArray = new string[1] { "A" }; IComparable[] expectedArray = new string[1] { "A" }; Quick.Sort(unsortedArray); CollectionAssert.AreEqual(expectedArray, unsortedArray); }
/// <summary> /// Shifts on line from a specific point for <paramref name="distance"/> length.<br></br>Returns true if successful, false if exceeded the limits - will return basepoint! /// </summary> /// <param name="ent">Ent</param> /// <param name="basepoint">the point to offset from</param> /// <param name="distance">The distance to offset</param> /// <returns>true if successful, false if exceeded the limits - will return basepoint!</returns> public static Tuple <Point2d, bool> OffsetToEnd(this Curve ent, Point2d basepoint, double distance) { var basepoint3 = ent.GetClosestPointTo(basepoint.ToPoint3D(), true); basepoint = basepoint3.ToPoint2D(); try { var dis = ent.GetDistAtPoint(basepoint3); var extra = dis + distance; var pt = ent.GetPointAtDist(extra); return(Tuple.Create(pt.ToPoint2D(), true)); } catch (Exception e) { Quick.WriteLine("\nInvalid Input, offset exceeds curve's limits.\n" + e); return(Tuple.Create(basepoint, false)); } }
public UCSaleReturnDetail() : base("v_sale_return_detail_report", "销售退换货") { InitializeComponent(); dgvReport.ColumnHeadersHeight = 40; dgvReport.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; Quick quick = new Quick(); quick.BindCustomer(txtcCust_code); txtcCust_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); quick.BindParts(txtcparts_code); txtcparts_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
public UCSalePerformance() : base("v_sale_performance_report", "销售业绩报表") { InitializeComponent(); colBackMoney.DefaultCellStyle = styleMoney; colAmount.DefaultCellStyle = styleMoney; colReturnedMoney.DefaultCellStyle = styleMoney; colActual.DefaultCellStyle = styleMoney; colRate.DefaultCellStyle = styleMoney; Quick quick = new Quick(); quick.BindCustomer(txtcCust_code); txtcCust_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); }
public UCPurchaseBillingSummariz() : base("v_parts_purchase_billing_summariz_report", "采购开单汇总表") { InitializeComponent(); colPayment.DefaultCellStyle = styleMoney; colTax.DefaultCellStyle = styleMoney; colMoney.DefaultCellStyle = styleMoney; Quick qSupp = new Quick(); qSupp.BindSupplier(txtcsup_code); txtcsup_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcSup_code_DataBacked); qSupp.BindParts(txtcparts_code); txtcparts_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
public void TestQuickSort() { var a = new int[16]; for (int i = 0; i < a.Length; i++) { a[i] = StdRandom.Uniform(100); } StdOut.WriteLine(a); Quick <int> .Sort(a); StdOut.WriteLine(a); var item4 = Quick <int> .Select(a, 9); StdOut.WriteLine("item7 = {0}", item4); }
public void MaxPriorityQueueTest() { int[] xs = { 3, 2, 1, 6, 5, 9, 4 }; var queue = new MaxPriorityQueue <int>(xs.Length); for (int i = 0; i < xs.Length; i++) { queue.Insert(xs[i]); } Quick <int> .SimpleSort(xs); for (int i = xs.Length - 1; i > 0; i--) { int v = queue.DelMax(); Assert.Equal(v, xs[i]); } }
public static int Solve(int[] a) { var sortedA = Quick.Sort(a); var max = int.MinValue; var maxNegativeProduct = int.MinValue; for (var i = 2; i < sortedA.Length; i++) { if (sortedA[i - 1] < 0) { maxNegativeProduct = Math.Max(maxNegativeProduct, GetMaxNegativePair(sortedA, i)); } max = Math.Max(max, TripletProduct(sortedA, i, maxNegativeProduct)); } return(max); }
public UCPurchaseOrderSummariz() : base("v_parts_purchase_order_summariz_report", "采购订单汇总表") { InitializeComponent(); colOrderMoney.DefaultCellStyle = styleMoney; colDoneMoney.DefaultCellStyle = styleMoney; colSuspendMoney.DefaultCellStyle = styleMoney; colUncollectedMoney.DefaultCellStyle = styleMoney; Quick qSupp = new Quick(); qSupp.BindSupplier(txtcSupCode); txtcSupCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcSup_code_DataBacked); qSupp.BindParts(txtcPartsCode); txtcPartsCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
public UCSaleBillingummariz() : base("v_sale_billing_summariz_report", "销售开单汇总表") { InitializeComponent(); colPayment.DefaultCellStyle = styleMoney; colTax.DefaultCellStyle = styleMoney; colMoney.DefaultCellStyle = styleMoney; Quick quick = new Quick(); quick.BindCustomer(txtcCust_code); txtcCust_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); quick.BindParts(txtcparts_code); txtcparts_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
public UCSaleOrderSummariz() : base("v_sale_order_summariz", "销售订单汇总表") { InitializeComponent(); colOrderMoney.DefaultCellStyle = styleMoney; colDoneMoney.DefaultCellStyle = styleMoney; colSuspendMoney.DefaultCellStyle = styleMoney; colUncollectedMoney.DefaultCellStyle = styleMoney; Quick quick = new Quick(); quick.BindCustomer(txtcCustCode); txtcCustCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); quick.BindParts(txtcPartsCode); txtcPartsCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
static void Main(string[] args) { string input = Console.ReadLine(); if (input == String.Empty) { return; } int[] arr = input .Split() .Select(int.Parse) .ToArray(); Quick.Sort(arr); Console.WriteLine(String.Join(" ", arr)); }
public UCPurchasePlanSummariz() : base("v_parts_purchase_plan_summariz_report", "采购计划汇总表") { InitializeComponent(); colPlanNum.DefaultCellStyle = styleNum; colPlanMoney.DefaultCellStyle = styleMoney; colOrderMoney.DefaultCellStyle = styleMoney; colCompleteNum.DefaultCellStyle = styleNum; colCompleteMoney.DefaultCellStyle = styleMoney; colUnfinishedNum.DefaultCellStyle = styleNum; colUnfinishedMoney.DefaultCellStyle = styleMoney; colCompleteRate.DefaultCellStyle = styleMoney; Quick qParts = new Quick(); qParts.BindParts(txtcPartsCode); txtcPartsCode.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcPartsCode_DataBacked); }
public UCSaleProfitSummariz() : base("v_sale_profit_summariz_report", "销售毛利汇总表") { InitializeComponent(); colIncome.DefaultCellStyle = styleMoney; colCost.DefaultCellStyle = styleMoney; colGrossMargin.DefaultCellStyle = styleMoney; colRate.DefaultCellStyle = styleMoney; Quick quick = new Quick(); quick.BindCustomer(txtcCust_code); txtcCust_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcCust_code_DataBacked); quick.BindParts(txtcparts_code); txtcparts_code.DataBacked += new ServiceStationClient.ComponentUI.TextBox.TextChooser.DataBackHandler(txtcparts_code_DataBacked); }
public static int Solve(int[] a) { if (a.Length < 2) { return(0); } var sortedA = Quick.Sort(a); for (var i = 2; i < sortedA.Length; i++) { if (IsTriangularTriplet(sortedA[i - 2], sortedA[i - 1], sortedA[i])) { return(1); } } return(0); }
public void QuickTest1() { string[] a = new string[] { "aba" }; string s; Quick.Sort(a); s = (string)Quick.Select(a, 0); Assert.AreEqual(s, a[0]); a = new string[] { "zoo", "able", "after", "cury", "aba", "bed", "bug", "boy", "bing", " " }; s = (string)Quick.Select(a, a.Length - 1); Assert.AreEqual(s, "zoo"); Quick.Sort(a); Assert.AreEqual("aba", a[1]); Quick.Select(a, a.Length); // generate exception }
//[MethodName_StateUnderTest_ExpectedBehavior] public void Sort_EmptyAndNonEpmtyItems_IsSorted() { var empty = Enumerable.Range(1, 10).Select(x => string.Empty).ToArray();; var newGuid = Guid.NewGuid().ToString().Select(c => c.ToString()); var newGuidSorted = newGuid.ToArray(); Array.Sort(newGuidSorted); IComparable[] unsortedArray = newGuid.Concat(empty).ToArray(); IComparable[] expectedArray = empty.Concat(newGuidSorted).ToArray(); Array.Sort(newGuidSorted); Quick.Sort(unsortedArray); CollectionAssert.AreEqual(expectedArray, unsortedArray); }
public void AddToQuicks(Quick quick) { base.AddObject("Quicks", quick); }
public static Quick CreateQuick(int pk_Quick, string description, global::System.DateTime date, global::System.TimeSpan hour, global::System.DateTime fulldate, string latitud, string longitud, string address, int iD_type, int iD_subtype) { Quick quick = new Quick(); quick.Pk_Quick = pk_Quick; quick.Description = description; quick.Date = date; quick.Hour = hour; quick.Fulldate = fulldate; quick.Latitud = latitud; quick.Longitud = longitud; quick.Address = address; quick.ID_type = iD_type; quick.ID_subtype = iD_subtype; return quick; }