org.openide.nodes.FilterNode.equals()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.openide.nodes.FilterNode.equals()方法的一些代码示例,展示了FilterNode.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterNode.equals()方法的具体详情如下:
包路径:org.openide.nodes.FilterNode
类名称:FilterNode
方法名:equals

FilterNode.equals介绍

[英]Test equality of original nodes. Note that for subclasses of FilterNode, or filter nodes with non-default children, the test reverts to object identity. Note: if you wish that the Index cookie works correctly on filtered nodes and their subnodes, and you are subclassing FilterNode or using non-default children, you will probably want to override this method to test equality of the specified node with this filter node's original node; otherwise Move Up and Move Down actions may be disabled.

Note though that it is often better to provide your own index cookie from a filter node. Only then it is possible to change the number of children relative to the original. And in many cases this is easier anyway, as for example with DataFolder.Index for data folders.
[中]测试原始节点的相等性。请注意,对于FilterNode的子类或具有非默认子级的筛选器节点,测试将恢复为对象标识。注意:如果您希望索引cookie在筛选节点及其子节点上正常工作,并且您正在子类化FilterNode或使用非默认子节点,则可能需要重写此方法以测试指定节点与此筛选节点的原始节点的相等性;否则,可能会禁用上移和下移操作。
但请注意,通常最好从筛选器节点提供自己的索引cookie。只有这样,才有可能更改相对于原始的子对象的数量。在许多情况下,这无论如何都比较容易,例如数据文件夹的DataFolder.Index

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Compares for equality. Does special treatment of
 * FilterNodes. If argument is FilterNode then this node can be
 * equal with it if it is its original.
 *
 * @param obj object to compare
 * @return true if the obj is <code>==</code> or is filter node of this node
 */
@Override
public boolean equals(Object obj) {
  if (obj instanceof FilterNode) {
    return ((FilterNode) obj).equals(this);
  }
  return this == obj;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Compares for equaliness. Does special treatment of 
 * FilterNodes. If argument is FilterNode then this node can be
 * equal with it if it is its original.
 *
 * @param obj object to compare
 * @return true if the obj is <code>==</code> or is filter node of this node
 */
public boolean equals (Object obj) {
  if (obj instanceof FilterNode) {
    return ((FilterNode)obj).equals(this);
  }
  return this == obj;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Compares for equaliness. Does special treatment of 
 * FilterNodes. If argument is FilterNode then this node can be
 * equal with it if it is its original.
 *
 * @param obj object to compare
 * @return true if the obj is <code>==</code> or is filter node of this node
 */
public boolean equals (Object obj) {
  if (obj instanceof FilterNode) {
    return ((FilterNode)obj).equals(this);
  }
  return this == obj;
}

相关文章

微信公众号

最新文章

更多