/** * Returns a Collection of all flags supported by any of the regular-expression Compilers used by * the plug-in. * * @return a Collection of all flags supported by any of the regular-expression Compilers used by * the plug-in */ public static Collection getAllSupportedFlags() { Vector allFlags = new Vector(); allFlags.addAll(MatchSetFactory.getAllFlags(JAVA_FLAVOUR)); allFlags.addAll(MatchSetFactory.getAllFlags(ORO_PERL_FLAVOUR)); allFlags.addAll(MatchSetFactory.getAllFlags(ORO_AWK_FLAVOUR)); return allFlags; }
/** * Factory-Method to create a MatchSet for the passed details. * * @param flavour one of the Flavour-Flags defined in this class * @param regExp the regular expression * @param text the text to match against the reg.exp. * @param flags a Collection of flags to pass to the Compiler. This may contain more flags than * are applicable to the requested flavour. In this case, only those flags wich are applicable * are taken into account when creating the MatchSet * @return a MatchSet as requested */ public static MatchSet createMatchSet(int flavour, String regExp, String text, Collection flags) { Vector flavourFlags = new Vector(flags); flavourFlags.retainAll(MatchSetFactory.getAllFlags(flavour)); switch (flavour) { case JAVA_FLAVOUR: return new JavaMatchSet(regExp, text, flavourFlags); case ORO_PERL_FLAVOUR: return new OROPerlMatchSet(regExp, text, flavourFlags); case ORO_AWK_FLAVOUR: return new OROAwkMatchSet(regExp, text, flavourFlags); default: throw new IllegalArgumentException( Messages.getString("regexp.MatchSetFactory.error.message1") + flavour); // $NON-NLS-1$ } }