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


Java ComparatorUtil类代码示例

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


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

示例1: compareSuites

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
private int compareSuites(final SMTestProxy suite1,
                          final SMTestProxy suite2) {
  // Compare errors
  final int errors1 = suite1.getChildren(ProxyFilters.FILTER_ERRORS).size();
  final int errors2 = suite2.getChildren(ProxyFilters.FILTER_ERRORS).size();
  final int errorsComparison = ComparatorUtil.compareInt(errors1, errors2);
  // If not equal return it
  if (errorsComparison != 0) {
    return errorsComparison;
  }

  // Compare failures
  final int failures1 = suite1.getChildren(ProxyFilters.FILTER_FAILURES).size();
  final int failures2 = suite2.getChildren(ProxyFilters.FILTER_FAILURES).size();
  final int failuresComparison = ComparatorUtil.compareInt(failures1, failures2);
  // If not equal return it
  if (failuresComparison != 0) {
    return failuresComparison;
  }

  // otherwise check passed count
  final int passed1 = suite1.getChildren(ProxyFilters.FILTER_PASSED).size();
  final int passed2 = suite2.getChildren(ProxyFilters.FILTER_PASSED).size();

  return ComparatorUtil.compareInt(passed1, passed2);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ColumnResults.java

示例2: updateMarkActions

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
protected void updateMarkActions() {
  myEditingActionsGroup.removeAll();

  Set<ContentFolderTypeProvider> folders = ContentFoldersSupportUtil.getSupportedFolders(myState.getRootModel());
  ContentFolderTypeProvider[] supportedFolders = folders.toArray(new ContentFolderTypeProvider[folders.size()]);
  Arrays.sort(supportedFolders, new Comparator<ContentFolderTypeProvider>() {
    @Override
    public int compare(ContentFolderTypeProvider o1, ContentFolderTypeProvider o2) {
      return ComparatorUtil.compareInt(o1.getWeight(), o2.getWeight());
    }
  });
  for (ContentFolderTypeProvider contentFolderTypeProvider : supportedFolders) {
    ToggleFolderStateAction action = new ToggleFolderStateAction(myTree, this, contentFolderTypeProvider);
   /* CustomShortcutSet shortcutSet = editor.getMarkRootShortcutSet();
    if (shortcutSet != null) {
      action.registerCustomShortcutSet(shortcutSet, myTree);
    }     */
    myEditingActionsGroup.add(action);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ContentEntryTreeEditor.java

示例3: shouldUpdate

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
private static <T> boolean shouldUpdate(@NotNull JComboBox comboBox, @NotNull List<T> newItems) {
  int count = comboBox.getItemCount();
  if (newItems.size() != count) {
    return true;
  }
  for (int i = 0; i < count; i++) {
    Object oldItem = comboBox.getItemAt(i);
    T newItem = newItems.get(i);
    if (!ComparatorUtil.equalsNullable(oldItem, newItem)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SwingHelper.java

示例4: updateSelectedDeveloper

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
private void updateSelectedDeveloper() {
  myProcessEvents = false;

  Integer index = null;
  for (int i = 0; i < myAssigneeComboBox.getItemCount(); i++) {
    Developer developer = (Developer) myAssigneeComboBox.getItemAt(i);
    if (ComparatorUtil.equalsNullable(developer.getId(), myAssigneeId)) {
      index = i;
      break;
    }
  }
  setSelectedAssigneeIndex(index);

  myProcessEvents = true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DetailsTabForm.java

示例5: chooseJdk

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
@Nullable
public static Sdk chooseJdk(Collection<Module> modules) {
  List<Sdk> jdks = skipNulls(map(skipNulls(modules), MODULE_JDK));
  if (jdks.isEmpty()) {
    return null;
  }
  Collections.sort(jdks, ComparatorUtil.compareBy(JDK_VERSION, String.CASE_INSENSITIVE_ORDER));
  return jdks.get(jdks.size() - 1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PathUtilEx.java

示例6: isModified

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
public boolean isModified(AbstractPyCommonOptionsForm form) {
  return !ComparatorUtil.equalsNullable(mySdkHome, form.getSdkHome()) ||
         !myInterpreterOptions.equals(form.getInterpreterOptions()) ||
         !myEnvs.equals(form.getEnvs()) ||
         myUseModuleSdk != form.isUseModuleSdk() ||
         myAddContentRoots != form.shouldAddContentRoots() ||
         myAddSourceRoots != form.shouldAddSourceRoots()
         || !ComparatorUtil.equalsNullable(myModuleName, form.getModule() == null ? null : form.getModule().getName())
         || !myWorkingDirectory.equals(form.getWorkingDirectory())
         || !myMappings.equals(form.getMappingSettings());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyConsoleOptions.java

示例7: chooseJdk

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
public static Sdk chooseJdk(Collection<Module> modules) {
  List<Sdk> sdks = skipNulls(map(skipNulls(modules), MODULE_JDK));
  if (sdks.isEmpty()) {
    return null;
  }
  Collections.sort(sdks, ComparatorUtil.compareBy(SDK_VERSION, String.CASE_INSENSITIVE_ORDER));
  return sdks.get(sdks.size() - 1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PathUtilEx.java

示例8: activate

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
public void activate() {
  if (!myRunState) {
    start();
    if (!ComparatorUtil.equalsNullable(myContent, myDesigner.getEditorText()) || myDesigner.getRootComponent() == null) {
      myUpdateRenderer = false;
      addRequest();
    }
    myContent = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ExternalPSIChangeListener.java

示例9: getHashColor

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
@Override
protected Color getHashColor() {
  if (invertLineColor && !ComparatorUtil.equalsNullable(UIUtil.getTreeSelectionForeground(), UIUtil.getTreeForeground())) {
    final Color c = UIUtil.getTreeSelectionForeground();
    if (c != null) {
      return c.darker();
    }
  }
  return super.getHashColor();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:WideSelectionTreeUI.java

示例10: activate

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
public void activate() {
    if (!myRunState) {
        start();
        if (!ComparatorUtil.equalsNullable(myContent, myDesigner.getEditorText()) || myDesigner.getRootComponent() == null) {
            myUpdateRenderer = false;
            addRequest();
        }
        myContent = null;
    }
}
 
开发者ID:chrimm,项目名称:cordovastudio,代码行数:11,代码来源:ExternalPSIChangeListener.java

示例11: compareTests

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
private int compareTests(final SMTestProxy test1, final SMTestProxy test2) {
  // Rule1. For tests: NotRun < Ignored, etc < Passed < Failure < Error < Progress < Terminated

  final int weight1 = test1.getMagnitudeInfo().getSortWeight();
  final int weight2 = test2.getMagnitudeInfo().getSortWeight();

  return ComparatorUtil.compareInt(weight1, weight2);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:ColumnResults.java

示例12: equals

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;

  AnnotationConfig that = (AnnotationConfig) o;

  if (!ComparatorUtil.equalsNullable(myAnnotation, that.myAnnotation)) return false;
  if (!ComparatorUtil.equalsNullable(myElement, that.myElement)) return false;

  return true;
}
 
开发者ID:VladRassokhin,项目名称:intellij-tasks-navigate,代码行数:13,代码来源:AnnotationConfig.java

示例13: getLeastUpperBound

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
@Nullable
public static PsiType getLeastUpperBound(@NotNull PsiType type1, @NotNull PsiType type2, PsiManager manager) {
  if (type1 instanceof GrTupleType && type2 instanceof GrTupleType) {
    GrTupleType tuple1 = (GrTupleType)type1;
    GrTupleType tuple2 = (GrTupleType)type2;
    PsiType[] components1 = tuple1.getComponentTypes();
    PsiType[] components2 = tuple2.getComponentTypes();

    if (components1.length == 0) return genNewListBy(type2, manager);
    if (components2.length == 0) return genNewListBy(type1, manager);

    PsiType[] components3 = PsiType.createArray(Math.min(components1.length, components2.length));
    for (int i = 0; i < components3.length; i++) {
      PsiType c1 = components1[i];
      PsiType c2 = components2[i];
      if (c1 == null || c2 == null) {
        components3[i] = null;
      }
      else {
        components3[i] = getLeastUpperBound(c1, c2, manager);
      }
    }
    return new GrImmediateTupleType(components3, JavaPsiFacade.getInstance(manager.getProject()), tuple1.getScope().intersectWith(tuple2.getResolveScope()));
  }
  else if (checkEmptyListAndList(type1, type2)) {
    return genNewListBy(type2, manager);
  }
  else if (checkEmptyListAndList(type2, type1)) {
    return genNewListBy(type1, manager);
  }
  else if (type1 instanceof GrMapType && type2 instanceof GrMapType) {
    return GrMapType.merge(((GrMapType)type1), ((GrMapType)type2));
  }
  else if (checkEmptyMapAndMap(type1, type2)) {
    return genNewMapBy(type2, manager);
  }
  else if (checkEmptyMapAndMap(type2, type1)) {
    return genNewMapBy(type1, manager);
  }
  else if (type1 instanceof GrClosureType && type2 instanceof GrClosureType) {
    GrClosureType clType1 = (GrClosureType)type1;
    GrClosureType clType2 = (GrClosureType)type2;
    GrSignature signature1 = clType1.getSignature();
    GrSignature signature2 = clType2.getSignature();

    if (signature1 instanceof GrClosureSignature && signature2 instanceof GrClosureSignature) {
      if (((GrClosureSignature)signature1).getParameterCount() == ((GrClosureSignature)signature2).getParameterCount()) {
        final GrClosureSignature signature = GrImmediateClosureSignatureImpl.getLeastUpperBound(((GrClosureSignature)signature1),
                                                                                                ((GrClosureSignature)signature2), manager);
        if (signature != null) {
          GlobalSearchScope scope = clType1.getResolveScope().intersectWith(clType2.getResolveScope());
          final LanguageLevel languageLevel = ComparatorUtil.max(clType1.getLanguageLevel(), clType2.getLanguageLevel());
          return GrClosureType.create(signature, scope, JavaPsiFacade.getInstance(manager.getProject()), languageLevel, true);
        }
      }
    }
  }
  else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(getQualifiedName(type1)) &&
           CommonClassNames.JAVA_LANG_STRING.equals(getQualifiedName(type2))) {
    return type2;
  }
  else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(getQualifiedName(type2)) &&
           CommonClassNames.JAVA_LANG_STRING.equals(getQualifiedName(type1))) {
    return type1;
  }
  return GenericsUtil.getLeastUpperBound(type1, type2, manager);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:68,代码来源:TypesUtil.java

示例14: getLeastUpperBound

import com.intellij.util.containers.ComparatorUtil; //导入依赖的package包/类
@Nullable
public static PsiType getLeastUpperBound(@NotNull PsiType type1, @NotNull PsiType type2, PsiManager manager) {
  if (type1 instanceof GrTupleType && type2 instanceof GrTupleType) {
    GrTupleType tuple1 = (GrTupleType)type1;
    GrTupleType tuple2 = (GrTupleType)type2;
    PsiType[] components1 = tuple1.getComponentTypes();
    PsiType[] components2 = tuple2.getComponentTypes();

    if (components1.length == 0) return genNewListBy(type2, manager);
    if (components2.length == 0) return genNewListBy(type1, manager);

    PsiType[] components3 = new PsiType[Math.min(components1.length, components2.length)];
    for (int i = 0; i < components3.length; i++) {
      PsiType c1 = components1[i];
      PsiType c2 = components2[i];
      if (c1 == null || c2 == null) {
        components3[i] = null;
      }
      else {
        components3[i] = getLeastUpperBound(c1, c2, manager);
      }
    }
    return new GrTupleType(components3, JavaPsiFacade.getInstance(manager.getProject()),
                           tuple1.getScope().intersectWith(tuple2.getResolveScope()));
  }
  else if (checkEmptyListAndList(type1, type2)) {
    return genNewListBy(type2, manager);
  }
  else if (checkEmptyListAndList(type2, type1)) {
    return genNewListBy(type1, manager);
  }
  else if (type1 instanceof GrMapType && type2 instanceof GrMapType) {
    return GrMapType.merge(((GrMapType)type1), ((GrMapType)type2));
  }
  else if (checkEmptyMapAndMap(type1, type2)) {
    return genNewMapBy(type2, manager);
  }
  else if (checkEmptyMapAndMap(type2, type1)) {
    return genNewMapBy(type1, manager);
  }
  else if (type1 instanceof GrClosureType && type2 instanceof GrClosureType) {
    GrClosureType clType1 = (GrClosureType)type1;
    GrClosureType clType2 = (GrClosureType)type2;
    GrSignature signature1 = clType1.getSignature();
    GrSignature signature2 = clType2.getSignature();

    if (signature1 instanceof GrClosureSignature && signature2 instanceof GrClosureSignature) {
      if (((GrClosureSignature)signature1).getParameterCount() == ((GrClosureSignature)signature2).getParameterCount()) {
        final GrClosureSignature signature = GrClosureSignatureImpl.getLeastUpperBound(((GrClosureSignature)signature1),
                                                                                       ((GrClosureSignature)signature2), manager);
        if (signature != null) {
          GlobalSearchScope scope = clType1.getResolveScope().intersectWith(clType2.getResolveScope());
          final LanguageLevel languageLevel = ComparatorUtil.max(clType1.getLanguageLevel(), clType2.getLanguageLevel());
          return GrClosureType.create(signature, scope, JavaPsiFacade.getInstance(manager.getProject()), languageLevel, true);
        }
      }
    }
  }
  else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(type1.getCanonicalText()) &&
           CommonClassNames.JAVA_LANG_STRING.equals(type2.getInternalCanonicalText())) {
    return type2;
  }
  else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(type2.getCanonicalText()) &&
           CommonClassNames.JAVA_LANG_STRING.equals(type1.getInternalCanonicalText())) {
    return type1;
  }
  final PsiType result = getLeastUpperBoundForNumericType(type1, type2);
  if (result != null) return result;
  return GenericsUtil.getLeastUpperBound(type1, type2, manager);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:71,代码来源:TypesUtil.java


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