public EAPackageCollections(EA.Package package) { this.connectors = new EABrowsableObjectsCollection<EA.Connector>(package.Connectors); this.element = package.Element; this.elements = new EABrowsableObjectsCollection<EA.Element>(package.Elements); this.packages = new EABrowsableObjectsCollection<EA.Package>(package.Packages); }
public XisListItem(EA.Repository repository, EA.Diagram diagram, XisList parent, string name, string onTap = null, string onLongTap = null) : base(repository, parent) { Element = XISMobileHelper.CreateXisListItem(parent.Element, name, onTap, onLongTap); parent.Items.Add(this); }
/// <summary> /// method handles item creations during synchronization /// </summary> /// <param name="itemCreation">instance of item creation carrying information about item creation</param> /// <param name="repository">EA repository</param> /// <returns>GUID of new item</returns> public string handleSynchronizationAdditions(ItemCreation itemCreation, EA.Repository repository) { string GUID = ""; if (itemCreation.elementType == 3) { GUID = synchronizationAdditions.addPackage(repository, itemCreation.packageGUID, itemCreation.name, itemCreation.author); } else if (itemCreation.elementType >= 50 && itemCreation.elementType < 70) { GUID = synchronizationAdditions.addDiagram(repository, itemCreation.parentGUID, itemCreation.packageGUID, itemCreation.elementType, itemCreation.name, itemCreation.author); } else if (itemCreation.elementType < 50) { GUID = synchronizationAdditions.addElement(repository, itemCreation.parentGUID, itemCreation.packageGUID, itemCreation.coordinates, itemCreation.elementType, itemCreation.name, itemCreation.author); } else if (itemCreation.elementType >= 70 && itemCreation.elementType <= 79) { GUID = synchronizationAdditions.addConnector(repository, itemCreation.srcGUID, itemCreation.targetGUID, itemCreation.name, itemCreation.elementType); } else if (itemCreation.elementType == 90) { GUID = synchronizationAdditions.addAttribute(repository, itemCreation.parentGUID, itemCreation.name, itemCreation.coordinates); } else if (itemCreation.elementType == 700) { synchronizationAdditions.addDiagramObject(repository, itemCreation.itemGUID, itemCreation.diagramGUID, itemCreation.coordinates); GUID = ""; } return GUID; }
/// <summary> /// 修改评价管理员信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAlter_Click(object sender, EventArgs e) { EAController GetInfo = new EAController(); EA EAadmin = new EA(); EAController UpdateInfo = new EAController(); if (Session["hUserName"] != null) { EAadmin.UserName = Session["hUserName"].ToString(); EAadmin.TrueName = tbxTrueName.Text; EAadmin.IdCardNum = tbxIDcardNum.Text; EAadmin.PassWord = txtPassword.Text; if (UpdateInfo.EAUpdateInfo(EAadmin) == true) { tbxTrueName.Text = GetInfo.EAGetInfo(EAadmin)[1]; tbxIDcardNum.Text = GetInfo.EAGetInfo(EAadmin)[6]; txtPassword.Text = GetInfo.EAGetInfo(EAadmin)[2]; this.lblCheck.Text = "修改成功!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ggg", "<script language='javascript'>alert('" + "信息修改成功" + "');</script>"); } else { this.lblCheck.Text = "修改失败!"; //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ggg", "<script language='javascript'>alert('" + "信息修改失败" + "');</script>"); } } }
public void OnNodeAdded(Node N) { if (N is EnemyAgent EA && PlayerNode != null) { EA.SetTarget(PlayerNode); } }
protected void Page_Load(object sender, EventArgs e) { EA EAadmin = new EA(); EAController EACon = new EAController(); if (Session["EA_EvaluateID"] != null) { EAadmin.StaffID = Convert.ToInt32(Session["EA_EvaluateID"]); string[] temp = EACon.EvaluateInfoShow(EAadmin); txtEvaluateID.Text = temp[0]; txtGoodID.Text = temp[1]; txtEvaluateContent.Text = temp[2]; txtEvaluateTime.Text = temp[3]; txtUserID.Text = temp[4]; switch (temp[5]) { case "1": lbGoodEvaluateGrade.Text = "好评"; break; case "2": lbGoodEvaluateGrade.Text = "中评"; break; case "3": lbGoodEvaluateGrade.Text = "差评"; break; } } }
public XisMenu(EA.Repository repository, EA.Diagram diagram, XisWidget parent, string name, MenuType type) : base(repository, parent) { Element = XisWebHelper.CreateXisMenu(parent.Element, name, type); Groups = new List<XisMenuGroup>(); Items = new List<XisMenuItem>(); }
private bool _disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). if (EA != null) { EA.Stop(); EA = null; } if (Arena != null) { Arena.Dispose(); Arena = null; } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. _disposedValue = true; } }
public static void PrintList(List <ElectricalAppliances> list) { foreach (ElectricalAppliances EA in list) { Console.WriteLine("Type: {0}, Brand: {1}, Status: {2}, Power = {3}", EA.GetTypeOf(), EA.GetName(), EA.GetStatus(), EA.GetPower()); } }
public Synchronization(EA.Repository repository) { this.synchronizationMovements = new SynchronizationMovements(repository); this.synchronizationDeletions = new SynchronizationDeletions(repository); this.synchronizationAdditions = new SynchronizationAdditions(repository); this.synchronizationChanges = new SynchronizationChanges(repository); }
public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName) { EAQueryServiceForm eaq; //DataElementCreationForm der; switch (ItemName) { case ROOT_MENU: //case "&Open Query Service Panel": eaq = new EAQueryServiceForm(); eaq.eaQueryServiceControl.m_Repository = Repository; eaq.eaQueryServiceControl.m_IncludeElements = false; eaq.Show(); break; /* case "&Create CDE": der = new DataElementCreationForm(); der.m_Repository = Repository; der.Show(); break; */ /* case "&View Selected Element Details": ShowElementDetails(Repository); break; */ } }
/// <summary> /// Get element from Context element. Possible inputs are: Attribute, Operation, Element, Package /// </summary> /// <param name="rep"></param> /// <returns></returns> public static EA.Element GetElementFromContextObject(EA.Repository rep) { EA.Element el = null; EA.ObjectType objectType = rep.GetContextItemType(); switch (objectType) { case ObjectType.otAttribute: var a = (EA.Attribute)rep.GetContextObject(); el = rep.GetElementByID(a.ParentID); break; case ObjectType.otMethod: var m = (Method)rep.GetContextObject(); el = rep.GetElementByID(m.ParentID); break; case ObjectType.otElement: el = (EA.Element)rep.GetContextObject(); break; case ObjectType.otPackage: EA.Package pkg = rep.GetContextObject(); el = rep.GetElementByGuid(pkg.PackageGUID); break; case ObjectType.otNone: EA.Diagram dia = rep.GetCurrentDiagram(); if (dia?.SelectedObjects.Count == 1) { var objSelected = (EA.DiagramObject)dia.SelectedObjects.GetAt(0); el = rep.GetElementByID(objSelected.ElementID); } break; default: MessageBox.Show(@"No Element, Attribute, Operation, Package selected"); break; } return el; }
/// <summary> /// method adds a new connector between source and target element /// </summary> /// <param name="Repository">EA repository</param> /// <param name="srcGUID">GUID of source element</param> /// <param name="targetGUID">GUID of target element</param> /// <param name="name">name of new connector</param> /// <param name="elementType">type of new connector</param> /// <returns>GUID of new connector</returns> public string addConnector(EA.Repository Repository, string srcGUID, string targetGUID, string name, int elementType) { EA.Element source = (EA.Element)Repository.GetElementByGuid(srcGUID); EA.Element target = (EA.Element)Repository.GetElementByGuid(targetGUID); EA.Connector newConnector = (EA.Connector)source.Connectors.AddNew(name, getConnectorType(elementType)); if (elementType == 73) { newConnector.Subtype = "Includes"; newConnector.Stereotype = "include"; } else if (elementType == 74) { newConnector.Subtype = "Extends"; newConnector.Stereotype = "extend"; } newConnector.SupplierID = target.ElementID; newConnector.Update(); source.Connectors.Refresh(); BPAddIn.synchronizationWindow.addToList("Addition of " + itemTypes.getElementTypeInEnglish(elementType) + " '" + name + "' between element '" + source.Name + "' and element '" + target.Name + "'"); return newConnector.ConnectorGUID; }
/// <summary> /// Called once Menu has been opened to see what menu items should active. /// </summary> /// <param name="Repository">the repository</param> /// <param name="Location">the location of the menu</param> /// <param name="MenuName">the name of the menu</param> /// <param name="ItemName">the name of the menu item</param> /// <param name="IsEnabled">boolean indicating whethe the menu item is enabled</param> /// <param name="IsChecked">boolean indicating whether the menu is checked</param> public override void EA_GetMenuState(EA.Repository Repository, string Location, string MenuName, string ItemName, ref bool IsEnabled, ref bool IsChecked) { if (IsProjectOpen(Repository)) { switch (ItemName) { // define the state of the hello menu option case menuHello: IsEnabled = shouldWeSayHello; break; // define the state of the goodbye menu option case menuGoodbye: IsEnabled = !shouldWeSayHello; break; // there shouldn't be any other, but just in case disable it. default: IsEnabled = false; break; } } else { // If no open project, disable all menu options IsEnabled = false; } }
public static void addTaggedValue(string name, string value, EA.Element o) { EA.TaggedValue tv = (EA.TaggedValue)o.TaggedValues.AddNew(name, "string"); tv.Value = value; tv.Update(); o.TaggedValues.Refresh(); }
public FindAndReplaceItem( EA.Repository rep, string GUID) { _GUID = GUID; _countChanges = 0; _isUpdated = false; }
// This checks all the expansion conditions of S. Theorem 12, but not the actual sum. public static int ExpansionSum_Checked(double[] e, double[] f, double[] h) { // Always conditions for calling GrowExpansion NUnit.Framework.Assert.IsTrue(h.Length == e.Length + f.Length); NUnit.Framework.Assert.IsTrue(e.IsNonOverlapping() && e.IsSorted()); NUnit.Framework.Assert.IsTrue(f.IsNonOverlapping() && f.IsSorted()); int e_Length = e.Length; bool e_IsNonAdjacent = e.IsNonAdjacent(); int f_Length = f.Length; bool f_IsNonAdjacent = f.IsNonAdjacent(); int p = EA.ExpansionSum(e.Length, e, f.Length, f, h); NUnit.Framework.Assert.AreEqual(e_Length + f_Length, p); NUnit.Framework.Assert.IsTrue(h.IsNonOverlapping() && h.IsSorted()); // Extra invariant that is maintained by ExpansionSum // That NonAdjacent is maintained is part of S. Theorem 12 if (e_IsNonAdjacent && f_IsNonAdjacent) { NUnit.Framework.Assert.IsTrue(h.IsNonAdjacent()); } // In addition, the predicates.c file asserts that if e is NonAdjacent, // then h will also be (without mentioning f) - (maybe a copy from Grow_Expansion?) if (e_IsNonAdjacent) { NUnit.Framework.Assert.IsTrue(h.IsNonAdjacent()); } return(p); }
// This checks all the expansion conditions of S. Theorem 10, but not the actual sum. int GrowExpansion_Checked(int elen, double[] e, double b, double[] h) { // Always conditions for calling GrowExpansion NUnit.Framework.Assert.IsTrue(e.Length >= elen); NUnit.Framework.Assert.IsTrue(h.Length >= elen + 1); NUnit.Framework.Assert.IsTrue(h.Length == e.Length + 1); NUnit.Framework.Assert.IsTrue(e.IsNonOverlapping() && e.IsSorted()); int e_Length = e.Length; bool e_IsNonAdjacent = e.IsNonAdjacent(); bool e_IsStronglyNonOverlapping = e.IsStronglyNonOverlapping(); int n = EA.GrowExpansion(elen, e, b, h); NUnit.Framework.Assert.AreEqual(e_Length + 1, n); NUnit.Framework.Assert.IsTrue(h.IsNonOverlapping() && h.IsSorted()); // Extra invariants that are maintained by GrowExpansion // That NonAdjacent is maintained is part of S. Theorem 10 if (e_IsNonAdjacent) { NUnit.Framework.Assert.IsTrue(h.IsNonAdjacent()); } // That StronglyNonOverlapping is maintained is not part of Theorem 10, // but claimed in the predicates.c implementation comments. if (e_IsStronglyNonOverlapping) { NUnit.Framework.Assert.IsTrue(h.IsStronglyNonOverlapping()); } return(n); }
public ReportException(String message, int code, EA.Repository r, byte b) { this.message = message; this.code = code; this.r = r; this.p = b; }
//public static bool updateActionPin(EA.Repository rep, EA.Element el) { // // get classifier (operation) // EA.Method m = Util.getOperationFromCallAction(rep, el); // // update action pins // if (m != null) // { // foreach (EA.Parameter par in m.Parameters) // { // updateActionPinParameter(rep, m, el, par); // } // } // return true; //} public static bool UpdateActionPinForElement(EA.Repository rep, EA.Element el1) { if (el1.Type == "Action") { UpdateActionPinParameter(rep, el1); return true; } if (el1.Type == "Class" | el1.Type == "Interface") { return true; } foreach (EA.Element el in el1.Elements) { // update parameter if (el.Type == "Action") { UpdateActionPinParameter(rep, el); } if (el.Type == "Activity") { UpdateActionPinForElement(rep, el); } } return true; }
public XisMenuGroup(EA.Repository repository, EA.Diagram diagram, XisMenu parent, string name) : base(repository, parent) { Element = XISMobileHelper.CreateXisMenuGroup(parent.Element, name); Items = new List<XisMenuItem>(); parent.Groups.Add(this); }
public void LoadFromRepository(EA.Repository repository) { element = EAHelper.GetCurrentElement(repository); if (element != null) { field = element.TaggedValuesEx.GetByName("Markdown"); if(field == null) { field = element.TaggedValuesEx.AddNew("Markdown", "TaggedValue"); field.Value = "<memo>"; field.Update(); } style = element.TaggedValuesEx.GetByName("MarkdownStyle"); if(style == null) { style = element.TaggedValuesEx.AddNew("MarkdownStyle", "TaggedValue"); style.Value = ((MarkdownStyle)this.toolstripStyleBox.SelectedItem).CSSLink; style.Update(); } skin = element.TaggedValuesEx.GetByName("PrettifySkin"); if (skin == null) { skin = element.TaggedValuesEx.AddNew("PrettifySkin", "TaggedValue"); skin.Value = this.toolStripSkinBox.SelectedItem.ToString(); skin.Update(); } } this.markdownTextBox.Text = field.Notes; //UpdateWebBrowser(); }
public XisList(EA.Repository repository, EA.Diagram diagram, XisWidget parent, string name, string searchBy = null, string orderBy = null) : base(repository, parent) { Element = XisWebHelper.CreateXisList(parent.Element, name, searchBy, orderBy); Items = new List<XisListItem>(); }
string _properties = ""; // the properties public Param(EA.Repository rep, EA.Element parTrgt) { _rep = rep; _parTrgt = parTrgt; // check if t_xref element is already present string query = @"SELECT XrefID As XREF_ID, description As DESCR FROM t_object o inner JOIN t_xref x on (o.ea_guid = x.client) where x.Name = 'CustomProperties' AND x.Type = 'element property' AND o.object_ID = " + _parTrgt.ElementID; string str = _rep.SQLQuery(query); var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(str); // get existing t_xref and remember GUID/XrefID XmlNode xrefGuid = xmlDoc.SelectSingleNode("//XREF_ID"); if (xrefGuid != null) { _xrefid = xrefGuid.InnerText;// GUID of xref // get description XmlNode xrefDesc = xmlDoc.SelectSingleNode("//DESCR"); _properties = null; if (xrefDesc != null) _properties = xrefDesc.InnerText; } }
public override void load(EA.Repository rep) { _Name = _dia.Name; _Description = _dia.Notes; _Stereotype = _dia.StereotypeEx; }
// Update is called once per frame public void setLine(int i) { switch (i) { case 0: { readyAni.SetTrigger("on"); Qs.SetActive(true); Enter.SetActive(true); EQ.SetActive(true); on[8] = false; } break; case 1: { readyAni.SetTrigger("on"); As.SetActive(true); Enter.SetActive(true); EA.SetActive(true); on[8] = false; } break; case 2: { readyAni.SetTrigger("on"); Zs.SetActive(true); Enter.SetActive(true); EZ.SetActive(true); on[8] = false; } break; } }
protected override async void Save() { var exist = Repository.Get(p => p.UPC == UPC).Count() > 0; if (exist) { await Dialoger.ShowMessageAsync(this, "Inventory", $"Product already exist with UPC:[{UPC}]", MessageDialogStyle.Affirmative, OkCancelMessageSettings); return; } var product = new P.Product() { UPC = UPC, Name = Name, Quantity = Quantity, PurchasePrice = PurchasePrice, SalePrice = SalePrice }; Repository.Add(product); Repository.Save(); UPC = Name = string.Empty; EA.GetEvent <ProductAddEvent>().Publish(product); }
public static List <ElectricalAppliances> SortByStatus(List <ElectricalAppliances> list, string condition) { List <ElectricalAppliances> SortedList = new List <ElectricalAppliances>(); try { ValidateList(list); } catch (NullElementException e) { Console.WriteLine("Some elements in collection is null, find details here:{0}", e); } foreach (ElectricalAppliances EA in list) { try { if (EA.GetStatus() == condition) { SortedList.Add(EA); } } catch (NullReferenceException e) { Console.WriteLine("Can't get data from null object, find details here:{0}", e); } } return(SortedList); }
private void OnUpdatePurchaseDetails(M.PurchaseOrderDetail detail) { var detilsInDb = _purchaseOrderDetailRepository.Get(detail.Id); var qty = detail.Quantity - detilsInDb.Quantity; detilsInDb.Quantity = detail.Quantity; detilsInDb.PurchasePrice = detail.PurchasePrice; detilsInDb.SalePrice = detail.SalePrice; _purchaseOrderDetailRepository.Save(); var productInDb = _productRepository.Get(detail.ProductId); productInDb.Quantity += qty; productInDb.SalePrice = detail.SalePrice > productInDb.SalePrice ? detail.SalePrice : productInDb.SalePrice; productInDb.PurchasePrice = detail.PurchasePrice > productInDb.PurchasePrice ? detail.PurchasePrice : productInDb.PurchasePrice; _productRepository.Save(); ///this event is enough to call. Because it will will update the information where it is subscribed EA.GetEvent <SubmittedEvent>().Publish(); EA.GetEvent <Messanger>().Publish("Inventory is being updated"); //await Dialoger.ShowMessageAsync(this, "Inventory", "Inventory is being updated.", MessageDialogStyle.Affirmative, OkCancelMessageSettings); }
/// <summary> /// Initialize the EaItem /// </summary> /// <param name="guid"></param> /// <param name="sqlObjType"></param> /// <param name="objType"></param> /// <param name="eaObject"></param> private void Init(string guid, string sqlObjType, EA.ObjectType objType, object eaObject) { Guid = guid; SqlObjectType = sqlObjType; EaObjectType = objType; EaObject = eaObject; }
public override void EA_FileOpen(EA.Repository Repository) { // initialize the model this.model = new TSF_EA.Model(Repository); // indicate that we are now fully loaded this.fullyLoaded = true; }
public override void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName) { switch (ItemName) { case NEWLINE_MENU_ITEM: NotesCleaner cleaner = new NotesCleaner(Repository); cleaner.CleanUpNotesAndSave(); break; case TRACE_MENU_ITEM: TraceabilityRunner runner = new TraceabilityRunner(Repository); runner.RunReportOnSelectedPBItem(); break; case MARKDOWN_EDITOR: mdownControl = (MarkdownNotesControl)Repository.AddTab("Markdown Editor", "EAPowerTools.MarkdownNotesControl"); mdownControl.LoadFromRepository(Repository); break; case MARKDOWN_DOCKED: mdownDocked = (MarkdownDockedViewer)Repository.AddWindow("Markdown Notes", "EAPowerTools.MarkdownDockedViewer"); mdownDocked.SetRepo(Repository); break; case POWER_EDITOR: control = (PowerEditorControl) Repository.AddTab("Power Editor", "EAPowerTools.PowerEditorControl"); control.LoadNotes(Repository); break; } }
// ReSharper disable once UnusedMethodReturnValue.Global public static bool CreateCallAction(EA.Repository rep, EA.Element action, EA.Method method) { // add ClassifierGUID to target action string updateStr = @"update t_object set classifier_GUID = '" + method.MethodGUID + "' where ea_guid = '" + action.ElementGUID + "' "; rep.Execute(updateStr); // set CallOperation string callOperationProperty = "@PROP=@NAME=kind@ENDNAME;@TYPE=ActionKind@ENDTYPE;@VALU=CallOperation@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;"; Guid g = Guid.NewGuid(); string xrefid = "{" + g + "}"; string insertIntoTXref = @"insert into t_xref (XrefID, Name, Type, Visibility, Namespace, Requirement, [Constraint], Behavior, Partition, Description, Client, Supplier, Link) VALUES('" + xrefid + "', 'CustomProperties', 'element property','Public', '','','', '',0, '" + callOperationProperty + "', '" + action.ElementGUID + "', null,'')"; rep.Execute(insertIntoTXref); // Link Call Operation to operation g = Guid.NewGuid(); xrefid = "{" + g + "}"; insertIntoTXref = @"insert into t_xref (XrefID, Name, Type, Visibility, Namespace, Requirement, [Constraint], Behavior, Partition, Description, Client, Supplier, Link) VALUES('" + xrefid + "', 'MOFProps', 'element property','Public', '','','', 'target',0, ' null ', '" + method.MethodGUID + "', null,'')"; //rep.Execute(insertIntoT_xref); return true; }
// Checks the conditions of Theorem 19 (and corollary 22), and the zero-elim condition public static int ScaleExpansionZeroElim_Checked(int elen, double[] e, double b, double[] h) { NUnit.Framework.Assert.IsTrue(e.Take(elen).IsNonOverlapping()); NUnit.Framework.Assert.IsTrue(e.Take(elen).IsSorted()); int hlen = EA.ScaleExpansionZeroElim(elen, e, b, h); NUnit.Framework.Assert.IsTrue(2 * elen >= hlen); NUnit.Framework.Assert.IsTrue(h.IsNonOverlapping()); NUnit.Framework.Assert.IsTrue(h.IsSorted()); if (e.IsNonAdjacent()) { NUnit.Framework.Assert.IsTrue(h.IsNonAdjacent()); } // Corollary 22 if (e.IsStronglyNonOverlapping()) { NUnit.Framework.Assert.IsTrue(h.IsStronglyNonOverlapping()); } // Zero elimintion NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsZeroElim()); return(hlen); }
public static void addTaggedValue(string name, string value, EA.Attribute attr) { EA.AttributeTag at = (EA.AttributeTag)attr.TaggedValues.AddNew(name, "string"); at.Value = value; at.Update(); attr.TaggedValues.Refresh(); }
public XisList(EA.Repository repository, EA.Diagram diagram, XisInteractionSpace parent, string name, string searchBy = null, string orderBy = null) : base(repository, parent) { Element = XISMobileHelper.CreateXisList(parent.Element, name, searchBy, orderBy); Items = new List<XisListItem>(); }
protected virtual void GetProduct() { if (string.IsNullOrWhiteSpace(UPC) || UPC.Length < 7) { return; } var product = Repository.Get(p => p.UPC == UPC).FirstOrDefault(); if (product == null) { Dialoger.ShowMessageAsync(this, "Product", $"No Product found for UPC:[{UPC}]", MahApps.Metro.Controls.Dialogs.MessageDialogStyle.Affirmative, OkCancelMessageSettings); } else { var productVM = new P.Product() { Id = product.Id, Name = product.Name, PurchasePrice = product.PurchasePrice, SalePrice = product.SalePrice, Quantity = 0, ///Becasue the ListableViewModel will take care of quantity UPC = product.UPC }; EA.GetEvent <PurchaseAddEvent>().Publish(productVM); } }
public void TwoProductPre2Split_Random() { // Just checks that the result from 2-pre-split is same as 2xSplit + TwoProduct var rnd = new RandomDouble(2); // Use a specific seed to ensure repeatability int testCount = 100000; for (int i = 0; i < testCount; i++) { double a = rnd.NextDoubleValidRange(); double b = rnd.NextDoubleValidRange(); double x; double y; TwoProduct_Checked(a, b, out x, out y); double ahi, alo; EA.Split(a, out ahi, out alo); double bhi, blo; EA.Split(b, out bhi, out blo); double xps, yps; EA.TwoProduct2Presplit(a, ahi, alo, b, bhi, blo, out xps, out yps); NUnit.Framework.Assert.AreEqual(x, xps); NUnit.Framework.Assert.AreEqual(y, yps); } Debug.Print("TwoProduct_Random Tested {0} tries", testCount); }
public void LoadNotes(EA.Repository repo) { if(repo != null) { EA.Element element = repo.GetTreeSelectedObject(); } }
public override void load(EA.Repository rep) { _attr = rep.GetAttributeByGuid(GUID); _Name = _attr.Name; _Description = _attr.Notes; _Stereotype = _attr.StereotypeEx; }
public static EA.Diagram CreateDiagram(EA.Package package, string diagramName, string diagramType) { EA.Diagram diagram = package.Diagrams.AddNew(diagramName, diagramType); diagram.ShowDetails = 0; diagram.Update(); package.Update(); return diagram; }
/// <summary> /// Makes a Forms Auto Completion List of all searches. /// </summary> /// <param name="rep"></param> /// <returns></returns> public static AutoCompleteStringCollection GetSearchesSuggestions(EA.Repository rep) { LoadAllSearches(rep); LoadStaticSearchesSuggestions(); return _staticSearchesSuggestions; }
public void LoadNotes(EA.Repository repo) { if (repo != null) { currentElement = repo.GetTreeSelectedObject(); this.richTextBox1.Text = currentElement.Notes; } }
public void BodyEntered(Node N) { if (N is EnemyAgent EA) { EA.TakeDamage(DamageAmount); QueueFree(); } }
public void CalculateTotal() { RaisePropertyChanged(nameof(TotalProduct)); RaisePropertyChanged(nameof(TotalQuantity)); RaisePropertyChanged(nameof(GrandTotal)); EA.GetEvent <CanSubmitEvent>().Publish(); }
public override void EA_OnPostInitialized(EA.Repository Repository) { if (this.navigatorControl != null) { this.navigatorControl.clear(); } }
protected override void OnModelChanged() { IsOpen = true; base.OnModelChanged(); if (EA != null) { EA.GetEvent <CanSubmitEvent>().Publish(); } }
protected override void OnModelChanged() { RaisePropertyChanged(nameof(UnitProfit)); RaisePropertyChanged(nameof(TotalProfit)); if (EA != null) { EA.GetEvent <ProductModelChange>().Publish(); } }
public void e() { // ServiceReference2.Service1Client p = new ServiceReference2.Service1Client(); //int m = Int16.Parse(T); //T=p.GetData(m); ev = ea.GetEvent <EA>(); ev.Publish(T); }
public static int GetTotalPower(List <ElectricalAppliances> list) { int totalPower = 0; foreach (ElectricalAppliances EA in list) { totalPower += EA.GetPower(); } return(totalPower); }
public static List <ElectricalAppliances> SortByStatus(List <ElectricalAppliances> list, string condition) { List <ElectricalAppliances> SortedList = new List <ElectricalAppliances>(); foreach (ElectricalAppliances EA in list) { if (EA.GetStatus() == condition) { SortedList.Add(EA); } } return(SortedList); }
public static List <ElectricalAppliances> FindByPower(List <ElectricalAppliances> list, int minCond, int maxCond) { List <ElectricalAppliances> SortedList = new List <ElectricalAppliances>(); foreach (ElectricalAppliances EA in list) { if (EA.GetPower() >= minCond & EA.GetPower() <= maxCond) { SortedList.Add(EA); } } return(SortedList); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["surrentPage"] = 0; int CurrentPage = Convert.ToInt32(ViewState["surrentPage"]); EA mEA = new EA(); int Page = mEA.GetPages(); ShowPages.Text = "第" + (CurrentPage + 1).ToString() + "页/共" + Page.ToString() + "页"; divide mdv = new divide(); this.EvaluateList.DataSource = mdv.EvaluateShow(Convert.ToInt32(ViewState["surrentPage"])); this.EvaluateList.DataBind(); } }
// These are the conditions from S. Theorem 17 // We split a double into two numbers, together having one fewer bit void Split_Checked(double a, out double ahi, out double alo) { // Precision (keeping in mind the normal 1) int p = 53; // Splitting point is chosen as int s = 27; EA.Split(a, out ahi, out alo); NUnit.Framework.Assert.IsTrue(ahi.BitWidth() <= p - s); // 26 = floor(p/2) NUnit.Framework.Assert.IsTrue(alo.BitWidth() <= s - 1); // 26 = floor(p/2) NUnit.Framework.Assert.IsTrue(System.Math.Abs(ahi) >= System.Math.Abs(alo)); NUnit.Framework.Assert.IsTrue(a == ahi + alo); }
// This checks the conditions of S. Theorem 23 (except the approximation condition) // Compresses an expansion int Compress_Checked(int elen, double[] e, double[] h) { NUnit.Framework.Assert.IsTrue(e.Length >= elen); NUnit.Framework.Assert.IsTrue(e.Take(elen).IsNonOverlapping()); NUnit.Framework.Assert.IsTrue(e.Take(elen).IsSorted()); int hlen = EA.Compress(elen, e, h); NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsNonOverlapping()); NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsNonAdjacent()); NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsSorted()); NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsZeroElim()); return(hlen); }
protected override void Save() { var supplier = new S.Supplier() { Name = Name, Address = Address, Contact = Contact }; Repository.Add(supplier); Repository.Save(); Name = Contact = string.Empty; EA.GetEvent <SupplierAddEvent>().Publish(supplier); }
// These are the conditions from S. Theorem 18 // multiplies and results in a nonoverlapping and nonadjacent expansion public static void TwoProduct_Checked(double a, double b, out double x, out double y) { EA.TwoProduct(a, b, out x, out y); // Don't check in case we'd overflow... if (!(2.0 * x).IsNumber() || !(2.0 * y).IsNumber()) { return; } var result = new[] { x, y }; NUnit.Framework.Assert.IsTrue(result.IsNonOverlapping()); NUnit.Framework.Assert.IsTrue(result.IsNonAdjacent()); NUnit.Framework.Assert.AreEqual(a * b, x + y); }
public void FastTwoSum_OppositeSign() { // Adapted example from Shewchuk p. 7 - Figure 4 - expanded to double // We expect a+b=x+y double a = DoubleConverter.FromFloatingPointBinaryString("1" + '0'.Repeat(51) + "10"); // 100...0010 double b = DoubleConverter.FromFloatingPointBinaryString("-" + '1'.Repeat(49) + "1011"); // -11...1011 double x_correct = DoubleConverter.FromFloatingPointBinaryString("111"); // 111 double y_correct = 0.0; double x; double y; EA.FastTwoSum(a, b, out x, out y); Assert.AreEqual(x_correct, x); Assert.AreEqual(y_correct, y); }
public void TwoSum_Small_a() { // This is an example that FastTwoSum gets wrong (|a|<|b|), but TwoSum does right // Shewchuck p. 8, Figure 5 double a = DoubleConverter.FromFloatingPointBinaryString('1'.Repeat(51) + ".11"); // 111...111.11 double b = DoubleConverter.FromFloatingPointBinaryString("110" + '0'.Repeat(49) + "1"); // 11000...001 double x_correct = DoubleConverter.FromFloatingPointBinaryString("1" + '0'.Repeat(53)); // 100000...000 double y_correct = DoubleConverter.FromFloatingPointBinaryString("0.11"); // 0.11 double x; double y; EA.TwoSum(a, b, out x, out y); Assert.AreEqual(x_correct, x); Assert.AreEqual(y_correct, y); }
public void TwoSum_ResultsNonOverlappingNonAdjacent_Random() { var rnd = new RandomDouble(1); // Use a specific seed to ensure repeatability int testCount = 1000000; for (int i = 0; i < testCount; i++) { double a = rnd.NextDoubleFullRange(); double b = rnd.NextDoubleFullRange(); double x; double y; EA.TwoSum(a, b, out x, out y); Assert.IsTrue(ExpansionExtensions.AreNonOverlapping(x, y)); Assert.IsTrue(ExpansionExtensions.AreNonAdjacent(x, y)); } }