📄 xzcstatistic.java
字号:
package net.aetherial.gis.our.allauto.create.xzc;
import java.util.Vector;
import net.aetherial.gis.table.WuWei;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class XzcStatistic {
private static Vector fileXzc = new Vector();
private static Vector arrayXzc = new Vector();
public XzcStatistic() {
}
public static void addXZC(FileXZC fileXzc) {
XzcStatistic.fileXzc.addElement(fileXzc);
}
public static void addArrayXZC(ArrayXZC arrayXzc) {
XzcStatistic.arrayXzc.addElement(arrayXzc);
}
public static void addArray(){
ArrayXZC temp = null;
WuWei ww = new WuWei();
for (int i = 0; i < ww.wuwei_cun.length; i++) {
temp = new ArrayXZC(ww.wuwei_cun[i],ww.wuchen_xiangzhen[i]);
addArrayXZC(temp);
}
}
public static long getArrayLength(){
return arrayXzc.size();
}
/**
* 比较分析
*/
public static void analyse() {
boolean find = false;
long arrayLength = arrayXzc.size();
long fileLength = fileXzc.size();
for (int i = 0; i < arrayLength; i++) {
find = false;
for (int j = 0; j < fileLength; j++) {
if (( (FileXZC) fileXzc.elementAt(j)).isSameAsArray( (ArrayXZC)
arrayXzc.elementAt(i))) {
fileXzc.removeElementAt(j);
fileLength = fileXzc.size();
find = true;
}
}
if (find) {
arrayXzc.removeElementAt(i);
arrayLength = arrayXzc.size();
}
}
}
public static void analyse2(){
Vector ve1 = new Vector();//fileXzc
Vector ve2 = new Vector();//arrayXzc
boolean find = false;
for (int i = 0; i < arrayXzc.size(); i++) {
find = false;
for (int j = 0; j < fileXzc.size(); j++) {
if (( (FileXZC) fileXzc.elementAt(j)).isSameAsArray( (ArrayXZC)
arrayXzc.elementAt(i))) {
ve1.add(j+"");
find = true;
}
}
if (find) {
ve2.add(i+"");
}
}
System.err.println("fileXzc:" + ve1.size() + ",arrayXzc:" + ve2.size());
for (int i = 0; i < ve1.size(); i++) {
for (int j = 0; j < ve1.size(); j++) {
if (i >= ve1.size()) {
break;
}
if (i != j) {
if ((ve1.elementAt(i)).equals(ve1.elementAt(j))) {
ve1.removeElementAt(j);
}
}
}
}
for (int i = 0; i < ve2.size(); i++) {
for (int j = 0; j < ve2.size(); j++) {
if (i != j) {
if (i >= ve2.size()) {
break;
}
if ((ve2.elementAt(i)).equals(ve2.elementAt(j))) {
ve2.removeElementAt(j);
}
}
}
}
System.err.println("fileXzc:" + ve1.size() + ",arrayXzc:" + ve2.size());
ve1 = paixu(ve1);
ve2 = paixu(ve2);
System.err.println("fileXzc:" + ve1.size() + ",arrayXzc:" + ve2.size());
int removed = 0;
for (int i = 0; i < ve1.size(); i++) {
fileXzc.removeElementAt(Integer.parseInt((String)(ve1.elementAt(i))) - removed);
removed ++;
}
removed = 0;
for (int i = 0; i < ve2.size(); i++) {
arrayXzc.removeElementAt(Integer.parseInt((String)(ve2.elementAt(i))) - removed);
removed ++;
}
}
private static Vector paixu(Vector ve){
Vector temp = new Vector();
int m = -1,n = -1;
for (int i = 0; i < ve.size(); i++) {
m = Integer.parseInt((String)(ve.elementAt(i)));
//寻找最小的
for (int j = 0; j < ve.size(); j++) {
n = Integer.parseInt((String)(ve.elementAt(j)));
if (m>n) {
m = n;
}
}
//将最小的删除掉
for (int j = 0; j < ve.size(); j++) {
n = Integer.parseInt((String)(ve.elementAt(j)));
if (m == n) {
ve.removeElementAt(j);
}
}
temp.add(m+"");
i--;
}
return temp;
}
/**
* 得到结果
*/
public static String getResult() {
ArrayXZC aXZC = null;
FileXZC fXZC = null;
String n = "", ln = "\r\n";
n = n + "***********************************************" + ln;
n = n + "表1中未测量到的行政村有" + arrayXzc.size() + "个:" + ln;
for (int i = 0; i < arrayXzc.size(); i++) {
aXZC = (ArrayXZC)arrayXzc.elementAt(i);
n = n + aXZC.getXiangzhenName() + "," + aXZC.getXzcName() + ln;
}
n = n + "" + ln;
n = n + "测量数据的行政村在表1中未发现的有" + fileXzc.size() + "个:" + ln;
for (int i = 0; i < fileXzc.size(); i++) {
fXZC = (FileXZC)fileXzc.elementAt(i);
n = n + fXZC.getFileName() + ",第" + fXZC.getPos()+ "个点," + fXZC.getXzcName() + ln;
}
n = n + "***********************************************" + ln;
n = n + "" + ln;
return n;
}
/**
* 清空
*/
public static void removeAll() {
fileXzc.removeAllElements();
arrayXzc.removeAllElements();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -