List of usage examples for com.google.common.collect ImmutableSet of
@SuppressWarnings({ "unchecked" }) public static <E> ImmutableSet<E> of()
From source file:org.onosproject.openstacknetworking.impl.InstancePortServiceAdapter.java
@Override public Set<InstancePort> instancePorts() { return ImmutableSet.of(); }
From source file:com.cloudera.oryx.common.settings.InboundSettings.java
public static InboundSettings create(Config config) { Config inbound = config.getConfig("inbound"); List<String> columnNames; if (inbound.hasPath("column-names")) { columnNames = inbound.getStringList("column-names"); } else {//from w w w .j a v a2 s. c o m int numColumns = inbound.getInt("num-columns"); columnNames = Lists.newArrayListWithCapacity(numColumns); for (int i = 0; i < numColumns; i++) { columnNames.add(String.valueOf(i)); } } Function<Object, Integer> lookup = new LookupFunction(columnNames); Iterable<Integer> allColumns = Collections2.transform(columnNames, lookup); Collection<Integer> idColumns; if (inbound.hasPath("id-columns")) { idColumns = ImmutableSet.copyOf(Collections2.transform(inbound.getAnyRefList("id-columns"), lookup)); } else { idColumns = ImmutableSet.of(); } Collection<Integer> ignoredColumns; if (inbound.hasPath("ignored-columns")) { ignoredColumns = ImmutableSet .copyOf(Collections2.transform(inbound.getAnyRefList("ignored-columns"), lookup)); } else { ignoredColumns = ImmutableSet.of(); } Collection<Integer> categoricalColumns; Collection<Integer> numericColumns; if (inbound.hasPath("categorical-columns")) { Preconditions.checkState(!inbound.hasPath("numeric-columns")); categoricalColumns = Sets .newHashSet(Collections2.transform(inbound.getAnyRefList("categorical-columns"), lookup)); numericColumns = Sets.newHashSet(allColumns); numericColumns.removeAll(categoricalColumns); } else if (inbound.hasPath("numeric-columns")) { Preconditions.checkState(!inbound.hasPath("categorical-columns")); numericColumns = Sets .newHashSet(Collections2.transform(inbound.getAnyRefList("numeric-columns"), lookup)); categoricalColumns = Sets.newHashSet(allColumns); categoricalColumns.removeAll(numericColumns); } else { throw new IllegalArgumentException("No categorical-columns or numeric-columns set"); } numericColumns.removeAll(idColumns); numericColumns.removeAll(ignoredColumns); categoricalColumns.removeAll(idColumns); categoricalColumns.removeAll(ignoredColumns); Integer targetColumn = null; if (inbound.hasPath("target-column")) { targetColumn = lookup.apply(inbound.getAnyRef("target-column")); Preconditions.checkState( categoricalColumns.contains(targetColumn) || numericColumns.contains(targetColumn), "Target column not specified as numeric or categorical"); } return new InboundSettings(columnNames, idColumns, categoricalColumns, numericColumns, ignoredColumns, targetColumn); }
From source file:com.google.gerrit.testutil.FakeAccountCache.java
private static AccountState newState(Account account) { return new AccountState(account, ImmutableSet.of(), ImmutableSet.of(), new HashMap<>()); }
From source file:com.facebook.buck.rules.AbstractDependencyVisitors.java
/** * Given dependencies in inputs builds graph of transitive dependencies filtering them by * instanceOf T./* w w w . ja va2 s . co m*/ * * @param inputs initial dependencies from which to build transitive closure * @param typeFilter class to filter with on instanceOf, we need this because of * the type erasure * @param <T> class to fitler on * @return filtered BuildRule DAG of transitive dependencies * * @see com.facebook.buck.rules.BuildRule */ public static <T> ImmutableDirectedAcyclicGraph<BuildRule> getBuildRuleDirectedGraphFilteredBy( final Iterable<? extends BuildRule> inputs, final Class<T> typeFilter) { // Build up a graph of the inputs and their transitive dependencies, we'll use the graph // to topologically sort the dependencies. final MutableDirectedGraph<BuildRule> graph = new MutableDirectedGraph<>(); AbstractDependencyVisitor visitor = new AbstractDependencyVisitor(inputs) { @Override public ImmutableSet<BuildRule> visit(BuildRule rule) { if (typeFilter.isAssignableFrom(rule.getClass())) { graph.addNode(rule); for (BuildRule dep : rule.getDeps()) { if (typeFilter.isAssignableFrom(dep.getClass())) { graph.addEdge(rule, dep); } } return rule.getDeps(); } else { return ImmutableSet.of(); } } }; visitor.start(); return new DefaultImmutableDirectedAcyclicGraph<BuildRule>(graph); }
From source file:org.gradle.model.internal.core.DefaultInstanceFactoryRegistry.java
@Override public Iterable<ModelType<?>> supportedTypes() { return ImmutableSet.of(); }
From source file:org.fenixedu.academic.domain.degreeStructure.CycleTypes.java
public CycleTypes() { this.types = ImmutableSet.of(); }
From source file:org.onosproject.openstacknetworking.impl.OpenstackNetworkServiceAdapter.java
@Override public Set<Network> networks() { return ImmutableSet.of(); }
From source file:org.androidtransfuse.adapter.ASTStringType.java
@Override public ImmutableSet<ASTMethod> getMethods() { return ImmutableSet.of(); }
From source file:org.obiba.onyx.magma.ScriptedVariableValueSourceFactory.java
public Set<VariableValueSource> createSources() { if (resource.exists() == false) { return ImmutableSet.of(); }/* w w w. j a v a 2 s.c o m*/ try { ImmutableSet.Builder<VariableValueSource> sources = new ImmutableSet.Builder<VariableValueSource>(); ObjectInputStream ois = getXStream().createObjectInputStream(resource.getInputStream()); try { while (true) { Variable variable = (Variable) ois.readObject(); sources.add(new JavascriptVariableValueSource(variable)); } } catch (EOFException e) { // Reached the end of the file. } finally { ois.close(); } return sources.build(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } }
From source file:es.usc.citius.composit.core.model.impl.SignatureIO.java
public SignatureIO() { this.inputs = ImmutableSet.of(); this.outputs = ImmutableSet.of(); }