public void addCompensationInstances(Collection<NodeInstance> generatedInstances) { this.compensationInstances.addAll(generatedInstances); }
private synchronized void addTableNamesForPrewarming(List<String> tblNames) { tableNames.clear(); if (tblNames != null) { tableNames.addAll(tblNames); } }
public DirectoryIterator(File... basis) { this.stack = new Stack<File>(); stack.addAll(Arrays.asList(basis)); }
/** * Returns true if a project has a non-direct dependency to another project. * <p> * A non-direct dependency is a path of dependency "edge"s from the source to the destination, * where the length is greater than 1. */ public boolean hasIndirectDependencies(AbstractProject src, AbstractProject dst) { Set<AbstractProject> visited = new HashSet<AbstractProject>(); Stack<AbstractProject> queue = new Stack<AbstractProject>(); queue.addAll(getDownstream(src)); queue.remove(dst); while(!queue.isEmpty()) { AbstractProject p = queue.pop(); if(p==dst) return true; if(visited.add(p)) queue.addAll(getDownstream(p)); } return false; }
private Set<Class> findAllInterfacesInHierarchy(Class candidateGoExtensionClass) { Stack<Class> classesInHierarchy = new Stack<>(); classesInHierarchy.add(candidateGoExtensionClass); Set<Class> interfaces = new HashSet<>(); while (!classesInHierarchy.empty()) { Class classToCheckFor = classesInHierarchy.pop(); if (classToCheckFor.isInterface()) { interfaces.add(classToCheckFor); } classesInHierarchy.addAll(Arrays.asList(classToCheckFor.getInterfaces())); if (classToCheckFor.getSuperclass() != null) { classesInHierarchy.add(classToCheckFor.getSuperclass()); } } return interfaces; }
public void markOptional(boolean propagate) { this.isOptional = true; if (propagate && next != null) { Stack<State> todo = new Stack<>(); Set<State> seen = new HashSet<>(); todo.addAll(next); while (!todo.empty()) { State s = todo.pop(); s.isOptional = true; seen.add(s); if (next != null) { for (State n : next) { if (!seen.contains(n)) { todo.push(n); } } } } } } }
@Signature synchronized public void __clone() { Stack<Memory> old = this.stack; this.stack = new Stack<Memory>(); stack.addAll(old); }
private Set<Operator<?>> getAllOperatorsForSimpleFetch(Set<Operator<?>> opSet) { Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); // add all children opStack.addAll(opSet); while (!opStack.empty()) { Operator<?> op = opStack.pop(); returnSet.add(op); if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } return returnSet; } }
private Set<Operator<?>> getAllOperatorsForSimpleFetch(Set<Operator<?>> opSet) { Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); // add all children opStack.addAll(opSet); while (!opStack.empty()) { Operator<?> op = opStack.pop(); returnSet.add(op); if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } return returnSet; } }
public Set<Operator<?>> getAllOperators() { Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>(); Set<Operator<?>> opSet = getAllRootOperators(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); // add all children opStack.addAll(opSet); while(!opStack.empty()) { Operator<?> op = opStack.pop(); returnSet.add(op); if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } return returnSet; }
public Set<Operator<?>> getAllOperators() { Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>(); Set<Operator<?>> opSet = getAllRootOperators(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); // add all children opStack.addAll(opSet); while(!opStack.empty()) { Operator<?> op = opStack.pop(); returnSet.add(op); if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } return returnSet; }
/** * This will decorate a graphql type with the original hierarchy of non null and list'ness * it originally contained in its definition type * * @param objectType this should be a graphql type that was originally built from this raw type * @param <T> the type * * @return the decorated type */ @SuppressWarnings("TypeParameterUnusedInFormals") public <T extends GraphQLType> T decorate(GraphQLType objectType) { GraphQLType out = objectType; Stack<Class<?>> wrappingStack = new Stack<>(); wrappingStack.addAll(this.decoration); while (!wrappingStack.isEmpty()) { Class<?> clazz = wrappingStack.pop(); if (clazz.equals(NonNullType.class)) { out = nonNull(out); } if (clazz.equals(ListType.class)) { out = list(out); } } // we handle both input and output graphql types //noinspection unchecked return (T) out; }
/** * Returns a set containing all leaf operators from the operator tree in this work. * @return a set containing all leaf operators in this operator tree. */ public Set<Operator<? extends OperatorDesc>> getAllLeafOperators() { Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>(); Set<Operator<?>> opSet = getAllRootOperators(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); // add all children opStack.addAll(opSet); while (!opStack.empty()) { Operator<?> op = opStack.pop(); if (op.getNumChild() == 0) { returnSet.add(op); } if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } return returnSet; }
public static Set<Operator<?>> getOp(BaseWork work, Class<?> clazz) { Set<Operator<?>> ops = new HashSet<Operator<?>>(); if (work instanceof MapWork) { Collection<Operator<?>> opSet = ((MapWork) work).getAliasToWork().values(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); opStack.addAll(opSet); while (!opStack.empty()) { Operator<?> op = opStack.pop(); ops.add(op); if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } } else { ops.addAll(work.getAllOperators()); } Set<Operator<? extends OperatorDesc>> matchingOps = new HashSet<Operator<? extends OperatorDesc>>(); for (Operator<? extends OperatorDesc> op : ops) { if (clazz.isInstance(op)) { matchingOps.add(op); } } return matchingOps; }
@Override protected void indexNodes(List<Node> nodes, RuleContext ctx) { Stack<Node> stack = new Stack<>(); stack.addAll(nodes); Collections.reverse(stack); while (!stack.isEmpty()) { Node node = stack.pop(); indexNode(node); if (node.jjtGetNumChildren() > 0) { for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) { stack.push(node.jjtGetChild(i)); } } } }
@Override protected void indexNodes(List<Node> nodes, RuleContext ctx) { // Visit Nodes in DFS order Stack<Node> stack = new Stack<>(); stack.addAll(nodes); Collections.reverse(stack); while (!stack.isEmpty()) { Node node = stack.pop(); indexNode(node); if (node.jjtGetNumChildren() > 0) { for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) { stack.push(node.jjtGetChild(i)); } } } }
@Override protected void indexNodes(List<Node> nodes, RuleContext ctx) { // Visit Nodes in DFS order Stack<Node> stack = new Stack<>(); stack.addAll(nodes); Collections.reverse(stack); while (!stack.isEmpty()) { Node node = stack.pop(); indexNode(node); if (node.jjtGetNumChildren() > 0) { for (int i = node.jjtGetNumChildren() - 1; i >= 0; i--) { stack.push(node.jjtGetChild(i)); } } } }
/** * Returns a set containing all leaf operators from the operator tree in this work. * @return a set containing all leaf operators in this operator tree. */ public Set<Operator<? extends OperatorDesc>> getAllLeafOperators() { Set<Operator<?>> returnSet = new LinkedHashSet<Operator<?>>(); Set<Operator<?>> opSet = getAllRootOperators(); Stack<Operator<?>> opStack = new Stack<Operator<?>>(); // add all children opStack.addAll(opSet); while (!opStack.empty()) { Operator<?> op = opStack.pop(); if (op.getNumChild() == 0) { returnSet.add(op); } if (op.getChildOperators() != null) { opStack.addAll(op.getChildOperators()); } } return returnSet; }
static Stack transform(final List<LogEvent> logEvents) { final List<String> filtered = new ArrayList<>(logEvents.size()); for (LogEvent event : logEvents) { filtered.add(event.getMessage().getFormattedMessage()); } Collections.reverse(filtered); Stack<String> result = new Stack<>(); result.addAll(filtered); return result; }
/** * Entry point into parsing command line arguments. * @param args the command line arguments * @return a list with all commands and subcommands initialized by this method * @throws ParameterException if the specified command line arguments are invalid */ List<CommandLine> parse(String... args) { Assert.notNull(args, "argument array"); if (tracer.isInfo()) {tracer.info("Picocli version: %s%n", versionString());} if (tracer.isInfo()) {tracer.info("Parsing %d command line args %s%n", args.length, Arrays.toString(args));} if (tracer.isDebug()){tracer.debug("Parser configuration: %s%n", config());} if (tracer.isDebug()){tracer.debug("(ANSI is %s by default: isatty=%s, XTERM=%s, OSTYPE=%s, isWindows=%s, JansiConsoleInstalled=%s, ANSICON=%s, ConEmuANSI=%s, NO_COLOR=%s, CLICOLOR=%s, CLICOLOR_FORCE=%s)%n", Help.Ansi.ansiPossible() ? "enabled" : "disabled", Help.Ansi.isTTY(), System.getenv("XTERM"), System.getenv("OSTYPE"), Help.Ansi.isWindows(), Help.Ansi.isJansiConsoleInstalled(), System.getenv("ANSICON"), System.getenv("ConEmuANSI"), System.getenv("NO_COLOR"), System.getenv("CLICOLOR"), System.getenv("CLICOLOR_FORCE"));} List<String> expanded = new ArrayList<String>(); for (String arg : args) { addOrExpand(arg, expanded, new LinkedHashSet<String>()); } Stack<String> arguments = new Stack<String>(); arguments.addAll(reverseList(expanded)); List<CommandLine> result = new ArrayList<CommandLine>(); parse(result, arguments, args, new ArrayList<Object>()); return result; }