當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。