当前位置: 首页>>代码示例>>Java>>正文


Java PatchedUsage类代码示例

本文整理汇总了Java中com.intellij.internal.statistic.beans.PatchedUsage的典型用法代码示例。如果您正苦于以下问题:Java PatchedUsage类的具体用法?Java PatchedUsage怎么用?Java PatchedUsage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PatchedUsage类属于com.intellij.internal.statistic.beans包,在下文中一共展示了PatchedUsage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: persistPatch

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void persistPatch(@NotNull Map<GroupDescriptor, Set<PatchedUsage>> patchedDescriptorMap) {
    for (Map.Entry<GroupDescriptor, Set<PatchedUsage>> entry : patchedDescriptorMap.entrySet()) {
        final GroupDescriptor groupDescriptor = entry.getKey();
        for (PatchedUsage patchedUsage : entry.getValue()) {
            UsageDescriptor usageDescriptor = StatisticsUploadAssistant.findDescriptor(mySentDescriptors, Pair.create(groupDescriptor, patchedUsage.getKey()));
            if (usageDescriptor != null) {
                usageDescriptor.setValue(usageDescriptor.getValue() + patchedUsage.getDelta());
            } else {
                if (!mySentDescriptors.containsKey(groupDescriptor)) {
                    mySentDescriptors.put(groupDescriptor, new HashSet<UsageDescriptor>());
                }
                mySentDescriptors.get(groupDescriptor).add(new UsageDescriptor(patchedUsage.getKey(), patchedUsage.getValue()));
            }
        }
    }

    setSentTime(System.currentTimeMillis());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:BasicSentUsagesPersistenceComponent.java

示例2: testPersistSentPatch

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testPersistSentPatch() {
    final Map<GroupDescriptor, Set<UsageDescriptor>> allUsages = createDescriptors("g:a1:-1", "g2:a2:-2", "g2:a3:-3", "g:a2:-2", "g2:a1:-1", "g3:a1:13");
    final SentUsagesPersistence usagesPersistence = new BasicSentUsagesPersistenceComponent();

    Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = StatisticsUploadAssistant.getPatchedUsages(allUsages, usagesPersistence);
    String result = StatisticsUploadAssistant.getStringPatch(patchedUsages, 500);
    StatisticsUploadAssistant.persistSentPatch(result, usagesPersistence);

    assertMapEquals(ConvertUsagesUtil.convertString(result), ConvertUsagesUtil.convertString("g:a2=-2,a1=-1;g2:a3=-3,a2=-2,a1=-1;g3:a1=13;"));

    patchedUsages = StatisticsUploadAssistant.getPatchedUsages(allUsages, usagesPersistence);
    result = StatisticsUploadAssistant.getStringPatch(patchedUsages, 500);
    StatisticsUploadAssistant.persistSentPatch(result, usagesPersistence);

    assertEquals("sent usages must be persisted", result.length(), 0);
    assertEquals(allUsages.size(), usagesPersistence.getSentUsages().size());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:StatisticsUploadAssistantTest.java

示例3: persistPatch

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
@Override
public void persistPatch(@Nonnull Map<GroupDescriptor, Set<PatchedUsage>> patchedDescriptorMap) {
    for (Map.Entry<GroupDescriptor, Set<PatchedUsage>> entry : patchedDescriptorMap.entrySet()) {
        final GroupDescriptor groupDescriptor = entry.getKey();
        for (PatchedUsage patchedUsage : entry.getValue()) {
            UsageDescriptor usageDescriptor = StatisticsUploadAssistant.findDescriptor(mySentDescriptors, Pair.create(groupDescriptor, patchedUsage.getKey()));
            if (usageDescriptor != null) {
                usageDescriptor.setValue(usageDescriptor.getValue() + patchedUsage.getDelta());
            } else {
                if (!mySentDescriptors.containsKey(groupDescriptor)) {
                    mySentDescriptors.put(groupDescriptor, new HashSet<UsageDescriptor>());
                }
                mySentDescriptors.get(groupDescriptor).add(new UsageDescriptor(patchedUsage.getKey(), patchedUsage.getValue()));
            }
        }
    }

    setSentTime(System.currentTimeMillis());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:BasicSentUsagesPersistenceComponent.java

示例4: testConvertUsagesWithPriority

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testConvertUsagesWithPriority() {
    final Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new HashMap<GroupDescriptor, Set<PatchedUsage>>();

    createPatchDescriptor(patchedUsages, "low", GroupDescriptor.LOWER_PRIORITY, "l1", 1);
    createPatchDescriptor(patchedUsages, "low", GroupDescriptor.LOWER_PRIORITY, "l2", 1);
    createPatchDescriptor(patchedUsages, "high", GroupDescriptor.HIGHER_PRIORITY, "h", 1);
    createPatchDescriptor(patchedUsages, "high", GroupDescriptor.HIGHER_PRIORITY, "h2", 1);
    createPatchDescriptor(patchedUsages, "default_1", GroupDescriptor.DEFAULT_PRIORITY, "d11", 1);
    createPatchDescriptor(patchedUsages, "default_2", GroupDescriptor.DEFAULT_PRIORITY, "d21", 1);
    createPatchDescriptor(patchedUsages, "default_1", GroupDescriptor.DEFAULT_PRIORITY, "d12", 1);


    assertEquals(ConvertUsagesUtil.convertUsages(patchedUsages),
                 "high:h=1,h2=1;default_1:d11=1,d12=1;default_2:d21=1;low:l1=1,l2=1;");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:StatisticsUploadAssistantTest.java

示例5: testConvertUsagesWithEqualPriority

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testConvertUsagesWithEqualPriority() {
      final Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new HashMap<GroupDescriptor, Set<PatchedUsage>>();

createPatchDescriptor(patchedUsages, "g4", GroupDescriptor.HIGHER_PRIORITY, "1", 1);
      createPatchDescriptor(patchedUsages, "g2", GroupDescriptor.HIGHER_PRIORITY, "2", 1);
      createPatchDescriptor(patchedUsages, "g1", GroupDescriptor.HIGHER_PRIORITY, "3", 1);
      createPatchDescriptor(patchedUsages, "g3", GroupDescriptor.HIGHER_PRIORITY, "4", 1);


      assertEquals(ConvertUsagesUtil.convertUsages(patchedUsages), "g1:3=1;g2:2=1;g3:4=1;g4:1=1;");
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:StatisticsUploadAssistantTest.java

示例6: testConvertString

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testConvertString() {
    final Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new HashMap<GroupDescriptor, Set<PatchedUsage>>();

    createPatchDescriptor(patchedUsages, "g4", GroupDescriptor.HIGHER_PRIORITY, "1", 1);
    createPatchDescriptor(patchedUsages, "g2", GroupDescriptor.HIGHER_PRIORITY, "2", 1);
    createPatchDescriptor(patchedUsages, "g1", GroupDescriptor.HIGHER_PRIORITY, "3", 1);
    createPatchDescriptor(patchedUsages, "g3", GroupDescriptor.HIGHER_PRIORITY, "4", 1);

    assertMapEquals(patchedUsages, ConvertUsagesUtil.convertString("g3:4=1;g1:3=1;g4:1=1;g2:2=1;"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:StatisticsUploadAssistantTest.java

示例7: testConvertWithTooLongGroupDescriptorId

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testConvertWithTooLongGroupDescriptorId() {
  final Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new HashMap<GroupDescriptor, Set<PatchedUsage>>();
  createPatchDescriptor(patchedUsages, "g1", GroupDescriptor.HIGHER_PRIORITY, "k1", 1);
  createPatchDescriptor(patchedUsages, "g1", GroupDescriptor.HIGHER_PRIORITY, "k2", 2);

  final String veryLongGroupId = StringUtil.repeat("g", GroupDescriptor.MAX_ID_LENGTH);
  assertMapEquals(patchedUsages, ConvertUsagesUtil.convertString(veryLongGroupId + ":k1=1;g1:k1=1,k2=2;"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:StatisticsUploadAssistantTest.java

示例8: createPatchDescriptor

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
private static void createPatchDescriptor(Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages, String groupId, double priority, String key, int i) {
    final GroupDescriptor groupDescriptor = GroupDescriptor.create(groupId, priority);

    if (!patchedUsages.containsKey(groupDescriptor)){
        patchedUsages.put(groupDescriptor, new LinkedHashSet<PatchedUsage>());
    }
    patchedUsages.get(groupDescriptor).add(new PatchedUsage(key, i));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:StatisticsUploadAssistantTest.java

示例9: getStringPatch

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
@NotNull
public static String getStringPatch(@NotNull Set<String> disabledGroups,
                                    @NotNull Project[] projects,
                                    @NotNull SentUsagesPersistence usagesPersistence,
                                    int maxSize) {
    final Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = getPatchedUsages(disabledGroups, projects, usagesPersistence);

    return getStringPatch(patchedUsages, maxSize);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:StatisticsUploadAssistant.java

示例10: getPatchedUsages

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
@NotNull
public static Map<GroupDescriptor, Set<PatchedUsage>> getPatchedUsages(@NotNull Set<String> disabledGroups,
                                                                       @NotNull Project[] projects,
                                                                       @NotNull SentUsagesPersistence usagesPersistence) {
    Map<GroupDescriptor, Set<PatchedUsage>> usages = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();

    for (Project project : projects) {
        final Map<GroupDescriptor, Set<UsageDescriptor>> allUsages = getAllUsages(project, disabledGroups);
        final Map<GroupDescriptor, Set<UsageDescriptor>> sentUsages = filterDisabled(disabledGroups, usagesPersistence.getSentUsages());

        usages.putAll(getPatchedUsages(allUsages, sentUsages));
    }
    return usages;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:StatisticsUploadAssistant.java

示例11: mapToPatchedUsagesMap

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
private static Map<GroupDescriptor, Set<PatchedUsage>> mapToPatchedUsagesMap(Map<GroupDescriptor, Set<UsageDescriptor>> allUsages) {
    Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
    for (Map.Entry<GroupDescriptor, Set<UsageDescriptor>> entry : allUsages.entrySet()) {
        patchedUsages.put(entry.getKey(), new HashSet<PatchedUsage>(ContainerUtil.map2Set(entry.getValue(), new Function<UsageDescriptor, PatchedUsage>() {
            @Override
            public PatchedUsage fun(UsageDescriptor usageDescriptor) {
                return new PatchedUsage(usageDescriptor);
            }
        })));
    }
    return patchedUsages;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:StatisticsUploadAssistant.java

示例12: packCollection

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
@NotNull
private static Map<GroupDescriptor, Set<PatchedUsage>> packCollection(@NotNull Map<GroupDescriptor, Set<PatchedUsage>> patchedUsages, Condition<PatchedUsage> condition) {
    Map<GroupDescriptor, Set<PatchedUsage>> result = new LinkedHashMap<GroupDescriptor, Set<PatchedUsage>>();
    for (GroupDescriptor descriptor : patchedUsages.keySet()) {
        final Set<PatchedUsage> usages = packCollection(patchedUsages.get(descriptor), condition);
        if (usages.size() > 0) {
            result.put(descriptor, usages);
        }
    }

    return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:StatisticsUploadAssistant.java

示例13: testCreateNewPatch

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testCreateNewPatch() {
    final Map<GroupDescriptor, Set<UsageDescriptor>> all = createDescriptors("g:a1:1", "g:a2:2", "g:a3:3");
    final Map<GroupDescriptor, Set<UsageDescriptor>> sent = new HashMap<GroupDescriptor, Set<UsageDescriptor>>();

    final Map<GroupDescriptor, Set<PatchedUsage>> patched = StatisticsUploadAssistant.getPatchedUsages(all, sent);

    assertMapEquals(patched, createDescriptors("g:a1:1", "g:a2:2", "g:a3:3"));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:StatisticsUploadAssistantTest.java

示例14: testCreatePatchEmptyAll

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testCreatePatchEmptyAll() {
    final Map<GroupDescriptor, Set<UsageDescriptor>> all = new HashMap<GroupDescriptor, Set<UsageDescriptor>>();
    final Map<GroupDescriptor, Set<UsageDescriptor>> sent = createDescriptors("g:a1:1", "g:a2:2", "g2:a1:1", "g2:a2:2", "g2:a3:3");

    final Map<GroupDescriptor, Set<PatchedUsage>> patched = StatisticsUploadAssistant.getPatchedUsages(all, sent);

    assertMapEquals(patched, createDescriptors("g:a1:-1", "g2:a2:-2", "g2:a3:-3", "g:a2:-2", "g2:a1:-1"));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:StatisticsUploadAssistantTest.java

示例15: testCreatePatchMerged

import com.intellij.internal.statistic.beans.PatchedUsage; //导入依赖的package包/类
public void testCreatePatchMerged() {
    final Map<GroupDescriptor, Set<UsageDescriptor>> all = createDescriptors("g:a1:100", "g:a2:2", "g2:a1:0", "g2:a2:1");
    final Map<GroupDescriptor, Set<UsageDescriptor>> sent = createDescriptors("g:a1:2", "g:a2:100", "g2:a1:1", "g2:a2:1", "g2:a3:3");

    final Map<GroupDescriptor, Set<PatchedUsage>> patched = StatisticsUploadAssistant.getPatchedUsages(all, sent);

    assertMapEquals(patched, createDescriptors("g:a1:98", "g:a2:-98", "g2:a1:-1", "g2:a3:-3"));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:StatisticsUploadAssistantTest.java


注:本文中的com.intellij.internal.statistic.beans.PatchedUsage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。