⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nodearrayoper.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
package net.aetherial.gis.publicuse;

import org.w3c.dom.Node;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class NodeArrayOper {
  public NodeArrayOper() {
  }

  public static Node[] removeNode(Node ob, Node[] array) {
    if (array == null) {
      return null;
    }
    else {
      Node[] temp = null;
      for (int i = 0; i < array.length; i++) {
        if (ob != array[i]) {
          temp = addNode(array[i], temp);
        }
      }
      return temp;
    }
  }

  public static Node[] getleftNode(Node[] source, Node[] target) {
    if (source == null) {
      return target;
    }
    else {
      for (int i = 0; i < source.length; i++) {
        target = removeNode(source[i], target);
      }
    }
    return target;
  }

  public static Node[] addNode(Node ob, Node[] array) {
    if (array == null) {
      array = new Node[1];
      array[0] = ob;
      return array;
    }
    else {
      Node[] temp = new Node[array.length + 1];
      for (int i = 0; i < array.length; i++) {
        temp[i] = array[i];
      }
      temp[array.length] = ob;
      return temp;
    }
  }

  public static Node[] addNodeExceptSame(Node ob, Node[] array) {
    if (array == null) {
      array = new Node[1];
      array[0] = ob;
      return array;
    }
    else {
      boolean same = false;
      for (int i = 0; i < array.length; i++) {
        if (array[i] == ob) {
          same = true;
        }
      }
      if (!same) {
        Node[] temp = new Node[array.length + 1];
        for (int i = 0; i < array.length; i++) {
          temp[i] = array[i];
        }
        temp[array.length] = ob;
        return temp;
      }
      else {
        return array;
      }

    }
  }

  public static Node[] getSameNodes(Node[] array1, Node[] array2) {
    if (array1 == null || array2 == null) {
      return null;
    }
    boolean same = false;
    Node[] temp = null;
    for (int i = 0; i < array1.length; i++) {
      for (int j = 0; j < array2.length; j++) {
        if (array1[i] == array2[j]) {
          temp = addNodeExceptSame(array1[i], temp);
        }
      }
    }
    return temp;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -