java类com.google.common.collect.ArrayListMultimap的实例源码

GradlePomModuleDescriptorBuilder.java 文件源码 项目:Reer 阅读 195 收藏 0 点赞 0 评论 0
public void addDependencyForRelocation(ModuleVersionSelector selector) {

        // Some POMs depend on themselves through their parent POM, don't add this dependency
        // since Ivy doesn't allow this!
        // Example: http://repo2.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom
        if (selector.getGroup().equals(descriptor.getComponentIdentifier().getGroup())
            && selector.getName().equals(descriptor.getComponentIdentifier().getModule())) {
            return;
        }

        // TODO - this is a constant
        ListMultimap<String, String> confMappings = ArrayListMultimap.create();
        // Map dependency on all public configurations
        for (Configuration m2Conf : GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS.values()) {
            if (m2Conf.isVisible()) {
                confMappings.put(m2Conf.getName(), m2Conf.getName());
            }
        }

        dependencies.add(new IvyDependencyMetadata(selector, confMappings));
    }
BuildInvocationsConverter.java 文件源码 项目:Reer 阅读 24 收藏 0 点赞 0 评论 0
private List<ConsumerProvidedTaskSelector> buildRecursively(GradleProject project) {
    Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();

    collectTasks(project, aggregatedTasks);

    List<ConsumerProvidedTaskSelector> selectors = Lists.newArrayList();
    for (String selectorName : aggregatedTasks.keySet()) {
        SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
        selectorTasks.addAll(aggregatedTasks.get(selectorName));
        selectors.add(new ConsumerProvidedTaskSelector().
                setName(selectorName).
                setTaskNames(selectorTasks).
                setDescription(project.getParent() != null
                        ? String.format("%s:%s task selector", project.getPath(), selectorName)
                        : String.format("%s task selector", selectorName)).
                setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
    }
    return selectors;
}
TaskDetailPrinter.java 文件源码 项目:Reer 阅读 24 收藏 0 点赞 0 评论 0
private ListMultimap<Class, Task> groupTasksByType(List<Task> tasks) {
    final Set<Class> taskTypes = new TreeSet<Class>(new Comparator<Class>() {
        public int compare(Class o1, Class o2) {
            return o1.getSimpleName().compareTo(o2.getSimpleName());
        }
    });
    taskTypes.addAll(collect(tasks, new Transformer<Class, Task>() {
        public Class transform(Task original) {
            return getDeclaredTaskType(original);
        }
    }));

    ListMultimap<Class, Task> tasksGroupedByType = ArrayListMultimap.create();
    for (final Class taskType : taskTypes) {
        tasksGroupedByType.putAll(taskType, filter(tasks, new Spec<Task>() {
            public boolean isSatisfiedBy(Task element) {
                return getDeclaredTaskType(element).equals(taskType);
            }
        }));
    }
    return tasksGroupedByType;
}
AccessControlLists.java 文件源码 项目:ditb 阅读 32 收藏 0 点赞 0 评论 0
private static ListMultimap<String, TablePermission> parsePermissions(
    byte[] entryName, Result result) {
  ListMultimap<String, TablePermission> perms = ArrayListMultimap.create();
  if (result != null && result.size() > 0) {
    for (Cell kv : result.rawCells()) {

      Pair<String,TablePermission> permissionsOfUserOnTable =
          parsePermissionRecord(entryName, kv);

      if (permissionsOfUserOnTable != null) {
        String username = permissionsOfUserOnTable.getFirst();
        TablePermission permissions = permissionsOfUserOnTable.getSecond();
        perms.put(username, permissions);
      }
    }
  }
  return perms;
}
DynamicPartitionObserver.java 文件源码 项目:dds-examples 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Adds a instance handle to the mapping, triggers creation of sessions and routes if needed.
 *
 * @param instanceHandle instance handle for identification
 * @param session session
 * @param topicRoute topic route
 */
private void addInstanceHandleToMap(
    final InstanceHandle_t instanceHandle,
    final Session session,
    final TopicRoute topicRoute
) {
  // create topic session if first item discovered
  if (!mapping.containsKey(session)) {
    mapping.put(session, ArrayListMultimap.create());
    mappingReverse.put(instanceHandle, session);
    createSession(session);
  }

  // check if topic route is about to be created
  if (!mapping.get(session).containsKey(topicRoute)) {
    createTopicRoute(session, topicRoute);
  }

  // add instance handle to topic route
  if (!mapping.get(session).get(topicRoute).contains(instanceHandle)) {
    mapping.get(session).put(topicRoute, instanceHandle);
  }
}
ChunkLoadingHandler.java 文件源码 项目:Simple-Chunks 阅读 28 收藏 0 点赞 0 评论 0
@Override
public ListMultimap<String, ForgeChunkManager.Ticket> playerTicketsLoaded(ListMultimap<String, ForgeChunkManager.Ticket> tickets, World world)
{
    // We don't care what order the tickets are in, but filter out the invalid ones
    ListMultimap<String, ForgeChunkManager.Ticket> validTickets = ArrayListMultimap.create();

    for (String playerName : tickets.keySet())
    {
        List<ForgeChunkManager.Ticket> playerTickets = new ArrayList<>();

        for (ForgeChunkManager.Ticket tkt : tickets.get(playerName))
        {
            BlockPos ticketPosition = NBTUtil.getPosFromTag(tkt.getModData().getCompoundTag("position"));
            TileEntity te = world.getTileEntity(ticketPosition);
            if (te instanceof TileEntityChunkLoader)
            {
                playerTickets.add(tkt);
            }
        }

        validTickets.putAll(playerName, playerTickets);
    }

    return validTickets;
}
AssignmentCreator2.java 文件源码 项目:dremio-oss 阅读 27 收藏 0 点赞 0 评论 0
private Map<String,HostFragments> createHostFragmentsMap(List<NodeEndpoint> incomingEndpoints) {
  Multimap<String,Integer> endpointMap = ArrayListMultimap.create();
  for (int i = 0; i < incomingEndpoints.size(); i++) {
    String host = incomingEndpoints.get(i).getAddress();
    endpointMap.put(host, i);
  }

  List<HostFragments> hostFragments = new ArrayList<>();
  for (Entry<String,Collection<Integer>> entry : endpointMap.asMap().entrySet()) {
    hostFragments.add(new HostFragments(entry.getKey(), entry.getValue()));
  }
  return FluentIterable.from(hostFragments)
    .uniqueIndex(new Function<HostFragments, String>() {
      @Override
      public String apply(HostFragments hostFragment) {
        return hostFragment.host;
      }
    });
}
TaskModeratorsDialog.java 文件源码 项目:Equella 阅读 26 收藏 0 点赞 0 评论 0
@Override
protected SectionRenderable getRenderableContents(RenderContext context)
{
    Model model = getModel(context);
    List<TaskModerator> moderatorList = workflowService.getModeratorList(model.getTaskId(), true);
    Multimap<Boolean, ModRow> rows = ArrayListMultimap.create();
    for( TaskModerator taskModerator : moderatorList )
    {
        HtmlLinkState link = createLinkForModerator(context, taskModerator);
        if( link != null )
        {
            rows.put(taskModerator.isAccepted(), new ModRow(link, false));
        }
    }
    model.setModerators(rows.get(false));
    model.setModeratorsAccepted(rows.get(true));
    return viewFactory.createResult("moddialog.ftl", this);
}
SecurityExtension.java 文件源码 项目:Equella 阅读 39 收藏 0 点赞 0 评论 0
private Multimap<String, TargetListEntry> getTargetListPrivReindexingMap(Set<String> reindexPrivs, TargetList tl)
{
    Multimap<String, TargetListEntry> rv = ArrayListMultimap.create();
    if( tl.getEntries() != null )
    {
        for( TargetListEntry entry : tl.getEntries() )
        {
            final String priv = entry.getPrivilege();
            if( reindexPrivs.contains(priv) )
            {
                rv.get(priv).add(entry);
            }
        }
    }
    return rv;
}
ItemDaoImpl.java 文件源码 项目:Equella 阅读 32 收藏 0 点赞 0 评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Item, Attachment> getAttachmentsForItems(Collection<Item> items)
{
    if( items.isEmpty() )
    {
        return ImmutableListMultimap.of();
    }
    List<Attachment> attachments = getHibernateTemplate().findByNamedParam(
        "select a from Item i join i.attachments a where i in (:items) order by index(a) ASC", "items", items);
    ListMultimap<Item, Attachment> multiMap = ArrayListMultimap.create();
    for( Attachment attachment : attachments )
    {
        multiMap.put(attachment.getItem(), attachment);
    }
    return multiMap;
}
ItemDaoImpl.java 文件源码 项目:Equella 阅读 33 收藏 0 点赞 0 评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, Attachment> getAttachmentsForItemIds(Collection<Long> ids)
{
    if( ids.isEmpty() )
    {
        return ImmutableListMultimap.of();
    }
    List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
        "select a, i.id from Item i join i.attachments a where i.id in (:items) order by index(a) ASC", "items",
        ids);
    ListMultimap<Long, Attachment> multiMap = ArrayListMultimap.create();
    for( Object[] attachmentRow : attachments )
    {
        multiMap.put((Long) attachmentRow[1], (Attachment) attachmentRow[0]);
    }
    return multiMap;
}
ItemDaoImpl.java 文件源码 项目:Equella 阅读 37 收藏 0 点赞 0 评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, HistoryEvent> getHistoryForItemIds(Collection<Long> ids)
{
    if( ids.isEmpty() )
    {
        return ImmutableListMultimap.of();
    }
    List<Object[]> history = getHibernateTemplate().findByNamedParam(
        "select h, i.id from Item i join i.history h where i.id in (:items) order by index(h)", "items", ids);
    ListMultimap<Long, HistoryEvent> multiMap = ArrayListMultimap.create();
    for( Object[] historyRow : history )
    {
        multiMap.put((Long) historyRow[1], (HistoryEvent) historyRow[0]);
    }
    return multiMap;
}
ItemDaoImpl.java 文件源码 项目:Equella 阅读 41 收藏 0 点赞 0 评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, ItemNavigationNode> getNavigationNodesForItemIds(Collection<Long> ids)
{
    if( ids.isEmpty() )
    {
        return ImmutableListMultimap.of();
    }
    List<Object[]> node = getHibernateTemplate().findByNamedParam(
        "select n, i.id from ItemNavigationNode n join n.item i where i.id in (:items) order by n.index ASC",
        "items", ids);
    ListMultimap<Long, ItemNavigationNode> multiMap = ArrayListMultimap.create();
    for( Object[] nodeRow : node )
    {
        multiMap.put((Long) nodeRow[1], (ItemNavigationNode) nodeRow[0]);
    }
    return multiMap;
}
ItemDaoImpl.java 文件源码 项目:Equella 阅读 31 收藏 0 点赞 0 评论 0
@Override
@Transactional(propagation = Propagation.MANDATORY)
public Multimap<Long, String> getCollaboratorsForItemIds(Collection<Long> itemIds)
{
    if( itemIds.isEmpty() )
    {
        return ImmutableMultimap.of();
    }
    List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
        "select c, i.id from Item i join i.collaborators c where i.id in (:items)", "items", itemIds);
    ListMultimap<Long, String> multiMap = ArrayListMultimap.create();
    for( Object[] attachmentRow : attachments )
    {
        multiMap.put((Long) attachmentRow[1], (String) attachmentRow[0]);
    }
    return multiMap;
}
ItemDaoImpl.java 文件源码 项目:Equella 阅读 31 收藏 0 点赞 0 评论 0
@Override
public ListMultimap<Long, DrmAcceptance> getDrmAcceptancesForItemIds(Collection<Long> itemIds)
{
    if( itemIds.isEmpty() )
    {
        return ImmutableListMultimap.of();
    }
    final List<Object[]> drmAcceptances = getHibernateTemplate().findByNamedParam(
        "select d, item.id from DrmAcceptance d where item.id in (:items) order by d.date DESC", "items", itemIds);
    final ListMultimap<Long, DrmAcceptance> multiMap = ArrayListMultimap.create();
    for( Object[] asseptRow : drmAcceptances )
    {
        multiMap.put((Long) asseptRow[1], (DrmAcceptance) asseptRow[0]);
    }
    return multiMap;
}
TestLocalExchange.java 文件源码 项目:dremio-oss 阅读 29 收藏 0 点赞 0 评论 0
/** Helper method to verify the number of PartitionSenders in a given fragment endpoint assignments */
private static void verifyAssignment(List<Integer> fragmentList,
    ArrayListMultimap<Integer, NodeEndpoint> partitionSenderMap) {

  // We expect at least one entry the list
  assertTrue(fragmentList.size() > 0);

  for(Integer majorFragmentId : fragmentList) {
    // we expect the fragment that has DeMux/HashToRandom as sending exchange to have parallelization with not more
    // than the number of nodes in the cluster and each node in the cluster can have at most one assignment
    List<NodeEndpoint> assignments = partitionSenderMap.get(majorFragmentId);
    assertNotNull(assignments);
    assertTrue(assignments.size() > 0);
    assertTrue(String.format("Number of partition senders in major fragment [%d] is more than expected", majorFragmentId), CLUSTER_SIZE >= assignments.size());

    // Make sure there are no duplicates in assigned endpoints (i.e at most one partition sender per endpoint)
    assertTrue("Some endpoints have more than one fragment that has ParitionSender", ImmutableSet.copyOf(assignments).size() == assignments.size());
  }
}
SecurityExtension.java 文件源码 项目:Equella 阅读 36 收藏 0 点赞 0 评论 0
private Multimap<String, TargetListEntry> getTargetListPrivReindexingMap(Set<String> reindexPrivs, TargetList tl)
{
    Multimap<String, TargetListEntry> rv = ArrayListMultimap.create();
    if( tl.getEntries() != null )
    {
        for( TargetListEntry entry : tl.getEntries() )
        {
            final String priv = entry.getPrivilege();
            if( reindexPrivs.contains(priv) )
            {
                rv.get(priv).add(entry);
            }
        }
    }
    return rv;
}
FMLModContainer.java 文件源码 项目:CustomWorldGen 阅读 36 收藏 0 点赞 0 评论 0
public FMLModContainer(String className, ModCandidate container, Map<String, Object> modDescriptor)
{
    this.className = className;
    this.source = container.getModContainer();
    this.candidate = container;
    this.descriptor = modDescriptor;
    this.eventMethods = ArrayListMultimap.create();

    this.modLanguage = (String)modDescriptor.get("modLanguage");
    String languageAdapterType = (String)modDescriptor.get("modLanguageAdapter");
    if (Strings.isNullOrEmpty(languageAdapterType))
    {
        this.languageAdapter = "scala".equals(modLanguage) ? new ILanguageAdapter.ScalaAdapter() : new ILanguageAdapter.JavaAdapter();
    }
    else
    {
        // Delay loading of the adapter until the mod is on the classpath, in case the mod itself contains it.
        this.languageAdapter = null;
        FMLLog.finer("Using custom language adapter %s for %s (modid: %s)", languageAdapterType, this.className, getModId());
    }
    sanityCheckModId();
}
DataMerger.java 文件源码 项目:javaide 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Returns a map of the data items.
 * @return a map of items.
 *
 * @see DataMap
 */
@NonNull
@Override
public ListMultimap<String, I> getDataMap() {
    // put all the sets in a multimap. The result is that for each key,
    // there is a sorted list of items from all the layers, including removed ones.
    ListMultimap<String, I> fullItemMultimap = ArrayListMultimap.create();

    for (S resourceSet : mDataSets) {
        ListMultimap<String, I> map = resourceSet.getDataMap();
        for (Map.Entry<String, Collection<I>> entry : map.asMap().entrySet()) {
            fullItemMultimap.putAll(entry.getKey(), entry.getValue());
        }
    }

    return fullItemMultimap;
}
DataMerger.java 文件源码 项目:javaide 阅读 36 收藏 0 点赞 0 评论 0
/**
 * Sets the post blob load state to WRITTEN.
 *
 * After a load from the blob file, all items have their state set to nothing.
 * If the load mode is set to incrementalState then we want the items that are in the current
 * merge result to have their state be WRITTEN.
 *
 * This will allow further updates with {@link #mergeData(MergeConsumer, boolean)} to ignore the
 * state at load time and only apply the new changes.
 *
 * @see #loadFromBlob(File, boolean)
 * @see DataItem#isWritten()
 */
private void setPostBlobLoadStateToWritten() {
    ListMultimap<String, I> itemMap = ArrayListMultimap.create();

    // put all the sets into list per keys. The order is important as the lower sets are
    // overridden by the higher sets.
    for (S dataSet : mDataSets) {
        ListMultimap<String, I> map = dataSet.getDataMap();
        for (Map.Entry<String, Collection<I>> entry : map.asMap().entrySet()) {
            itemMap.putAll(entry.getKey(), entry.getValue());
        }
    }

    // the items that represent the current state is the last item in the list for each key.
    for (String key : itemMap.keySet()) {
        List<I> itemList = itemMap.get(key);
        itemList.get(itemList.size() - 1).resetStatusToWritten();
    }
}
OldAssignmentCreator.java 文件源码 项目:QDrill 阅读 30 收藏 0 点赞 0 评论 0
OldAssignmentCreator(List<DrillbitEndpoint> incomingEndpoints, List<T> units) {
  logger.debug("Assigning {} units to {} endpoints", units.size(), incomingEndpoints.size());
  Stopwatch watch = new Stopwatch();

  Preconditions.checkArgument(incomingEndpoints.size() <= units.size(), String.format("Incoming endpoints %d "
      + "is greater than number of row groups %d", incomingEndpoints.size(), units.size()));
  this.mappings = ArrayListMultimap.create();
  this.endpoints = Lists.newLinkedList(incomingEndpoints);

  ArrayList<T> rowGroupList = new ArrayList<>(units);
  for (double cutoff : ASSIGNMENT_CUTOFFS) {
    scanAndAssign(rowGroupList, cutoff, false, false);
  }
  scanAndAssign(rowGroupList, 0.0, true, false);
  scanAndAssign(rowGroupList, 0.0, true, true);

  logger.debug("Took {} ms to apply assignments", watch.elapsed(TimeUnit.MILLISECONDS));
  Preconditions.checkState(rowGroupList.isEmpty(), "All readEntries should be assigned by now, but some are still unassigned");
  Preconditions.checkState(!units.isEmpty());

}
ParquetGroupScan.java 文件源码 项目:QDrill 阅读 32 收藏 0 点赞 0 评论 0
private ParquetGroupScan(ParquetGroupScan that) {
  super(that);
  this.columns = that.columns == null ? null : Lists.newArrayList(that.columns);
  this.endpointAffinities = that.endpointAffinities == null ? null : Lists.newArrayList(that.endpointAffinities);
  this.entries = that.entries == null ? null : Lists.newArrayList(that.entries);
  this.formatConfig = that.formatConfig;
  this.formatPlugin = that.formatPlugin;
  this.fs = that.fs;
  this.mappings = that.mappings == null ? null : ArrayListMultimap.create(that.mappings);
  this.rowCount = that.rowCount;
  this.rowGroupInfos = that.rowGroupInfos == null ? null : Lists.newArrayList(that.rowGroupInfos);
  this.selectionRoot = that.selectionRoot;
  this.columnValueCounts = that.columnValueCounts == null ? null : new HashMap(that.columnValueCounts);
  this.columnTypeMap = that.columnTypeMap == null ? null : new HashMap(that.columnTypeMap);
  this.partitionValueMap = that.partitionValueMap == null ? null : new HashMap(that.partitionValueMap);
  this.fileSet = that.fileSet == null ? null : new HashSet(that.fileSet);
  this.usedMetadataCache = that.usedMetadataCache;
  this.parquetTableMetadata = that.parquetTableMetadata;
}
TestLocalExchange.java 文件源码 项目:QDrill 阅读 44 收藏 0 点赞 0 评论 0
/** Helper method to verify the number of PartitionSenders in a given fragment endpoint assignments */
private static void verifyAssignment(List<Integer> fragmentList,
    ArrayListMultimap<Integer, DrillbitEndpoint> partitionSenderMap) {

  // We expect at least one entry the list
  assertTrue(fragmentList.size() > 0);

  for(Integer majorFragmentId : fragmentList) {
    // we expect the fragment that has DeMux/HashToRandom as sending exchange to have parallelization with not more
    // than the number of nodes in the cluster and each node in the cluster can have at most one assignment
    List<DrillbitEndpoint> assignments = partitionSenderMap.get(majorFragmentId);
    assertNotNull(assignments);
    assertTrue(assignments.size() > 0);
    assertTrue(String.format("Number of partition senders in major fragment [%d] is more than expected", majorFragmentId), CLUSTER_SIZE >= assignments.size());

    // Make sure there are no duplicates in assigned endpoints (i.e at most one partition sender per endpoint)
    assertTrue("Some endpoints have more than one fragment that has ParitionSender", ImmutableSet.copyOf(assignments).size() == assignments.size());
  }
}
HiveFunctionRegistry.java 文件源码 项目:QDrill 阅读 30 收藏 0 点赞 0 评论 0
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) {
  Description desc = clazz.getAnnotation(Description.class);
  String[] names;
  if (desc != null) {
    names = desc.name().split(",");
    for (int i=0; i<names.length; i++) {
      names[i] = names[i].trim();
    }
  }else{
    names = new String[]{clazz.getName().replace('.', '_')};
  }

  UDFType type = clazz.getAnnotation(UDFType.class);
  if (type != null && type.deterministic()) {
    nonDeterministicUDFs.add(clazz);
  }


  for(int i=0; i<names.length;i++) {
    methods.put(names[i].toLowerCase(), clazz);
  }
}
SignPosts.java 文件源码 项目:fpm 阅读 30 收藏 0 点赞 0 评论 0
private static ListMultimap<Long, SignPost> siFile(TomtomFolder folder) {
    ListMultimap<Long, SignPost> signs = ArrayListMultimap.create();
    File file = new File(folder.getFile("si.dbf"));
    if (!file.exists()) {
        return signs;
    }
    log.info("Reading SI {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            if (row.getInt("AMBIG") != 1) {
                SignPost sign = SignPost.fromRow(row);
                signs.put(sign.getId(), sign);
            }
        }
    }
    log.info("Loaded {} si", signs.size());
    return signs;
}
HsnpDbf.java 文件源码 项目:fpm 阅读 33 收藏 0 点赞 0 评论 0
private static ArrayListMultimap<Long, Speed> loadHsnp(String filename) {
    File file = new File(filename);
    ArrayListMultimap<Long, Speed> speeds = ArrayListMultimap.create();
    if (!file.exists()) {
        log.info("File not found : {}", file.getAbsolutePath());
        return speeds;
    }

    log.info("Reading HSNP {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            Speed speed = parse(row);
            speeds.put(speed.getId(), speed);
        }
    }
    log.info("Loaded {} speed profile", speeds.size());
    return speeds;
}
LdDbf.java 文件源码 项目:fpm 阅读 25 收藏 0 点赞 0 评论 0
private static Map<Long, List<String>> ldFile(TomtomFolder folder) {
    File file = new File(folder.getFile("ld.dbf"));
    if (!file.exists()) {
        return newHashMap();
    }
    ArrayListMultimap<Long, LaneDirection> directions = ArrayListMultimap.create();
    log.info("Reading LD {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            directions.put(row.getLong("ID"), LaneDirection.parse(row.getInt("DIRECTION"), row.getString("VALIDITY")));
        }
    }
    Map<Long, List<String>> tags = newHashMap();
    for (Long id : directions.keySet()) {
        tags.put(id, asText(directions.get(id)));
    }
    log.info("Loaded {} lane directions", directions.size());
    return tags;
}
SrDbf.java 文件源码 项目:fpm 阅读 29 收藏 0 点赞 0 评论 0
private static ArrayListMultimap<Long, SpeedRestriction> loadSpeedRestrictions(String filename) {
    ArrayListMultimap<Long, SpeedRestriction> restrictions = ArrayListMultimap.create();
    File file = new File(filename);
    if (!file.exists()) {
        log.info("File not found : {}", file.getAbsolutePath());
        return restrictions;
    }
    log.info("Reading SR {}", file);
    try (DbfReader reader = new DbfReader(file)) {
        DbfRow row;
        while ((row = reader.nextRow()) != null) {
            SpeedRestriction restriction = new SpeedRestriction(row.getLong("ID"), row.getInt("SPEED"), Validity.values()[row.getInt("VALDIR") - 1]);
            restrictions.put(restriction.getId(), restriction);
        }
    }
    log.info("Loaded {} speed restrictions", restrictions.size());

    return restrictions;
}
LoadController.java 文件源码 项目:CustomWorldGen 阅读 38 收藏 0 点赞 0 评论 0
public LoadController(Loader loader)
{
    this.loader = loader;
    this.masterChannel = new EventBus(new SubscriberExceptionHandler()
    {
        @Override
        public void handleException(Throwable exception, SubscriberExceptionContext context)
        {
            FMLLog.log("FMLMainChannel", Level.ERROR, exception, "Could not dispatch event: %s to %s", context.getEvent(), context.getSubscriberMethod());
        }
    });
    this.masterChannel.register(this);

    state = LoaderState.NOINIT;
    packageOwners = ArrayListMultimap.create();

}
TestCompiler.java 文件源码 项目:guava-beta-checker 阅读 36 收藏 0 点赞 0 评论 0
/**
 * Asserts that the given diagnostics contain errors with a message containing "[CheckerName]"
 * on the given lines of the given file. If there should be multiple errors on a line, the line
 * number must appear multiple times. There may not be any errors in any other file.
 */
public void assertErrorsOnLines(String file,
    List<Diagnostic<? extends JavaFileObject>> diagnostics, long... lines) {
  ListMultimap<String, Long> actualErrors = ArrayListMultimap.create();
  for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {
    String message = diagnostic.getMessage(Locale.US);

    // The source may be null, e.g. for diagnostics about command-line flags
    assertNotNull(message, diagnostic.getSource());
    String sourceName = diagnostic.getSource().getName();

    assertEquals(
        "unexpected error in source file " + sourceName + ": " + message,
        file, sourceName);

    actualErrors.put(diagnostic.getSource().getName(), diagnostic.getLineNumber());

    // any errors from the compiler that are not related to this checker should fail
    assertThat(message).contains("[" + checker.getAnnotation(BugPattern.class).name() + "]");
  }

  assertEquals(
      ImmutableMultiset.copyOf(Longs.asList(lines)),
      ImmutableMultiset.copyOf(actualErrors.get(file)));
}


问题


面经


文章

微信
公众号

扫码关注公众号