Класс «MainFrame»

public class MainFrame extends javax.swing.JFrame {

/** Creates new form MainFrame */MainFrame() {();.setCellRenderer(new ListCellRenderer() {Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {comp = (Component)value;.setBackground(isSelected ? Color.LIGHT_GRAY : Color.white);comp;

}

});.addMouseListener(new MouseAdapter() {

@Overridevoid mouseReleased(MouseEvent e) {.get(jList1.getSelectedIndex()).check();.updateUI();super.mouseReleased(e);

}

});.setValue(2);

}Vector<ConditionPanel> vec;LinkedList<int[]> conditions;void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {value = (Integer)jSpinner1.getValue();= new LinkedList<int[]>();[] lastNumIndex = new int[value];(int num : lastNumIndex) {.out.println(num);

}(int i = 3; i <= value; i++) {[] indices;x = new CombinationGenerator(value, i);(x.hasMore()) {= x.getNext();.add(indices.clone());

}

}.sort(conditions, new Comparator<int[]>() {int compare(int[] o1, int[] o2) {( o1[0] < o2[0] ) {-1;

} else if( o1[0] == o2[0] ) {(o1.length < o2.length) {-1;

} else {0;

}

} else {1;

}

}

});= new Vector<ConditionPanel>();num = 1;(int[] indices : conditions) {list = new ConditionPanel();.setCondition(indices, num);++;.add(list);

}.setListData(vec);.updateUI();

}void jSpinner1StateChanged(javax.swing.event.ChangeEvent evt) {.setModel(new DefaultTableModel((Integer)jSpinner1.getValue(), 3) [] canEdit = new boolean [] {, true, true

};

@Overrideboolean isCellEditable(int rowIndex, int columnIndex) {canEdit [columnIndex];

}

@OverrideString getColumnName(int column) {name = "";(column) {0:= "№";;1:= "цель";;2:= "оценка";;

}name;

}

});(int i = 0; i < (Integer)jSpinner1.getValue(); i++){s = "" + (1-0.1*i);.setValueAt(i + 1, i, 0);.setValueAt("цель " + (i + 1), i, 1);.setValueAt(s, i, 2);

}

}float[] values;void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {.updateUI();count = (Integer)jSpinner1.getValue();= new float[count];(int i = 0; i < count; i++) {[i] = Float.parseFloat((String) jTable1.getModel().getValueAt(i, 2));

}(jRadioButton1.isSelected()) {();

} else {();

}

}

}void manualSolve() {i = checkConditions();(i !=-1){.showMessageDialog(this, (i + 1) + " правило не выполнилось. Скорректируйте оценки");

}{();.showMessageDialog(this, "Принятые оценки корректны");

}

}void automaticSolve() {<Integer> ind = new ArrayList<Integer>();.add(0);(int i = 1; i < conditions.size(); i++) {[] currentIndex = conditions.get(i);[] previousIndex = conditions.get(i - 1);(currentIndex[0] == previousIndex[0]

&& currentIndex.length == previousIndex.length) {(isConditionSelected(i) != isConditionSelected(i - 1)) {

JOptionPane.showMessageDialog(this, "Уловия не могут быть выполнены при данных значениях оценок !!!");

Перейти на страницу: 1 2 3