Exemple #1
0
 public Rule(int valOne, int valTwo, HValType t, Operator o)
 {
     type = t;
     v1   = valOne;
     op   = o;
     v2   = valTwo;
 }
Exemple #2
0
        public Rule(string[] rule)
        {
            inputted_Rule = rule;
            if (inputted_Rule.Length != 3)
            {
                throw new Exception("Illegal number of arguments in rule " + WriteRule(inputted_Rule));
            }
            if (!opVals.ContainsKey(rule[1]))
            {
                throw new Exception("[" + inputted_Rule[1] + "] from " + WriteRule(inputted_Rule) + " is an illegal operator");
            }
            if (!CollisionEntry.headers.Contains(inputted_Rule[0]))
            {
                throw new Exception("[" + inputted_Rule[0] + "] from " + WriteRule(inputted_Rule) + "not found in collisions headers");
            }

            v1 = CollisionEntry.headers.ToList().IndexOf(inputted_Rule[0]);
            //If we're comparing headers
            if ((int.TryParse(inputted_Rule[2], out int vTwo)))
            {
                type = HValType.HeaderCompVal;
                op   = opVals[rule[1]];
                v2   = vTwo;
            }