Exemplo n.º 1
0
 public bool Implies(Term term)
 {
     for (int i=0; i<Values.Length; i++) {
         if (Values [i] != DontCare &&
             Values [i] != term.Values [i]) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 2
0
        public Term Combine(Term term)
        {
            int positionWhereDifferent = -1;

            for (int i=0; i<Values.Length; i++) {
                if (Values [i] != term.Values [i]) {
                    if (positionWhereDifferent == -1) {
                        positionWhereDifferent = i;

                    } else {
                        // They're different in at least two places
                        return null;
                    }
                }
            }

            // They're identical
            if (positionWhereDifferent == -1) {
                return null;
            }

            byte[] resultVars = new byte[Values.Length];
            Array.Copy (Values, resultVars, Values.Length);
            resultVars [positionWhereDifferent] = DontCare;

            return new Term (resultVars);
        }