📄 variable.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 += " ≥ 0"; break; case ConstraintTypes.LESS_THAN: result += " ≤ 0"; break; case ConstraintTypes.BELONG_R: result += " ∈ 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 + -