• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Equality类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: NamedItemsListEditor

import gnu.trove.Equality; //导入依赖的package包/类
protected NamedItemsListEditor(Namer<T> namer,
                               Factory<T> factory,
                               Cloner<T> cloner,
                               Equality<T> comparer,
                               List<T> items,
                               boolean initInConstructor) {
    myNamer = namer;
    myFactory = factory;
    myCloner = cloner;
    myComparer = comparer;

    myOriginalItems = items;
    myResultItems = items;
    if (initInConstructor) {
      reset();
      initTree();
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:NamedItemsListEditor.java


示例2: install

import gnu.trove.Equality; //导入依赖的package包/类
public static TreeExpansionMonitor<DefaultMutableTreeNode> install(final JTree tree, final Equality<DefaultMutableTreeNode> equality) {
  return new TreeExpansionMonitor<DefaultMutableTreeNode>(tree) {
    protected TreePath findPathByNode(final DefaultMutableTreeNode node) {
      Enumeration enumeration = ((DefaultMutableTreeNode)tree.getModel().getRoot()).breadthFirstEnumeration();
      while (enumeration.hasMoreElements()) {
        final Object nextElement = enumeration.nextElement();
        if (nextElement instanceof DefaultMutableTreeNode) {
          DefaultMutableTreeNode child = (DefaultMutableTreeNode)nextElement;
          if (equality.equals(child, node)) {
            return new TreePath(child.getPath());
          }
        }
      }
      return null;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TreeExpansionMonitor.java


示例3: equals

import gnu.trove.Equality; //导入依赖的package包/类
@Contract(pure=true)
public static <T> boolean equals(@NotNull T[] a1, @NotNull T[] a2, @NotNull Equality<? super T> comparator) {
  if (a1 == a2) {
    return true;
  }

  int length = a2.length;
  if (a1.length != length) {
    return false;
  }

  for (int i = 0; i < length; i++) {
    if (!comparator.equals(a1[i], a2[i])) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ArrayUtil.java


示例4: offerIfAbsent

import gnu.trove.Equality; //导入依赖的package包/类
public boolean offerIfAbsent(@NotNull final T thing, @NotNull final Equality<T> equality) {
  boolean absent;
  synchronized (myQueue) {
    absent = myQueue.process(new Processor<T>() {
      @Override
      public boolean process(T t) {
        return !equality.equals(t, thing);
      }
    });
    if (absent) {
      myQueue.addLast(thing);
      scheduleUpdate();
    }
  }
  return absent;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:TransferToEDTQueue.java


示例5: equals

import gnu.trove.Equality; //导入依赖的package包/类
public static <T> boolean equals(T[] a1, T[] a2, @NotNull Equality<? super T> comparator) {
  if (a1 == a2) {
    return true;
  }
  if (a1 == null || a2 == null) {
    return false;
  }

  int length = a2.length;
  if (a1.length != length) {
    return false;
  }

  for (int i = 0; i < length; i++) {
    if (!comparator.equals(a1[i], a2[i])) {
      return false;
    }
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ArrayUtil.java


示例6: equals

import gnu.trove.Equality; //导入依赖的package包/类
@Contract(pure=true)
public static <T> boolean equals(@Nonnull T[] a1, @Nonnull T[] a2, @Nonnull Equality<? super T> comparator) {
  //noinspection ArrayEquality
  if (a1 == a2) {
    return true;
  }

  int length = a2.length;
  if (a1.length != length) {
    return false;
  }

  for (int i = 0; i < length; i++) {
    if (!comparator.equals(a1[i], a2[i])) {
      return false;
    }
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:ArrayUtil.java


示例7: RangeIterator

import gnu.trove.Equality; //导入依赖的package包/类
public RangeIterator(Gaps foldingModel, Equality<TextAttributes> equality,
                     HighlighterIterator source, Condition<TextAttributes> filter) {
  mySource = source;
  myGaps = foldingModel;
  myEquality = equality;
  myFilter = filter;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RangeIterator.java


示例8: testExtractWords

import gnu.trove.Equality; //导入依赖的package包/类
public void testExtractWords() {
  String text = "a b, c.d\n\n  x\n y";
  Word[] words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.setEquality(new Equality() {
    @Override
    public boolean equals(Object o1, Object o2) {
      Word word1 = (Word)o1;
      Word word2 = (Word)o2;
      return word1.getStart() == word2.getStart() && word1.getEnd() == word2.getEnd();
    }
  });
  CHECK.setStringConvertion(StringConvertion.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 0)),
                              new Word(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(2, 3)),
                              new Word(text, new TextRange(5, 6)),
                              new Word(text, new TextRange(7, 8)),
                              new Formatting(text, new TextRange(8, 12)),
                              new Word(text, new TextRange(12, 13)),
                              new Formatting(text, new TextRange(13, 15)),
                              new Word(text, new TextRange(15, 16))}, words);
  text = " b c";
  words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(1, 2)),
                              new Word(text, new TextRange(3, 4))}, words);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ByWordTest.java


示例9: createIterator

import gnu.trove.Equality; //导入依赖的package包/类
private RangeIterator createIterator(Equality equality, int[] starts, int[] ends, RangeIterator.Gaps gaps) {
  RangeIterator iterator = new RangeIterator(gaps, equality,
                                             new MyHighlighterIterator(starts, ends), ANY);
  iterator.init(new TextRange(0, Integer.MAX_VALUE));
  iterator.advance();
  return iterator;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RangeIteratorTest.java


示例10: offerIfAbsent

import gnu.trove.Equality; //导入依赖的package包/类
public boolean offerIfAbsent(@NotNull final T thing, @NotNull final Equality<T> equality) {
  synchronized (myQueue) {
    boolean absent = myQueue.process(new Processor<T>() {
      @Override
      public boolean process(T t) {
        return !equality.equals(t, thing);
      }
    });
    if (absent) {
      myQueue.addLast(thing);
      scheduleUpdate();
    }
    return absent;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:TransferToEDTQueue.java


示例11: indexOf

import gnu.trove.Equality; //导入依赖的package包/类
@Contract(pure=true)
public static <T> int indexOf(@NotNull List<T> objects, T object, @NotNull Equality<T> comparator) {
  for (int i = 0; i < objects.size(); i++) {
    if (comparator.equals(objects.get(i), object)) return i;
  }
  return -1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ArrayUtil.java


示例12: lastIndexOf

import gnu.trove.Equality; //导入依赖的package包/类
@Contract(pure=true)
public static <T> int lastIndexOf(@NotNull final T[] src, final T obj, @NotNull Equality<? super T> comparator) {
  for (int i = src.length - 1; i >= 0; i--) {
    final T o = src[i];
    if (comparator.equals(obj, o)) {
      return i;
    }
  }
  return -1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ArrayUtil.java


示例13: mergeDescriptors

import gnu.trove.Equality; //导入依赖的package包/类
@NotNull
private static CommonProblemDescriptor[] mergeDescriptors(@NotNull CommonProblemDescriptor[] problems1,
                                                          @NotNull CommonProblemDescriptor[] problems2) {
  CommonProblemDescriptor[] out = new CommonProblemDescriptor[problems1.length + problems2.length];
  int o = problems1.length;
  Equality<CommonProblemDescriptor> equality = new Equality<CommonProblemDescriptor>() {
    @Override
    public boolean equals(CommonProblemDescriptor o1, CommonProblemDescriptor o2) {
      if (o1 instanceof ProblemDescriptor) {
        ProblemDescriptorBase p1 = (ProblemDescriptorBase)o1;
        ProblemDescriptorBase p2 = (ProblemDescriptorBase)o2;
        if (!Comparing.equal(p1.getDescriptionTemplate(), p2.getDescriptionTemplate())) return false;
        if (!Comparing.equal(p1.getTextRange(), p2.getTextRange())) return false;
        if (!Comparing.equal(p1.getHighlightType(), p2.getHighlightType())) return false;
        if (!Comparing.equal(p1.getProblemGroup(), p2.getProblemGroup())) return false;
        if (!Comparing.equal(p1.getStartElement(), p2.getStartElement())) return false;
        if (!Comparing.equal(p1.getEndElement(), p2.getEndElement())) return false;
      }
      else {
        if (!o1.toString().equals(o2.toString())) return false;
      }
      return true;
    }
  };
  for (CommonProblemDescriptor descriptor : problems2) {
    if (ArrayUtil.indexOf(problems1, descriptor, equality) == -1) {
      out[o++] = descriptor;
    }
  }
  System.arraycopy(problems1, 0, out, 0, problems1.length);
  return Arrays.copyOfRange(out, 0, o);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:DefaultInspectionToolPresentation.java


示例14: assertEquals

import gnu.trove.Equality; //导入依赖的package包/类
public void assertEquals(String[][] expected) {
  String[][] actual = myResults.toArray(new String[myResults.size()][]);
  boolean equals = ArrayUtil.equals(actual, expected, new Equality<String[]>() {
    public boolean equals(String[] o1, String[] o2) {
      return Arrays.equals(o1, o2);
    }
  });

  StringBuilder message = new StringBuilder("Expected: ");
  toString(expected, message);
  message.append("\nActual: ");
  toString(actual, message);
  Assert.assertTrue(message.toString(), equals);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:15,代码来源:ConsumeInPartsTest.java


示例15: getMergeType

import gnu.trove.Equality; //导入依赖的package包/类
@Nonnull
public static MergeConflictType getMergeType(@Nonnull Condition<ThreeSide> emptiness,
                                             @Nonnull Equality<ThreeSide> equality) {
  boolean isLeftEmpty = emptiness.value(ThreeSide.LEFT);
  boolean isBaseEmpty = emptiness.value(ThreeSide.BASE);
  boolean isRightEmpty = emptiness.value(ThreeSide.RIGHT);
  assert !isLeftEmpty || !isBaseEmpty || !isRightEmpty;

  if (isBaseEmpty) {
    if (isLeftEmpty) { // --=
      return new MergeConflictType(TextDiffType.INSERTED, false, true);
    }
    else if (isRightEmpty) { // =--
      return new MergeConflictType(TextDiffType.INSERTED, true, false);
    }
    else { // =-=
      boolean equalModifications = equality.equals(ThreeSide.LEFT, ThreeSide.RIGHT);
      return new MergeConflictType(equalModifications ? TextDiffType.INSERTED : TextDiffType.CONFLICT);
    }
  }
  else {
    if (isLeftEmpty && isRightEmpty) { // -=-
      return new MergeConflictType(TextDiffType.DELETED);
    }
    else { // -==, ==-, ===
      boolean unchangedLeft = equality.equals(ThreeSide.BASE, ThreeSide.LEFT);
      boolean unchangedRight = equality.equals(ThreeSide.BASE, ThreeSide.RIGHT);
      assert !unchangedLeft || !unchangedRight;

      if (unchangedLeft) return new MergeConflictType(isRightEmpty ? TextDiffType.DELETED : TextDiffType.MODIFIED, false, true);
      if (unchangedRight) return new MergeConflictType(isLeftEmpty ? TextDiffType.DELETED : TextDiffType.MODIFIED, true, false);

      boolean equalModifications = equality.equals(ThreeSide.LEFT, ThreeSide.RIGHT);
      return new MergeConflictType(equalModifications ? TextDiffType.MODIFIED : TextDiffType.CONFLICT);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:38,代码来源:DiffUtil.java


示例16: offerIfAbsent

import gnu.trove.Equality; //导入依赖的package包/类
public boolean offerIfAbsent(@Nonnull final T thing, @Nonnull final Equality<T> equality) {
  synchronized (myQueue) {
    boolean absent = myQueue.process(new Processor<T>() {
      @Override
      public boolean process(T t) {
        return !equality.equals(t, thing);
      }
    });
    if (absent) {
      myQueue.addLast(thing);
      scheduleUpdate();
    }
    return absent;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:TransferToEDTQueue.java


示例17: indexOf

import gnu.trove.Equality; //导入依赖的package包/类
@Contract(pure=true)
public static <T> int indexOf(@Nonnull List<T> objects, T object, @Nonnull Equality<T> comparator) {
  for (int i = 0; i < objects.size(); i++) {
    if (comparator.equals(objects.get(i), object)) return i;
  }
  return -1;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:ArrayUtil.java


示例18: lastIndexOf

import gnu.trove.Equality; //导入依赖的package包/类
@Contract(pure=true)
public static <T> int lastIndexOf(@Nonnull final T[] src, final T obj, @Nonnull Equality<? super T> comparator) {
  for (int i = src.length - 1; i >= 0; i--) {
    final T o = src[i];
    if (comparator.equals(obj, o)) {
      return i;
    }
  }
  return -1;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:ArrayUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PsiSuperMethodImplUtil类代码示例发布时间:2022-05-22
下一篇:
Java IWorkingCopyManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap