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

x33g5p2x  于2022-01-24 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(186)

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

Node.equals介绍

[英]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.
[中]比较平等。对过滤器节点进行特殊处理。如果参数是FilterNode,那么如果该节点是其原始节点,则该节点可以与其相等。

代码示例

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

  1. /** Get the index of a node. Simply scans through the array returned by {@link #getNodes}.
  2. * @param node the node
  3. * @return the index, or <code>-1</code> if the node was not found
  4. */
  5. public int indexOf(final Node node) {
  6. Node[] arr = getNodes();
  7. for (int i = 0; i < arr.length; i++) {
  8. if (node.equals(arr[i])) {
  9. return i;
  10. }
  11. }
  12. return -1;
  13. }

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

  1. return left.equals(right);

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

  1. if (newNode.equals(oldNode)) {

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

  1. private int rowForNode(Node node) {
  2. for (int i = 0; i < nodeRows.length; i++) {
  3. if (node.equals(nodeRows[i])) {
  4. return i;
  5. }
  6. }
  7. return -1;
  8. }

代码示例来源:origin: stackoverflow.com

  1. for (final Node temp : edges.get(current)){
  2. if(temp.equals(node2)){
  3. return true;
  4. } else {
  5. stack.push(temp);
  6. }
  7. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-bugtracking-commons

  1. private int rowForNode(Node node) {
  2. for (int i = 0; i < nodeRows.length; i++) {
  3. if (node.equals(nodeRows[i])) {
  4. return i;
  5. }
  6. }
  7. return -1;
  8. }

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

  1. private int rowForNode(Node node) {
  2. for (int i = 0; i < nodeRows.length; i++) {
  3. if (node.equals(nodeRows[i]))
  4. return i;
  5. }
  6. return -1;
  7. }

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

  1. private int rowForNode(Node node) {
  2. for (int i = 0; i < nodeRows.length; i++) {
  3. if (node.equals(nodeRows[i]))
  4. return i;
  5. }
  6. return -1;
  7. }

代码示例来源:origin: stackoverflow.com

  1. @Override
  2. public int compare(Node n1, Node n2) {
  3. // TODO Auto-generated method stub
  4. if(n1.cost > n2.cost) return 1;
  5. else if(n1.cost < n2.cost) return -1;
  6. else return ( n1.equals(n2)? 0 : 1);
  7. }

代码示例来源:origin: stackoverflow.com

  1. for(int i=0; i<rootChildren.length; i++){
  2. Node rootChild = rootChildren[i];
  3. //see if the addChar1 already exists in the tree
  4. //if it doesn't
  5. if(!rootChild.equals(addChar1)){
  6. //add the addChar1 as a child of the root
  7. root.addChild(addChar1);
  8. }
  9. else{
  10. System.out.println(addChar1.getItem() + " Exists in the tree already");
  11. }

代码示例来源:origin: stackoverflow.com

  1. ArrayList<Node> tempList = new ArrayList<Node>();
  2. Node head = nodesAttachedTo.get(0); //get the head of the list
  3. tempList.add(head);
  4. Node runner = head;
  5. runner = runner.next;
  6. while (!runner.equals(head)) {
  7. tempList.add(runner);
  8. runner = runner.next;
  9. }

代码示例来源:origin: stackoverflow.com

  1. private HashMap<Source, ArrayList<Node>> sourceMap = new HashMap<Source, ArrayList<Node>>();
  2. private HashMap<Target, ArrayList<Node>> targetMap = new HashMap<Target, ArrayList<Node>>();
  3. private HashMap<Cost, ArrayList<Node>> costMap = new HashMap<Cost, ArrayList<Node>>();
  4. /** Look for a node with a given source */
  5. for( Node node : sourceMap.get(keySource) )
  6. {
  7. /** Test the node for equality with a given node. Equals method below */
  8. if(node.equals(nodeYouAreLookingFor) { return node; }
  9. }

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

  1. /** Checks whether given Node is a subnode of rootContext.
  2. * @return true if specified Node is under current rootContext
  3. */
  4. private boolean isUnderRoot(Node rootContext, Node node) {
  5. while (node != null) {
  6. if (node.equals(rootContext)) {
  7. return true;
  8. }
  9. node = node.getParentNode();
  10. }
  11. return false;
  12. }

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

  1. /** Checks whether given Node is a subnode of rootContext.
  2. * @return true if specified Node is under current rootContext
  3. */
  4. private boolean isUnderRoot(Node node) {
  5. while (node != null) {
  6. if (node.equals(rootContext)) return true;
  7. node = node.getParentNode();
  8. }
  9. return false;
  10. }

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

  1. /** Checks whether given Node is a subnode of rootContext.
  2. * @return true if specified Node is under current rootContext
  3. */
  4. private boolean isUnderRoot(Node node) {
  5. while (node != null) {
  6. if (node.equals(rootContext)) {
  7. return true;
  8. }
  9. node = node.getParentNode();
  10. }
  11. return false;
  12. }

代码示例来源:origin: stackoverflow.com

  1. private boolean treeCompare(Node firstNode, Node secondNode) {
  2. if (firstNode == secondNode)
  3. return true;
  4. if (firstNode == null || !firstNode.equals(secondNode))
  5. return false;
  6. return treeCompare(firstNode.left, secondNode.left) && treeCompare(firstNode.right, secondNode.right);
  7. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui

  1. private boolean isSelected(TestMethodNode testMethod, Node selected) {
  2. if (testMethod.equals(selected)) {
  3. return true;
  4. }
  5. for (Node node : testMethod.getChildren().getNodes()) {
  6. if (node.equals(selected)) {
  7. return true;
  8. }
  9. }
  10. return false;
  11. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates

  1. @Override
  2. protected void filterChildrenAdded (NodeMemberEvent ev) {
  3. super.filterChildrenAdded (ev);
  4. if (getTemplateRootNode ().equals (this.getNode ())) {
  5. sortNodes ();
  6. }
  7. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates

  1. @Override
  2. protected void addNotify () {
  3. super.addNotify ();
  4. if (getTemplateRootNode ().equals (this.getNode ())) {
  5. sortNodes ();
  6. }
  7. }

代码示例来源:origin: stackoverflow.com

  1. public int countPaths(Graph graph, Node u, Node v) {
  2. nodes = graph.getNodes();
  3. edges = new ArrayList<>(graph.getEdges());
  4. if (u.equals(v)) return 1;
  5. int count = 0;
  6. List<Edge> neighbours = u.getNeighbouringEdges(edges);
  7. for(Edge edge : neighbours){
  8. w = edge.getTo();
  9. count += countPaths(graph, w, v);
  10. }
  11. return count;
  12. }

相关文章