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

📄 zonghe.java

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

import net.aetherial.gis.our.duibi.data.AllRoad;
import java.io.File;
import net.aetherial.gis.surface.CreateFile;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class Zonghe {
  private String lcTJ = "";
  private double xianLicheng = 0.0;
  private String shixian = "";
  public Zonghe() {
  }

  private void addData(){
    (new ReadXiandao()).addXianDao();
    new ReadXiangDao().addXianDao();
  }

  private boolean isShixianChenged(String shixian1){
    if (this.shixian.equals("")) {
      this.shixian = shixian1;
      return false;
    }else if (!this.shixian.equals(shixian1)) {
      this.shixian = shixian1;
      return true;
    }else{
      return false;
    }
  }

  private void countLicheng(String shi,String xian ,double lc){
//    if (isShixianChenged(shi + xian)) {
//      lcTJ = lcTJ + shi + "\t" + xian + "\t" + xianLicheng + "\r\n";
//      xianLicheng = 0.0;
//    }
    xianLicheng = lc+ xianLicheng;
  }

  public String getRightString(String filename) {
    String n = "";
    ReadResultFile rf = new ReadResultFile(filename);
    double tlc = 0.0;
    while (true) {
      rf.moveNext();
      if (rf.isEmptyrow()) {
        break;
      }else{
        /**
         * 得到正确的路线里程数据
         */
        if (rf.getBianma().trim().equals("")) {
          n = n +rf.getXian() +"\t"+ rf.getBianma()+ "\t"+" "+"\r\n";
        }else{
          tlc = AllRoad.getGljRightLicheng(rf.getShi(),rf.getXian(),rf.getBianma());
          if (tlc>0) {
            this.countLicheng(rf.getShi(),rf.getXian(),tlc);
          }else{
            System.out.println(rf.getShi() + " , " + rf.getXian() + " : " +  tlc);
          }
          n = n +rf.getXian() +"\t"+ rf.getBianma()+ "\t"+ tlc +"\r\n";
        }
      }
    }
    lcTJ = this.xianLicheng+"";
    return n.replaceAll("\t\t \r\n\t\t \r\n\t\t \r\n\t\t \r\n","");
  }

  public void createFile(String message,String file){
    CreateFile cf = new CreateFile(new File(file));
    cf.setEncode("GB2312");
    cf.memoryToFile(message);

  }
  public void resetLicheng(){
    this.xianLicheng = 0;
  }
  public double getlicheng(){
    return this.xianLicheng;
  }
  public static void main(String args[]){
    String n = "";
    File direct = new File("E:\\temp\\data");
    Zonghe zh = new Zonghe();
    zh.addData();
    File[] f = direct.listFiles();
    for (int i = 0; i < f.length; i++) {
      zh.createFile(zh.getRightString(f[i].getAbsolutePath()),"E:\\temp\\create\\" + f[i].getName().replaceAll(".xls","")+".txt");
      n = n +f[i].getName() +"\t" +zh.getlicheng() + "\r\n";
      zh.resetLicheng();
    }

    zh.createFile(n,"E:\\temp\\create\\licheng.txt");
  }

}

⌨️ 快捷键说明

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