⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 variable.java

📁 This is my implementation for linear programming
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package ro.simplex;import ro.utils.Fraction;/** * * @author Doan Chien Thang */public class Variable {    private int constraint;    private Fraction value;    private int index;    private String prefix;    public Variable(Fraction initValue, int initIndex,            String initPrefix, int constraint) {        this.value = initValue;        this.index = initIndex;        this.prefix = initPrefix;        this.constraint = constraint;        this.value = null;    }    @Override    public String toString() {        return prefix + "<sub>" + index + "</sub>";    }    public Fraction getValue() {        return this.value;    }    public int getConstraint() {        return constraint;    }    public int getIndex() {        return index;    }    public String getConstraintString() {        String result = this.toString();        switch (this.constraint) {            case ConstraintTypes.GREATER_THAN:                result += " &ge; 0";                break;            case ConstraintTypes.LESS_THAN:                result += " &le; 0";                break;            case ConstraintTypes.BELONG_R:                result += " &isin; R";                break;            default:                break;        }        return result;    }    public String getPrefix() {        return prefix;    }    public boolean equals(Variable variable) {        return (prefix.compareTo(variable.getPrefix()) == 0 &&                index == variable.getIndex());    }    public void setValue(Fraction value) {        this.value = value;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -