Java Code Examples for

The following examples show how to use . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File:    From presto with Apache License 2.0 5 votes vote down vote up
public NetworkLocation locate(HostAddress address)
    List<String> parts = new ArrayList<>(ImmutableList.copyOf(Splitter.on(".").split(address.getHostText())));
    return new NetworkLocation(parts);
Example 2
Source File:    From judgels with GNU General Public License v2.0 5 votes vote down vote up
private void doAggregate() {
    MDC.put("gradingPhase", "AGGREGATE");"Aggregation started.");
    ImmutableList.Builder<SubtaskVerdict> subtaskVerdictBuilder = ImmutableList.builder();
    for (Subtask subtask : config.getSubtasks()) {
        List<TestCaseVerdict> testCaseVerdicts =
                ImmutableList.copyOf(testCaseVerdictsBySubtaskIds.get(subtask.getId() + 1));
        AggregationResult aggregationResult =
                getAggregator().aggregate(testCaseVerdicts, subtask.getPoints());

        SubtaskVerdict subtaskVerdict = aggregationResult.getSubtaskVerdict();
        List<String> testCasePoints = aggregationResult.getTestCasePoints();


        for (int i = 0; i < testCaseVerdicts.size(); i++) {
            Integer[] testCaseIndices = testCaseIndicesBySubtaskIds.get(subtask.getId() + 1).get(i);
            int testGroupIndex = testCaseIndices[0];
            int testCaseIndex = testCaseIndices[1];
            String points = testCasePoints.get(i);
            testGroupPoints.get(testGroupIndex).set(testCaseIndex, points);

    subtaskVerdicts =;
    gradingVerdict = subtaskAggregator.aggregate(;"Aggregation finished.");
Example 3
Source File:    From bazel with Apache License 2.0 5 votes vote down vote up
 * Constructs a new IncludeScanner
 * @param cache externally scoped cache of file-path to inclusion-set mappings
 * @param pathCache include path existence cache
 * @param quoteIncludePaths the list of quote search path dirs (-iquote)
 * @param includePaths the list of all other non-framework search path dirs (-I and -isystem)
 * @param frameworkIncludePaths the list of framework other search path dirs (-F)
    IncludeParser parser,
    ExecutorService includePool,
    ConcurrentMap<Artifact, ListenableFuture<Collection<Inclusion>>> cache,
    PathExistenceCache pathCache,
    List<PathFragment> quoteIncludePaths,
    List<PathFragment> includePaths,
    List<PathFragment> frameworkIncludePaths,
    Path outputPath,
    Path execRoot,
    ArtifactFactory artifactFactory,
    Supplier<SpawnIncludeScanner> spawnIncludeScannerSupplier,
    boolean useAsyncIncludeScanner) {
  this.parser = parser;
  this.includePool = includePool;
  this.fileParseCache = cache;
  this.pathCache = pathCache;
  this.artifactFactory = Preconditions.checkNotNull(artifactFactory);
  this.spawnIncludeScannerSupplier = spawnIncludeScannerSupplier;
  this.quoteIncludePaths = ImmutableList.<PathFragment>builder()
  this.quoteIncludePathsFrameworkIndex = quoteIncludePaths.size();
  this.includePaths = ImmutableList.copyOf(includePaths);
  this.frameworkIncludePaths = ImmutableList.copyOf(frameworkIncludePaths);
  this.inclusionCache =
      useAsyncIncludeScanner ? new AsyncInclusionCache() : new LegacyInclusionCache();
  this.execRoot = execRoot;
  this.outputPathFragment = outputPath.relativeTo(execRoot);
  this.includeRootFragment =
  this.absoluteRoot = Root.absoluteRoot(execRoot.getFileSystem());
  this.useAsyncIncludeScanner = useAsyncIncludeScanner;
Example 4
Source File:    From presto with Apache License 2.0 5 votes vote down vote up
public TableScanNode(
        PlanNodeId id,
        TableHandle table,
        List<Symbol> outputs,
        Map<Symbol, ColumnHandle> assignments,
        TupleDomain<ColumnHandle> enforcedConstraint)
    this.table = requireNonNull(table, "table is null");
    this.outputSymbols = ImmutableList.copyOf(requireNonNull(outputs, "outputs is null"));
    this.assignments = ImmutableMap.copyOf(requireNonNull(assignments, "assignments is null"));
    checkArgument(assignments.keySet().containsAll(outputs), "assignments does not cover all of outputs");
    this.enforcedConstraint = requireNonNull(enforcedConstraint, "enforcedConstraint is null");
Example 5
Source File:    From grpc-spring-boot-starter with MIT License 5 votes vote down vote up
 * Gets the immutable and sorted list of global server interceptors.
 * @return The list of globally registered server interceptors.
public ImmutableList<ClientInterceptor> getClientInterceptors() {
    if (this.sortedClientInterceptors == null) {
        List<ClientInterceptor> temp = Lists.newArrayList(this.clientInterceptors);
        this.sortedClientInterceptors = ImmutableList.copyOf(temp);
    return this.sortedClientInterceptors;
Example 6
Source File:    From genie with Apache License 2.0 5 votes vote down vote up
 * Constructor.
 * @param jobArchivers             The ordered list of {@link JobArchiver} implementations to use. Not empty.
 * @param directoryManifestFactory The job directory manifest factory
public JobArchiveServiceImpl(
    final List<JobArchiver> jobArchivers,
    final DirectoryManifest.Factory directoryManifestFactory
) {
    this.jobArchivers = ImmutableList.copyOf(jobArchivers);
    this.directoryManifestFactory = directoryManifestFactory;
Example 7
Source File:    From ArchUnit with Apache License 2.0 4 votes vote down vote up
JavaClassList(List<JavaClass> elements) {
    this.elements = ImmutableList.copyOf(elements);
Example 8
Source File:    From armeria with Apache License 2.0 4 votes vote down vote up
 * Creates a new instance.
public ExceptionInfo(String name, Iterable<FieldInfo> fields, @Nullable String docString) { = requireNonNull(name, "name");
    this.fields = ImmutableList.copyOf(requireNonNull(fields, "fields"));
    this.docString = Strings.emptyToNull(docString);
Example 9
Source File:    From grakn with GNU Affero General Public License v3.0 4 votes vote down vote up
public ImmutableList<Parameter<Order>> getOrders() {
    return ImmutableList.copyOf(orders);
Example 10
Source File:    From chvote-protocol-poc with GNU Affero General Public License v3.0 4 votes vote down vote up
public Object[] elementsToHash() {
    return new Object[]{t_1, t_2, t_3, ImmutableList.copyOf(t_4), ImmutableList.copyOf(t_hat)};
Example 11
Source File:    From japicmp with Apache License 2.0 4 votes vote down vote up
public List<Filter> getIncludes() {
	return ImmutableList.copyOf(includes);
Example 12
Source File:    From calcite with Apache License 2.0 4 votes vote down vote up
public ImmutableList<RelCollation> collations(EnumerableCorrelate join,
    RelMetadataQuery mq) {
  return ImmutableList.copyOf(
      RelMdCollation.enumerableCorrelate(mq, join.getLeft(), join.getRight(),
Example 13
Source File:    From bazel with Apache License 2.0 4 votes vote down vote up
public ListenableFuture<List<Artifact>> determineAdditionalInputs(
    @Nullable IncludeScannerSupplier includeScannerSupplier,
    CppCompileAction action,
    ActionExecutionContext actionExecutionContext,
    IncludeScanningHeaderData includeScanningHeaderData)
    throws ExecException, InterruptedException {
  // Return null when no include scanning occurs, as opposed to an empty set, to distinguish from
  // the case where includes are scanned but none are found.
  if (!action.shouldScanIncludes()) {
    return null;

  Preconditions.checkNotNull(includeScannerSupplier, action);

  Set<Artifact> includes = Sets.newConcurrentHashSet();

  final List<PathFragment> absoluteBuiltInIncludeDirs = new ArrayList<>();

  // Deduplicate include directories. This can occur especially with "built-in" and "system"
  // include directories because of the way we retrieve them. Duplicate include directories
  // really mess up #include_next directives.
  Set<PathFragment> includeDirs = new LinkedHashSet<>(action.getIncludeDirs());
  List<PathFragment> quoteIncludeDirs = action.getQuoteIncludeDirs();
  List<PathFragment> frameworkIncludeDirs = action.getFrameworkIncludeDirs();
  List<String> cmdlineIncludes = includeScanningHeaderData.getCmdlineIncludes();


  // Add the system include paths to the list of include paths.
  for (PathFragment pathFragment : action.getBuiltInIncludeDirectories()) {
    if (pathFragment.isAbsolute()) {

  List<PathFragment> includeDirList = ImmutableList.copyOf(includeDirs);
  IncludeScanner scanner =
      includeScannerSupplier.scannerFor(quoteIncludeDirs, includeDirList, frameworkIncludeDirs);

  Artifact mainSource = action.getMainIncludeScannerSource();
  Collection<Artifact> sources = action.getIncludeScannerSources();

  try (SilentCloseable c =
          .profile(ProfilerTask.SCANNER, action.getSourceFile().getExecPathString())) {
    ListenableFuture<?> future =
    return Futures.transformAsync(
        new AsyncFunction<Object, List<Artifact>>() {
          public ListenableFuture<List<Artifact>> apply(Object input) throws Exception {
            return Futures.immediateFuture(
                collect(actionExecutionContext, includes, absoluteBuiltInIncludeDirs));
  } catch (IOException e) {
    throw new EnvironmentalExecException(
        e, createFailureDetail("Include scanning IOException", Code.SCANNING_IO_EXCEPTION));
Example 14
Source File:    From centraldogma with Apache License 2.0 4 votes vote down vote up
public MergedEntryDto(Revision revision, EntryType type, T content, Iterable<String> paths) {
    this.revision = requireNonNull(revision, "revision");
    this.type = requireNonNull(type, "type");
    this.content = requireNonNull(content, "content");
    this.paths = ImmutableList.copyOf(requireNonNull(paths, "paths"));
Example 15
Source File:    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private AttributeContainerImmutable(String name, List<Attribute> atts) { = name;
  this.atts = ImmutableList.copyOf(atts);
Example 16
Source File:    From micro-server with Apache License 2.0 4 votes vote down vote up
public ImmutableList<Entity> findAll(String name){
	return ImmutableList.copyOf(searchByName(name));
Example 17
Source File:    From emodb with Apache License 2.0 4 votes vote down vote up
private List<UUID> toChangeIds(Iterator<Map.Entry<DeltaClusteringKey, Change>> iterator) {
    return ImmutableList.copyOf(
            Iterators.transform(iterator, entry -> entry.getKey().getChangeId()));
Example 18
Source File:    From tracecompass with Eclipse Public License 2.0 3 votes vote down vote up
 * Constructor This one takes the scope and thus speeds up definition
 * creation
 * @param declaration
 *            the parent declaration
 * @param definitionScope
 *            the parent scope
 * @param scope
 *            the scope of this variable
 * @param structFieldName
 *            the field name
 * @param fieldNames
 *            the list of fields
 * @param definitions
 *            the definitions
 * @since 1.0
public StructDefinition(@NonNull StructDeclaration declaration,
        IDefinitionScope definitionScope,
        @NonNull ILexicalScope scope,
        @NonNull String structFieldName,
        @NonNull Iterable<@NonNull String> fieldNames,
        Definition[] definitions) {
    super(declaration, definitionScope, structFieldName, scope);
    fFieldNames = ImmutableList.copyOf(fieldNames);
    fDefinitions = definitions;
    if (fFieldNames.isEmpty()) {
        fDefinitionsMap = Collections.emptyMap();
Example 19
Source File:    From calcite with Apache License 2.0 2 votes vote down vote up
 * Returns a list of matched relational expressions.
 * @return matched relational expressions
 * @see #rel(int)
public List<RelNode> getRelList() {
  return ImmutableList.copyOf(rels);
Example 20
Source File:    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
 * Get the list of child attributes below this one.
 * @return The child attributes.
public Iterable<Attribute> getSubAttributes() {
    return ImmutableList.copyOf(fSubAttributes.values());