private static void addResourceInstsToSet(final File archiveFile, final String specString, final Set<ResourceInst> resourceInsts) throws IOException { StatSpec statSpec = new StatSpec(specString); StatArchiveReader reader = new StatArchiveReader(new File[] {archiveFile}, new StatSpec[] {statSpec}, true); StatValue[] statValues = reader.matchSpec(statSpec); for (StatValue statValue : statValues) { for (ResourceInst resourceInst : statValue.getResources()) { resourceInsts.add(resourceInst); } } }
new HashMap<CombinedResources, List<StatValue>>(); for (int i = 0; i < specs.length; i++) { StatValue[] values = reader.matchSpec(specs[i]); if (values.length == 0) { if (!quiet) {
/** * Returns an array of stat values that match the specified spec. If nothing matches then an empty * array is returned. */ public StatValue[] matchSpec(StatSpec spec) { if (spec.getCombineType() == StatSpec.GLOBAL) { StatValue[] allValues = matchSpec(new RawStatSpec(spec)); if (allValues.length == 0) { return allValues; } else { ComboValue cv = new ComboValue(allValues); // need to save this in reader's combo value list return new StatValue[] {cv}; } } else { List l = new ArrayList(); StatArchiveReader.StatArchiveFile[] archives = getArchives(); for (int i = 0; i < archives.length; i++) { StatArchiveFile f = archives[i]; if (spec.archiveMatches(f.getFile())) { f.matchSpec(spec, l); } } StatValue[] result = new StatValue[l.size()]; return (StatValue[]) l.toArray(result); } }