public static List<String> removeOverlapInServiceComponentHeader(Collection<String> names) { List<String> wildcards = new ArrayList<>(names); wildcards.removeIf(name -> !name.contains("*")); Instructions wildcardedPaths = new Instructions(wildcards); if (wildcardedPaths.isEmpty()) return new ArrayList<>(names); List<String> actual = new ArrayList<>(); for (String name : names) { if (!name.contains("*") && wildcardedPaths.matches(name)) continue; actual.add(name); } return actual; }
public Instruction matcher(String value) { for (Instruction i : keySet()) { if (i.matches(value)) { return i; } } return null; }
public Instructions(Parameters contained) { append(contained); }
private <T> Collection<T> filter(Collection<T> list, String[] args) { if (args == null || args.length <= 1) return list; if (args.length > 2) warning("Too many arguments for ${%s} macro", args[0]); Instructions instrs = new Instructions(args[1]); return instrs.select(list, false); }
public <T> Collection<T> select(Collection<T> set, Set<Instruction> unused, boolean emptyIsAll) { List<T> input = new ArrayList<>(set); if (emptyIsAll && isEmpty()) return input; List<T> result = new ArrayList<>(); for (Instruction instruction : keySet()) { boolean used = false; for (Iterator<T> o = input.iterator(); o.hasNext();) { T oo = o.next(); String s = oo.toString(); if (instruction.matches(s)) { if (!instruction.isNegated()) result.add(oo); o.remove(); used = true; } } if (!used && unused != null) unused.add(instruction); } return result; }
Collections.sort(refs); List<Instruction> filters = new ArrayList<>(instructions.keySet()); if (nomatch == null) nomatch = Create.set(); if (!instruction.isNegated()) { result.merge(packageRef, instruction.isDuplicate(), source.get(packageRef), instructions.get(instruction)); result.merge(getPackageRef(instruction.getLiteral()), true, instructions.get(instruction)); i.remove(); continue;
return null; Instructions baselines = new Instructions(getProperty(Constants.BASELINE)); if (baselines.isEmpty()) return null; // no baselining for (Entry<Instruction, Attrs> e : baselines.entrySet()) { if (e.getKey() .matches(bsn)) {
Instructions filter = new Instructions(getExportPackage()); filter.append(getExportContents()); warning("Empty Import-Package header"); Instructions filter = new Instructions(h); imports = filter(filter, referredAndExported, unused); if (!unused.isEmpty()) {
for (java.util.Map.Entry<Instruction,Attrs> instr : entrySet()) { if (instr.getKey().isLiteral() && !instr.getKey().isNegated()) { File f = IO.getFile(base, instr.getKey().getLiteral()); for (Entry<Instruction,Attrs> instr : entrySet()) { String name = f.getName(); if (instr.getKey().matches(name)) {
private void doFixup(Instructions instrs, List<String> messages, List<String> other, String type) { for (int i = 0; i < messages.size(); i++) { String message = messages.get(i); Instruction matcher = instrs.finder(message); if (matcher == null || matcher.isNegated()) continue; Attrs attrs = instrs.get(matcher);
Instructions getMakeHeader() { if (make == null) { make = new Instructions(); builder.getMergedParameters(Constants.MAKE) .forEach((k, v) -> make.put(Instruction.legacy(k), v)); } return make; } }
/** * @param p * @param pack */ private boolean isDynamicImport(PackageRef pack) { if (dynamicImports == null) dynamicImports = new Instructions(main.getDynamicImportPackage()); return dynamicImports.matches(pack.getFQN()); }
public Instructions(Collection<String> other) { if (other != null) for (String s : other) { put(new Instruction(s), null); } }
Instructions getFilter() { if (instructions == null) { String contract = analyzer.getProperty(Constants.CONTRACT, "*"); this.instructions = new Instructions(contract); } return instructions; }
private Element resourcesElement(Jar jar) throws Exception { List<Element> resources = new ArrayList<Element>(); for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) { // // The manifest and other (signer) files are ignored // since they are extremely sensitive to time // if ( META_INF_P.matcher(entry.getKey()).matches()) continue; if ( localIgnore != null && localIgnore.matches(entry.getKey())) continue; InputStream in = entry.getValue().openInputStream(); try { Digester<SHA1> digester = SHA1.getDigester(); IO.copy(in, digester); String value = Hex.toHexString(digester.digest().digest()); resources.add(new Element(Type.RESOURCE, entry.getKey(), Arrays.asList(new Element(Type.SHA, value)), CHANGED, CHANGED, null)); } finally { in.close(); } } return new Element(Type.RESOURCES, "<resources>", resources, CHANGED, CHANGED, null); }
public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) { return select(set, null, emptyIsAll); }
private <T> Collection<T> filter(Collection<T> list, String[] args) { if (args == null || args.length <= 1) return list; if (args.length > 2) warning("Too many arguments for ${%s} macro", args[0]); Instructions instrs = new Instructions(args[1]); return instrs.select(list, false); }