public override bool Equals(Condition other)
 {
     AndCondition ot = other as AndCondition;
     if(ot == null)
         return false;
     return IteratorEquals(_conditions.GetEnumerator(), ot._conditions.GetEnumerator());
 }
Example #2
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, 
     int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
     WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range, 
     origin, page, quality, wq, special, turbo, comp, cond)
 {
 }
Example #3
0
 /// <summary>
 /// Create a new Landing Bay
 /// </summary>
 /// <param name="name">name of the landing bay</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public LandingBay(string name, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
     RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
     string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.LandingBay, hulls, slots, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     Squadrons = new List<Squadron>(Strength * 3);
 }
Example #4
0
        public void TestClone()
        {
            IConditionGroup group = new ConditionGroup(Guid.NewGuid(), new TranslateableLanguageItem(Guid.NewGuid()), ConditionLogic.AND, true);
            ICondition condition1 = new Condition(Guid.NewGuid(), "className1", new TranslateableLanguageItem(Guid.NewGuid()), OperatorType.GreaterThan);
            ICondition condition2 = new Condition(Guid.NewGuid(), "className2", new TranslateableLanguageItem(Guid.NewGuid()), OperatorType.LessThan);
            group.Conditions.Add(condition1);
            group.Conditions.Add(condition2);

            IConditionGroup copyGroup = (group as PolicyObject).Clone() as IConditionGroup;
            Assert.IsNotNull(copyGroup);
            Assert.AreNotEqual(group.Identifier, copyGroup.Identifier);
            Assert.AreEqual(group.Logic, copyGroup.Logic);
            Assert.AreNotEqual(group.Name.Identifier, copyGroup.Name.Identifier);
            Assert.AreEqual(group.Name.Value, copyGroup.Name.Value);
            Assert.AreEqual(group.ReadOnly, copyGroup.ReadOnly);
            Assert.IsNotNull(copyGroup.Conditions);
            Assert.AreEqual(group.Conditions.Count, copyGroup.Conditions.Count);

            ICondition copyCondition1 = copyGroup.Conditions[0] as ICondition;
            Assert.IsNotNull(copyCondition1);
            Assert.AreNotEqual(condition1.Identifier, copyCondition1.Identifier);
            Assert.AreNotEqual(condition1.Name.Identifier, copyCondition1.Name.Identifier);
            Assert.AreEqual(condition1.Name.Value, copyCondition1.Name.Value);
            Assert.AreEqual(condition1.Operator, copyCondition1.Operator);
            Assert.AreEqual(condition1.ReadOnly, copyCondition1.ReadOnly);

            ICondition copyCondition2 = copyGroup.Conditions[1] as ICondition;
            Assert.IsNotNull(copyCondition2);
            Assert.AreNotEqual(condition2.Identifier, copyCondition2.Identifier);
            Assert.AreNotEqual(condition2.Name.Identifier, copyCondition2.Name.Identifier);
            Assert.AreEqual(condition2.Name.Value, copyCondition2.Name.Value);
            Assert.AreEqual(condition2.Operator, copyCondition2.Operator);
            Assert.AreEqual(condition2.ReadOnly, copyCondition2.ReadOnly);
        }
 public override bool Equals(Condition other)
 {
     EntityCondition ot = other as EntityCondition;
     if(ot == null)
         return false;
     return _entityId.Equals(ot._entityId);
 }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string input;

            if (!inputbox.Visible)
            {
                Point formLoc = this.Location;
                Point butnLoc = button1.Location;
                inputbox.Show();
                inputbox.Location = new Point(formLoc.X + butnLoc.X,
                    formLoc.Y + butnLoc.Y);
                inputbox.Location = new Point(inputbox.Location.X + 55,
                    inputbox.Location.Y);
            }
            else
            {
                inputbox.Hide();
                input = inputbox.input;
                inputbox.input = "";
                inputbox.textBox1.Text = "";

                Condition cond = new Condition();
                if (input.Length > 0)
                {
                    cond.Description = input;
                    parentGame.Editor.activeFlag.Conditions.Add(cond);
                    input = "";
                }
            }
        }
        public RaiseArmTrigger(XmlNode node)
        {
            mHeightThreshold = Nui.magnitude(Nui.joint(Nui.Shoulder_Centre) - Nui.joint(Nui.Hip_Centre));
            mAngleThreshold = Scalar.Create(.48f);
            mDepthThreshold = Scalar.Create(GetFloat(node, 3.6f, "DepthThreshold"));
            mWidthThreshold = Scalar.Create(GetFloat(node, 1f, "WidthThreshold"));

            mBody = Nui.joint(Nui.Hip_Centre);

            Condition inWidth = Nui.abs(Nui.x(Nui.joint(Nui.Hip_Centre))) < mWidthThreshold;
            Condition inDepth = Nui.z(Nui.joint(Nui.Hip_Centre)) < mDepthThreshold;
            Condition inRange = C.And(inWidth, inDepth);

            Vector up = Vector.Create(0f, 1f, 0f);
            mArmR = Nui.joint(Nui.Hand_Right) - Nui.joint(Nui.Shoulder_Right);
            mArmL = Nui.joint(Nui.Hand_Left) - Nui.joint(Nui.Shoulder_Left);
            mAngleR = Nui.dot(up, mArmR);
            mAngleL = Nui.dot(up, mArmL);

            mTriggerR = C.And(Nui.y(mArmR) > mHeightThreshold, mAngleR > mAngleThreshold);
            mTriggerL = C.And(Nui.y(mArmL) > mHeightThreshold, mAngleL > mAngleThreshold);
            mTrigger = C.And(C.Or(mTriggerR, mTriggerL), inRange);

            mTrigger.OnChange += new ChangeDelegate(mTrigger_OnChange);
        }
Example #8
0
        internal static TestExpressionInfo Parse(string critiera, Condition condition, string value)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(critiera));
            Contract.Requires(value != null);

            var g = EnumParsing.TryParse<InputCriteria>(critiera);
            var e = EnumParsing.TryParse<EventCriteria>(critiera);

            object val = null;
            if (e.HasValue)
            {
                val = UInt32.Parse(value);
            }
            if (g.HasValue)
            {
                switch (g.Value)
                {
                    case InputCriteria.Mode:
                        val = EnumParsing.Parse<Mode>(value);
                        break;
                    case InputCriteria.Variant:
                        val = EnumParsing.Parse<Variant>(value);
                        break;
                    default: throw new ArgumentOutOfRangeException();
                }
            }

            Contract.Assert(val != null);

            return new TestExpressionInfo(e.HasValue ? e.Value : EventCriteria.None,
                                            g.HasValue ? g.Value : InputCriteria.None,
                                            condition,
                                            val);
        }
Example #9
0
 private ConditionDescription()
 {
     conditions = new Condition[3];
     conditions[0] = new CombinedCondition(subType, values);
     conditions[1] = new CombinedCondition(subType, damageTypes);
     conditions[2] = new CombinedCondition(subType, charTypes);
 }
 public override bool Equals(Condition other)
 {
     ArchitectureCondition ot = other as ArchitectureCondition;
     if(ot == null)
         return false;
     return _match.Equals(ot._match);
 }
 protected override bool CouldMergeToCoalescedTreeNode(Condition condition)
 {
     foreach(Condition c in _conditions)
         if(c.Equals(condition))
             return true;
     return false;
 }
 public override bool Equals(Condition other)
 {
     NotCondition ot = other as NotCondition;
     if(ot == null)
         return false;
     return _condition.Equals(ot._condition);
 }
Example #13
0
 /// <summary>
 /// Create a new Crew Quarters or Life Sustainer
 /// </summary>
 /// <param name="name">name of teh life sustainer of crew quarters</param>
 /// <param name="types">classes of ship which can use this component</param>
 /// <param name="power">power used by this component</param>
 /// <param name="space">space used by this component</param>
 /// <param name="morale">morale modifier of this component</param>
 /// <param name="origin">rulebook containing this component</param>
 /// <param name="page">page this component can be found on</param>
 /// <param name="special">special rules for this component</param>
 /// <param name="quality">quality of this component</param>
 /// <param name="sp">cost of this component</param>
 /// <param name="loss">modifier to morale loss granted by this component</param>
 public CrewSustainer(string name, HullType types, int power, int space, int morale, RuleBook origin, byte page,
     string special = null, Quality quality = Quality.Common, int sp = 0, int loss = 0, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, types, quality, comp, cond)
 {
     this.Morale = morale;
     this.MoraleLoss = loss;
 }
Example #14
0
 public Rule(Condition condition, string val, Action action)
     : this()
 {
     Condition   = condition;
     Val         = val;
     Action      = action;
 }
 public override SqlStatement GetDeleteStatement(Condition iwc)
 {
     var sb = new UpdateStatementBuilder(Context.Info.From);
     sb.Values.Add(new KeyOpValue(_columnName, true, KvOpertation.None));
     sb.Where.Conditions = iwc && _colExp;
     return sb.ToSqlStatement(Context);
 }
 public override bool Equals(Condition other)
 {
     InputSignalsFlagCondition ot = other as InputSignalsFlagCondition;
     if(ot == null)
         return false;
     return _flag.Equals(ot._flag) && (_state == ot._state) && _mode.Equals(ot._mode);
 }
Example #17
0
 public TriggerOperation(MessageInfo msg)
     : base(msg, TriggerType.Operation)
 {
     OnlyOneUse = true;
     var cond = new Condition(MessageInfo.GetOperationFromNPU(msg.CorrelationNPU) , "npu", EnumCondition.LIKE);
     AddCondition(cond);
 }
Example #18
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="condition">The condition.</param>
 /// <param name="instigator">The primary character.</param>
 /// <param name="receiver">The secondary character.</param>
 /// <param name="item">The item.</param>
 /// <param name="priority">The goal priority.</param>
 public CharacterGoal(Condition condition, Character instigator, Character receiver, Item item, int priority=0) {
     this.Condition = condition;
     this.Instigator = instigator;
     this.Receiver = receiver;
     this.Item = item;
     this.Priority = priority;
 }
 public void ProcessCondition(Condition condition)
 {
     if (ProcessConditionObject != null)
         ProcessConditionObject(condition);
     foreach (var obj in condition.Children)
         obj.AcceptVisitor(this);
 }
        public RegularExpressionLocalizedAttribute(Type ResourceType, string valueToCompareName, string errorMessageResourceName)
        {

            base.ErrorMessageResourceName = errorMessageResourceName;
            base.ErrorMessageResourceType = ResourceType;
            string displayName = "";

            var resman = new System.Resources.ResourceManager(ResourceType);
            
            //error message
            displayName = resman.GetString(errorMessageResourceName);

            //base.ErrorMessage = string.IsNullOrEmpty(displayName)
            //    ? string.Format("[[{0}]]", errorMessageResourceName)
            //    : displayName;

            //value To Compare
            displayName = resman.GetString(valueToCompareName);

            _valueToCompare = string.IsNullOrEmpty(displayName)
                ? string.Format("[[{0}]]", valueToCompareName)
                : displayName;

            //ignore it
            _condition = Condition.EqualTo;
        }
 public IEnumerable<Movie> all_movies_matching(Condition<Movie> condition)
 {
     foreach (var movie in all_movies())
     {
         if (condition(movie)) yield return movie;
     }
 }
 public override bool Equals(Condition other)
 {
     OutputSignalsPropertyCondition ot = other as OutputSignalsPropertyCondition;
     if(ot == null)
         return false;
     return _propertyType.Equals(ot._propertyType) && _mode.Equals(ot._mode);
 }
Example #23
0
 //метод поиска элементов массива array, удовлетворяющих условию cond
 static public IEnumerable<int> FindByCondition(int[] array, Condition cond)
 {
     var list = new List<int>();
     foreach (int i in array)
         if (cond(i))
             list.Add(i);
     return list;
 }        
Example #24
0
 public Vehicles(string name, string description, int price, string type, int year, string manufacturer, Condition condition)
     : base(name, description, price)
 {
     this.type=type;
     this.year = year;
     this.manufacturer = manufacturer;
     this.condition = condition;
 }
        /// <summary>
        ///     Changes the table column used by a Condition.   This may cause the condition to move to the
        ///     other EntityTypeMapping, which is done via a delete and create.
        /// </summary>
        /// <param name="cond">A valid Condition; this cannot be null.</param>
        /// <param name="tableColumn">This must be a valid Property from the S-Model.</param>
        internal ChangeConditionColumnCommand(Condition cond, Property tableColumn)
        {
            CommandValidation.ValidateCondition(cond);
            CommandValidation.ValidateTableColumn(tableColumn);

            Condition = cond;
            NewStorageProperty = tableColumn;
        }
Example #26
0
 public FilterDescriptor(string path, string value, Condition condition, List<FilterDescriptor> children, FilterOperation filterOperation = FilterOperation.And)
 {
     this.path = path;
     this.value = value;
     this.condition = condition;
     this.operation = filterOperation;
     this.children =  children != null ? children : new List<FilterDescriptor>();
 }
 public ModelClientValidationCurrencyLocalizedRule(string errorMessage, Condition condition, object propertyValue)
     : base()
 {
     this.ErrorMessage = errorMessage;
     this.ValidationType = "currency";
     this.ValidationParameters.Add("propertyvalue", propertyValue);
     this.ValidationParameters.Add("condition", (int)condition);
 }
Example #28
0
 public void Post(Condition condition, Action action)
 {
     nextPairs.Add(new Pair
     {
         Condition = condition,
         Action = action
     });
 }
 public CoalescedTreeNode(Condition condition)
 {
     _condition = condition;
     _subscriptionAxis = new List<MathIdentifier>(4);
     _groupAxis = new Dictionary<MathIdentifier, string>(4);
     _conditionAxis = new List<CoalescedTreeNode>(4);
     _patternAxis = new List<CoalescedChildPattern>(4);
 }
Example #30
0
 public Cars(string name, string description, double price, string type, int yearBuilt, string manufacturer, int condition)
     : base(name, description, price)
 {
     this.type = type;
     this.yearBuilt = yearBuilt;
     this.manufacturer = manufacturer;
     this.condition = (Condition)condition;
 }