Examples of XMLUtils


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

Examples of cputils.XmlUtils

    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

Examples of cputils.XmlUtils

  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

Examples of jmt.framework.xml.XMLUtils

 
  private JSimLogger logger = JSimLogger.getLogger(SolverClient.class);

  public SolverClient(Frame owner) {
    solver = new SolverDispatcher();
    xmlUtils = new XMLUtils();
    this.owner = owner;
  }
View Full Code Here

Examples of jmt.framework.xml.XMLUtils

  private ExactModel model;
 
  public boolean loadModel(File xmlFile) throws SolverException {
    model = new ExactModel();
    try {
      XMLUtils xmlUtils = new XMLUtils();
      if (!model.loadDocument(xmlUtils.loadXML(xmlFile))) {
        fail("Error loading model from tempfile", null);
      }
      return true;
    } catch (SAXException e) {
      fail("XML parse error in tempfile", e);
View Full Code Here

Examples of jmt.framework.xml.XMLUtils

  private XMLUtils xmlUtils;
  /** Used to notify when a computation ends */
  private SolverListener listener;

  public SolverDispatcher() {
    xmlUtils = new XMLUtils();
  }
View Full Code Here

Examples of jmt.framework.xml.XMLUtils

    /*********************SIM DEFINITION MODEL*********************/

    //Loads ExactModel and transforms it to CommonModel
    ExactModel exact = new ExactModel();
    XMLUtils xmlUtils = new XMLUtils();
    Document inputDoc;
    try {
      inputDoc = xmlUtils.loadXML(input);
      exact.loadDocument(inputDoc);
    } catch (SAXException e1) {
      logger.error("Cannot parse correctly input JMVA model: " + e1.getMessage());
      return null;
    } catch (IOException e1) {
View Full Code Here

Examples of jmt.framework.xml.XMLUtils

        modelDefinition.delete();
      }

      // Put in place all measures from classes with null service demands and adjusts throughputs
      Document outDocument;
      XMLUtils xmlUtils = new XMLUtils();
      try {
        outDocument = xmlUtils.loadXML(temp);
        addNullMeasuresCorrectThroughputs(inputModel, outDocument);
      } catch (SAXException e2) {
        logger.error("Cannot parse correctly output JMVA model: " + e2.getMessage());
        return false;
      } catch (IOException e1) {
        logger.error("I/O error opening output JMVA model: " + e1.getMessage());
        return false;
      }
      logger.debug("Added null measures to final results");

      try {
        xmlUtils.saveXML(outDocument, modelDefinition);
      } catch (Exception e3) {
        logger.error("could not copy results into model " + modelDefinitionPath);
        return false;
      }
View Full Code Here

Examples of jmt.framework.xml.XMLUtils

   * WARNING: This method should be called before solving the system.
   * @return true if sufficient capacity exists for the given workload, false otherwise
   */
  public boolean checkProcessingCapacity() {
    ExactModel exact = new ExactModel();
    XMLUtils xmlUtils = new XMLUtils();
    Document inputDoc;
    try {
      inputDoc = xmlUtils.loadXML(modelDefinition);
      exact.loadDocument(inputDoc);
    } catch (SAXException e1) {
      logger.error("Cannot parse correctly input JMVA model: " + e1.getMessage());
      return false;
    } catch (IOException e1) {
View Full Code Here

Examples of org.apache.cassandra.utils.XMLUtils

    }
   
    private static void loadPreviousConfig(String config) throws ConfigurationException
    {
        try {
            XMLUtils xmlUtils = new XMLUtils(config);
            conf.cluster_name = xmlUtils.getNodeValue("/Storage/ClusterName");
           
            String syncRaw = xmlUtils.getNodeValue("/Storage/CommitLogSync");
            conf.commitlog_sync = Config.CommitLogSync.valueOf(syncRaw);

            if (conf.commitlog_sync != null)
            {
                if (conf.commitlog_sync == Config.CommitLogSync.batch)
                    conf.commitlog_sync_batch_window_in_ms = Double.valueOf(xmlUtils.getNodeValue("/Storage/CommitLogSyncBatchWindowInMS"));
                else
                    conf.commitlog_sync_period_in_ms = Integer.valueOf(xmlUtils.getNodeValue("/Storage/CommitLogSyncPeriodInMS"));
                   
            }

            String modeRaw = xmlUtils.getNodeValue("/Storage/DiskAccessMode");
            conf.disk_access_mode = Config.DiskAccessMode.valueOf(modeRaw);
           
            conf.authenticator = xmlUtils.getNodeValue("/Storage/Authenticator");
            // handle the authc/authz split by configuring SimpleAuthority if SimpleAuthenticator is in use
            if (conf.authenticator != null && conf.authenticator.equals(SimpleAuthenticator.class.getName()))
                conf.authority = SimpleAuthority.class.getName();
           
            /* Hashing strategy */
            conf.partitioner = xmlUtils.getNodeValue("/Storage/Partitioner");
           
            conf.job_tracker_host = xmlUtils.getNodeValue("/Storage/JobTrackerHost");
           
            conf.job_jar_file_location = xmlUtils.getNodeValue("/Storage/JobJarFileLocation");

            conf.initial_token = xmlUtils.getNodeValue("/Storage/InitialToken");
           
            String rpcTimeout = xmlUtils.getNodeValue("/Storage/RpcTimeoutInMillis");
            if ( rpcTimeout != null )
                conf.rpc_timeout_in_ms = Long.parseLong(rpcTimeout);
           
            String rawReaders = xmlUtils.getNodeValue("/Storage/ConcurrentReads");
            if (rawReaders != null)
            {
                conf.concurrent_reads = Integer.parseInt(rawReaders);
            }
           
            String rawWriters = xmlUtils.getNodeValue("/Storage/ConcurrentWrites");
            if (rawWriters != null)
            {
                conf.concurrent_writes = Integer.parseInt(rawWriters);
            }
           
            String rawSlicedBuffer = xmlUtils.getNodeValue("/Storage/SlicedBufferSizeInKB");
            if (rawSlicedBuffer != null)
            {
                conf.sliced_buffer_size_in_kb = Integer.parseInt(rawSlicedBuffer);
            }

            String bmtThresh = xmlUtils.getNodeValue("/Storage/BinaryMemtableThroughputInMB");
            if (bmtThresh != null)
            {
                conf.binary_memtable_throughput_in_mb = Integer.parseInt(bmtThresh);
            }
           
            /* TCP port on which the storage system listens */
            String port = xmlUtils.getNodeValue("/Storage/StoragePort");
            if ( port != null )
                conf.storage_port = Integer.parseInt(port);
           
            /* Local IP or hostname to bind services to */
            conf.listen_address = xmlUtils.getNodeValue("/Storage/ListenAddress");
           
            conf.rpc_address = xmlUtils.getNodeValue("/Storage/RPCAddress");
           
            port = xmlUtils.getNodeValue("/Storage/RPCPort");
            if (port != null)
                conf.rpc_port = Integer.parseInt(port);
           
            String framedRaw = xmlUtils.getNodeValue("/Storage/ThriftFramedTransport");
            if (framedRaw != null && !Boolean.valueOf(framedRaw))
            {
                System.out.println("WARN : Cassandra uses a Thrift framed Transport by default in 0.7! Clients will need to match.");
            }
            conf.thrift_framed_transport_size_in_mb = 15;
           
            String sbc = xmlUtils.getNodeValue("/Storage/SnapshotBeforeCompaction");
            if (sbc != null)
            {
                conf.snapshot_before_compaction = Boolean.valueOf(sbc);
            }
           
            String autoBootstr = xmlUtils.getNodeValue("/Storage/AutoBootstrap");
            if (autoBootstr != null)
            {
                conf.auto_bootstrap = Boolean.valueOf(autoBootstr);
            }
           
            String columnIndexSize = xmlUtils.getNodeValue("/Storage/ColumnIndexSizeInKB");
            if(columnIndexSize != null)
            {
                conf.column_index_size_in_kb = Integer.parseInt(columnIndexSize);
            }

            conf.data_file_directories = xmlUtils.getNodeValues("/Storage/DataFileDirectories/DataFileDirectory");
           
            conf.commitlog_directory = xmlUtils.getNodeValue("/Storage/CommitLogDirectory");

            conf.saved_caches_directory = xmlUtils.getNodeValue("/Storage/SavedCachesDirectory");

            String value = xmlUtils.getNodeValue("/Storage/CommitLogRotationThresholdInMB");
            if ( value != null)
                conf.commitlog_rotation_threshold_in_mb = Integer.parseInt(value);
           
            conf.seeds = xmlUtils.getNodeValues("/Storage/Seeds/Seed");
           
            conf.keyspaces = readTablesFromXml(xmlUtils);
        }
        catch (ParserConfigurationException e) {
            System.out.println("Parser error during previous config load.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.