public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) { return select(set, null, emptyIsAll); }
public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) { return select(set, null, emptyIsAll); }
public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) { return select(set, null, emptyIsAll); }
public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) { return select(set, null, emptyIsAll); }
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); }
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 ${" + args[0] + "} macro"); Instructions instrs = new Instructions(args[1]); return instrs.select(list, false); }
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); }
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 ${" + args[0] + "} macro"); Instructions instrs = new Instructions(args[1]); return instrs.select(list, false); }
String ls(String args[], boolean relative) { if (args.length < 2) throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter"); File dir = domain.getFile(args[1]); if (!dir.isAbsolute()) throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir); if (!dir.exists()) throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir); if (!dir.isDirectory()) throw new IllegalArgumentException( "the ${ls} macro directory parameter points to a file instead of a directory: " + dir); Collection<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles())); for (int i = 2; i < args.length; i++) { Instructions filters = new Instructions(args[i]); files = filters.select(files, true); } List<String> result = new ArrayList<String>(); for (File file : files) result.add(relative ? file.getName() : file.getAbsolutePath()); return Processor.join(result, ","); }
String ls(String args[], boolean relative) { if (args.length < 2) throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter"); File dir = domain.getFile(args[1]); if (!dir.isAbsolute()) throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir); if (!dir.exists()) throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir); if (!dir.isDirectory()) throw new IllegalArgumentException( "the ${ls} macro directory parameter points to a file instead of a directory: " + dir); Collection<File> files = new ArrayList<>(new SortedList<>(dir.listFiles())); for (int i = 2; i < args.length; i++) { Instructions filters = new Instructions(args[i]); files = filters.select(files, true); } List<String> result = new ArrayList<>(); for (File file : files) result.add(relative ? file.getName() : IO.absolutePath(file)); return Processor.join(result, ","); }
String ls(String args[], boolean relative) { if (args.length < 2) throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter"); File dir = domain.getFile(args[1]); if (!dir.isAbsolute()) throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir); if (!dir.exists()) throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir); if (!dir.isDirectory()) throw new IllegalArgumentException( "the ${ls} macro directory parameter points to a file instead of a directory: " + dir); Collection<File> files = new ArrayList<>(new SortedList<>(dir.listFiles())); for (int i = 2; i < args.length; i++) { Instructions filters = new Instructions(args[i]); files = filters.select(files, true); } List<String> result = new ArrayList<>(); for (File file : files) result.add(relative ? file.getName() : IO.absolutePath(file)); return Processor.join(result, ","); }
/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet().removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String,String>> i = attributes.entrySet().iterator(); i.hasNext();) { String v = i.next().getValue(); if (v.equals("!")) i.remove(); } }
/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet().removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String,String>> i = attributes.entrySet().iterator(); i.hasNext();) { String v = i.next().getValue(); if (v.equals("!")) i.remove(); } }
/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet().removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String,String>> i = attributes.entrySet().iterator(); i.hasNext();) { String v = i.next().getValue(); if (v.equals("!")) i.remove(); } }
/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet() .removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String, String>> i = attributes.entrySet() .iterator(); i.hasNext();) { String v = i.next() .getValue(); if (v.equals("!")) i.remove(); } }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<Run>(); Map<File,Attrs> files = runspec.select(getBase()); for (Entry<File,Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String,String> ee : e.getValue().entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<>(); Map<File, Attrs> files = runspec.select(getBase()); for (Entry<File, Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String, String> ee : e.getValue() .entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<Run>(); Map<File,Attrs> files = runspec.select(getBase()); for (Entry<File,Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String,String> ee : e.getValue().entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<>(); Map<File, Attrs> files = runspec.select(getBase()); for (Entry<File, Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String, String> ee : e.getValue() .entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }