zoukankan      html  css  js  c++  java
  • 第二周星期一

    1、新增代码设计

    * FileName:FileIO.java
    * 处理文件的读写
    */
    public class FileIO {

    public static String READ_PATH; //读取路径
    public static String WRITE_PATH; //写入路径

    /**
    * 读取文件初始化地铁线路
    */
    public static void readSubway(List < Station > map) throws IOException {
    File readfile = new File(READ_PATH);
    BufferedReader reader = new BufferedReader(new FileReader(readfile));
    String tempString = null;
    while ((tempString = reader.readLine()) != null) {
    int trim = tempString.indexOf(' ');
    String lineNo = tempString.substring(0, trim);
    tempString = tempString.substring(trim + 1);
    String[] stations = tempString.split(" ");

    for (String s: stations) { //初始化站点
    Station test = new Station(s, lineNo); //要添加的车站
    if (map.contains(test)) { //已经有了
    int index = (map.indexOf(test));
    map.get(index).isInterchangeStation = true;
    map.get(index).line.add(lineNo);
    } else {
    map.add(test);
    }
    }

    for (int i = 0; i < stations.length; i++) { //添加相邻站点
    Station s = new Station(stations[i], lineNo);
    int index = (map.indexOf(s));
    if(stations.length==1) {
    break;
    }
    if (i == 0) {
    Station pres = new Station(stations[i + 1], lineNo);
    int preindex = (map.indexOf(pres));
    map.get(index).linkStations.add(map.get(preindex));
    } else if (i == stations.length - 1) {
    Station nexts = new Station(stations[i - 1], lineNo);
    int nextindex = (map.indexOf(nexts));
    map.get(index).linkStations.add(map.get(nextindex));
    } else {
    Station pres = new Station(stations[i + 1], lineNo);
    int preindex = (map.indexOf(pres));
    Station nexts = new Station(stations[i - 1], lineNo);
    int nextindex = (map.indexOf(nexts));
    map.get(index).linkStations.add(map.get(preindex));
    map.get(index).linkStations.add(map.get(nextindex));
    }
    }
    }
    reader.close();
    }

    2.计划明天继续完成第一个功能,实现地图文本的读入

    3.问题,之前没有见过实现读入的程序,设计,学习,查询询问过程比较艰难,进展缓慢。

  • 相关阅读:
    组件封装小试:使用Vue CLI3基于Element-ui进行组件封装
    <四>docker中的mysql和mongodb挂载
    <五>.netcore webapi连接部署在docker中的mysql
    <三>docker安装mysql
    <二>docker 安装mongodb
    <一>docker基础及centos安装docker
    <十一>将identityserver4的一些权限配置持久化到数据库
    <十>使用profileserver获取用户数据
    <九>集成ASP.NETCore Identity 作为授权账户持久到数据库
    <一>初试Identity
  • 原文地址:https://www.cnblogs.com/pekey/p/11414761.html
Copyright © 2011-2022 走看看