コード例 #1
0
    protected Column(final Column entityToCopy) {

      super(entityToCopy);

      myActivator = entityToCopy.needsActivator();
      myInteger = entityToCopy.isInteger();

      myElements.putAll(entityToCopy.myElements);
    }
コード例 #2
0
  /**
   * @see #getActivatorVariableColumns()
   * @see #getNegativeVariableColumns()
   * @see #getPositiveVariableColumns()
   */
  public Column[] getPositiveVariableColumns() {

    final HashSet<Column> tmpSelection = new HashSet<Column>();

    for (final Column tmpColumn : myColumns.values()) {
      if (tmpColumn.hasPositivePart()) {
        tmpSelection.add(tmpColumn);
      }
    }

    return tmpSelection.toArray(new Column[tmpSelection.size()]);
  }
コード例 #3
0
  /**
   * @see #getActivatorVariableColumns()
   * @see #getNegativeVariableColumns()
   * @see #getPositiveVariableColumns()
   */
  public Column[] getActivatorVariableColumns() {

    final HashSet<Column> tmpSelection = new HashSet<Column>();

    for (final Column tmpColumn : myColumns.values()) {
      if (tmpColumn.needsActivator()) {
        tmpSelection.add(tmpColumn);
      }
    }

    return tmpSelection.toArray(new Column[tmpSelection.size()]);
  }
コード例 #4
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;
    }
  }