private void LoadPoultry() { this.poultry.Clear(); var bird = new Bird { Id = new Guid("F8E0CAFEA4214645957BBE477C0B821E"), BirthDate = DateTime.Parse("2016-04-8"), Breed = this.breeds.FirstOrDefault(x => x.Name.Equals("Sussex", StringComparison.OrdinalIgnoreCase)), ImageFileName = null, NickName = "Lady Jane", Weights = new Collection <WeightInfo>() }; var weightInfo = new WeightInfo(); weightInfo.Id = Guid.NewGuid(); weightInfo.Bird = bird; weightInfo.DateOfWeight = DateTime.Parse("2016-09-13"); weightInfo.Weight = 38.5; weightInfo.Weigher = new User { Active = true, Id = Guid.NewGuid(), CreateDate = DateTime.Parse("2014-11-26"), FirsName = "Ted", LastName = "Shred" }; bird.Weights.Add(weightInfo); poultry.Add(bird); }
/// <summary> /// 新增状态下的数据保存 /// </summary> /// <returns></returns> public override bool SaveAddNew() { WeightInfo info = tempInfo;//必须使用存在的局部变量,因为部分信息可能被附件使用 SetInfo(info); try { #region 新增数据 bool succeed = BLLFactory <Weight> .Instance.Insert(info); if (succeed) { //可添加其他关联操作 return(true); } #endregion } catch (Exception ex) { LogTextHelper.Error(ex); MessageDxUtil.ShowError(ex.Message); } return(false); }
//private bool isLoading = false; //public bool IsLoading //{ // get { return isLoading; } // set { SetAndNotifyProperty("IsLoading", ref isLoading, value); } //} /// <summary> /// Загружает итоговую информацию о счёте (итоги по платежам и итоги по счёту) /// </summary> public void CollectInfo() { if (sfRef == null) { return; } sfVal = repository.GetValutaByKod(SfRef.KodVal); postavschik = repository.GetKontrAgent(CommonModule.CommonSettings.OurKontrAgentKod); GetOtpravitel(); platelschik = repository.GetKontrAgent(SfRef.Kpok); GetPoluchatel(); GetResourceOwner(); postBank = repository.GetBankInfo((int)SfRef.IdDog, repository.OurKgr); if (SfRef.StOtpr > 0) { fromStation = repository.GetRailStation(SfRef.StOtpr); } if (SfRef.StPol > 0) { toStation = repository.GetRailStation(SfRef.StPol); } platBank = repository.GetBankInfo(SfRef.IdDog, SfRef.Kpok); dogovor = repository.GetDogInfo(SfRef.IdDog, false); weight = repository.GetSfWeightInfo(SfRef.IdSf); LoadPrils(); sumOpl = repository.GetSfSumOpl(SfRef.IdSf); SelectOkpoData(); CheckESFN(); isLoaded = true; }
/// <summary> /// 编辑状态下的数据保存 /// </summary> /// <returns></returns> public override bool SaveUpdated() { WeightInfo info = BLLFactory <Weight> .Instance.FindByID(ID); if (info != null) { SetInfo(info); try { #region 更新数据 bool succeed = BLLFactory <Weight> .Instance.Update(info, info.ID); if (succeed) { //可添加其他关联操作 return(true); } #endregion } catch (Exception ex) { LogTextHelper.Error(ex); MessageDxUtil.ShowError(ex.Message); } } return(false); }
public List <WeightInfo> GetWeightHistory() { string SqlCommand = "SELECT RID,SlotID,TotalWeight,EmptyWeight " + "FROM ResinInfo " + "Where EmptyWeight is not null " + "Order by RID Desc;"; List <WeightInfo> WIList = new List <WeightInfo>(); using (connection = new SQLiteConnection()) { // 建立SQLiteDataReader物件 using (SQLiteDataReader reader = ExecuteReader(SqlCommand)) { while (reader.Read()) { WeightInfo WI = new WeightInfo() { LotID = reader["SlotID"].ToString(), TotalWeight = reader["TotalWeight"].ToString(), EmptyWeight = reader["EmptyWeight"].ToString() }; WIList.Add(WI); } } } return(WIList); }
public override int GetHashCode() { unchecked { int hashCode = Distance; hashCode = (hashCode * 397) ^ Radius; hashCode = (hashCode * 397) ^ RadiusDistance; hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (InCache != null ? InCache.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IgnoreReason != null ? IgnoreReason.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Weight != null ? Weight.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IsBoss != null ? IsBoss.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IsElite != null ? IsElite.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IsQuestMonster != null ? IsQuestMonster.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IsMinimapActive != null ? IsMinimapActive.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MarkerHash != null ? MarkerHash.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MinimapTexture != null ? MinimapTexture.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (WeightInfo != null ? WeightInfo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ RActorGUID; hashCode = (hashCode * 397) ^ ActorSNO; hashCode = (hashCode * 397) ^ ACDGuid; return(hashCode); } }
public void setWeightValues(WeightInfo info) { for (int i = 0; i < info.weight_mappings.Count; i++) { connections[i].GetComponent <Connection>().SetWeights(info.weight_mappings[i]); } this.setActive(false); }
void CreateConnections() { this.connectionGroups = new List <ConnectionGroup>(); List <dynamic> VertexWeights = new List <dynamic>(); List <string> weightFiles = FileManager.GetWeightFiles(this.tissueInstance); this.weightMappings = new List <int>(); float count = 0f; foreach (int key in connectionMappings.Keys) { int preNeuron = connectionMappings[key]; int[] postNeurons = this.ConnectionData.connection_mappings[this.connectionGroups.Count]; List <GameObject> currentConnections = new List <GameObject>(); for (int j = 0; j < postNeurons.Length; j++) { Vector3 preNeuronPos = new Vector3(this.TissueData.somaPositionArr[preNeuron - 1, 0] + xOffset, this.TissueData.somaPositionArr[preNeuron - 1, 1] + yOffset, this.TissueData.somaPositionArr[preNeuron - 1, 2]); Vector3 postNeuronPos = new Vector3(this.TissueData.somaPositionArr[postNeurons[j] - 1, 0] + xOffset, this.TissueData.somaPositionArr[postNeurons[j] - 1, 1] + yOffset, this.TissueData.somaPositionArr[postNeurons[j] - 1, 2]); if (preNeuronPos.Equals(postNeuronPos)) { continue; } GameObject obj = Instantiate(connection, new Vector3(0f, 0f, 0f), Quaternion.identity); obj.GetComponent <Connection>().CreateConnections(1f, preNeuronPos, postNeuronPos); currentConnections.Add(obj); //Creating for just 1 connection now //j = postNeurons.Length; } ConnectionGroup group = new ConnectionGroup(); //if (key == 10) // group.CreateConnections(preNeuron, currentConnections, true); //else // group.CreateConnections(preNeuron, currentConnections, false); group.CreateConnections(preNeuron, currentConnections); //int indexOfConnections = connectionFiles[i].IndexOf("/connections") string leftPath = weightFiles[this.connectionGroups.Count].Substring(0, weightFiles[this.connectionGroups.Count].IndexOf("\\weights") + 1); //string weightSub = shortName.Substring("weights".Length, shortName.Length - ".json".Length - "weights".Length); //Will need to modulo against minimum neuron ID string fullPath = leftPath + "weights" + (preNeuron % 799).ToString() + ".json"; Debug.Log("Full path"); //this.weightMappings.Add(Convert.ToInt32(weightSub)); WeightInfo info = new WeightInfo(ParseJson(fullPath)); //this.WeightData.Add(info); group.setWeightValues(info); //i = weightFiles.Count; this.connectionGroups.Add(group); count++; Constants.connectionsLoaded = count / connectionMappings.Keys.Count; } this.connectionGroups[0].setActive(true); }
public override bool verify(int user, WeightInfo questionWeightInfo) { t.Enabled = false; WeightInfo domainWeightInfo = DatabaseManager.GetDomainWeight(user, domain); double newDomainWeight; string programReturn=""; bool vverify = false; if (isProgram) { if (CCompiler.Compile("#include<stdlib.h>\n#include<stdio.h>\nint main(){\n" + t.Text + "\nreturn 0;}\n",DatabaseManager.GetInput(base.id), out programReturn)) vverify = answer.Equals(programReturn); programReturn = programReturn.Replace("\r\n", "<br/>"); } else { vverify = t.Text.Equals(answer); } if (vverify) { t.BorderColor = System.Drawing.Color.FromArgb(171, 255, 122); base.fl.Visible = true; base.fl.ForeColor = System.Drawing.Color.Green; if (!isProgram) base.fl.Text = ("ai raspuns corect"); else base.fl.Text = programReturn; DatabaseManager.SetQuestionWeight(user, id, new WeightInfo(DatabaseManager.DefaultQuestionWeight, questionWeightInfo.Number + 1, questionWeightInfo.MistakesNumber, 0)); newDomainWeight = domainWeightInfo.QuestionWeight * TestLogic.DomainDecrement; if (newDomainWeight < TestLogic.MinDomainWeight) newDomainWeight = TestLogic.MinDomainWeight; DatabaseManager.SetDomainWeight(user, domain, new WeightInfo(newDomainWeight, domainWeightInfo.Number + 1, domainWeightInfo.MistakesNumber, 0)); return true; } t.BorderColor = System.Drawing.Color.FromArgb(255, 151, 122); base.fl.Visible = true; base.fl.ForeColor = System.Drawing.Color.Red; if (!isProgram) { base.fl.Text = ("ai raspuns gresit, raspunsul corect era " + answer + ", mai citeste "); } else base.fl.Text = programReturn+"<br/>mai citeste "; fh.Visible = true; double newWeight = questionWeightInfo.QuestionWeight * TestLogic.QuestionIncrement; if (newWeight > TestLogic.MaxQuestionWeight) { newWeight = TestLogic.MaxQuestionWeight; } DatabaseManager.SetQuestionWeight(user, id, new WeightInfo(newWeight, questionWeightInfo.Number + 1, questionWeightInfo.MistakesNumber + 1, questionWeightInfo.StreakNumber + 1)); newDomainWeight = domainWeightInfo.QuestionWeight * TestLogic.DomainIncrement; if (newDomainWeight > TestLogic.MaxDomainWeight) newDomainWeight = TestLogic.MaxDomainWeight; DatabaseManager.SetDomainWeight(user, domain, new WeightInfo(newDomainWeight, domainWeightInfo.Number + 1, domainWeightInfo.MistakesNumber + 1, domainWeightInfo.StreakNumber + 1)); return false; }
/// <summary> /// 编辑或者保存状态下取值函数 /// </summary> /// <param name="info"></param> private void SetInfo(WeightInfo info) { info.CarNo = txtCarNo.Text; info.CardID = txtCardID.Text; info.MzQty = txtMzQty.Value; info.PzQty = txtPzQty.Value; info.NetQty = txtNetQty.Value; info.MZ_BalanceNo = txtMZ_BalanceNo.Text; info.MZ_Time = txtMZ_Time.DateTime; info.MZ_Type = txtMZ_Type.Text; info.MZ_Operator = txtMZ_Operator.Text; info.PZ_BalanceNo = txtPZ_BalanceNo.Text; info.PZ_Time = txtPZ_Time.DateTime; info.PZ_Type = txtPZ_Type.Text; info.PZ_Operator = txtPZ_Operator.Text; info.Remark = txtRemark.Text; }
bool ExcelData_OnDataSave(DataRow dr) { bool success = false; bool converted = false; DateTime dtDefault = Convert.ToDateTime("1900-01-01"); DateTime dt; WeightInfo info = new WeightInfo(); info.CarNo = dr["CarNo"].ToString(); info.CardID = dr["CardID"].ToString(); info.MzQty = dr["MzQty"].ToString().ToDecimal(); info.PzQty = dr["PzQty"].ToString().ToDecimal(); info.NetQty = dr["NetQty"].ToString().ToDecimal(); info.MZ_BalanceNo = dr["MZ_BalanceNo"].ToString(); converted = DateTime.TryParse(dr["MZ_Time"].ToString(), out dt); if (converted && dt > dtDefault) { info.MZ_Time = dt; } info.MZ_Type = dr["MZ_Type"].ToString(); info.MZ_Operator = dr["MZ_Operator"].ToString(); info.PZ_BalanceNo = dr["PZ_BalanceNo"].ToString(); converted = DateTime.TryParse(dr["PZ_Time"].ToString(), out dt); if (converted && dt > dtDefault) { info.PZ_Time = dt; } info.PZ_Type = dr["PZ_Type"].ToString(); info.PZ_Operator = dr["PZ_Operator"].ToString(); info.PrintStatus = dr["PrintStatus"].ToString().ToInt32(); info.DataStatus = dr["DataStatus"].ToString().ToInt32(); info.Remark = dr["Remark"].ToString(); converted = DateTime.TryParse(dr["InsertTime"].ToString(), out dt); if (converted && dt > dtDefault) { info.InsertTime = dt; } success = BLLFactory <Weight> .Instance.Insert(info); return(success); }
/// <summary> /// 数据显示的函数 /// </summary> public override void DisplayData() { InitDictItem();//数据字典加载(公用) if (!string.IsNullOrEmpty(ID)) { #region 显示信息 WeightInfo info = BLLFactory <Weight> .Instance.FindByID(ID); if (info != null) { tempInfo = info; //重新给临时对象赋值,使之指向存在的记录对象 txtCarNo.Text = info.CarNo; txtCardID.Text = info.CardID; txtMzQty.Value = info.MzQty; txtPzQty.Value = info.PzQty; txtNetQty.Value = info.NetQty; txtMZ_BalanceNo.Text = info.MZ_BalanceNo; txtMZ_Time.SetDateTime(info.MZ_Time); txtMZ_Type.Text = info.MZ_Type; txtMZ_Operator.Text = info.MZ_Operator; txtPZ_BalanceNo.Text = info.PZ_BalanceNo; txtPZ_Time.SetDateTime(info.PZ_Time); txtPZ_Type.Text = info.PZ_Type; txtPZ_Operator.Text = info.PZ_Operator; txtRemark.Text = info.Remark; } #endregion //this.btnOK.Enabled = HasFunction("Weight/Edit"); } else { //this.btnOK.Enabled = Portal.gc.HasFunction("Weight/Add"); } //tempInfo在对象存在则为指定对象,新建则是全新的对象,但有一些初始化的GUID用于附件上传 //SetAttachInfo(tempInfo); }
// Recursively accumulates mixers. void FindMixers(Playable parent, int port, Playable node) { if (!node.IsValid()) { return; } var type = node.GetPlayableType(); if (type == typeof(AnimationMixerPlayable) || type == typeof(AnimationLayerMixerPlayable)) { // use post fix traversal so children come before parents int subCount = node.GetInputCount(); for (int j = 0; j < subCount; j++) { FindMixers(node, j, node.GetInput(j)); } // if we encounter a layer mixer, we assume there is nesting occuring // and we modulate the weight instead of overwriting it. var weightInfo = new WeightInfo { parentMixer = parent, mixer = node, port = port, modulate = (type == typeof(AnimationLayerMixerPlayable)) }; m_Mixers.Add(weightInfo); } else { var count = node.GetInputCount(); for (var i = 0; i < count; i++) { FindMixers(parent, port, node.GetInput(i)); } } }
public IHttpActionResult PostWeightInfo([FromBody] WeightInfo weightinfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { using (var context = new AppDbContext()) { weightinfo.CurrDate = DateTime.Now; context.WeightInfos.Add(weightinfo); context.SaveChanges(); return(Ok("Weight info was created!")); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public override bool verify(int user, WeightInfo questionWeightInfo) { rbl.Enabled = false; WeightInfo domainWeightInfo = DatabaseManager.GetDomainWeight(user, domain); double newDomainWeight; if (rbl.SelectedIndex == answer) { rbl.Items[rbl.SelectedIndex].Attributes.Add("style", "background-color:#ABFF7A;border:2px solid #72CF5F;"); base.fl.Visible = true; base.fl.ForeColor = System.Drawing.Color.Green; base.fl.Text = ("ai raspuns corect"); DatabaseManager.SetQuestionWeight(user, id, new WeightInfo(DatabaseManager.DefaultQuestionWeight, questionWeightInfo.Number + 1, questionWeightInfo.MistakesNumber, 0)); newDomainWeight=domainWeightInfo.QuestionWeight*TestLogic.DomainDecrement; if (newDomainWeight<TestLogic.MinDomainWeight) newDomainWeight=TestLogic.MinDomainWeight; DatabaseManager.SetDomainWeight(user, domain, new WeightInfo(newDomainWeight, domainWeightInfo.Number + 1, domainWeightInfo.MistakesNumber, 0)); return true; } rbl.Items[rbl.SelectedIndex].Attributes.Add("style", "background-color:#FF977A;border:2px solid #FF977A;"); rbl.Items[answer].Attributes.Add("style", "border:2px solid #72CF5F;"); base.fl.Visible = true; base.fl.ForeColor = System.Drawing.Color.Red; base.fl.Text = ("ai raspuns gresit, raspunsul corect era " + Char.ConvertFromUtf32('a'+answer) + ", mai citeste "); fh.Visible = true; double newWeight=questionWeightInfo.QuestionWeight*TestLogic.QuestionIncrement; if (newWeight>TestLogic.MaxQuestionWeight) {newWeight=TestLogic.MaxQuestionWeight;} DatabaseManager.SetQuestionWeight(user, id, new WeightInfo(newWeight, questionWeightInfo.Number + 1, questionWeightInfo.MistakesNumber + 1, questionWeightInfo.StreakNumber + 1)); newDomainWeight = domainWeightInfo.QuestionWeight * TestLogic.DomainIncrement; if (newDomainWeight > TestLogic.MaxDomainWeight) newDomainWeight = TestLogic.MaxDomainWeight; DatabaseManager.SetDomainWeight(user, domain, new WeightInfo(newDomainWeight, domainWeightInfo.Number + 1, domainWeightInfo.MistakesNumber + 1, domainWeightInfo.StreakNumber + 1)); return false; }
public static bool SetQuestionWeight(int userId, int questionId, WeightInfo weightInfo) { string command = String.Format("update QuestionsWeights set Weight = {0}, Number = {1}, MistakesNumber = {2}, StreakNumber = {3} where Question = {4} and [User] = {5}", weightInfo.QuestionWeight, weightInfo.Number, weightInfo.MistakesNumber, weightInfo.StreakNumber, questionId, userId); if (ExecuteNonQuerry(command) == 0) { command = String.Format("insert into QuestionsWeights values( {0}, {1}, {2}, {3}, {4}, {5} )", userId, questionId, weightInfo.QuestionWeight, weightInfo.Number, weightInfo.MistakesNumber, weightInfo.StreakNumber); return (ExecuteNonQuerry(command) != 0); } else return true; }
public static bool SetDomainWeight(int userId, string domain, WeightInfo weightInfo) { string command = String.Format("update DomainsWeights set Weight = {0}, Number = {1}, MistakesNumber = {2}, StreakNumber = {3} where Domain = '{4}' and [User] = {5}", weightInfo.QuestionWeight, weightInfo.Number, weightInfo.MistakesNumber, weightInfo.StreakNumber, domain, userId); if (ExecuteNonQuerry(command) == 0) { command = String.Format("insert into DomainsWeights values( {0}, '{1}', {2}, {3}, {4}, {5} )", userId, domain, weightInfo.QuestionWeight, weightInfo.Number, weightInfo.MistakesNumber, weightInfo.StreakNumber); return (ExecuteNonQuerry(command) != 0); } else return true; }
//intrebarile dintrun anumit domeniu public static Dictionary<int, WeightInfo> GetQuestionsWeights(int userId,string domain) { Dictionary<int, WeightInfo> questionWeights = new Dictionary<int, WeightInfo>(); string querry1 = String.Format("select qw.Question, qw.Weight, qw.Number, qw.MistakesNumber, qw.StreakNumber from QuestionsWeights qw, Questions q where qw.[User] = {0} and q.Id = qw.Question and q.Domain = '{1}'", userId,domain); string querry2 = String.Format("select Id from Questions where Domain = '{1}' and Id NOT IN (select Question from QuestionsWeights where [User] = {0})", userId,domain); SqlDataReader rdr1 = SelectQuerry(querry1); SqlDataReader rdr2 = SelectQuerry(querry2); try { while (rdr1.Read()) { int question = (int)rdr1.GetValue(0); WeightInfo weightInfo = new WeightInfo((Double)rdr1.GetValue(1), (int)rdr1.GetValue(2), (int)rdr1.GetValue(3), (int)rdr1.GetValue(4)); questionWeights.Add(question, weightInfo); } while (rdr2.Read()) { int question = (int)rdr2.GetValue(0); WeightInfo weightInfo = new WeightInfo(DefaultQuestionWeight, 0, 0, 0); questionWeights.Add(question, weightInfo); } } catch (Exception e) { Logger.WriteError(e.Message); } return questionWeights; }
public static Dictionary<string, WeightInfo> GetDomainsWeights(int userId) { Dictionary<string, WeightInfo> domainWeights = new Dictionary<string, WeightInfo>(); string querry1 = String.Format("select Domain, Weight, Number, MistakesNumber, StreakNumber from DomainsWeights where [User] = {0}", userId); string querry2 = String.Format("select Name from Domains where Name NOT IN (select Domain from DomainsWeights where [User] = {0})", userId); SqlDataReader rdr1 = SelectQuerry(querry1); SqlDataReader rdr2 = SelectQuerry(querry2); try { while (rdr1.Read()) { string domain = rdr1.GetValue(0).ToString().Trim(); WeightInfo weightInfo = new WeightInfo((Double)rdr1.GetValue(1), (int)rdr1.GetValue(2), (int)rdr1.GetValue(3), (int)rdr1.GetValue(4)); domainWeights.Add(domain, weightInfo); } while (rdr2.Read()) { string domain = rdr2.GetValue(0).ToString().Trim(); WeightInfo weightInfo = new WeightInfo(DefaultDomainWeight, 0, 0, 0); domainWeights.Add(domain, weightInfo); } } catch (Exception e) { Logger.WriteError(e.Message); } return domainWeights; }
void SelectPlayerRoomAndBossRoom(List<RoomEdge> mst, List<RoomVertex> vertexList) { //최소신장트리가 주어졌을때 말단에 위치한 정점들을 찾는다. //그래프를 탐색하며 말단에서 말단끼리 가는 깊이와 가중치를 계산한다. //가장 깊이가 깊고 가중치가 높은 간선에 연결된 방을 시작방과 보스방으로둔다. var visitedEdgeList = new List<RoomEdge>(); var leafList = new List<RoomVertex>(); //말단 노드를 찾는다. foreach(var vertex in vertexList) { int edgeCount = 0; foreach(var edge in mst) { if(edge.A == vertex || edge.B == vertex) { ++edgeCount; } } if(edgeCount == 1) { leafList.Add(vertex); } } WeightInfo maxWeightInfo = new WeightInfo(0, 0); for (int i = 0; i < leafList.Count; ++i) { var vertexA = leafList[i]; for (int j = 0; j < leafList.Count; ++j) { var vertexB = leafList[j]; if (vertexA == vertexB) { continue; } WeightInfo? weightInfo = StartSearch(mst, visitedEdgeList, vertexA, vertexB); if(weightInfo != null) { //뎁스를 우선적으로 판별함 if (weightInfo.Value.totalDepth > maxWeightInfo.totalDepth) { maxWeightInfo.totalDepth = weightInfo.Value.totalDepth; if ((vertexA.Value.Width + vertexA.Value.Height) > (vertexB.Value.Width + vertexB.Value.Height)) { _BossRoom = vertexA.Value; _PlayerRoom = vertexB.Value; } else { _BossRoom = vertexB.Value; _PlayerRoom = vertexA.Value; } print("max depth : " + maxWeightInfo.totalDepth); } //뎁스가 같으면 가중치를 봄 else if (weightInfo.Value.totalDepth == maxWeightInfo.totalDepth) { if(weightInfo.Value.totalWeight > maxWeightInfo.totalDepth) { if ((vertexA.Value.Width + vertexA.Value.Height) > (vertexB.Value.Width + vertexB.Value.Height)) { _BossRoom = vertexA.Value; _PlayerRoom = vertexB.Value; } else { _BossRoom = vertexB.Value; _PlayerRoom = vertexA.Value; } } } } //재탐색을 위해 초기화한다. visitedEdgeList.Clear(); } } }
/// <summary> /// </summary> /// <param name="db"/> /// <param name="wips"/> /// <param name="ctx"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public IList <IHandlingBatch> EVALUATE0(Mozart.SeePlan.Simulation.DispatcherBase db, IList <Mozart.SeePlan.Simulation.IHandlingBatch> wips, Mozart.SeePlan.Simulation.IDispatchContext ctx, ref bool handled, IList <Mozart.SeePlan.Simulation.IHandlingBatch> prevReturnValue) { if (db is FifoDispatcher) { return(wips); } if (db.Comparer == null) { return(wips); } var stepDic = new Dictionary <string, WeightInfo>(); var list = new List <IHandlingBatch>(wips.Count); var eqp = db.Eqp.ToFabAoEquipment(); if (eqp.Dispatcher is WeightSumDispatcher) { db.Comparer = new CompareHelper.WeightSumComparer(eqp); } foreach (IHandlingBatch hb in wips) { if (hb.Sample == null) { continue; } var lot = hb.Sample; lot.WeightInfo = new WeightInfo(); WeightInfo lotInfo = lot.WeightInfo; WeightInfo stepInfo; if (!stepDic.TryGetValue(lot.CurrentStep.StepID, out stepInfo)) { stepDic.Add(lot.CurrentStep.StepID, stepInfo = new WeightInfo()); } bool hasMinusValue = false; if (db.FactorList != null) { //Logger.Info(string.Format("<< {0} EVALUATE {1} >>"); foreach (var info in db.FactorList) { WeightValue wval = null; FabWeightFactor factor = info.Factor as FabWeightFactor; if (factor.Type == FactorType.FIXED) { wval = lotInfo.GetValueData(factor); if (wval.IsMinValue) { wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx); } } else if (factor.Type == FactorType.STEPTYPE) { wval = stepInfo.GetValueData(factor); if (wval.IsMinValue) { wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx); } stepInfo.SetValueData(factor, wval); } else //LOTTYPE { wval = db.WeightEval.GetWeight(factor, info.Method, lot, ctx); //Factor가 하나라도 음수를 가질 경우 해당 재공은 제외 (필터를 허용할 경우) if (wval.Value < 0) { wval = new WeightValue(factor, 0, wval.Description); if (factor.IsAllowFilter) { lotInfo.SetValueData(factor, wval); hasMinusValue = true; db.Eqp.EqpDispatchInfo.AddFilteredWipInfo(hb, string.Format("Minus_Value:{0}, Desc:{1}", factor.Name, wval.Description)); } } } lotInfo.SetValueData(factor, wval); } } if (hasMinusValue == false) { list.AddSort(hb, db.Comparer); } } return(list); }
public virtual bool verify(int user, WeightInfo questionWeightInfo) { return false; }
//리턴값이 널이면 못찾은거 WeightInfo? StartSearch(List<RoomEdge> edgeList, List<RoomEdge> visitedEdgeList, RoomVertex startVertex, RoomVertex endVertex) { WeightInfo weightInfo = new WeightInfo(0, 0); if(startVertex == endVertex) { return weightInfo; } var connectedEdgeList = new List<RoomEdge>(); //연결된 간선을 찾아온다 foreach (var edge in edgeList) { if (edge.A == startVertex || edge.B == startVertex) { connectedEdgeList.Add(edge); } } foreach (var edge in connectedEdgeList) { if(visitedEdgeList.Contains(edge)) { continue; } else { weightInfo.totalDepth = 1; weightInfo.totalWeight = edge.Weight; var anotherVertex = (startVertex == edge.A) ? edge.B : edge.A; visitedEdgeList.Add(edge); if(anotherVertex == endVertex) { return weightInfo; } var foundWeightInfo = StartSearch(edgeList, visitedEdgeList, anotherVertex, endVertex); if (foundWeightInfo != null) { weightInfo.totalDepth += foundWeightInfo.Value.totalDepth; weightInfo.totalWeight += foundWeightInfo.Value.totalWeight; return weightInfo; } } } return null; }
/*private double GetDamageWeight( Style style ) * { * if ( m_styleWeights.ContainsKey( style.ID ) == false || m_styleWeights[style.ID].ContainsKey( style.ClassID ) == false ) * { * AddStyleWeight( style ); * } * * return m_styleWeights[style.ID][style.ClassID].dmgWeight; * } * * private double GetEffectWeight( Style style ) * { * if ( m_styleWeights.ContainsKey( style.ID ) == false || m_styleWeights[style.ID].ContainsKey( style.ClassID ) == false ) * { * AddStyleWeight( style ); * } * * return m_styleWeights[style.ID][style.ClassID].fxWeight; * } * * private eStyleFX GetEffectType( Style style ) * { * if ( m_styleWeights.ContainsKey( style.ID ) == false || m_styleWeights[style.ID].ContainsKey( style.ClassID ) == false ) * { * AddStyleWeight( style ); * } * * return m_styleWeights[style.ID][style.ClassID].fxType; * }*/ private static void AddStyleWeight(Style style) { WeightInfo weight; //weight.classID = style.ClassID; //weight.ID = style.ID; weight.dmgWeight = 400 * style.GrowthRate; weight.fxType = eStyleFX.None; weight.fxWeight = 0.0; if (style.OpeningRequirementType == Style.eOpening.Offensive && style.OpeningRequirementValue != 0) { if (m_styleWeights.ContainsKey(style.ID) && m_styleWeights[style.ID].ContainsKey(style.ClassID)) { WeightInfo tmpweight = m_styleWeights[style.ID][style.ClassID]; tmpweight.dmgWeight += 100; m_styleWeights[style.ID][style.ClassID] = tmpweight; } } if (style.Procs != null && style.Procs.Count > 0) { //Spell proc = SkillBase.GetSpellByID( style.Procs[0].SpellID ); Spell proc = GetSpell(style.Procs[0].SpellID); if (proc != null) { try { weight.fxType = (eStyleFX)(Enum.Parse(typeof(eStyleFX), proc.SpellType, true)); } catch (Exception) { weight.fxType = eStyleFX.Other; } switch (weight.fxType) { // result: 0 to 2,000 (for 10s stun) - puts us at 1200 for a 6s stun, basically top priority case eStyleFX.StyleStun: weight.fxWeight = 0.2 * proc.Duration; break; case eStyleFX.DirectDamage: weight.fxWeight = 2.5 * proc.Damage; break; case eStyleFX.Lifedrain: weight.fxWeight = 5.0 * proc.Damage; break; case eStyleFX.HealOverTime: weight.fxWeight = 500 + (proc.Value * (proc.Duration / 1000.0)); // [could be improved to consider tick frequency] break; case eStyleFX.StyleCombatSpeedDebuff: weight.fxWeight = 80 * proc.Value; break; case eStyleFX.Heal: weight.fxWeight = 6.0 * proc.Value; break; case eStyleFX.StrengthConstitutionDebuff: weight.fxWeight = 8.0 * proc.Value; break; case eStyleFX.StrengthDebuff: weight.fxWeight = 4.5 * proc.Value; break; case eStyleFX.StyleBleeding: weight.fxWeight = 2.0 * proc.Damage * (proc.Duration / 1000.0); // [could be improved to consider tick frequency] break; // give a small bonus to other style effects - assume a style with some effect is better than an equivalent style with no effect default: weight.fxWeight = 50; break; } } } if (m_styleWeights.ContainsKey(style.ID) == false) { m_styleWeights.Add(style.ID, new Dictionary <int, WeightInfo>(1)); } if (m_styleWeights[style.ID].ContainsKey(style.ClassID) == false) { m_styleWeights[style.ID].Add(style.ClassID, weight); } else { m_styleWeights[style.ID][style.ClassID] = weight; } }
//Inserts new weight info for user public void WeighIn(WeightInfo newWeight) { _conn.Execute("INSERT INTO weights(WeighIn, WeighInDate, UserID) VALUES(@WeighIn, @Date @UserID)", new { WeighIn = newWeight.WeighIn, date = newWeight.WeighIn, UserID = newWeight.UserID }); //***Need to connect this in UserController, UpdateUser*** }
//private void SetAttachInfo(WeightInfo info) //{ // this.attachmentGUID.AttachmentGUID = info.AttachGUID; // this.attachmentGUID.userId = LoginUserInfo.Name; // string name = txtName.Text; // if (!string.IsNullOrEmpty(name)) // { // string dir = string.Format("{0}", name); // this.attachmentGUID.Init(dir, tempInfo.ID, LoginUserInfo.Name); // } //} public override void ClearScreen() { this.tempInfo = new WeightInfo(); base.ClearScreen(); }