Package jc.pbntools

Examples of jc.pbntools.Deal$FiltrTekstuRozd


    for (int iDeal=1; iDeal<=m_cDeals; iDeal++) {
      if (Thread.interrupted()) {
        println(PbnTools.getStr("msg.interrupted"));
        break;
      }
      Deal ad[] = readDeals(getLocalLinkForDeal(iDeal), false);
      if (ad != null) {
        for (Deal d: ad) {
          d.setIdentField("Event", m_sTitle);
          deals.add(d);
        }
View Full Code Here


    Document doc;
    m_sCurFile = sUrl;
    m_bSilent = bSilent;
   
    resetErrors();
    Deal deal = new Deal();
    try {
      SoupProxy proxy = new SoupProxy();
      doc = proxy.getDocument(sUrl);
    }
    catch (JCException e) {
View Full Code Here

          && !tds.get(7).text().matches("[-0-9]+")) {
        bValidContract = false;
      }
     
      if (bValidContract) {
        Deal d = deal0.clone();
        d.setIdentField("North", "Para-" + tds.get(0).text());
        d.setIdentField("South", "Para-" + tds.get(0).text());
        d.setIdentField("East", "Para-" + tds.get(1).text());
        d.setIdentField("West", "Para-" + tds.get(1).text());
        d.setDeclarer(Deal.person(tds.get(3).text()));
        processContract(d, tds.get(2));
        processResult(d, tds.get(5).text());
        if (!d.isOk()) {
          reportErrors(d.getErrors());
        }
        ad.add(d);
      }
    }
   
View Full Code Here

    for (int iDeal=1; iDeal<=m_cDeals; iDeal++) {
      if (Thread.interrupted()) {
        println(PbnTools.getStr("msg.interrupted"));
        break;
      }
      Deal ad[] = readDeals(getLocalLinkForDeal(iDeal), m_bSilent);
      if (ad != null) {
        for (Deal d: ad) {
          if (m_sTitle != null)
            d.setIdentField("Event", m_sTitle);
          deals.add(d);
View Full Code Here

        if (f.isDebugMode())
          m_ow.addLine("reading lin: " + sFile);
        String sLin = f.readFile(sFile);
        LinReader linReader = new LinReader();
        linReader.setOutputWindow(m_ow);
        Deal d = linReader.readLin(sLin, m_bSilent)[0];
        d.setId(f.getFileName(sFile));
        processResults(d, tr);
       
        // At this moment we have both contract (taken from traveller) and
        // plays (from lin). But it can happen that the play is judged
        // without contract (N/A) and the plays are present in the file.
        // This is kind of contradiction, but since the plays are in the
        // lin file, let's leave it here too. Thus commenting line below.
        // if (d.getDeclarer() < 0)
          // d.clearPlays();

        if (!d.isOk()) {
          reportErrors(d.getErrors());
        }
        aDeals.add(d);
      }
    }
    catch (DownloadFailedException e) {
View Full Code Here

    for (int iDeal=1; iDeal<=m_cDeals; iDeal++) {
      if (Thread.interrupted()) {
        println(PbnTools.getStr("msg.interrupted"));
        break;
      }
      Deal ad[] = readDeals(getLocalLinkForDeal(iDeal), false);
      if (ad != null) {
        for (Deal d: ad) {
          d.setIdentField("Event", m_sTitle);
          deals.add(d);
        }
View Full Code Here

    Document doc;
    m_sCurFile = sUrl;
    m_bSilent = bSilent;
   
    resetErrors();
    Deal deal = new Deal();
    try {
      SoupProxy proxy = new SoupProxy();
      doc = proxy.getDocument(sUrl);
    }
    catch (JCException e) {
View Full Code Here

      if (bValidContract && "TD".equals(tds.get(3).text())) {
        // rozdanie bez wyniku
        bValidContract = false;
      }
      if (bValidContract) {
        Deal d = deal0.clone();
        d.setIdentField("North", "Para-" + tds.get(1).text());
        d.setIdentField("South", "Para-" + tds.get(1).text());
        d.setIdentField("East", "Para-" + tds.get(2).text());
        d.setIdentField("West", "Para-" + tds.get(2).text());
        d.setDeclarer(Deal.person(tds.get(4).text()));
        processContract(d, tds.get(3));
        processResult(d, tds.get(6).text());
        if (!d.isOk()) {
          reportErrors(d.getErrors());
        }
        ad.add(d);
      }
    }
   
View Full Code Here

    throws DownloadFailedException
  {
    // m_sp.addLine(sLin);
    m_bSilent = bSilent;
    m_nCurCard = 0;
    Deal d = new Deal();
    String sLastComm = "";
    Scanner sc = new Scanner(sLin).useDelimiter("\\|");
    while (sc.hasNext()) {
      String sComm = sc.next();
      if (sComm.length() == 0) {
       throw new DownloadFailedException(
         PbnTools.getStr("lin.error.emptyCmd", sc.match().start()),
           m_sp, !m_bSilent);
      }
      if (!sc.hasNext()) {
       throw new DownloadFailedException(
         PbnTools.getStr("lin.error.noArg", sComm), m_sp, !m_bSilent);
      }
      String sArg = sc.next();
      if (sComm.equals("ah"))
        readNumber(d, sArg);
      else if (sComm.equals("an") && sLastComm.equals("mb")) {
        d.annotateLastBid(sArg);
      } else if (sComm.equals("pc"))
        try {
          readPlay(d, sArg);
        } catch (DownloadFailedException dfe) {
          // ignore played cards errors, as it's not the main functionality
          m_sp.addLine(dfe.getMessage());
        }
      else if (sComm.equals("pg"))
        {} // pause game, ignore it
      else if (sComm.equals("pn"))
        readPlayers(d, sArg);
      else if (sComm.equals("mb"))
        readBid(d, sArg);
      else if (sComm.equals("mc")) {
        try {
          int cTricks = Integer.parseInt(sArg);
          if (cTricks < 0 || cTricks > 13)
            throw new NumberFormatException();
          d.setResult(cTricks);
        } catch (NumberFormatException nfe) {
          m_sp.addLine(PbnTools.getStr("error.linInvArg", sComm, sArg));
        }
      } else if (sComm.equals("md"))
        readHands(d, sArg);
      else if (sComm.equals("rh") || sComm.equals("st")) {
        if (!sArg.isEmpty() && !m_bSilent)
          m_sp.addLine(PbnTools.getStr("msg.interesting", sComm + sArg));
      }
      else if (sComm.equals("sv"))
        readVulner(d, sArg);
      else {
        if (!m_bSilent) {
          m_sp.addLine(PbnTools.getStr("msg.interesting",
            "Command: " + sComm + ", arg: " + sArg));
        }
      }
      sLastComm = sComm;
    }

    // contract must be deduced from auction
    ArrayList<String> asErrors = new ArrayList<String>();
    d.setContractFromAuction(asErrors);
    if (asErrors.size() > 0) {
      m_sp.addLine(PbnTools.getStr("lin.error.noContract"));
      for (String sMsg: asErrors)
        m_sp.addLine("  " + sMsg);
    }

    // passed out - result can be deduced :)
    if (d.getContractHeight() == 0)
      d.setResult(0);
   
    if (d.getResult() < 0 && d.getContractHeight() > 0) {
      // the result must be deduced from plays
      asErrors.clear();
      d.setResultFromPlays(asErrors);
      if (asErrors.size() > 0) {
        m_sp.addLine(PbnTools.getStr("lin.error.noContract"));
        for (String sMsg: asErrors)
          m_sp.addLine("  " + sMsg);
      }
    }
   
    // when no result, don't show the contract either
    if (d.getResult() < 0)
      d.setContractHeight(-1);
   
    return new Deal[] { d };
  } //}}}
View Full Code Here

TOP

Related Classes of jc.pbntools.Deal$FiltrTekstuRozd

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.