Package fit

Examples of fit.Parse


    dt2 = getDataTable(symbol2);
  }

  public void doTable(Parse table) {
    initialiseDataTables();
    Parse lastRow = table.parts.more;
    if (lastRow == null) {
      throw new Error("Query structure missing from second row");
    }
    loadRowStructure(lastRow);
    lastRow = processDataTable(dt1, dt2, lastRow, symbol2);
View Full Code Here


      lastRow = addRow(lastRow, dr, true, " missing from " + symbol1);
    }
  }

  private void loadRowStructure(Parse headerRow) {
    Parse headerCell = headerRow.parts;
    int colNum = headerRow.parts.size();
    columnNames = new String[colNum];
    keyProperties = new boolean[colNum];
    for (int i = 0; i < colNum; i++) {
      String currentName = headerCell.text();
      if (currentName == null)
        throw new UnsupportedOperationException("Column " + i + " does not have a name");
      currentName = currentName.trim();
      if (currentName.length() == 0)
        throw new UnsupportedOperationException("Column " + i + " does not have a name");
View Full Code Here

    }
    return lastScreenRow;
  }

  private Parse addRow(Parse lastRow, DataRow dr, DataRow dr2) {
    Parse newRow = new Parse("tr", null, null, null);
    lastRow.more = newRow;
    lastRow = newRow;
    try {
      String lval = dr.getStringValue(columnNames[0]);
      String rval = dr2.getStringValue(columnNames[0]);
      Parse firstCell = new Parse("td", lval, null, null);
      newRow.parts = firstCell;
      if (!lval.equals(rval)) {
        wrong(firstCell, rval);
      } else {
        right(firstCell);
      }
      for (int i = 1; i < columnNames.length; i++) {
        lval = dr.getStringValue(columnNames[i]);
        rval = dr2.getStringValue(columnNames[i]);
        Parse nextCell = new Parse("td", lval, null, null);
        firstCell.more = nextCell;
        firstCell = nextCell;
        if (!lval.equals(rval)) {
          wrong(firstCell, rval);
        } else {
View Full Code Here

    }
    return lastRow;
  }

  private Parse addRow(Parse lastRow, DataRow dr, boolean markAsError, String desc) {
    Parse newRow = new Parse("tr", null, null, null);
    lastRow.more = newRow;
    lastRow = newRow;
    try {
      Parse firstCell = new Parse("td", dr.getStringValue(columnNames[0]), null, null);
      newRow.parts = firstCell;
      if (markAsError) {
        firstCell.addToBody(Fixture.gray(desc));
        wrong(firstCell);
      }
      for (int i = 1; i < columnNames.length; i++) {
        Parse nextCell = new Parse("td", dr.getStringValue(columnNames[i]), null, null);
        firstCell.more = nextCell;
        firstCell = nextCell;
      }
    } catch (Throwable e) {
      exception(newRow, e);
View Full Code Here

   * 例如: @{name} = your value
   */
  @Override
  public void wrong(Parse row) {
    if (row != null && row.parts != null) {
      Parse cells = row.parts;
      try {
        for (int i = 0; cells != null; i++) {
          ParseArg.parseCellValue(cells);
          cells = cells.more;
        }
View Full Code Here

    }
    super.wrong(row);
  }

  public DataRow findMatchingRow(Parse row) throws NoMatchingRowFoundException {
    Parse columns = row.parts;
    Map<String, Object> keyMap = new HashMap<String, Object>();
    for (int i = 0; i < keyColumns.length; i++, columns = columns.more) {
      if (keyColumns[i] != null) {
        try {
          Object value = columnBindings[i].adapter.parse(columns.text());
          if (value instanceof InputStream) {
            value = columns.text();
          }

          keyMap.put(keyColumns[i], value);
        } catch (Throwable e) {
          exception(columns, e);
View Full Code Here

    }
    return dt.findMatching(keyMap);
  }

  private void addSurplusRows(Parse rows) {
    Parse lastRow = rows;
    for (DataRow dr : dt.getUnprocessedRows()) {
      Parse newRow = new Parse("tr", null, null, null);
      lastRow.more = newRow;
      lastRow = newRow;
      try {
        currentRow = dr; // for getting
        Parse firstCell = new Parse("td", String.valueOf(columnBindings[0].adapter.invoke()), null, null);
        newRow.parts = firstCell;
        firstCell.addToBody(Fixture.gray(" surplus"));
        wrong(firstCell);
        for (int i = 1; i < columnBindings.length; i++) {
          Parse nextCell = new Parse("td", String.valueOf(columnBindings[i].adapter.invoke()), null, null);
          firstCell.more = nextCell;
          firstCell = nextCell;
        }
      } catch (Throwable e) {
        exception(newRow, e);
View Full Code Here

    }
    PreparedStatement statement = null;
    try {
      initParameters(rows.parts);// init parameters from the first row
      statement = buildInsertCommand(tableName, accessors);
      Parse row = rows;
      int rowNum = 0;
      while ((row = row.more) != null) {
        insertRowData(statement, row, rowNum++);
        right(row);
      }
View Full Code Here

      columnBindings[i].adapter = accessors[i];
    }
  }

  protected void insertRowData(PreparedStatement statement, Parse row, int rowNum) {
    Parse cell = row.parts;
    try {
      statement.clearParameters();
      // first set input params
      for (int column = 0; column < accessors.length; column++, cell = cell.more) {
        int direction = accessors[column].getDirection();
View Full Code Here

    PreparedStatement st = null;
    ResultSet rs = null;
    try {
      st = environment.createStatementWithBoundFixtureSymbols(objectName);
      rs = st.executeQuery();
      Parse newRow = getHeaderFromRS(rs);
      table.parts.more = newRow;
      while (rs.next()) {
        newRow.more = getDataRow(rs);
        newRow = newRow.more;
      }
View Full Code Here

TOP

Related Classes of fit.Parse

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.