if (instr.matches(getClassName())) return !instr.isNegated(); return false; if (instr.matches(v)) return !instr.isNegated(); return false; if (instr.matches(interfaces[i])) return !instr.isNegated(); return false; if (instr.matches(zuper)) return !instr.isNegated(); break; return false; if (annotations.contains(instr.getPattern())) return true; if (instr.matches(annotation)) return !instr.isNegated(); if (instr.matches(imp.replace('.', '/'))) return !instr.isNegated();
public boolean matches(String value) { return getMatcher(value).matches(); }
/** * Copy the input collection into an output set but skip names that have * been marked as duplicates or are optional. * * @param superfluous * @return */ Set<Instruction> removeMarkedDuplicates(Collection<Instruction> superfluous) { Set<Instruction> result = new HashSet<Instruction>(); for (Iterator<Instruction> i = superfluous.iterator(); i.hasNext();) { Instruction instr = (Instruction) i.next(); if (!isDuplicate(instr.getPattern()) && !instr.isOptional()) result.add(instr); } return result; }
public List<String> list(String regex) { Instruction pattern = null; if (regex != null) pattern = Instruction.getPattern(regex); List<String> result = new ArrayList<String>(); for (String f : index.keySet()) { if (pattern == null || pattern.matches(f)) result.add(f); } return result; }
Set<Instruction> subs = Instruction.replaceWithInstruction(subsMap).keySet(); if (instruction.matches(file.getName())) { if (!instruction.isNegated()) { builders.add(getSubBuilder(file));
public String toString() { return getPattern(); }
public static Map<Instruction, Map<String, String>> replaceWithInstruction( Map<String, Map<String, String>> header) { Map<Instruction, Map<String, String>> map = Processor.newMap(); for (Iterator<Map.Entry<String, Map<String, String>>> e = header .entrySet().iterator(); e.hasNext();) { Map.Entry<String, Map<String, String>> entry = e.next(); String pattern = entry.getKey(); Instruction instr = getPattern(pattern); String presence = entry.getValue() .get(Constants.PRESENCE_DIRECTIVE); if ("optional".equals(presence)) instr.setOptional(); map.put(instr, entry.getValue()); } return map; }
public Resource process(String source) { Map<Instruction, Map<String, String>> make = getMakeHeader(); builder.trace("make " + source); for (Map.Entry<Instruction, Map<String, String>> entry : make .entrySet()) { Instruction instr = entry.getKey(); Matcher m = instr.getMatcher(source); if (m.matches() || instr.isNegated()) { Map<String, String> arguments = replace(m, entry.getValue()); List<MakePlugin> plugins = builder.getPlugins(MakePlugin.class); for (MakePlugin plugin : plugins) { try { Resource resource = plugin.make(builder, source, arguments); if (resource != null) { builder.trace("Made " + source + " from args " + arguments + " with " + plugin); return resource; } } catch (Exception e) { builder.error("Plugin " + plugin + " generates error when use in making " + source + " with args " + arguments, e); } } } } return null; }
.replaceWithInstruction(clauses); Instruction i = matches(instructions, pack, null, r.getName()); if (i != null) return !i.isNegated();
if (!instr.isNegated()) { Map<String, Resource> contents = directory.getValue();
private Instruction matches( Map<Instruction, Map<String, String>> instructions, String pack, Set<Instruction> superfluousPatterns) { for (Instruction pattern : instructions.keySet()) { if (pattern.matches(pack)) { superfluousPatterns.remove(pattern); return pattern; } } return null; }
sb.append(string.substring(0, string.length() - 4)); return new Instruction(sb.toString(), negated);
Set<Instruction> matchers = Instruction.replaceWithInstruction(removes).keySet(); Collection<Object> toBeRemoved = Instruction.select(matchers, main.keySet()); Iterator<Object> i = main.keySet().iterator(); while (i.hasNext())
Instruction.replaceWithInstruction(filtered), false);
public static <T> Collection<T> select(Collection<Instruction> matchers, Collection<T> targets) { Collection<T> result = Create.list(); outer: for (T t : targets) { String s = t.toString(); for (Instruction i : matchers) { if (i.matches(s)) { if (!i.isNegated()) result.add(t); continue outer; } } } return result; } }
public List<String> list(String regex) { Instruction pattern = null; if (regex != null) pattern = Instruction.getPattern(regex); String list[] = root.list(); List<String> result = new ArrayList<String>(); for (String f : list) { if (pattern == null || pattern.matches(f)) result.add(f); } return result; }
NAMESECTION)); Set<Entry<Instruction, Map<String, String>>> instructions = Instruction .replaceWithInstruction(namesection).entrySet(); Set<Map.Entry<String, Resource>> resources = new HashSet<Map.Entry<String, Resource>>(dot .getResources().entrySet()); if (instr.getKey().matches(next.getKey())) { if (!instr.getKey().isNegated()) {
public String toString() { return getPattern(); }
public static Map<Instruction, Map<String, String>> replaceWitInstruction( Map<String, Map<String, String>> header, String type) { Map<Instruction, Map<String, String>> map = newMap(); for (Iterator<Map.Entry<String, Map<String, String>>> e = header .entrySet().iterator(); e.hasNext();) { Map.Entry<String, Map<String, String>> entry = e.next(); String pattern = entry.getKey(); Instruction instr = Instruction.getPattern(pattern); String presence = entry.getValue().get(PRESENCE_DIRECTIVE); if ("optional".equals(presence)) instr.setOptional(); map.put(instr, entry.getValue()); } return map; }