本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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;");
}
示例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;");
}
示例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;"));
}
示例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;"));
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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"));
}
示例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"));
}
示例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"));
}