Package cputils

Examples of cputils.XmlUtils


    everyPos();
  }

  public static List<String> everyPos() {
    List<String> resList = new ArrayList<String>();
    XmlUtils utils = new XmlUtils();
    Map<Integer, Map<Integer, Integer>> posMap = new HashMap<Integer, Map<Integer, Integer>>();

    Map<Integer, Integer> dataMap1 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap2 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap3 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap4 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap5 = new HashMap<Integer, Integer>();

    Map<Integer, Integer> first2 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first3 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first4 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first5 = new HashMap<Integer, Integer>();
    for (int i = 0; i <= 9; i++) {
      first2.put(i, 0);
      first3.put(i, 0);
      first4.put(i, 0);
      first5.put(i, 0);
      dataMap1.put(i, 0);
      dataMap2.put(i, 0);
      dataMap3.put(i, 0);
      dataMap4.put(i, 0);
      dataMap5.put(i, 0);
    }

    List<DataItem> list = new ArrayList<DataItem>();
    try {
      Document root = utils.getDocumentComm(Config.DATA_FILE_PATH + "ssc.xml");
      Element rootEl = root.getRootElement();
      Iterator<Element> it = rootEl.elementIterator();
      Element el;
      DataItem item1;
      while (it.hasNext()) {
View Full Code Here


    everyPos("ssq");
  }

  public static List<String> everyPos(String type) {
    List<String> resList = new ArrayList<String>();
    XmlUtils utils = new XmlUtils();
    int bMax = 33, bSize = 6, aMax = 16;
    if ("dlt".equals(type)) {
      bMax = 35;
      bSize = 5;
      aMax = 12;
    }
    Map<Integer, Map<Integer, Integer>> posMap = new HashMap<Integer, Map<Integer, Integer>>();
   
    Map<Integer, Integer> dataMap1 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap2 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap3 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap4 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap5 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap6 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> dataMap7 = new HashMap<Integer, Integer>();
   
    Map<Integer, Integer> first2 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first3 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first4 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first5 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first6 = new HashMap<Integer, Integer>();
    Map<Integer, Integer> first7 = new HashMap<Integer, Integer>();
    for (int i = 1; i <= bMax; i++) {
      first2.put(i, 0);
      first3.put(i, 0);
      first4.put(i, 0);
      first5.put(i, 0);
      dataMap1.put(i, 0);
      dataMap2.put(i, 0);
      dataMap3.put(i, 0);
      dataMap4.put(i, 0);
      dataMap5.put(i, 0);
      if (bSize == 6) {
        dataMap6.put(i, 0);
        first6.put(i, 0);
      }
    }
    for (int i = 1; i <= aMax; i++) {
      if (bSize == 5) {
        dataMap6.put(i, 0);
        first6.put(i, 0);
      }
      dataMap7.put(i, 0);
      first7.put(i, 0);
    }
    List<DataItem> list = null;
    try {
      list = utils.list(type);
      System.out.println("all size:"+list.size());
      for (DataItem item : list) {
        String[] codeArr = item.getOpencode().split(" ");
        Integer[] intCodeArr = new Integer[codeArr.length];
        for (int i = 0; i < codeArr.length; i++) {
          intCodeArr[i] = Integer.parseInt(codeArr[i]);
        }
       
        addMapData(dataMap1,intCodeArr[0]);
        addMapData(dataMap2,intCodeArr[1]);
        addMapData(dataMap3,intCodeArr[2]);
        addMapData(dataMap4,intCodeArr[3]);
        addMapData(dataMap5,intCodeArr[4]);
        addMapData(dataMap6,intCodeArr[5]);
        addMapData(dataMap7,intCodeArr[6]);
       
        addMapData(first2,intCodeArr[0]);
        addMapData(first2,intCodeArr[1]);
       
        addMapData(first3,intCodeArr[0]);
        addMapData(first3,intCodeArr[1]);
        addMapData(first3,intCodeArr[2]);
       
        addMapData(first4,intCodeArr[0]);
        addMapData(first4,intCodeArr[1]);
        addMapData(first4,intCodeArr[2]);
        addMapData(first4,intCodeArr[3]);
       
        addMapData(first5,intCodeArr[0]);
        addMapData(first5,intCodeArr[1]);
        addMapData(first5,intCodeArr[2]);
        addMapData(first5,intCodeArr[3]);
        addMapData(first5,intCodeArr[4]);
       
        if (bSize == 6) {
          addMapData(first6,intCodeArr[0]);
          addMapData(first6,intCodeArr[1]);
          addMapData(first6,intCodeArr[2]);
          addMapData(first6,intCodeArr[3]);
          addMapData(first6,intCodeArr[4]);
          addMapData(first6,intCodeArr[5]);
        }
       
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    posMap.put(1, XmlUtils.makeSortedMap(dataMap1));
    posMap.put(2, XmlUtils.makeSortedMap(dataMap2));
    posMap.put(3, XmlUtils.makeSortedMap(dataMap3));
    posMap.put(4, XmlUtils.makeSortedMap(dataMap4));
    posMap.put(5, XmlUtils.makeSortedMap(dataMap5));
    posMap.put(6, XmlUtils.makeSortedMap(dataMap6));
    posMap.put(7, XmlUtils.makeSortedMap(dataMap7));
    System.out.println("/*****************every position**********************/");
    for (Entry<Integer, Map<Integer, Integer>> tem : posMap.entrySet()) {
      System.out.println(tem.getKey() + ": " + tem.getValue());
    }
    //First two
    System.out.println("/*****************first2 3 4 5 6 7 position**********************/");
    System.out.println("first2:"+XmlUtils.makeSortedMap(first2));
    System.out.println("first3:"+XmlUtils.makeSortedMap(first3));
    System.out.println("first4:"+XmlUtils.makeSortedMap(first4));
    System.out.println("first5:"+XmlUtils.makeSortedMap(first5));
    System.out.println("first6:"+XmlUtils.makeSortedMap(first6));
    System.out.println("first7:"+XmlUtils.makeSortedMap(first7));
   
    System.out.println("/*****************all position**********************/");
    try {
      Map<String, Map<Integer, Integer>> all = utils.stat(type);
      for (Entry<String, Map<Integer, Integer>> tem : all.entrySet()) {
        System.out.println(tem.getKey() + ": " + tem.getValue());
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

  public static String[] game = {"SSQ","DLT"};
  public static String[] gameNo = {"101","201"};
  public static List<String> issueList = null;
 
  public static void main(String[] args) {
    XmlUtils utils = new XmlUtils();
    CPHMTBService service = new CPHMTBService();
    Calendar c = Calendar.getInstance();
    //c.setTime(new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-16"));
    int week = c.get(Calendar.DAY_OF_WEEK);
    String game = "DLT";
    String gameNo = "201";
    if (week == 1 || week == 3 || week == 5) {
      game = "SSQ";
      gameNo = "101";
    }
    Map<String, Object> infomMap = service.lastIssuoInfo(game);
    issueList = (List<String>) infomMap.get("issueList");
    help();
    String onsaleIssueNo = (String) infomMap.get("onsaleIssueNo");
    System.out.println(new SimpleDateFormat("yyyy-MM-dd E").format(c.getTime())
        +" "+game+" onsaleIssueNo:"+onsaleIssueNo);
    while(true){
      System.out.print("Input keyword:");
      Scanner sca = new Scanner(System.in)
      String queryStr = sca.next();
      if ("0".equals(queryStr)) {
        System.exit(0);
      }else if("1".equals(queryStr)) {
       
      }else {
        System.out.println(queryStr);
        String[] con = queryStr.split("-");
        if (con.length != 2) {
          continue;
        }
        game = con[0];
        onsaleIssueNo = con[1];
        Class<?> class1 = utils.getClass();
        try {
          class1.getMethod("import"+game+"Data", Integer.class,Integer.class).invoke(utils, 0,Integer.parseInt(onsaleIssueNo));
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of cputils.XmlUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.