/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Main.java
*
* Created on 2010-3-16, 16:28:45
*/
package lift;
/**
*
* @author mickyfeng
*/
public class Main extends javax.swing.JFrame {
/** Creates new form Main */
public Main() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Main.java
*
* Created on 2010-3-16, 16:28:45
*/
package lift;
/**
*
* @author mickyfeng
*/
public class Main extends javax.swing.JFrame {
/** Creates new form Main */
public Main() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
private void JustDown(Integer[] liftN) {
int Max1=0,Max2=0;
jTextArea1.append("Just Down Before :"+ArrToStr(liftN)+"\n");
for(int i= 1;i<5;i++){
if (liftN[Max1] <liftN[i]){
Max1 =i;
}else{
if (liftN[Max2] <liftN[i]){
Max2 = i;
}
}
}
if ((liftN[Max1]>25)|(liftN[Max2]>25)) {
liftN[Max1]-=13;
liftN[Max2]-=13;
}
jTextArea1.append("Just Down After :"+ArrToStr(liftN)+"\n");
}
private void JustUp(Integer[] liftN) {
int Min1=0,Min2=0;
jTextArea1.append("Just Up Before :"+ArrToStr(liftN)+"\n");
for(int i= 1;i<5;i++){
if (liftN[Min1] >liftN[i]){
Min1 =i;
}else{
if (liftN[Min2] >liftN[i]){
Min2 = i;
}
}
}
if((liftN[Min1]<21)|liftN[Min2]<21){
liftN[Min1]+=8;
liftN[Min2]+=8;
}
jTextArea1.append("Just Up After :"+ArrToStr(liftN)+"\n");
}
private String ArrToStr(Integer[] liftN) {
String s="";
for (int i=0 ;i<5 ;i++){
s += liftN[i].toString()+"; ";
}
return s;
}