public static List<WorkingCounter> getWorkingCounter(List<CounterFactory> factories, IUser usr) { List<WorkingCounter> c = new ArrayList<WorkingCounter>(); for (CounterFactory f : factories) { c.add(f.getWorkingCounter(usr)); } for (WorkingCounter first : c) { for (WorkingCounter second : c) { if (first != second) { first.addWorkingCounter(second); } } } Collections.sort(c); return c; }
private boolean evaluate(WorkingCounter w) { if ((minCount <= w.count || noLowerBound) && (w.count <= maxCount || noUpperBound) && !w.files.isEmpty()) { FileListFile random = (FileListFile) w.files.toArray()[GH.nextInt(w.files.size())]; execute(w.usr, random, w.files, w.count, w.getComment(), w.otherCounters); /* logger.info("Counter "+w.getName()+" Action evaluation: "+random.getName()+ " "+w.count+" number of files: "+w.files.size()); //OK .. we do sth.. if (openFileList) { OpenFilelistAction.openFileList(w.usr); } if (!GH.isNullOrEmpty(raw)) { IHub hub = w.usr.getHub(); if (hub != null) { hub.sendRaw(raw, new OpADLSendContext(hub,random,w.files,w.count,w.getComment())); } } if (incrementByWhat != 0 && !GH.isNullOrEmpty(incrementCounter)) { WorkingCounter other = w.otherCounters.get(incrementCounter); if (other != null) { other.addFiles(w.files, incrementByWhat); } } */ return breakAfterExecution; } return false; }
/** order by highest priority first.. */ public int compareTo(WorkingCounter o) { return -Integer.valueOf(this.getPriority()).compareTo(o.getPriority()); }
private void addWorkingCounter(WorkingCounter counter) { otherCounters.put(counter.getName(), counter); }