コード例 #1
0
ファイル: SimpleNetwork.java プロジェクト: rooma92/Terasology
  public boolean canAddLeafNode(NetworkNode networkNode) {
    if (isEmptyNetwork()) return false;
    if (networkingNodes.containsValue(networkNode) || leafNodes.containsValue(networkNode))
      return false;

    return canConnectToNetworkingNode(networkNode);
  }
コード例 #2
0
  /**
   * Remove the targets and rules defined by {@code path} from the cache and recursively remove the
   * targets and rules defined by files that transitively include {@code path} from the cache.
   *
   * @param path The File that has changed.
   */
  private synchronized void invalidatePath(Cell cell, Path path) {
    // Paths from Watchman are not absolute.
    path = cell.getFilesystem().resolve(path);

    // If the path is a build file for the cell, nuke the targets that it owns first. We don't need
    // to check whether or not the path ends in the build file name, since we know that these are
    // the only things that get added. Which makes for an easy life.
    List<Map<String, Object>> rawNodes = allRawNodes.getIfPresent(path);
    if (rawNodes != null) {
      // Invalidate the target nodes first
      for (Map<String, Object> rawNode : rawNodes) {
        UnflavoredBuildTarget target = parseBuildTargetFromRawRule(cell.getRoot(), rawNode);
        allTargetNodes.invalidateAll(targetsCornucopia.get(target));
        targetsCornucopia.removeAll(target);
      }

      // And then the raw node itself.
      allRawNodes.invalidate(path);
    }

    // We may have been given a file that other build files depend on. Iteratively remove those.
    Iterable<Path> dependents = buildFileDependents.get(path);
    for (Path dependent : dependents) {
      if (dependent.equals(path)) {
        continue;
      }
      invalidatePath(cell, dependent);
    }
    buildFileDependents.removeAll(path);
  }
コード例 #3
0
  int invalidatePath(Path path) {
    try (AutoCloseableLock writeLock = rawAndComputedNodesLock.writeLock()) {
      int invalidatedRawNodes = 0;
      ImmutableSet<Map<String, Object>> rawNodes = allRawNodes.getIfPresent(path);
      if (rawNodes != null) {
        // Increment the counter
        invalidatedRawNodes = rawNodes.size();
        for (Map<String, Object> rawNode : rawNodes) {
          UnflavoredBuildTarget target =
              RawNodeParsePipeline.parseBuildTargetFromRawRule(cell.getRoot(), rawNode, path);
          LOG.debug("Invalidating target for path %s: %s", path, target);
          for (CacheImpl<?> cache : typedNodeCaches.values()) {
            cache.allComputedNodes.invalidateAll(targetsCornucopia.get(target));
          }
          targetsCornucopia.removeAll(target);
        }
        allRawNodes.invalidate(path);
      }

      // We may have been given a file that other build files depend on. Iteratively remove those.
      Iterable<Path> dependents = buildFileDependents.get(path);
      LOG.debug("Invalidating dependents for path %s: %s", path, dependents);
      for (Path dependent : dependents) {
        if (dependent.equals(path)) {
          continue;
        }
        invalidatedRawNodes += invalidatePath(dependent);
      }
      buildFileDependents.removeAll(path);
      buildFileConfigs.remove(path);

      return invalidatedRawNodes;
    }
  }
コード例 #4
0
ファイル: SimpleNetwork.java プロジェクト: rooma92/Terasology
  @Override
  public byte getLeafSidesInNetwork(NetworkNode networkNode) {
    if (!hasLeafNode(networkNode))
      throw new IllegalArgumentException("Cannot test nodes not in network");

    if (networkingNodes.size() == 0) {
      // Degenerated network
      for (Side connectingOnSide : SideBitFlag.getSides(networkNode.connectionSides)) {
        Vector3i possibleLocation = networkNode.location.toVector3i();
        possibleLocation.add(connectingOnSide.getVector3i());
        for (NetworkNode node : leafNodes.get(new ImmutableBlockLocation(possibleLocation))) {
          if (SideBitFlag.hasSide(node.connectionSides, connectingOnSide.reverse())) {
            return SideBitFlag.getSide(connectingOnSide);
          }
        }
      }

      return 0;
    } else {
      byte result = 0;
      for (Side connectingOnSide : SideBitFlag.getSides(networkNode.connectionSides)) {
        Vector3i possibleLocation = networkNode.location.toVector3i();
        possibleLocation.add(connectingOnSide.getVector3i());
        for (NetworkNode node : networkingNodes.get(new ImmutableBlockLocation(possibleLocation))) {
          if (SideBitFlag.hasSide(node.connectionSides, connectingOnSide.reverse())) {
            result += SideBitFlag.getSide(connectingOnSide);
          }
        }
      }

      return result;
    }
  }
コード例 #5
0
  public ReverseCFATransformerFactory(Set<CFAEdge> cfa) {
    reverseCFA = HashMultimap.create();
    Set<Location> nonSinks = new HashSet<Location>();
    for (CFAEdge e : cfa) {
      reverseCFA.put(e.getTarget(), e);
      nonSinks.add(e.getSource());
    }

    FastSet<Location> sinks = new FastSet<Location>();
    for (Location l : reverseCFA.keySet()) {
      if (!nonSinks.contains(l)) {
        sinks.add(l);
      }
    }

    if (sinks.size() == 1) {
      sink = sinks.pick();
    } else if (sinks.size() == 0) {
      throw new RuntimeException("CFA has no sink!");
    } else {
      // Generate artificial exit node
      sink = new Location(new AbsoluteAddress(0xFFFFFF01L));
      for (Location l : sinks) {
        reverseCFA.put(sink, new CFAEdge(l, sink, new RTLSkip()));
      }
    }
  }
コード例 #6
0
  public void sendPersistentChunksToPlayer(EntityPlayerMP player) {
    if (!AdditionalPipes.instance.chunkSight) {
      return;
    }
    if (sightRange > MAX_SIGHT_RANGE) sightRange = MAX_SIGHT_RANGE;

    SetMultimap<ChunkCoordIntPair, Ticket> persistentChunks =
        ForgeChunkManager.getPersistentChunksFor(player.worldObj);
    List<ChunkCoordIntPair> chunksInRange = new LinkedList<ChunkCoordIntPair>();
    int playerX = (((int) player.posX) >> 4) - sightRange / 2,
        playerZ = (((int) player.posZ) >> 4) - sightRange / 2;

    for (int i = -sightRange; i <= sightRange; i++) {
      for (int j = -sightRange; j <= sightRange; j++) {
        ChunkCoordIntPair coords = new ChunkCoordIntPair(playerX + i, playerZ + j);
        if (persistentChunks.containsKey(coords)) {
          chunksInRange.add(coords);
        }
      }
    }

    MessageChunkloadData message = new MessageChunkloadData(chunksInRange);

    PacketHandler.INSTANCE.sendTo(message, player);

    AdditionalPipes.instance.logger.info(
        "[ChunkLoadViewDataProxy] Sent chunks within " + sightRange + " of player.");
  }
コード例 #7
0
ファイル: AdminTest.java プロジェクト: Benoye/voldemort
  public void testFetch(final SetMultimap<Integer, Integer> nodePartitions) {
    for (final Integer node : nodePartitions.keySet()) {
      System.out.println(
          "Testing fetch of node " + node + " partitions " + nodePartitions.get(node) + ": \n");
      measureFunction(
          new Measurable() {

            @Override
            public long apply() {
              long i = 0;
              Iterator<Pair<ByteArray, Versioned<byte[]>>> result =
                  adminClient.bulkFetchOps.fetchEntries(
                      node,
                      storeName,
                      new ArrayList<Integer>(nodePartitions.get(node)),
                      null,
                      false);
              while (result.hasNext()) {
                i++;
                result.next();
              }
              return i;
            }
          },
          1);
    }
  }
コード例 #8
0
ファイル: EdgeContentPart.java プロジェクト: psuzzi/gef4
 @Override
 public SetMultimap<Object, String> getContentAnchorages() {
   SetMultimap<Object, String> anchorages = HashMultimap.create();
   anchorages.put(getContent().getSource(), "START");
   anchorages.put(getContent().getTarget(), "END");
   return anchorages;
 }
コード例 #9
0
  @Nonnull
  @Override
  public Map<Object, Map<Class, Set<Method>>> findSubscribers() {
    SetMultimap<String, ASMData> allAnnotationsInContainer =
        asmTable.getAnnotationsFor(Loader.instance().activeModContainer());
    if (!allAnnotationsInContainer.containsKey(ForgepathHandler.class.getCanonicalName()))
      return NO_SUBSCRIBERS;
    Set<ASMData> asmDataSet = allAnnotationsInContainer.get(ForgepathHandler.class.getName());

    // Goddamnit Java and your stupidly long types
    ImmutableMap.Builder<Object, Map<Class, Set<Method>>> mapBuilder =
        new ImmutableMap.Builder<Object, Map<Class, Set<Method>>>();

    for (ASMData asmData : asmDataSet) {
      String cname = asmData.getClassName();
      Object obj;
      try {
        obj = Class.forName(cname).newInstance();
      } catch (Exception ex) {
        continue; // SKIP!
      }
      Map<Class, Set<Method>> subscribers = innerLocator.findSubscribers(obj);
      mapBuilder.put(obj, subscribers);
    }

    return mapBuilder.build();
  }
コード例 #10
0
 /** Get the snapshot of union find */
 ImmutableMap<ECR, Collection<IRVar>> snapshot() {
   SetMultimap<Partition, IRVar> map = uf.snapshot();
   ImmutableMap.Builder<ECR, Collection<IRVar>> builder = ImmutableMap.builder();
   for (Partition ecr : map.asMap().keySet()) {
     builder.put(findRoot((ECR) ecr), ImmutableSet.copyOf(map.asMap().get(ecr)));
   }
   return builder.build();
 }
コード例 #11
0
 @Override
 public void clearPixels(CanvasRenderer renderer) {
   if (!pixels.containsKey(renderer)) return;
   for (MapPixel pixel : pixels.removeAll(renderer)) {
     Point point = pixel.getPoint();
     buffer.buffer[point.getY() * 128 + point.getX()] = 0;
   }
 }
コード例 #12
0
ファイル: ObjectiveTracker.java プロジェクト: rvhub/onos
 @Override
 public void removeTrackedResources(Key intentKey, Collection<NetworkResource> resources) {
   for (NetworkResource resource : resources) {
     if (resource instanceof Link) {
       intentsByLink.remove(linkKey((Link) resource), intentKey);
     } else if (resource instanceof ElementId) {
       intentsByDevice.remove((ElementId) resource, intentKey);
     }
   }
 }
コード例 #13
0
 public void unsubscribeAll() {
   Collection<SubscriptionHandle> subscriptionsSnapshot;
   synchronized (subscriptions) {
     subscriptionsSnapshot = ImmutableList.copyOf(subscriptions.values());
     subscriptions.clear();
   }
   for (SubscriptionHandle s : subscriptionsSnapshot) {
     context.unsubscribe(s);
   }
 }
コード例 #14
0
 /** Populate the taxonomy, providing the transitive closure manually. */
 @BeforeClass
 public void populateSubclasses() {
   subclasses.putAll(
       Creature.MAMMAL, Arrays.asList(Creature.CAT, Creature.DOG, Creature.DACHSHUND));
   subclasses.putAll(Creature.DOG, Arrays.asList(Creature.DACHSHUND));
   subclasses.putAll(Creature.FISH, Arrays.asList(Creature.COD, Creature.HAKE));
   subclasses.putAll(
       Creature.BIRD, Arrays.asList(Creature.FINCH, Creature.GREENFINCH, Creature.MAGPIE));
   subclasses.putAll(Creature.FINCH, Arrays.asList(Creature.GREENFINCH));
 }
コード例 #15
0
  /** Returns documents grouped by partitions. */
  SetMultimap<Object, Document> getDocumentsByPartition(List<Document> documents) {
    final SetMultimap<Object, Document> index = HashMultimap.create();
    for (Document document : documents) {
      final Collection<Object> partitions = document.getField(partitionIdFieldName);
      for (Object partition : partitions) {
        index.put(partition, document);
      }
    }

    return ImmutableSetMultimap.copyOf(index);
  }
コード例 #16
0
  /**
   * Filters SchemaContext for yang modules
   *
   * @param delegate original SchemaContext
   * @param rootModules modules (yang schemas) to be available and all their dependencies (modules
   *     importing rootModule and whole chain of their imports)
   * @param additionalModuleIds (additional) modules (yang schemas) to be available and whole chain
   *     of their imports
   */
  public FilteringSchemaContextProxy(
      final SchemaContext delegate,
      final Collection<ModuleId> rootModules,
      final Set<ModuleId> additionalModuleIds) {

    Preconditions.checkArgument(rootModules != null, "Base modules cannot be null.");
    Preconditions.checkArgument(additionalModuleIds != null, "Additional modules cannot be null.");

    final Builder<Module> filteredModulesBuilder = new Builder<>();

    final SetMultimap<URI, Module> nsMap =
        Multimaps.newSetMultimap(new TreeMap<URI, Collection<Module>>(), MODULE_SET_SUPPLIER);
    final SetMultimap<String, Module> nameMap =
        Multimaps.newSetMultimap(new TreeMap<String, Collection<Module>>(), MODULE_SET_SUPPLIER);

    ImmutableMap.Builder<ModuleIdentifier, String> identifiersToSourcesBuilder =
        ImmutableMap.builder();

    // preparing map to get all modules with one name but difference in revision
    final TreeMultimap<String, Module> nameToModulesAll = getStringModuleTreeMultimap();

    nameToModulesAll.putAll(getStringModuleMap(delegate));

    // in case there is a particular dependancy to view filteredModules/yang models
    // dependancy is checked for module name and imports
    processForRootModules(delegate, rootModules, filteredModulesBuilder);

    // adding additional modules
    processForAdditionalModules(delegate, additionalModuleIds, filteredModulesBuilder);

    filteredModulesBuilder.addAll(
        getImportedModules(
            Maps.uniqueIndex(delegate.getModules(), ModuleId.MODULE_TO_MODULE_ID),
            filteredModulesBuilder.build(),
            nameToModulesAll));

    /**
     * Instead of doing this on each invocation of getModules(), pre-compute it once and keep it
     * around -- better than the set we got in.
     */
    this.filteredModules = filteredModulesBuilder.build();

    for (final Module module : filteredModules) {
      nameMap.put(module.getName(), module);
      nsMap.put(module.getNamespace(), module);
      identifiersToSourcesBuilder.put(module, module.getSource());
    }

    namespaceToModules = ImmutableSetMultimap.copyOf(nsMap);
    nameToModules = ImmutableSetMultimap.copyOf(nameMap);
    identifiersToSources = identifiersToSourcesBuilder.build();
  }
コード例 #17
0
 @Override
 public void render(Screen screen, MapCanvas canvas) {
   if (canvas.getMapView() != this.map) map = canvas.getMapView();
   Arrays.fill(getBuffer(canvas), (byte) -1);
   for (RenderPriority priority : RenderPriority.values()) {
     if (!renderers.containsKey(priority)) continue;
     for (CanvasRenderer renderer : renderers.get(priority)) {
       if (!renderer.isRendering()) continue;
       directRender(screen, renderer, canvas);
     }
   }
   merge(buffer.buffer, getBuffer(canvas));
 }
コード例 #18
0
 public SetMultimap<AbstractModule, FeatureProject> resolveResolutionContext(
     AbstractModule module, boolean scopeTest) {
   final SetMultimap<AbstractModule, FeatureProject> result = LinkedHashMultimap.create();
   for (FeatureProject featureProject : requiredFeatures) {
     result.get(featureProject.getParent().getParent()).add(featureProject);
   }
   if (scopeTest) {
     for (FeatureProject featureProject : requiredTestFeatures) {
       result.get(featureProject.getParent().getParent()).add(featureProject);
     }
   }
   return result;
 }
コード例 #19
0
 private void directRender(Screen screen, CanvasRenderer renderer, MapCanvas canvas) {
   setBase(canvas, buffer.buffer);
   renderer.render(screen, canvas);
   byte[] canvasBuffer = getBuffer(canvas);
   for (int i = 0; i < canvasBuffer.length; ++i) {
     if (canvasBuffer[i] >= 0) {
       MapPixel pixel = new MapPixel(new Point(i % 128, i / 128), canvasBuffer[i]);
       if (pixels.containsValue(pixel)) pixels.values().remove(pixel);
       pixels.put(renderer, pixel);
       buffer.buffer[i] = canvasBuffer[i];
     }
   }
   setBase(canvas, buffer.buffer);
   Arrays.fill(getBuffer(canvas), (byte) -1);
 }
コード例 #20
0
ファイル: BindsConfig.java プロジェクト: frankpunx/Terasology
 @Override
 public BindsConfig deserialize(
     JsonElement json, Type typeOfT, JsonDeserializationContext context)
     throws JsonParseException {
   BindsConfig result = new BindsConfig();
   JsonObject inputObj = json.getAsJsonObject();
   for (Map.Entry<String, JsonElement> entry : inputObj.entrySet()) {
     SetMultimap<String, Input> map = context.deserialize(entry.getValue(), SetMultimap.class);
     for (String id : map.keySet()) {
       SimpleUri uri = new SimpleUri(new Name(entry.getKey()), id);
       result.data.putAll(uri, map.get(id));
     }
   }
   return result;
 }
コード例 #21
0
ファイル: FMLModContainer.java プロジェクト: recon88/FML
 private void parseSimpleFieldAnnotation(
     SetMultimap<String, ASMData> annotations,
     String annotationClassName,
     Function<ModContainer, Object> retreiver)
     throws IllegalAccessException {
   String[] annName = annotationClassName.split("\\.");
   String annotationName = annName[annName.length - 1];
   for (ASMData targets : annotations.get(annotationClassName)) {
     String targetMod = (String) targets.getAnnotationInfo().get("value");
     Field f = null;
     Object injectedMod = null;
     ModContainer mc = this;
     boolean isStatic = false;
     Class<?> clz = modInstance.getClass();
     if (!Strings.isNullOrEmpty(targetMod)) {
       if (Loader.isModLoaded(targetMod)) {
         mc = Loader.instance().getIndexedModList().get(targetMod);
       } else {
         mc = null;
       }
     }
     if (mc != null) {
       try {
         clz = Class.forName(targets.getClassName(), true, Loader.instance().getModClassLoader());
         f = clz.getDeclaredField(targets.getObjectName());
         f.setAccessible(true);
         isStatic = Modifier.isStatic(f.getModifiers());
         injectedMod = retreiver.apply(mc);
       } catch (Exception e) {
         Throwables.propagateIfPossible(e);
         FMLLog.log(
             getModId(),
             Level.WARNING,
             e,
             "Attempting to load @%s in class %s for %s and failing",
             annotationName,
             targets.getClassName(),
             mc.getModId());
       }
     }
     if (f != null) {
       Object target = null;
       if (!isStatic) {
         target = modInstance;
         if (!modInstance.getClass().equals(clz)) {
           FMLLog.log(
               getModId(),
               Level.WARNING,
               "Unable to inject @%s in non-static field %s.%s for %s as it is NOT the primary mod instance",
               annotationName,
               targets.getClassName(),
               targets.getObjectName(),
               mc.getModId());
           continue;
         }
       }
       f.set(target, injectedMod);
     }
   }
 }
コード例 #22
0
 @VisibleForTesting
 public void addFreeformBlockFamily(BlockUri family, Iterable<String> categories) {
   freeformBlockUris.add(family);
   for (String category : categories) {
     categoryLookup.put(category, family);
   }
 }
コード例 #23
0
  @Override
  public synchronized void addSplits(PlanNodeId sourceId, Iterable<Split> splits) {
    try (SetThreadName ignored = new SetThreadName("HttpRemoteTask-%s", taskId)) {
      requireNonNull(sourceId, "sourceId is null");
      requireNonNull(splits, "splits is null");
      checkState(
          !noMoreSplits.contains(sourceId), "noMoreSplits has already been set for %s", sourceId);

      // only add pending split if not done
      if (!getTaskInfo().getState().isDone()) {
        int added = 0;
        for (Split split : splits) {
          if (pendingSplits.put(
              sourceId, new ScheduledSplit(nextSplitId.getAndIncrement(), split))) {
            added++;
          }
        }
        if (sourceId.equals(planFragment.getPartitionedSource())) {
          pendingSourceSplitCount += added;
          fireSplitCountChanged(added);
        }
        needsUpdate.set(true);
      }

      scheduleUpdate();
    }
  }
コード例 #24
0
  // identify nodes that can serve as graft branches as part of a coordinated exchange move
  protected SetMultimap<Integer, Node> getGraftBranches(Node yNode) {
    final int yNumber = yNode.getNr();
    final Set<String> cousinDescendants = findDescendants(yNode, yNumber);

    final SetMultimap<Integer, Node> allGraftBranches = HashMultimap.create();
    final List<Tree> geneTrees = geneTreeInput.get();
    for (int j = 0; j < nGeneTrees; j++) {
      final Tree geneTree = geneTrees.get(j);
      final Node geneTreeRootNode = geneTree.getRoot();
      final Set<Node> jGraftBranches = new LinkedHashSet<>();
      findGraftBranches(geneTreeRootNode, jGraftBranches, cousinDescendants);
      allGraftBranches.putAll(j, jGraftBranches);
    }

    return allGraftBranches;
  }
コード例 #25
0
 @Override
 public synchronized void stopAll() {
   for (TaskContext context : assignedWorkItems.keySet()) {
     stop(context);
   }
   templates.clear();
 }
コード例 #26
0
 private void collectTransitiveClosure(ClassName className, Set<ClassName> transitiveClosure) {
   if (transitiveClosure.add(className)) {
     for (ClassName referencedClass : _classToReferencedClassesMap.get(className)) {
       collectTransitiveClosure(referencedClass, transitiveClosure);
     }
   }
 }
コード例 #27
0
ファイル: ModulesHandler.java プロジェクト: robfig/plovr
  /**
   * For each node in the graph, we want to find the longest path from the node to the root. The
   * length of the longest path is the depth at which the node should be drawn in the visualization
   * of the graph.
   */
  @VisibleForTesting
  static SetMultimap<Integer, String> calculateModuleDepths(
      String root, Map<String, List<String>> graph) {

    // To determine the longest path for each node, progressively descend
    // down the inverted dependency tree. Keep track of each module found at
    // that depth and record the deepest point at which the module was seen.
    SetMultimap<Integer, String> modulesAtDepth = HashMultimap.create();
    modulesAtDepth.put(0, root);
    Map<String, Integer> moduleToDepth = Maps.newHashMap();
    moduleToDepth.put(root, 0);

    int depth = 0;
    while (true) {
      Set<String> modules = modulesAtDepth.get(depth);
      if (modules.isEmpty()) {
        break;
      }
      int newDepth = ++depth;

      // For each module at the current depth, collect of its descendants so
      // they can be inserted in modulesAtDepth at their new depth.
      Set<String> atNewDepth = Sets.newHashSet();
      for (String module : modules) {
        List<String> descendants = graph.get(module);
        for (String descendant : descendants) {
          atNewDepth.add(descendant);
        }
      }

      // A module in atNewDepth may already be in the modulesAtDepth multimap.
      // If so, then the key with which it is associated in the multimap must
      // be changed. The moduleToDepth map is used to keep track of where each
      // module is in the multimap for quick lookup, so moduleToDepth must be
      // kept up to date, as well.
      for (String module : atNewDepth) {
        if (moduleToDepth.containsKey(module)) {
          int oldDepth = moduleToDepth.remove(module);
          modulesAtDepth.remove(oldDepth, module);
        }
        moduleToDepth.put(module, newDepth);
        modulesAtDepth.put(newDepth, module);
      }
    }

    return modulesAtDepth;
  }
コード例 #28
0
 /** @see SubscriptionContext#subscribeToMembers(Group, Sensor, SensorEventListener) */
 public <T> SubscriptionHandle subscribeToMembers(
     Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener) {
   SubscriptionHandle handle = context.subscribeToMembers(parent, sensor, listener);
   synchronized (subscriptions) {
     subscriptions.put(parent, handle);
   }
   return handle;
 }
コード例 #29
0
ファイル: PBXBuildFiles.java プロジェクト: CydeWeys/bazel
  /**
   * Returns new or cached instances of PBXBuildFiles corresponding to files that may or may not
   * belong to an aggregate reference (see {@link AggregateReferenceType}). Files specified by the
   * {@code paths} argument are grouped into individual PBXBuildFiles using the given {@link
   * AggregateReferenceType}. Files that are standalone are not put in an aggregate reference, but
   * are put in a standalone PBXBuildFile in the returned sequence.
   */
  public Iterable<PBXBuildFile> get(AggregateReferenceType type, Iterable<Path> paths) {
    ImmutableList.Builder<PBXBuildFile> result = new ImmutableList.Builder<>();
    SetMultimap<AggregateKey, Path> keyedPaths = type.aggregates(paths);
    for (Map.Entry<AggregateKey, Collection<Path>> aggregation : keyedPaths.asMap().entrySet()) {
      if (!aggregation.getKey().isStandalone()) {
        ImmutableSet<Path> itemPaths = ImmutableSet.copyOf(aggregation.getValue());
        result.add(
            aggregateBuildFile(
                itemPaths, type.create(aggregation.getKey(), fileReferences(itemPaths))));
      }
    }
    for (Path generalResource : keyedPaths.get(AggregateKey.standalone())) {
      result.add(getStandalone(FileReference.of(generalResource.toString(), SourceTree.GROUP)));
    }

    return result.build();
  }
コード例 #30
0
 private synchronized void invalidateAllCaches() {
   LOG.debug("Invalidating all caches");
   allTargetNodes.invalidateAll();
   targetsCornucopia.clear();
   allRawNodes.invalidateAll();
   buildFileDependents.clear();
   knownCells.clear();
 }