public void Init() { CastConditions = new ConditionTable(); Influences = new InfluenceTable(); AIConditionWeightSelf = new Dictionary <Condition, float>(); AIConditionWeightEnemy = new Dictionary <Condition, float>(); }
public void Init() { Influences = new InfluenceTable(); if (levelUpKindID == null || levelUpKindID.Count == 0) { levelUpKindID = new List <int>(); } else { } titleInfluence = -1; // morphToKindId = -1; AICreateArchitectureConditionWeight = new Dictionary <Condition, float>(); AIUpgradeArchitectureConditionWeight = new Dictionary <Condition, float>(); AIUpgradeLeaderConditionWeight = new Dictionary <Condition, float>(); AILeaderConditionWeight = new Dictionary <Condition, float>(); CreateConditions = new ConditionTable(); Persons = new PersonList(); }
public void Init() { AIConditions = new ConditionTable(); CastConditions = new ConditionTable(); Influences = new InfluenceTable(); LearnConditions = new ConditionTable(); GenerateConditions = new ConditionTable(); }
public void Init() { Conditions = new ConditionTable(); LoseConditions = new ConditionTable(); Influences = new InfluenceTable(); ArchitectureConditions = new ConditionTable(); FactionConditions = new ConditionTable(); GenerateConditions = new ConditionTable(); Persons = new PersonList(); }
public virtual ConditionTable convertToConditionTable() { ConditionTable conditionTable = new ConditionTable(); conditionTable.ConditionId = ConditionId; conditionTable.Title = Title; conditionTable.Description = Description; conditionTable.DatabaseName = DatabaseName; conditionTable.Username = Username; conditionTable.Password = Password; conditionTable.Host = Host; conditionTable.BidNo = BidNo; conditionTable.CndNo = CndNo; conditionTable.CndId = CndId; conditionTable.CndType = CndType; conditionTable.PickType = PickType; conditionTable.PickData = PickData; conditionTable.Building = Building; conditionTable.Storey = Storey; conditionTable.Layer = Layer; conditionTable.Location = Location; conditionTable.Quantity1 = Quantity1; conditionTable.Quantity2 = Quantity2; conditionTable.Quantity3 = Quantity3; conditionTable.QuantityF = QuantityF; conditionTable.Quantity1Name = Quantity1Name; conditionTable.Quantity2Name = Quantity2Name; conditionTable.Quantity3Name = Quantity3Name; conditionTable.QuantityFName = QuantityFName; conditionTable.Formula1 = Formula1; conditionTable.Formula2 = Formula2; conditionTable.Formula3 = Formula3; conditionTable.FormulaF = FormulaF; conditionTable.Unit1 = Unit1; conditionTable.Unit2 = Unit2; conditionTable.Unit3 = Unit3; conditionTable.UnitF = UnitF; conditionTable.DefaultQuantity = SelectedQuantity; conditionTable.TakeOffType = TakeOffType; conditionTable.GlobalId = GlobalId; conditionTable.BimMaterial = BimMaterial; conditionTable.BimType = BimType; conditionTable.FunctionState = FunctionState; conditionTable.Virtual = Virtual; return(conditionTable); }
public void Init() { Conditions = new ConditionTable(); EffectAreas = new List <TroopEffectArea>(); EffectPersons = new List <TroopEffectPerson>(); SelfEffects = new List <GameObjects.TroopDetail.EventEffect.EventEffect>(); TargetPersons = new List <PersonRelation>(); }
public void LoadFactionCondFromString(ConditionTable c, string data) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.factionCond = new List <Condition>(); foreach (string i in strArray) { if (!c.Conditions.ContainsKey(int.Parse(i))) { continue; } this.factionCond.Add(c.Conditions[int.Parse(i)]); } }
/// <summary> /// Adds a new filter condition to the data filter /// </summary> /// <param name="condition">The condition to add</param> /// <returns>Boolean; whether the addition was successful</returns> public bool AddFilterCondition(FilterCondition condition, ConditionJoinType joinType) { #region Input Validation if (condition == null || string.IsNullOrEmpty(condition.ColumnName)) { throw new ApplicationException("Invalid filter condition. Cannot add condition to data filter."); } #endregion // Input Validation // check for duplicate conditions foreach (DataRow row in ConditionTable.Rows) { FilterCondition rCondition = (FilterCondition)row[COLUMN_FILTER]; if (rCondition.FriendlyCondition.Equals(condition.FriendlyCondition)) { // cannot add a duplicate condition, so return false return(false); } } // find the highest ID value of all the conditions presently in the table int maxInt = int.MinValue; foreach (DataRow row in ConditionTable.Rows) { int value = row.Field <int>(COLUMN_ID); maxInt = Math.Max(maxInt, value); } // get the string representation of the joinType enum string join = ConvertJoinType(joinType); if (this.Count == 0) { maxInt = 0; join = string.Empty; } // assume group = 1 ConditionTable.Rows.Add(maxInt + 1, join, condition, 1); // sort by ID this.conditionTable = ConditionTable.Select("", COLUMN_ID).CopyToDataTable().DefaultView.ToTable("FilterTable"); return(true); }
public void LoadPersonCondFromString(ConditionTable allConds, string data) { char[] separator = new char[] { ' ', '\n', '\r', '\t' }; string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); this.personCond = new Dictionary <int, List <Condition> >(); for (int i = 0; i < strArray.Length; i += 2) { int n = int.Parse(strArray[i]); int id = int.Parse(strArray[i + 1]); if (!allConds.Conditions.ContainsKey(id)) { continue; } if (!this.personCond.ContainsKey(n)) { this.personCond[n] = new List <Condition>(); } this.personCond[n].Add(allConds.Conditions[id]); } }
public void Init() { Influences = new InfluenceTable(); levelUpKindID = new List <int>(); titleInfluence = -1; morphToKindId = -1; AICreateArchitectureConditionWeight = new Dictionary <Condition, float>(); AIUpgradeArchitectureConditionWeight = new Dictionary <Condition, float>(); AIUpgradeLeaderConditionWeight = new Dictionary <Condition, float>(); AILeaderConditionWeight = new Dictionary <Condition, float>(); CreateConditions = new ConditionTable(); Persons = new PersonList(); }
public static void GainCondition(this PlayerInstance ch, ConditionTypes condition, int value) { if (value == 0 || ch.Level >= LevelConstants.ImmortalLevel || ch.IsNotAuthorized()) { return; } var conditionValue = ch.PlayerData.GetConditionValue(condition); ch.PlayerData.SetConditionValue(ConditionTypes.Bloodthirsty, condition == ConditionTypes.Bloodthirsty ? (conditionValue + value).GetNumberThatIsBetween(0, 10 + ch.Level) : (conditionValue + value).GetNumberThatIsBetween(0, 48)); if (ConditionTable.ContainsKey(condition)) { ConditionTable[condition].Invoke(ch, conditionValue); } else { LogManager.Instance.Bug("Invalid condition type {0}", condition); } }
/// <summary> /// Removes a filter condition /// </summary> /// <returns>Bool</returns> public bool RemoveFilterCondition(string friendlyCondition) { int i; int rowToRemove = -1; DataRow row = null; for (i = 0; i < ConditionTable.Rows.Count; i++) { row = ConditionTable.Rows[i]; string str = row[COLUMN_FILTER].ToString(); if (str.Equals(friendlyCondition)) { rowToRemove = i; break; } } if (rowToRemove >= 0) { ConditionTable.Rows.Remove(ConditionTable.Rows[rowToRemove]); if (ConditionTable.Rows.Count > 0) { this.conditionTable = ConditionTable.Select("", COLUMN_ID).CopyToDataTable().DefaultView.ToTable("FilterTable"); if (rowToRemove == 0) { ConditionTable.Rows[0][COLUMN_JOIN] = string.Empty; } } return(true); } return(false); }
public void Init() { Conditions = new ConditionTable(); Influences = new InfluenceTable(); GenerateConditions = new ConditionTable(); }
public virtual ImageIcon iconOfTakeoff(ConditionTable paramConditionTable) { return(null); }
public void Init() { Influences = new InfluenceTable(); Conditions = new ConditionTable(); AIBuildConditionWeight = new Dictionary <Condition, float>(); }
/// <summary> /// Gets an array of data rows from the ConditionTable, sorted by the column ID /// </summary> /// <returns>Array of data rows</returns> private DataRow[] GetSortedDataRows() { return(ConditionTable.Select(string.Empty, COLUMN_ID)); }
public virtual BoqItemTable convertToBoqItem(DateTime projectStartDate, long?code, ProjectDBUtil currentDBUtil, bool online, bool useProductivity, bool replaceQuantity) { BoqItemTable boqTable = BlankResourceInitializer.createBlankBoqItem(this, code, projectStartDate, useProductivity); Timestamp updateTime = new Timestamp(DateTimeHelper.CurrentUnixTimeMillis()); //if ( useProductivity ) { // boqTable.setCalculationType(BoqItemTable.s_PRODUCTIVITY_METHOD); //} //else { // boqTable.setCalculationType(BoqItemTable.s_TOTAL_UNITS_METHOD); //} //boqTable.setProductivity(BigDecimalMath.ONE); //boqTable.setQuantity(BigDecimalMath.ONE); //boqTable.setDuration(BigDecimalMath.ONE); boqTable.LastUpdate = updateTime; boqTable.CreateDate = updateTime; boqTable.BoqItemAssemblySet = new HashSet <object>(); boqTable.BoqItemEquipmentSet = new HashSet <object>(); boqTable.BoqItemSubcontractorSet = new HashSet <object>(); boqTable.BoqItemLaborSet = new HashSet <object>(); boqTable.BoqItemMaterialSet = new HashSet <object>(); boqTable.BoqItemConsumableSet = new HashSet <object>(); boqTable.BoqItemConditionSet = new HashSet <object>(); ConditionTable conditionTable = (ConditionTable)convertToConditionTable(); BoqItemConditionTable boqConditionTable = new BoqItemConditionTable(); boqConditionTable.Factor1 = BigDecimalMath.ONE; boqConditionTable.Factor2 = BigDecimalMath.ONE; boqConditionTable.QuantityPerUnit = BigDecimalMath.ONE; boqConditionTable.Sumup = BigDecimalMath.ZERO; if (replaceQuantity) { if (conditionTable.DefaultQuantity == null || conditionTable.DefaultQuantity == 0 || conditionTable.DefaultQuantity == 1) { boqTable.Quantity = conditionTable.Quantity1; } else if (conditionTable.DefaultQuantity == 2) { boqTable.Quantity = conditionTable.Quantity2; } else if (conditionTable.DefaultQuantity == 3) { boqTable.Quantity = conditionTable.Quantity3; } else if (conditionTable.DefaultQuantity == 4) { boqTable.Quantity = conditionTable.QuantityF; } } if (conditionTable.DefaultQuantity == null || conditionTable.DefaultQuantity == 0 || conditionTable.DefaultQuantity == 1) { boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNIT1; boqTable.Quantity = conditionTable.Quantity1; boqTable.MeasuredQuantity = conditionTable.Quantity1; //boqTable.setEstimatedQuantity(conditionTable.getQuantity1()); boqTable.Unit = conditionTable.Unit1; boqTable.SecondUnit = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.Unit1); boqTable.UnitsDiv = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.Unit1); } else if (conditionTable.DefaultQuantity == 2) { boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNIT2; boqTable.Quantity = conditionTable.Quantity2; boqTable.MeasuredQuantity = conditionTable.Quantity2; //boqTable.setEstimatedQuantity(conditionTable.getQuantity2()); boqTable.Unit = conditionTable.Unit2; boqTable.SecondUnit = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.Unit2); boqTable.UnitsDiv = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.Unit2); } else if (conditionTable.DefaultQuantity == 3) { boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNIT3; boqTable.Quantity = conditionTable.Quantity3; //boqTable.setEstimatedQuantity(conditionTable.getQuantity3()); boqTable.MeasuredQuantity = conditionTable.Quantity3; boqTable.Unit = conditionTable.Unit3; boqTable.SecondUnit = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.Unit3); boqTable.UnitsDiv = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.Unit3); } else if (conditionTable.DefaultQuantity == 4) { boqConditionTable.SelectedUnit = BoqItemConditionTable.SELECTED_UNITF; boqTable.Quantity = conditionTable.QuantityF; //boqTable.setEstimatedQuantity(conditionTable.getQuantity3()); boqTable.MeasuredQuantity = conditionTable.QuantityF; boqTable.Unit = conditionTable.UnitF; boqTable.SecondUnit = Unit1ToUnit2Util.Instance.getUnit2(conditionTable.UnitF); boqTable.UnitsDiv = Unit1ToUnit2Util.Instance.getUnitDiv(conditionTable.UnitF); } boqConditionTable.LastUpdate = updateTime; boqConditionTable.ConditionTable = conditionTable; boqConditionTable.BoqItemTable = boqTable; boqTable.BoqItemConditionSet.Add(boqConditionTable); boqTable.recalculate(); return(boqTable); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr) { assertMinArgCount(paramArrayOfExpr, 4); for (sbyte b = 0; b < paramArrayOfExpr.Length; b++) { if (paramArrayOfExpr[b] is org.boris.expr.ExprEvaluatable) { paramArrayOfExpr[b] = evalArg(paramIEvaluationContext, paramArrayOfExpr[b]); } } string str1 = "p.IFCNUMVAL:unitFactorQuery"; string str2 = (paramArrayOfExpr[0] is ExprString) ? ((ExprString)paramArrayOfExpr[0]).str : paramArrayOfExpr[0].ToString(); string str3 = (paramArrayOfExpr[1] is ExprString) ? ((ExprString)paramArrayOfExpr[1]).str : paramArrayOfExpr[1].ToString(); string str4 = (paramArrayOfExpr[2] is ExprString) ? ((ExprString)paramArrayOfExpr[2]).str : paramArrayOfExpr[2].ToString(); string str5 = (paramArrayOfExpr[3] is ExprString) ? ((ExprString)paramArrayOfExpr[3]).str : paramArrayOfExpr[3].ToString(); string str6 = (paramArrayOfExpr.Length >= 5) ? ((paramArrayOfExpr[4] is ExprString) ? ((ExprString)paramArrayOfExpr[4]).str : paramArrayOfExpr[4].ToString()) : null; int i = findQtyType(str5); ProjectDBUtil projectDBUtil = ProjectDBUtil.currentProjectDBUtil(); if (projectDBUtil == null) { return(new ExprTakeoff(-1.0D, null)); } decimal bigDecimal = BigDecimalMath.ZERO; ConditionTable[] arrayOfConditionTable = null; bool @bool = projectDBUtil.hasOpenedSession(); try { string str7 = "SELECT e.IFCTITLE as \"title\", e.IFCDESCRIPTION as \"description\", e.IFCBUILDING as \"building\", e.IFCSTOREY as \"storey\", e.IFCLAYER as \"layer\", e.IFCLOCATION as \"location\", e.IFCMATERIAL as \"bimMaterial\", e.IFCOBJECTTYPE as \"bimType\",e.IFCFILE as \"databaseName\", ' ' as \"username\", ' ' as \"password\", e.IFCFNAME as \"host\", e.CNDID as \"bidNo\", e.CNDID as \"cndNo\", e.CNDID as \"cndId\", e.IFCID as \"globalId\", e.IFCOBJECTTYPE as \"cndType\", 'BIM' as \"takeOffType\", e.IFCQTY2 as \"quantity2\", e.IFCQTY3 as \"quantity3\", NULL as \"quantityF\",e.IFCQTYNAME2 as \"quantity2Name\", e.IFCQTYNAME3 as \"quantity3Name\", ' ' as \"quantityFName\",e.IFCUOM2 as \"unit2\", e.IFCUOM3 as \"unit3\", ' ' as \"unitF\", ' ' as \"formulaF\", p.IFCPROPNAME as \"quantity1Name\", ':unitParam' as \"unit1\", (:quantityQuery) as \"quantity1\", 1 as \"defaultQuantity\" FROM IFCELEMENT AS e INNER JOIN IFCPROPERTY p ON e.ELEMID = p.ELEMID WHERE e.PRJID = :prjId AND (p.IFCNUMVAL is not null AND e.IFCMODEL = ':modelName' AND p.IFCPROPNAME = :propertyNameParam AND e.IFCOBJECTTYPE = ':objectTypeParam' AND p.IFCQTYTYPE = :quantityTypeParam)"; if (StringUtils.isNullOrBlank(str3)) { str7 = StringUtils.replaceAll(str7, "AND e.IFCOBJECTTYPE=':objectTypeParam'", ""); } else { str7 = StringUtils.replaceAll(str7, ":objectTypeParam", str3); } if (StringUtils.isNullOrBlank(str5)) { str7 = StringUtils.replaceAll(str7, "AND p.IFCQTYTYPE = :quantityTypeParam", ""); } else { str7 = StringUtils.replaceAll(str7, ":quantityTypeParam", "" + i); } str7 = StringUtils.replaceAll(str7, ":modelName", str2); int j = 5; if (!StringUtils.isNullOrBlank(str6)) { str7 = str7 + " AND (" + str6 + ")"; j = 5 + StringUtils.numberOfOccurences(str6, '?'); } int k = j; string str8 = (k < paramArrayOfExpr.Length) ? ((ExprString)paramArrayOfExpr[k]).str : null; if (!string.ReferenceEquals(str8, null)) { str7 = StringUtils.replaceAll(str7, ":quantityQuery", str8); } else { str7 = StringUtils.replaceAll(str7, ":quantityQuery", str1); str7 = StringUtils.replaceAll(str7, ":unitFactorQuery", makeUnitFactorQuery(i, str5)); } if (!str4.StartsWith("QUERY", StringComparison.Ordinal)) { str7 = StringUtils.replaceAll(str7, ":propertyNameParam", "'" + str4 + "'"); } else { str4 = StringUtils.replace(str4, "QUERY", ""); str7 = StringUtils.replaceAll(str7, ":propertyNameParam", str4); } string str9 = (++k < paramArrayOfExpr.Length) ? ((ExprString)paramArrayOfExpr[k]).str : null; string str10 = (++k < paramArrayOfExpr.Length) ? ((ExprString)paramArrayOfExpr[k]).str : null; if (StringUtils.isNullOrBlank(str10)) { str7 = StringUtils.replaceAll(str7, ":unitParam", str5); } else { str7 = StringUtils.replaceAll(str7, ":unitParam", str10); } str7 = StringUtils.replaceAll(str7, ":prjId", "" + projectDBUtil.ProjectUrlId); Query query = projectDBUtil.currentSession().createSQLQuery(str7); sbyte b1 = 5; for (b1 = 5; b1 < j; b1++) { sbyte b3 = b1; if (paramArrayOfExpr[b3] is ExprString) { query = query.setString(b3 - 5, ((ExprString)paramArrayOfExpr[b3]).str); } else if (paramArrayOfExpr[b3] is ExprDouble) { query = query.setDouble(b3 - 5, ((ExprDouble)paramArrayOfExpr[b3]).doubleValue()); } else if (paramArrayOfExpr[b3] is ExprInteger) { query = query.setInteger(b3 - 5, ((ExprInteger)paramArrayOfExpr[b3]).intValue()); } else if (paramArrayOfExpr[b3] is ExprBoolean) { query = query.setBoolean(b3 - 5, ((ExprBoolean)paramArrayOfExpr[b3]).booleanValue()); } else if (paramArrayOfExpr[b3] is ExprArray) { Expr[] arrayOfExpr = ((ExprArray)paramArrayOfExpr[b3]).InternalArray; if (arrayOfExpr.Length == 0) { return(new ExprTakeoff(bigDecimal.doubleValue(), arrayOfConditionTable)); } List <object> arrayList = new List <object>(arrayOfExpr.Length); foreach (Expr expr in arrayOfExpr) { if (expr is ExprNumber) { arrayList.Add(Convert.ToDouble(((ExprNumber)expr).doubleValue())); } else if (expr is ExprString) { arrayList.Add(((ExprString)paramArrayOfExpr[b3]).str); } else { arrayList.Add(paramArrayOfExpr[b3].ToString()); } } query = query.setParameter(b3 - 5, arrayList); } else { query = query.setString(b3 - 5, paramArrayOfExpr[b3].ToString()); } } System.Collections.IList list = query.list(); arrayOfConditionTable = new ConditionTable[list.Count]; sbyte b2 = 0; foreach (object[] arrayOfObject in list) { ConditionTable conditionTable = new ConditionTable(); conditionTable.Title = castToString(arrayOfObject[0]); conditionTable.Description = castToString(arrayOfObject[1]); conditionTable.Building = castToString(arrayOfObject[2]); conditionTable.Storey = castToString(arrayOfObject[3]); conditionTable.Layer = castToString(arrayOfObject[4]); conditionTable.Location = castToString(arrayOfObject[5]); conditionTable.BimMaterial = castToString(arrayOfObject[6]); conditionTable.BimType = castToString(arrayOfObject[7]); conditionTable.DatabaseName = castToString(arrayOfObject[8]); conditionTable.Username = castToString(arrayOfObject[9]); conditionTable.Password = castToString(arrayOfObject[10]); conditionTable.Host = castToString(arrayOfObject[11]); conditionTable.BidNo = (int?)arrayOfObject[12]; conditionTable.CndNo = (int?)arrayOfObject[13]; conditionTable.CndId = (int?)arrayOfObject[14]; conditionTable.GlobalId = castToString(arrayOfObject[15]); conditionTable.CndType = castToString(arrayOfObject[16]); conditionTable.TakeOffType = castToString(arrayOfObject[17]); conditionTable.Quantity2 = (decimal)arrayOfObject[18]; conditionTable.Quantity3 = (decimal)arrayOfObject[19]; conditionTable.QuantityF = (decimal)arrayOfObject[20]; conditionTable.Quantity2Name = castToString(arrayOfObject[21]); conditionTable.Quantity3Name = castToString(arrayOfObject[22]); conditionTable.QuantityFName = castToString(arrayOfObject[23]); conditionTable.Unit2 = castToString(arrayOfObject[24]); conditionTable.Unit3 = castToString(arrayOfObject[25]); conditionTable.UnitF = castToString(arrayOfObject[26]); conditionTable.FormulaF = castToString(arrayOfObject[27]); conditionTable.Quantity1Name = castToString(arrayOfObject[28]); conditionTable.Unit1 = castToString(arrayOfObject[29]); conditionTable.Quantity1 = (decimal)arrayOfObject[30]; conditionTable.PickType = ConditionTable.PICK_ELEMENTS; conditionTable.DefaultQuantity = Convert.ToInt32(1); bigDecimal = bigDecimal + conditionTable.Quantity1; if (!string.ReferenceEquals(str9, null)) { conditionTable.Quantity1Name = str9; } arrayOfConditionTable[b2++] = conditionTable; } } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); if (!@bool) { projectDBUtil.closeSession(); } throw new ExprException(exception.Message); } if (!@bool) { projectDBUtil.closeSession(); } return(new ExprTakeoff(bigDecimal.doubleValue(), arrayOfConditionTable)); }
public int GetConditionValue(ConditionTypes condition) { return(ConditionTable.ContainsKey(condition) ? ConditionTable[condition] : 0); }