Пример #1
0
  void parseSectionLine(final FileSection aSection, final String aLine) {

    this.extractFields(aLine);

    //      BasicLogger.logDebug("{}: {}.", aSection, Arrays.toString(myFields));

    switch (aSection) {
      case NAME:
        break;

      case OBJSENSE:
        if (myFields[0].equals("MAX")) {
          this.setMaximisation(true);
        }

        break;

      case OBJNAME:
        break;

      case ROWS:
        final Row aConstraint = new Row(myFields[1], RowType.valueOf(myFields[0]));

        myRows.put(aConstraint.getName(), aConstraint);

        break;

      case COLUMNS:
        if (myFields[2].indexOf("MARKER") != -1) {

          if (myFields[4].indexOf("INTORG") != -1) {
            myIntegerMarker = true;
          } else if (myFields[4].indexOf("INTEND") != -1) {
            myIntegerMarker = false;
          }

        } else {

          if (!myColumns.containsKey(myFields[1])) {
            myColumns.put(myFields[1], new Column(myFields[1]));
          }

          final Column tmpColumn = myColumns.get(myFields[1]);

          tmpColumn.setRowValue(myFields[2], new BigDecimal(myFields[3]));
          if (myFields[4].length() != 0) {
            tmpColumn.setRowValue(myFields[4], new BigDecimal(myFields[5]));
          }

          if (myIntegerMarker) {
            tmpColumn.setInteger(myIntegerMarker);
          }
        }

        break;

      case RHS:
        myRows.get(myFields[2]).rhs(new BigDecimal(myFields[3]));

        if (myFields[4].length() != 0) {
          myRows.get(myFields[4]).rhs(new BigDecimal(myFields[5]));
        }

        break;

      case RANGES:
        myRows.get(myFields[2]).range(new BigDecimal(myFields[3]));

        if (myFields[4].length() != 0) {
          myRows.get(myFields[4]).range(new BigDecimal(myFields[5]));
        }

        break;

      case BOUNDS:
        myColumns
            .get(myFields[2])
            .bound(
                BoundType.valueOf(myFields[0]),
                myFields[3].length() == 0 ? null : new BigDecimal(myFields[3]));

        break;

      case ENDATA:
        break;

      default:
        break;
    }
  }