Back to index

wims  3.65+svn20090927
Public Member Functions | Package Attributes | Static Package Attributes
PlinkoNegativeBinomial Class Reference
Inheritance diagram for PlinkoNegativeBinomial:
Inheritance graph
[legend]
Collaboration diagram for PlinkoNegativeBinomial:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PlinkoNegativeBinomial ()
void init ()
void showFrame ()
void start ()
void stop ()
void run ()
void toggleStart ()
void actionPerformed (ActionEvent actionevent)
void stateChanged (ChangeEvent changeevent)
void windowActivated (WindowEvent windowevent)
void windowClosed (WindowEvent windowevent)
void windowClosing (WindowEvent windowevent)
void windowDeactivated (WindowEvent windowevent)
void windowDeiconified (WindowEvent windowevent)
void windowIconified (WindowEvent windowevent)
void windowOpened (WindowEvent windowevent)
String getAppletInfo ()
String ReadApplet ()

Package Attributes

JLabel count
JLabel mean
JLabel variance
JLabel current_bin
JLabel current_bin_count
JLabel current_bin_prob
JLabel confidence
JButton start
JButton clear
JButton close
PlinkoBoard plinkoboard
Thread thread
boolean active
JFrame frame
SplashPanel splash
boolean wims_exercise = false
int bins_num = 11
int speed = 1
int total_balls = 100000
double chance = 0.5
int frame_x = 650
int frame_y = 600
int font_size = 14
int R = 1
String title = "Binomial Distribution"
String click_text = "CLICK ANYWHERE TO BEGIN"
String start_text = "START"
String stop_text = "STOP"
String clear_text = "CLEAR"
String close_text = "CLOSE"
String label_count = "Count: "
String label_mean = "Mean: "
String label_variance = "Variance: "
String label_bin = "Bin: "
String label_bins = "Bins: "
String label_speed = "Speed: "
String label_probability = "Probability: "
String label_bin_count = "Bin Count: "
String label_bin_probability = "Bin Probability: "
String label_confidence = "Confidence Interval: "
String some_text = " % of the balls landed in bin "
String through = " through "
String label_controls = " Controls "
String label_statistics = "Statistics"

Static Package Attributes

static JSpinner bins
static JSpinner strk
static JSpinner rate
static JSpinner prob
static AudioClip click
static AudioClip ping

Detailed Description

Definition at line 8 of file PlinkoNegativeBinomial.java.


Constructor & Destructor Documentation

Definition at line 66 of file PlinkoNegativeBinomial.java.

       {
              active = false;
       }

Member Function Documentation

void PlinkoNegativeBinomial.actionPerformed ( ActionEvent  actionevent) [inline]

Definition at line 311 of file PlinkoNegativeBinomial.java.

                                                           {
              Object obj = actionevent.getSource();
              if(obj == close){ stop();}
              if(obj == start){ toggleStart();} 
              if(obj == clear){
                  if(plinkoboard.FIRST_BALL == null){
                     plinkoboard.newHist();
                  } 
                  else
                  {
                     plinkoboard.FIRST_BALL = null;
                     if(!active){
                         strk.setEnabled(true);
                     }
                  }
                  plinkoboard.repaint();
              }
              plinkoboard.requestFocus();
       }

Here is the call graph for this function:

Definition at line 384 of file PlinkoNegativeBinomial.java.

                                     {                                                                                                     
            return "Written by Dr. P. Little \n http://www.math.psu.edu/dlittle/java/probability/plinko/index.html" ;
       }                                                                                                                                  
void PlinkoNegativeBinomial.init ( ) [inline]

Definition at line 71 of file PlinkoNegativeBinomial.java.

       {
    //@begin jm.evers: introducing a few Applet params , used for tailoring the exercise.
       String s=getParameter("wims_exercise");
       if(s!=null){
           if(s.equalsIgnoreCase("yes") || s.equals("1")){
              wims_exercise = true;
              s=getParameter("balls");
              if(s!=null && s.length()>0){total_balls = Integer.parseInt(s, 10);}
              s=getParameter("chance");
              if(s!=null && s.length()>0){chance = Double.parseDouble(s);}
              s=getParameter("bins");
              if(s!=null && s.length()>0){bins_num = Integer.parseInt(s, 10);}
              s=getParameter("speed");
              if(s!=null && s.length()>0){speed = Integer.parseInt(s, 10);}
              s=getParameter("xsize");
              if(s!=null && s.length()>0){frame_x = Integer.parseInt(s, 10);}
              s=getParameter("ysize");
              if(s!=null && s.length()>0){frame_y = Integer.parseInt(s, 10);}
              s=getParameter("title");
              if(s!=null && s.length()>0){title=s;}
              s=getParameter("font_size");
              if(s!=null && s.length()>0){font_size = Integer.parseInt(s, 10);}
              s=getParameter("R");
              if(s!=null && s.length()>0){R = Integer.parseInt(s, 10);}

           }
       }
       s=getParameter("language");
       if(s!=null && s.length()>0){
           if(s.equalsIgnoreCase("nl")){
              click_text="KLIK HIER OM TE BEGINNEN";
              start_text="START";
              stop_text="STOP";
              clear_text="WISSEN";
              close_text="SLUITEN";
              label_count="Aantal: ";
              label_mean="Gemiddeld: ";
              label_variance="Variantie: ";
              label_bin="Bakje: ";
              label_bins="Bakjes: ";
              label_speed="Snelheid: ";
              label_bin_count="Ballen/bakje: ";
              label_probability="Kans: ";    
              label_bin_probability="Kans per bakje: ";
              label_confidence="Betrouwbaarheids interval: ";
              some_text=" % van de ballen in bakje: ";
              through=" t/m ";
              String label_controls=" Menu ";
              String label_statistics="Statistiek";
           }
           if(s.equalsIgnoreCase("fr")){
              click_text="CLIQUEZ ICI";
              start_text="COMMENCER";
              stop_text="PAUSE";
              clear_text="EFFACER";
              close_text="FERMER";
              label_count="Quantit\u00E9 : ";
              label_mean="Moyenne : ";
              label_variance="Variance: ";
              label_bin="Panier : ";
              label_bins="Paniers : ";
              label_speed="Vitesse : ";
              label_bin_count="Balles dans ce panier : ";
              label_bin_probability="% de balles dans ce panier : ";
              label_probability="Probabilit\u00E9 : ";    
              label_confidence="Intervalle de confiance : ";
              some_text=" % de balles dans le panier ";
              through=" through ";
              label_controls="Menu";
              label_statistics="Statistiques";
           }
           if(s.equalsIgnoreCase("de")){
              click_text="Klicken Sie hier um zu starten";
              start_text="START";
              stop_text="STOP";
              clear_text="CLEAR";
              close_text="CLOSE";
              label_count="Zahl: ";
              label_mean="Mean: ";
              label_variance="Variance: ";
              label_bin="Behälter: ";
              label_bins="Behälter: ";
              label_speed="Geschwindigkeit : ";
              label_bin_count="Zahl/Behälter: ";
              label_bin_probability="Wahrscheinlichkeit in Behälter: ";
              label_probability="Wahrscheinlichkeit: ";    
              label_confidence="Wahrscheinlichkeits Intervall: ";
              some_text=" % der Kugeln fällt in Behälter ";
              through=" bis ";
              String label_controls=" Menu ";
              String label_statistics="Statistik";
           }
       }
    //@end jm.evers: introducing a few Applet params , used for tailoring the exercise.

           setBackground(Color.white);
           frame = new JFrame();
           frame.setVisible(false);
           frame.setSize(frame_x, frame_y);
           frame.setLocation(0,0);
           frame.setTitle( title );
           Font font = new Font( "Helvetica", Font.BOLD, font_size );
              
           JPanel jpanel = new JPanel();
           JLabel jlabel = new JLabel("R:", 2);
           if(wims_exercise == false){
              jpanel.add(jlabel);
           }
           strk = new JSpinner(new SpinnerNumberModel( R , 1, 50, 1));
           if(wims_exercise == false){
              jpanel.add(strk);
           }
           jlabel = new JLabel(label_bins, 2);
           if(wims_exercise == false){
              jpanel.add(jlabel);
           }
           bins = new JSpinner(new SpinnerNumberModel(bins_num, 2, 100, 1));
           if(wims_exercise == false){        
              jpanel.add(bins);
           }
           jlabel = new JLabel(label_probability, 2);
           if(wims_exercise == false){
              jpanel.add(jlabel);
           }
           prob = new JSpinner(new SpinnerNumberModel(chance, 0.0D, 100D, 0.01D));
           SpinnerNumberModel spinnernumbermodel = (SpinnerNumberModel)prob.getModel();
           spinnernumbermodel.setMaximum(new Double(1.0D));
           if(wims_exercise == false){
              jpanel.add(prob);
           }
           jlabel = new JLabel(label_speed, 2);
           if(wims_exercise == false){
              jpanel.add(jlabel);
           }
           rate = new JSpinner(new SpinnerNumberModel(speed, 1, 10, 1));
           
           if(wims_exercise == false){jpanel.add(rate);
           }
           JPanel jpanel1 = new JPanel();
           jpanel1.add(start = new JButton(start_text));
           start.setDefaultCapable(true);
           frame.getRootPane().setDefaultButton(start);
           jpanel1.add(clear = new JButton(clear_text));
           jpanel1.add(close = new JButton(close_text));
           close.setDefaultCapable(false);
           JPanel jpanel2 = new JPanel(new BorderLayout());
           jpanel2.add("West", jpanel);
           jpanel2.add("South", jpanel1);
           jpanel2.add("South", jpanel1);
           jpanel2.setBorder(BorderFactory.createTitledBorder(jpanel2.getBorder(), label_controls, 1, 2, new Font("Helvetica", 1, font_size)));
           JPanel jpanel3 = new JPanel(new GridLayout(2, 3));
           jpanel3.add(count = new JLabel(label_count));
           jpanel3.add(current_bin = new JLabel(label_bin));
           jpanel3.add(current_bin_count = new JLabel(label_bin_count));
           JPanel jpanel4 = new JPanel(new GridLayout(1, 1));
           JPanel jpanel5 = new JPanel(new BorderLayout());
           jpanel5.add("Center", jpanel3);
           jpanel5.add("South", jpanel4);
           jpanel5.setBorder(BorderFactory.createTitledBorder(jpanel5.getBorder(),label_statistics, 1, 2, new Font("Helvetica", 1, font_size)));
           JPanel jpanel6 = new JPanel(new BorderLayout());
           jpanel6.add("Center", jpanel5);
           JLabel jlabel1 = new JLabel("");
           jlabel1.setPreferredSize(new Dimension(15, 15));
           jpanel6.add("South", jlabel1);
           if(wims_exercise == false){
              jpanel3.add(mean = new JLabel(label_mean));
               jpanel3.add(variance = new JLabel(label_variance));
              jpanel3.add(current_bin_prob = new JLabel(label_bin_probability));
              jpanel4.add(confidence = new JLabel(label_confidence));
           }

           Container container = frame.getContentPane();
           container.setLayout(new BorderLayout(10, 10));
           container.add("Center", plinkoboard = new PlinkoBoard(this));
           container.add("North", jpanel2);
           container.add("South", jpanel6);
           start.addActionListener(this);
           clear.addActionListener(this);
           close.addActionListener(this);
           strk.addChangeListener(this);
           bins.addChangeListener(this);
           rate.addChangeListener(this);
           prob.addChangeListener(this);
           plinkoboard.requestFocus();
           frame.addWindowListener(this);
           getContentPane().add(splash = new SplashPanel(this));
           click = getAudioClip(getCodeBase(), "sounds/click.au");
           ping = getAudioClip(getCodeBase(), "sounds/ping.au");
       }

Here is the call graph for this function:

String PlinkoNegativeBinomial.ReadApplet ( ) [inline]

Definition at line 390 of file PlinkoNegativeBinomial.java.

                                  {                                                                                                        
            String s=plinkoboard.ReadData();                                                                                               
            return s;                                                                                                                      
        }                                                                                                                                  

Here is the call graph for this function:

void PlinkoNegativeBinomial.run ( ) [inline]

Definition at line 282 of file PlinkoNegativeBinomial.java.

       {
              while(active) 
              {
                     plinkoboard.dropBall(false);
                     try
                     {
                            Thread.sleep(105 - 10 * ((Integer)rate.getValue()).intValue());
                     }
                     catch(InterruptedException interruptedexception) { }
              }
       }

Here is the call graph for this function:

Definition at line 262 of file PlinkoNegativeBinomial.java.

       {
              frame.setVisible(true);
       }
void PlinkoNegativeBinomial.start ( ) [inline]

Definition at line 267 of file PlinkoNegativeBinomial.java.

       {
              if(!frame.isVisible())
              {
                     splash.start();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void PlinkoNegativeBinomial.stateChanged ( ChangeEvent  changeevent) [inline]

Definition at line 331 of file PlinkoNegativeBinomial.java.

       {
              Object obj = changeevent.getSource();
              if(obj == strk)
              {
                     count.setText("0");
                     plinkoboard.setup();
                     plinkoboard.newHist();
                     plinkoboard.drawBackground();
              } else
              if(obj == bins)
              {
                     plinkoboard.setup();
                     plinkoboard.drawBackground();
              } else
              if(obj != rate && obj == prob)
              {
                     plinkoboard.updatePercent();
                     plinkoboard.repaint();
              }
       }

Here is the call graph for this function:

void PlinkoNegativeBinomial.stop ( ) [inline]

Definition at line 275 of file PlinkoNegativeBinomial.java.

       {
              splash.active = false;
                frame.setVisible( false );                                                                                                 
                splash.start();                                                                                                            
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 295 of file PlinkoNegativeBinomial.java.

       {
              if(active)
              {
                     active = false;
                     start.setText(start_text);
              } else
              {
                     active = true;
                     strk.setEnabled(false);
                     thread = new Thread(this);
                     thread.start();
                     start.setText(stop_text);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void PlinkoNegativeBinomial.windowActivated ( WindowEvent  windowevent) [inline]

Definition at line 353 of file PlinkoNegativeBinomial.java.

       {
       }
void PlinkoNegativeBinomial.windowClosed ( WindowEvent  windowevent) [inline]

Definition at line 357 of file PlinkoNegativeBinomial.java.

       {
       }
void PlinkoNegativeBinomial.windowClosing ( WindowEvent  windowevent) [inline]

Definition at line 361 of file PlinkoNegativeBinomial.java.

       {
              splash.start();
              active = false;
              start.setText(start_text);
       }

Here is the call graph for this function:

void PlinkoNegativeBinomial.windowDeactivated ( WindowEvent  windowevent) [inline]

Definition at line 368 of file PlinkoNegativeBinomial.java.

       {
       }
void PlinkoNegativeBinomial.windowDeiconified ( WindowEvent  windowevent) [inline]

Definition at line 372 of file PlinkoNegativeBinomial.java.

       {
       }
void PlinkoNegativeBinomial.windowIconified ( WindowEvent  windowevent) [inline]

Definition at line 376 of file PlinkoNegativeBinomial.java.

       {
       }
void PlinkoNegativeBinomial.windowOpened ( WindowEvent  windowevent) [inline]

Definition at line 380 of file PlinkoNegativeBinomial.java.

       {
       }

Member Data Documentation

Definition at line 26 of file PlinkoNegativeBinomial.java.

JSpinner PlinkoNegativeBinomial.bins [static, package]

Definition at line 10 of file PlinkoNegativeBinomial.java.

int PlinkoNegativeBinomial.bins_num = 11 [package]

Definition at line 34 of file PlinkoNegativeBinomial.java.

double PlinkoNegativeBinomial.chance = 0.5 [package]

Definition at line 37 of file PlinkoNegativeBinomial.java.

JButton PlinkoNegativeBinomial.clear [package]

Definition at line 22 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.clear_text = "CLEAR" [package]

Definition at line 46 of file PlinkoNegativeBinomial.java.

AudioClip PlinkoNegativeBinomial.click [static, package]

Definition at line 29 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.click_text = "CLICK ANYWHERE TO BEGIN" [package]

Definition at line 43 of file PlinkoNegativeBinomial.java.

JButton PlinkoNegativeBinomial.close [package]

Definition at line 23 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.close_text = "CLOSE" [package]

Definition at line 47 of file PlinkoNegativeBinomial.java.

Definition at line 20 of file PlinkoNegativeBinomial.java.

JLabel PlinkoNegativeBinomial.count [package]

Definition at line 14 of file PlinkoNegativeBinomial.java.

Definition at line 17 of file PlinkoNegativeBinomial.java.

Definition at line 18 of file PlinkoNegativeBinomial.java.

Definition at line 19 of file PlinkoNegativeBinomial.java.

Definition at line 40 of file PlinkoNegativeBinomial.java.

JFrame PlinkoNegativeBinomial.frame [package]

Definition at line 27 of file PlinkoNegativeBinomial.java.

int PlinkoNegativeBinomial.frame_x = 650 [package]

Definition at line 38 of file PlinkoNegativeBinomial.java.

int PlinkoNegativeBinomial.frame_y = 600 [package]

Definition at line 39 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_bin = "Bin: " [package]

Definition at line 51 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_bin_count = "Bin Count: " [package]

Definition at line 55 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_bin_probability = "Bin Probability: " [package]

Definition at line 56 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_bins = "Bins: " [package]

Definition at line 52 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_confidence = "Confidence Interval: " [package]

Definition at line 57 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_controls = " Controls " [package]

Definition at line 60 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_count = "Count: " [package]

Definition at line 48 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_mean = "Mean: " [package]

Definition at line 49 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_probability = "Probability: " [package]

Definition at line 54 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_speed = "Speed: " [package]

Definition at line 53 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_statistics = "Statistics" [package]

Definition at line 61 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.label_variance = "Variance: " [package]

Definition at line 50 of file PlinkoNegativeBinomial.java.

JLabel PlinkoNegativeBinomial.mean [package]

Definition at line 15 of file PlinkoNegativeBinomial.java.

AudioClip PlinkoNegativeBinomial.ping [static, package]

Definition at line 30 of file PlinkoNegativeBinomial.java.

Definition at line 24 of file PlinkoNegativeBinomial.java.

JSpinner PlinkoNegativeBinomial.prob [static, package]

Definition at line 13 of file PlinkoNegativeBinomial.java.

int PlinkoNegativeBinomial.R = 1 [package]

Definition at line 41 of file PlinkoNegativeBinomial.java.

JSpinner PlinkoNegativeBinomial.rate [static, package]

Definition at line 12 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.some_text = " % of the balls landed in bin " [package]

Definition at line 58 of file PlinkoNegativeBinomial.java.

int PlinkoNegativeBinomial.speed = 1 [package]

Definition at line 35 of file PlinkoNegativeBinomial.java.

Definition at line 28 of file PlinkoNegativeBinomial.java.

JButton PlinkoNegativeBinomial.start [package]

Definition at line 21 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.start_text = "START" [package]

Definition at line 44 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.stop_text = "STOP" [package]

Definition at line 45 of file PlinkoNegativeBinomial.java.

JSpinner PlinkoNegativeBinomial.strk [static, package]

Definition at line 11 of file PlinkoNegativeBinomial.java.

Definition at line 25 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.through = " through " [package]

Definition at line 59 of file PlinkoNegativeBinomial.java.

String PlinkoNegativeBinomial.title = "Binomial Distribution" [package]

Definition at line 42 of file PlinkoNegativeBinomial.java.

int PlinkoNegativeBinomial.total_balls = 100000 [package]

Definition at line 36 of file PlinkoNegativeBinomial.java.

Definition at line 16 of file PlinkoNegativeBinomial.java.

Definition at line 33 of file PlinkoNegativeBinomial.java.


The documentation for this class was generated from the following file: