Esempio n. 1
0
 static {
   try {
     non_word_pattern = Pattern.compile("\\W+");
     orig_pattern = Pattern.compile("orig\\s*\\(");
     dot_class_pattern = Pattern.compile("\\.class");
     inequality_pattern = Pattern.compile("[\\!<>]=");
     gteq_pattern = Pattern.compile(">=");
     lteq_pattern = Pattern.compile("<=");
     neq_pattern = Pattern.compile("\\!=");
     contradict_inv_pattern =
         Pattern.compile("(^| && )(.*) == -?[0-9]+ &.*& \\2 == -?[0-9]+($| && )");
     useless_inv_pattern_1 =
         Pattern.compile("(^| && )(.*) > -?[0-9]+ &.*& \\2 > -?[0-9]+($| && )");
     useless_inv_pattern_2 =
         Pattern.compile("(^| && )(.*) < -?[0-9]+ &.*& \\2 < -?[0-9]+($| && )");
   } catch (PatternSyntaxException me) {
     throw new Error("ExtractConsequent: Error while compiling pattern " + me.getMessage());
   }
 }
Esempio n. 2
0
 private static boolean contains_exactly_one(String string, Pattern pattern) {
   Matcher m = pattern.matcher(string);
   // return true if first call returns true and second returns false
   return (m.find() && !m.find());
 }